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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 112 | /* Offset where the EID-Len-IE, start. */ |
| 113 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 114 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 115 | |
| 116 | #define BEACON_FRAME_IES_OFFSET 12 |
| 117 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 118 | |
| 119 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 120 | * beacon_filter_table - table of IEs used for beacon filtering |
| 121 | */ |
| 122 | static const int beacon_filter_table[] = { |
| 123 | SIR_MAC_DS_PARAM_SET_EID, |
| 124 | SIR_MAC_ERP_INFO_EID, |
| 125 | SIR_MAC_EDCA_PARAM_SET_EID, |
| 126 | SIR_MAC_QOS_CAPABILITY_EID, |
| 127 | SIR_MAC_HT_INFO_EID, |
| 128 | SIR_MAC_VHT_OPMODE_EID, |
| 129 | SIR_MAC_VHT_OPERATION_EID, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 130 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 131 | /* |
| 132 | * EID: 221 vendor IE is being used temporarily by 11AX |
| 133 | * bss-color-change IE till it gets any fixed number. This |
| 134 | * vendor EID needs to be replaced with bss-color-change IE |
| 135 | * number. |
| 136 | */ |
| 137 | SIR_MAC_EID_VENDOR, |
| 138 | #endif |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 139 | }; |
| 140 | |
| 141 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 142 | * hdd_conn_set_authenticated() - set authentication state |
| 143 | * @pAdapter: pointer to the adapter |
| 144 | * @authState: authentication state |
| 145 | * |
| 146 | * This function updates the global HDD station context |
| 147 | * authentication state. |
| 148 | * |
| 149 | * Return: none |
| 150 | */ |
| 151 | static void |
| 152 | hdd_conn_set_authenticated(hdd_adapter_t *pAdapter, uint8_t authState) |
| 153 | { |
| 154 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 155 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 156 | |
| 157 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 158 | hdd_debug("Authenticated state Changed from oldState:%d to State:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 159 | pHddStaCtx->conn_info.uIsAuthenticated, authState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 160 | pHddStaCtx->conn_info.uIsAuthenticated = authState; |
| 161 | |
| 162 | /* Check is pending ROC request or not when auth state changed */ |
| 163 | schedule_delayed_work(&pHddCtx->roc_req_work, 0); |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * hdd_conn_set_connection_state() - set connection state |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 168 | * @adapter: pointer to the adapter |
| 169 | * @conn_state: connection state |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 170 | * |
| 171 | * This function updates the global HDD station context connection state. |
| 172 | * |
| 173 | * Return: none |
| 174 | */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 175 | void hdd_conn_set_connection_state(hdd_adapter_t *adapter, |
| 176 | eConnectionState conn_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 177 | { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 178 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 179 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 180 | |
| 181 | /* save the new connection state */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 182 | hdd_debug("%pS Changed conn state from old:%d to new:%d for dev %s", |
| 183 | (void *)_RET_IP_, hdd_sta_ctx->conn_info.connState, |
| 184 | conn_state, adapter->dev->name); |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 185 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 186 | hdd_tsf_notify_wlan_state_change(adapter, |
| 187 | hdd_sta_ctx->conn_info.connState, |
| 188 | conn_state); |
| 189 | hdd_sta_ctx->conn_info.connState = conn_state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 190 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 191 | schedule_delayed_work(&hdd_ctx->roc_req_work, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | /** |
| 195 | * hdd_conn_get_connection_state() - get connection state |
| 196 | * @pAdapter: pointer to the adapter |
| 197 | * @pConnState: pointer to connection state |
| 198 | * |
| 199 | * This function updates the global HDD station context connection state. |
| 200 | * |
| 201 | * Return: true if (Infra Associated or IBSS Connected) |
| 202 | * and sets output parameter pConnState; |
| 203 | * false otherwise |
| 204 | */ |
| 205 | static inline bool hdd_conn_get_connection_state(hdd_station_ctx_t *pHddStaCtx, |
| 206 | eConnectionState *pConnState) |
| 207 | { |
| 208 | bool fConnected = false; |
| 209 | eConnectionState connState; |
| 210 | |
| 211 | /* get the connection state. */ |
| 212 | connState = pHddStaCtx->conn_info.connState; |
| 213 | |
| 214 | if (eConnectionState_Associated == connState || |
| 215 | eConnectionState_IbssConnected == connState || |
| 216 | eConnectionState_IbssDisconnected == connState) { |
| 217 | fConnected = true; |
| 218 | } |
| 219 | |
| 220 | if (pConnState) |
| 221 | *pConnState = connState; |
| 222 | |
| 223 | return fConnected; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * hdd_is_connecting() - Function to check connection progress |
| 228 | * @hdd_sta_ctx: pointer to global HDD Station context |
| 229 | * |
| 230 | * Return: true if connecting, false otherwise |
| 231 | */ |
| 232 | bool hdd_is_connecting(hdd_station_ctx_t *hdd_sta_ctx) |
| 233 | { |
| 234 | return hdd_sta_ctx->conn_info.connState == |
| 235 | eConnectionState_Connecting; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * hdd_conn_is_connected() - Function to check connection status |
| 240 | * @pHddStaCtx: pointer to global HDD Station context |
| 241 | * |
| 242 | * Return: false if any errors encountered, true otherwise |
| 243 | */ |
| 244 | bool hdd_conn_is_connected(hdd_station_ctx_t *pHddStaCtx) |
| 245 | { |
| 246 | return hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * hdd_conn_get_connected_band() - get current connection radio band |
| 251 | * @pHddStaCtx: pointer to global HDD Station context |
| 252 | * |
| 253 | * Return: eCSR_BAND_24 or eCSR_BAND_5G based on current AP connection |
| 254 | * eCSR_BAND_ALL if not connected |
| 255 | */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 256 | 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] | 257 | { |
| 258 | uint8_t staChannel = 0; |
| 259 | |
| 260 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 261 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 262 | |
| 263 | if (staChannel > 0 && staChannel < 14) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 264 | return BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 265 | else if (staChannel >= 36 && staChannel <= 184) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 266 | return BAND_5G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 267 | else /* If station is not connected return as eCSR_BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 268 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | /** |
| 272 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
| 273 | * @pHddStaCtx: pointer to global HDD Station context |
| 274 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 275 | * |
| 276 | * Return: false if any errors encountered, true otherwise |
| 277 | */ |
| 278 | static inline bool |
| 279 | hdd_conn_get_connected_cipher_algo(hdd_station_ctx_t *pHddStaCtx, |
| 280 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 281 | { |
| 282 | bool fConnected = false; |
| 283 | |
| 284 | fConnected = hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 285 | |
| 286 | if (pConnectedCipherAlgo) |
| 287 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 288 | |
| 289 | return fConnected; |
| 290 | } |
| 291 | |
| 292 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 293 | * hdd_remove_beacon_filter() - remove beacon filter |
| 294 | * @adapter: Pointer to the hdd adapter |
| 295 | * |
| 296 | * Return: 0 on success and errno on failure |
| 297 | */ |
| 298 | static int hdd_remove_beacon_filter(hdd_adapter_t *adapter) |
| 299 | { |
| 300 | QDF_STATUS status; |
| 301 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 302 | |
| 303 | status = sme_remove_beacon_filter(hdd_ctx->hHal, |
| 304 | adapter->sessionId); |
| 305 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 306 | hdd_err("sme_remove_beacon_filter() failed"); |
| 307 | return -EFAULT; |
| 308 | } |
| 309 | |
| 310 | return 0; |
| 311 | } |
| 312 | |
| 313 | /** |
| 314 | * hdd_add_beacon_filter() - add beacon filter |
| 315 | * @adapter: Pointer to the hdd adapter |
| 316 | * |
| 317 | * Return: 0 on success and errno on failure |
| 318 | */ |
| 319 | static int hdd_add_beacon_filter(hdd_adapter_t *adapter) |
| 320 | { |
| 321 | int i; |
| 322 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 323 | QDF_STATUS status; |
| 324 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 325 | |
| 326 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 327 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 328 | (unsigned long int *)ie_map); |
| 329 | |
| 330 | status = sme_add_beacon_filter(hdd_ctx->hHal, |
| 331 | adapter->sessionId, ie_map); |
| 332 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 333 | hdd_err("sme_add_beacon_filter() failed"); |
| 334 | return -EFAULT; |
| 335 | } |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 340 | * hdd_copy_vht_caps()- copy vht caps info from roam info to |
| 341 | * hdd station context. |
| 342 | * @hdd_sta_ctx: pointer to hdd station context |
| 343 | * @roam_info: pointer to roam info |
| 344 | * |
| 345 | * Return: None |
| 346 | */ |
| 347 | static void hdd_copy_ht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 348 | tCsrRoamInfo *roam_info) |
| 349 | { |
| 350 | tDot11fIEHTCaps *roam_ht_cap = &roam_info->ht_caps; |
| 351 | struct ieee80211_ht_cap *hdd_ht_cap = &hdd_sta_ctx->conn_info.ht_caps; |
| 352 | uint32_t i, temp_ht_cap; |
| 353 | |
| 354 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 355 | |
| 356 | if (roam_ht_cap->advCodingCap) |
| 357 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 358 | if (roam_ht_cap->supportedChannelWidthSet) |
| 359 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 360 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 361 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 362 | if (temp_ht_cap) |
| 363 | hdd_ht_cap->cap_info |= |
| 364 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 365 | if (roam_ht_cap->greenField) |
| 366 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 367 | if (roam_ht_cap->shortGI20MHz) |
| 368 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 369 | if (roam_ht_cap->shortGI40MHz) |
| 370 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 371 | if (roam_ht_cap->txSTBC) |
| 372 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 373 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 374 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 375 | if (temp_ht_cap) |
| 376 | hdd_ht_cap->cap_info |= |
| 377 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 378 | if (roam_ht_cap->delayedBA) |
| 379 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 380 | if (roam_ht_cap->maximalAMSDUsize) |
| 381 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 382 | if (roam_ht_cap->dsssCckMode40MHz) |
| 383 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 384 | if (roam_ht_cap->psmp) |
| 385 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 386 | if (roam_ht_cap->stbcControlFrame) |
| 387 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 388 | if (roam_ht_cap->lsigTXOPProtection) |
| 389 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 390 | |
| 391 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 392 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 393 | hdd_ht_cap->ampdu_params_info |= |
| 394 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 395 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 396 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 397 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 398 | if (temp_ht_cap) |
| 399 | hdd_ht_cap->ampdu_params_info |= |
| 400 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 401 | |
| 402 | /* 802.11n HT extended capabilities masks */ |
| 403 | if (roam_ht_cap->pco) |
| 404 | hdd_ht_cap->extended_ht_cap_info |= |
| 405 | IEEE80211_HT_EXT_CAP_PCO; |
| 406 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 407 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 408 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 409 | if (temp_ht_cap) |
| 410 | hdd_ht_cap->extended_ht_cap_info |= |
| 411 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 412 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 413 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 414 | if (temp_ht_cap) |
| 415 | hdd_ht_cap->extended_ht_cap_info |= |
| 416 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 417 | |
| 418 | /* tx_bf_cap_info capabilities */ |
| 419 | if (roam_ht_cap->txBF) |
| 420 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 421 | if (roam_ht_cap->rxStaggeredSounding) |
| 422 | hdd_ht_cap->tx_BF_cap_info |= |
| 423 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 424 | if (roam_ht_cap->txStaggeredSounding) |
| 425 | hdd_ht_cap->tx_BF_cap_info |= |
| 426 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 427 | if (roam_ht_cap->rxZLF) |
| 428 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 429 | if (roam_ht_cap->txZLF) |
| 430 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 431 | if (roam_ht_cap->implicitTxBF) |
| 432 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 433 | temp_ht_cap = roam_ht_cap->calibration & |
| 434 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 435 | if (temp_ht_cap) |
| 436 | hdd_ht_cap->tx_BF_cap_info |= |
| 437 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 438 | if (roam_ht_cap->explicitCSITxBF) |
| 439 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 440 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 441 | hdd_ht_cap->tx_BF_cap_info |= |
| 442 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 443 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 444 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 445 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 446 | if (temp_ht_cap) |
| 447 | hdd_ht_cap->tx_BF_cap_info |= |
| 448 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 449 | temp_ht_cap = |
| 450 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 451 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 452 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 453 | if (temp_ht_cap) |
| 454 | hdd_ht_cap->tx_BF_cap_info |= |
| 455 | temp_ht_cap << |
| 456 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 457 | temp_ht_cap = |
| 458 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 459 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 460 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 461 | if (temp_ht_cap) |
| 462 | hdd_ht_cap->tx_BF_cap_info |= |
| 463 | temp_ht_cap << |
| 464 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 465 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 466 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 467 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 468 | if (temp_ht_cap) |
| 469 | hdd_ht_cap->tx_BF_cap_info |= |
| 470 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 471 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 472 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 473 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 474 | if (temp_ht_cap) |
| 475 | hdd_ht_cap->tx_BF_cap_info |= |
| 476 | temp_ht_cap << |
| 477 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 478 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 479 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 480 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 481 | if (temp_ht_cap) |
| 482 | hdd_ht_cap->tx_BF_cap_info |= |
| 483 | temp_ht_cap << |
| 484 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 485 | |
| 486 | /* antenna selection */ |
| 487 | if (roam_ht_cap->antennaSelection) |
| 488 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 489 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 490 | hdd_ht_cap->antenna_selection_info |= |
| 491 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 492 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 493 | hdd_ht_cap->antenna_selection_info |= |
| 494 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 495 | if (roam_ht_cap->explicitCSIFeedback) |
| 496 | hdd_ht_cap->antenna_selection_info |= |
| 497 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 498 | if (roam_ht_cap->antennaIndicesFeedback) |
| 499 | hdd_ht_cap->antenna_selection_info |= |
| 500 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 501 | if (roam_ht_cap->rxAS) |
| 502 | hdd_ht_cap->antenna_selection_info |= |
| 503 | ANTENNA_SEL_INFO_RX_AS; |
| 504 | if (roam_ht_cap->txSoundingPPDUs) |
| 505 | hdd_ht_cap->antenna_selection_info |= |
| 506 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 507 | |
| 508 | /* mcs data rate */ |
| 509 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 510 | hdd_ht_cap->mcs.rx_mask[i] = |
| 511 | roam_ht_cap->supportedMCSSet[i]; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 512 | hdd_ht_cap->mcs.rx_highest = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 513 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 514 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 515 | hdd_ht_cap->mcs.tx_params = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 516 | roam_ht_cap->supportedMCSSet[12]; |
| 517 | } |
| 518 | |
| 519 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 520 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 521 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 522 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 523 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 524 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 525 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 526 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 527 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 528 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 529 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 530 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 531 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 532 | |
| 533 | /** |
| 534 | * hdd_copy_ht_caps()- copy ht caps info from roam info to |
| 535 | * hdd station context. |
| 536 | * @hdd_sta_ctx: pointer to hdd station context |
| 537 | * @roam_info: pointer to roam info |
| 538 | * |
| 539 | * Return: None |
| 540 | */ |
| 541 | static void hdd_copy_vht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 542 | tCsrRoamInfo *roam_info) |
| 543 | { |
| 544 | tDot11fIEVHTCaps *roam_vht_cap = &roam_info->vht_caps; |
| 545 | struct ieee80211_vht_cap *hdd_vht_cap = |
| 546 | &hdd_sta_ctx->conn_info.vht_caps; |
| 547 | uint32_t temp_vht_cap; |
| 548 | |
| 549 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 550 | |
| 551 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 552 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 553 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 554 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 555 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 556 | if (temp_vht_cap) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 557 | if (roam_vht_cap->supportedChannelWidthSet & |
| 558 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 559 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 560 | hdd_vht_cap->vht_cap_info |= |
| 561 | temp_vht_cap << |
| 562 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 563 | if (roam_vht_cap->supportedChannelWidthSet & |
| 564 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 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_160_80PLUS80MHZ; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 569 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 570 | if (roam_vht_cap->ldpcCodingCap) |
| 571 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 572 | if (roam_vht_cap->shortGI80MHz) |
| 573 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 574 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 575 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 576 | if (roam_vht_cap->txSTBC) |
| 577 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 578 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 579 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 580 | if (temp_vht_cap) |
| 581 | hdd_vht_cap->vht_cap_info |= |
| 582 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 583 | if (roam_vht_cap->suBeamFormerCap) |
| 584 | hdd_vht_cap->vht_cap_info |= |
| 585 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 586 | if (roam_vht_cap->suBeamformeeCap) |
| 587 | hdd_vht_cap->vht_cap_info |= |
| 588 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 589 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 590 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 591 | if (temp_vht_cap) |
| 592 | hdd_vht_cap->vht_cap_info |= |
| 593 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 594 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 595 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 596 | if (temp_vht_cap) |
| 597 | hdd_vht_cap->vht_cap_info |= |
| 598 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 599 | if (roam_vht_cap->muBeamformerCap) |
| 600 | hdd_vht_cap->vht_cap_info |= |
| 601 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 602 | if (roam_vht_cap->muBeamformeeCap) |
| 603 | hdd_vht_cap->vht_cap_info |= |
| 604 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 605 | if (roam_vht_cap->vhtTXOPPS) |
| 606 | hdd_vht_cap->vht_cap_info |= |
| 607 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 608 | if (roam_vht_cap->htcVHTCap) |
| 609 | hdd_vht_cap->vht_cap_info |= |
| 610 | IEEE80211_VHT_CAP_HTC_VHT; |
| 611 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 612 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 613 | if (temp_vht_cap) |
| 614 | hdd_vht_cap->vht_cap_info |= |
| 615 | temp_vht_cap << |
| 616 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 617 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 618 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 619 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 620 | if (temp_vht_cap) |
| 621 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 622 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 623 | if (roam_vht_cap->rxAntPattern) |
| 624 | hdd_vht_cap->vht_cap_info |= |
| 625 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 626 | if (roam_vht_cap->txAntPattern) |
| 627 | hdd_vht_cap->vht_cap_info |= |
| 628 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 629 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 630 | hdd_vht_cap->supp_mcs.rx_highest = |
| 631 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 632 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 633 | hdd_vht_cap->supp_mcs.tx_highest = |
| 634 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 635 | } |
| 636 | |
| 637 | /* ht param */ |
| 638 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 639 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 640 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 641 | |
| 642 | /* operatinon mode */ |
| 643 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 644 | |
| 645 | /* stbc_param */ |
| 646 | #define HT_STBC_PARAM_MCS 0x007f |
| 647 | |
| 648 | /** |
| 649 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 650 | * hdd station context. |
| 651 | * @hdd_sta_ctx: pointer to hdd station context |
| 652 | * @roam_info: pointer to roam info |
| 653 | * |
| 654 | * Return: None |
| 655 | */ |
| 656 | static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 657 | tCsrRoamInfo *roam_info) |
| 658 | { |
| 659 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 660 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 661 | &hdd_sta_ctx->conn_info.ht_operation; |
| 662 | uint32_t i, temp_ht_ops; |
| 663 | |
| 664 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 665 | |
| 666 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 667 | |
| 668 | /* HT_PARAMS */ |
| 669 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 670 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 671 | if (temp_ht_ops) |
| 672 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 673 | else |
| 674 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 675 | if (roam_ht_ops->recommendedTxWidthSet) |
| 676 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 677 | if (roam_ht_ops->rifsMode) |
| 678 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 679 | if (roam_ht_ops->controlledAccessOnly) |
| 680 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 681 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 682 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 683 | if (temp_ht_ops) |
| 684 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 685 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 686 | |
| 687 | /* operation mode */ |
| 688 | temp_ht_ops = roam_ht_ops->opMode & |
| 689 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 690 | switch (temp_ht_ops) { |
| 691 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 692 | hdd_ht_ops->operation_mode |= |
| 693 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 694 | break; |
| 695 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 696 | hdd_ht_ops->operation_mode |= |
| 697 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 698 | break; |
| 699 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 700 | hdd_ht_ops->operation_mode |= |
| 701 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 702 | break; |
| 703 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 704 | default: |
| 705 | hdd_ht_ops->operation_mode |= |
| 706 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 707 | } |
| 708 | if (roam_ht_ops->nonGFDevicesPresent) |
| 709 | hdd_ht_ops->operation_mode |= |
| 710 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 711 | if (roam_ht_ops->transmitBurstLimit) |
| 712 | hdd_ht_ops->operation_mode |= |
| 713 | HT_OP_MODE_TX_BURST_LIMIT; |
| 714 | if (roam_ht_ops->obssNonHTStaPresent) |
| 715 | hdd_ht_ops->operation_mode |= |
| 716 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 717 | |
| 718 | /* stbc_param */ |
| 719 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 720 | HT_STBC_PARAM_MCS; |
| 721 | if (temp_ht_ops) |
| 722 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 723 | if (roam_ht_ops->dualCTSProtection) |
| 724 | hdd_ht_ops->stbc_param |= |
| 725 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 726 | if (roam_ht_ops->secondaryBeacon) |
| 727 | hdd_ht_ops->stbc_param |= |
| 728 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 729 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 730 | hdd_ht_ops->stbc_param |= |
| 731 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 732 | if (roam_ht_ops->pcoActive) |
| 733 | hdd_ht_ops->stbc_param |= |
| 734 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 735 | if (roam_ht_ops->pcoPhase) |
| 736 | hdd_ht_ops->stbc_param |= |
| 737 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 738 | |
| 739 | /* basic MCs set */ |
| 740 | for (i = 0; i < 16; ++i) |
| 741 | hdd_ht_ops->basic_set[i] = |
| 742 | roam_ht_ops->basicMCSSet[i]; |
| 743 | } |
| 744 | |
| 745 | /** |
| 746 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 747 | * hdd station context. |
| 748 | * @hdd_sta_ctx: pointer to hdd station context |
| 749 | * @roam_info: pointer to roam info |
| 750 | * |
| 751 | * Return: None |
| 752 | */ |
| 753 | static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 754 | tCsrRoamInfo *roam_info) |
| 755 | { |
| 756 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 757 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 758 | &hdd_sta_ctx->conn_info.vht_operation; |
| 759 | |
| 760 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 761 | |
| 762 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
| 763 | hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; |
| 764 | hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; |
| 765 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 766 | } |
| 767 | |
| 768 | |
| 769 | /** |
| 770 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 771 | * @adapter: Pointer to adapter |
| 772 | * @roam_info: pointer to roam info |
| 773 | * |
| 774 | * Return: None |
| 775 | */ |
| 776 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 777 | tCsrRoamInfo *roam_info) |
| 778 | { |
| 779 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 780 | |
| 781 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
| 782 | hdd_sta_ctx->conn_info.operationChannel); |
| 783 | if (roam_info->vht_caps.present) { |
| 784 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
| 785 | hdd_copy_vht_caps(hdd_sta_ctx, roam_info); |
| 786 | } else { |
| 787 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 788 | } |
| 789 | if (roam_info->ht_caps.present) { |
| 790 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
| 791 | hdd_copy_ht_caps(hdd_sta_ctx, roam_info); |
| 792 | } else { |
| 793 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 794 | } |
| 795 | if (roam_info->reassoc) |
| 796 | hdd_sta_ctx->conn_info.roam_count++; |
| 797 | if (roam_info->hs20vendor_ie.present) { |
| 798 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 799 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 800 | &roam_info->hs20vendor_ie, |
| 801 | sizeof(roam_info->hs20vendor_ie)); |
| 802 | } else { |
| 803 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 804 | } |
| 805 | if (roam_info->ht_operation.present) { |
| 806 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 807 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 808 | } else { |
| 809 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 810 | } |
| 811 | if (roam_info->vht_operation.present) { |
| 812 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 813 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 814 | } else { |
| 815 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 816 | } |
| 817 | } |
| 818 | |
| 819 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 820 | * hdd_conn_save_connect_info() - save current connection information |
| 821 | * @pAdapter: pointer to adapter |
| 822 | * @pRoamInfo: pointer to roam info |
| 823 | * @eBssType: bss type |
| 824 | * |
| 825 | * Return: none |
| 826 | */ |
| 827 | static void |
| 828 | hdd_conn_save_connect_info(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 829 | eCsrRoamBssType eBssType) |
| 830 | { |
| 831 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 832 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 833 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 834 | QDF_ASSERT(pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 835 | |
| 836 | if (pRoamInfo) { |
| 837 | /* Save the BSSID for the connection */ |
| 838 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 839 | QDF_ASSERT(pRoamInfo->pBssDesc); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 840 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | &pRoamInfo->bssid); |
| 842 | |
| 843 | /* |
| 844 | * Save the Station ID for this station from |
| 845 | * the 'Roam Info'. For IBSS mode, staId is |
| 846 | * assigned in NEW_PEER_IND. For reassoc, |
| 847 | * the staID doesn't change and it may be invalid |
| 848 | * in this structure so no change here. |
| 849 | */ |
| 850 | if (!pRoamInfo->fReassocReq) { |
| 851 | pHddStaCtx->conn_info.staId[0] = |
| 852 | pRoamInfo->staId; |
| 853 | } |
| 854 | } else if (eCSR_BSS_TYPE_IBSS == eBssType) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 855 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 856 | &pRoamInfo->bssid); |
| 857 | } else { |
| 858 | /* |
| 859 | * can't happen. We need a valid IBSS or Infra setting |
| 860 | * in the BSSDescription or we can't function. |
| 861 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 862 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 863 | } |
| 864 | |
| 865 | /* notify WMM */ |
| 866 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 867 | |
| 868 | if (!pRoamInfo->u.pConnectedProfile) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 869 | QDF_ASSERT(pRoamInfo->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 870 | } else { |
| 871 | /* Get Multicast Encryption Type */ |
| 872 | encryptType = |
| 873 | pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 874 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 875 | /* Get Unicast Encryption Type */ |
| 876 | encryptType = |
| 877 | pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 878 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 879 | |
| 880 | pHddStaCtx->conn_info.authType = |
| 881 | pRoamInfo->u.pConnectedProfile->AuthType; |
| 882 | |
| 883 | pHddStaCtx->conn_info.operationChannel = |
| 884 | pRoamInfo->u.pConnectedProfile->operationChannel; |
| 885 | |
| 886 | /* Save the ssid for the connection */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 887 | qdf_mem_copy(&pHddStaCtx->conn_info.SSID.SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 888 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 889 | sizeof(tSirMacSSid)); |
| 890 | |
| 891 | /* Save dot11mode in which STA associated to AP */ |
| 892 | pHddStaCtx->conn_info.dot11Mode = |
| 893 | pRoamInfo->u.pConnectedProfile->dot11Mode; |
| 894 | |
| 895 | pHddStaCtx->conn_info.proxyARPService = |
| 896 | pRoamInfo->u.pConnectedProfile->proxyARPService; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 897 | |
| 898 | pHddStaCtx->conn_info.nss = pRoamInfo->chan_info.nss; |
| 899 | |
| 900 | pHddStaCtx->conn_info.rate_flags = |
| 901 | pRoamInfo->chan_info.rate_flags; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 902 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 903 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 904 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 905 | } |
| 906 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 907 | /** |
| 908 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 909 | * @dev: pointer to net device |
| 910 | * @pAdapter: pointer to adapter |
| 911 | * @pCsrRoamInfo: pointer to roam info |
| 912 | * |
| 913 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 914 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 915 | * for the same purpose.) |
| 916 | * |
| 917 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 918 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 919 | * This is the Assoc Response. |
| 920 | * |
| 921 | * Return: none |
| 922 | */ |
| 923 | static void |
| 924 | hdd_send_ft_assoc_response(struct net_device *dev, |
| 925 | hdd_adapter_t *pAdapter, |
| 926 | tCsrRoamInfo *pCsrRoamInfo) |
| 927 | { |
| 928 | union iwreq_data wrqu; |
| 929 | char *buff; |
| 930 | unsigned int len = 0; |
| 931 | u8 *pFTAssocRsp = NULL; |
| 932 | |
| 933 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 934 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | return; |
| 936 | } |
| 937 | |
| 938 | pFTAssocRsp = |
| 939 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 940 | pCsrRoamInfo->nAssocReqLength); |
| 941 | if (pFTAssocRsp == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 942 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 943 | return; |
| 944 | } |
| 945 | /* pFTAssocRsp needs to point to the IEs */ |
| 946 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 947 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 948 | (unsigned int)pFTAssocRsp[0], |
| 949 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | |
| 951 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 952 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 954 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 955 | return; |
| 956 | } |
| 957 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 958 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 959 | wrqu.data.length = len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 960 | memcpy(buff, pFTAssocRsp, len); |
| 961 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 962 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 963 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 965 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 966 | /** |
| 967 | * hdd_send_ft_event() - send fast transition event |
| 968 | * @pAdapter: pointer to adapter |
| 969 | * |
| 970 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 971 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 972 | * followed by the auth response IEs to the supplicant. |
| 973 | * Once both are received in the supplicant, an FT event is generated |
| 974 | * to the supplicant. |
| 975 | * |
| 976 | * Return: none |
| 977 | */ |
| 978 | static void hdd_send_ft_event(hdd_adapter_t *pAdapter) |
| 979 | { |
| 980 | uint16_t auth_resp_len = 0; |
| 981 | uint32_t ric_ies_length = 0; |
| 982 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 983 | |
| 984 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 985 | struct cfg80211_ft_event_params ftEvent; |
| 986 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 987 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 988 | struct net_device *dev = pAdapter->dev; |
| 989 | #else |
| 990 | char *buff; |
| 991 | union iwreq_data wrqu; |
| 992 | uint16_t str_len; |
| 993 | #endif |
| 994 | |
| 995 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 996 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 997 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 998 | |
| 999 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, (u8 *) ricIe, |
| 1000 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1001 | if (ric_ies_length == 0) |
| 1002 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | |
| 1004 | ftEvent.ric_ies = ricIe; |
| 1005 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1006 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1007 | |
| 1008 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1009 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1010 | &auth_resp_len); |
| 1011 | |
| 1012 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1013 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1014 | return; |
| 1015 | } |
| 1016 | |
| 1017 | sme_set_ft_pre_auth_state(pHddCtx->hHal, pAdapter->sessionId, true); |
| 1018 | |
| 1019 | ftEvent.target_ap = ftIe; |
| 1020 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1021 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1022 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1023 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1024 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1025 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1026 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1027 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1028 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1029 | ftEvent.target_ap[5]); |
| 1030 | |
| 1031 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1032 | |
| 1033 | #else |
| 1034 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1035 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1036 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1037 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1038 | return; |
| 1039 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1040 | |
| 1041 | /* Sme needs to send the RIC IEs first */ |
| 1042 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
| 1043 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, |
| 1044 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1045 | &ric_ies_length); |
| 1046 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1047 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1048 | } else { |
| 1049 | wrqu.data.length = str_len + ric_ies_length; |
| 1050 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1051 | } |
| 1052 | |
| 1053 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1054 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
| 1056 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1057 | (u8 *) &buff[str_len], |
| 1058 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1059 | |
| 1060 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1061 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1062 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1063 | return; |
| 1064 | } |
| 1065 | |
| 1066 | wrqu.data.length = str_len + auth_resp_len; |
| 1067 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1068 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1069 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1070 | #endif |
| 1071 | } |
| 1072 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1073 | #ifdef FEATURE_WLAN_ESE |
| 1074 | /** |
| 1075 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1076 | * @dev: pointer to net device |
| 1077 | * @pAdapter: pointer to adapter |
| 1078 | * @pCsrRoamInfo: pointer to roam info |
| 1079 | * |
| 1080 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1081 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1082 | * |
| 1083 | * The current (new AP) channel information is passed in. |
| 1084 | * |
| 1085 | * Return: none |
| 1086 | */ |
| 1087 | static void |
| 1088 | hdd_send_new_ap_channel_info(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 1089 | tCsrRoamInfo *pCsrRoamInfo) |
| 1090 | { |
| 1091 | union iwreq_data wrqu; |
| 1092 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
| 1093 | |
| 1094 | if (descriptor == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1095 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1096 | return; |
| 1097 | } |
| 1098 | /* |
| 1099 | * Send the Channel event, the supplicant needs this to generate |
| 1100 | * the Adjacent AP report. |
| 1101 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1102 | hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1103 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1104 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1105 | wrqu.freq.m = descriptor->channelId; |
| 1106 | wrqu.freq.e = 0; |
| 1107 | wrqu.freq.i = 0; |
| 1108 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1109 | } |
| 1110 | |
| 1111 | #endif /* FEATURE_WLAN_ESE */ |
| 1112 | |
| 1113 | /** |
| 1114 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
| 1115 | * @pAdapter: pointer to adapter |
| 1116 | * @pCsrRoamInfo: pointer to roam info |
| 1117 | * |
| 1118 | * Return: none |
| 1119 | */ |
| 1120 | static void |
| 1121 | hdd_send_update_beacon_ies_event(hdd_adapter_t *pAdapter, |
| 1122 | tCsrRoamInfo *pCsrRoamInfo) |
| 1123 | { |
| 1124 | union iwreq_data wrqu; |
| 1125 | u8 *pBeaconIes; |
| 1126 | u8 currentLen = 0; |
| 1127 | char *buff; |
| 1128 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1129 | |
| 1130 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1131 | |
| 1132 | if (0 == pCsrRoamInfo->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1133 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1134 | return; |
| 1135 | } |
| 1136 | pBeaconIes = (u8 *) (pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 1137 | if (pBeaconIes == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1138 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1139 | return; |
| 1140 | } |
| 1141 | /* pBeaconIes needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1142 | hdd_debug("Beacon IEs is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1143 | (unsigned int)pBeaconIes[0], |
| 1144 | (unsigned int)pBeaconIes[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1145 | hdd_debug("Beacon IEs length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1146 | pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1147 | |
| 1148 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1149 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1150 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1151 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1152 | return; |
| 1153 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1154 | |
| 1155 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1156 | currentLen = strLen + 1; |
| 1157 | |
| 1158 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1159 | do { |
| 1160 | /* |
| 1161 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1162 | * into chunks of CUSTOM event max size and send it to |
| 1163 | * supplicant. Changes are done in supplicant to handle this. |
| 1164 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1165 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1166 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1167 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1168 | qdf_mem_copy(&buff[strLen + 1], pBeaconIes + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1169 | currentLen); |
| 1170 | currentOffset += currentLen; |
| 1171 | totalIeLen -= currentLen; |
| 1172 | wrqu.data.length = strLen + 1 + currentLen; |
| 1173 | if (totalIeLen) |
| 1174 | buff[strLen] = 1; /* more chunks pending */ |
| 1175 | else |
| 1176 | buff[strLen] = 0; /* last chunk */ |
| 1177 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1178 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1179 | currentLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1180 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1181 | } while (totalIeLen > 0); |
| 1182 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1183 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1184 | } |
| 1185 | |
| 1186 | /** |
| 1187 | * hdd_send_association_event() - send association event |
| 1188 | * @dev: pointer to net device |
| 1189 | * @pCsrRoamInfo: pointer to roam info |
| 1190 | * |
| 1191 | * Return: none |
| 1192 | */ |
| 1193 | static void hdd_send_association_event(struct net_device *dev, |
| 1194 | tCsrRoamInfo *pCsrRoamInfo) |
| 1195 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1196 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1197 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1198 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1199 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1200 | union iwreq_data wrqu; |
| 1201 | int we_event; |
| 1202 | char *msg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1203 | struct qdf_mac_addr peerMacAddr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1205 | /* Added to find the auth type on the fly at run time */ |
| 1206 | /* rather than with cfg to see if FT is enabled */ |
| 1207 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1208 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1209 | |
| 1210 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1211 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1212 | we_event = SIOCGIWAP; |
| 1213 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1214 | if (NULL != pCsrRoamInfo) |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1215 | if (pCsrRoamInfo->roamSynchInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1216 | /* change logging before release */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1217 | hdd_debug("LFR3:hdd_send_association_event"); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1218 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1219 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1220 | true, pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1221 | wlan_hdd_tdls_notify_disconnect(pAdapter, true); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1222 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1223 | #endif |
| 1224 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) { |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1225 | tSirSmeChanInfo chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1226 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1227 | if (!pCsrRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1228 | hdd_warn("STA in associated state but pCsrRoamInfo is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1229 | return; |
| 1230 | } |
| 1231 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1232 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1233 | policy_mgr_incr_active_session(pHddCtx->hdd_psoc, |
| 1234 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1235 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, |
| 1236 | sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1237 | |
| 1238 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1239 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1240 | if (global_p2p_connection_status == |
| 1241 | P2P_CLIENT_CONNECTING_STATE_1) { |
| 1242 | global_p2p_connection_status = |
| 1243 | P2P_CLIENT_CONNECTED_STATE_1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1244 | 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] | 1245 | } else if (global_p2p_connection_status == |
| 1246 | P2P_CLIENT_CONNECTING_STATE_2) { |
| 1247 | global_p2p_connection_status = |
| 1248 | P2P_CLIENT_COMPLETED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1249 | 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] | 1250 | } |
| 1251 | } |
| 1252 | #endif |
| 1253 | pr_info("wlan: " MAC_ADDRESS_STR " connected to " |
| 1254 | MAC_ADDRESS_STR "\n", |
| 1255 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1256 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
| 1257 | hdd_send_update_beacon_ies_event(pAdapter, pCsrRoamInfo); |
| 1258 | |
| 1259 | /* |
| 1260 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1261 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1262 | * fFTEnable is true. |
| 1263 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1264 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1265 | if ((pRoamProfile->AuthType.authType[0] == |
| 1266 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 1267 | || (pRoamProfile->AuthType.authType[0] == |
| 1268 | eCSR_AUTH_TYPE_FT_RSN) |
| 1269 | #ifdef FEATURE_WLAN_ESE |
| 1270 | || (pRoamProfile->AuthType.authType[0] == |
| 1271 | eCSR_AUTH_TYPE_CCKM_RSN) |
| 1272 | || (pRoamProfile->AuthType.authType[0] == |
| 1273 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1274 | #endif |
| 1275 | ) { |
| 1276 | hdd_send_ft_assoc_response(dev, pAdapter, pCsrRoamInfo); |
| 1277 | } |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1278 | qdf_copy_macaddr(&peerMacAddr, |
| 1279 | &pHddStaCtx->conn_info.bssId); |
| 1280 | chan_info.chan_id = pCsrRoamInfo->chan_info.chan_id; |
| 1281 | chan_info.mhz = pCsrRoamInfo->chan_info.mhz; |
| 1282 | chan_info.info = pCsrRoamInfo->chan_info.info; |
| 1283 | chan_info.band_center_freq1 = |
| 1284 | pCsrRoamInfo->chan_info.band_center_freq1; |
| 1285 | chan_info.band_center_freq2 = |
| 1286 | pCsrRoamInfo->chan_info.band_center_freq2; |
| 1287 | chan_info.reg_info_1 = |
| 1288 | pCsrRoamInfo->chan_info.reg_info_1; |
| 1289 | chan_info.reg_info_2 = |
| 1290 | pCsrRoamInfo->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1291 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1292 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1293 | pAdapter->device_mode, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1294 | peerMacAddr.bytes, |
| 1295 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1296 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1297 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1298 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1299 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1300 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1301 | if (ret) |
| 1302 | hdd_err("Peer object %pM fail to set associated state", |
| 1303 | peerMacAddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1304 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1305 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1306 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
| 1307 | ePeerConnected, |
| 1308 | pCsrRoamInfo->timingMeasCap, |
| 1309 | pAdapter->sessionId, &chan_info, |
| 1310 | pAdapter->device_mode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1311 | /* Update tdls module about connection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1312 | hdd_notify_sta_connect(pAdapter->sessionId, |
| 1313 | pCsrRoamInfo->tdls_chan_swit_prohibited, |
| 1314 | pCsrRoamInfo->tdls_prohibited, |
| 1315 | pAdapter->hdd_vdev); |
| 1316 | |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1317 | wlan_hdd_tdls_notify_connect(pAdapter, pCsrRoamInfo); |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 1318 | |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1319 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1320 | #ifdef MSM_PLATFORM |
Ravi Joshi | ae8e9a7 | 2016-08-03 17:38:03 -0700 | [diff] [blame] | 1321 | #if defined(CONFIG_ICNSS) || defined(CONFIG_CNSS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1322 | /* start timer in sta/p2p_cli */ |
| 1323 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1324 | pAdapter->prev_tx_packets = pAdapter->stats.tx_packets; |
| 1325 | pAdapter->prev_rx_packets = pAdapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1326 | cdp_get_intra_bss_fwd_pkts_count( |
| 1327 | cds_get_context(QDF_MODULE_ID_SOC), pAdapter->sessionId, |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1328 | &pAdapter->prev_fwd_tx_packets, |
| 1329 | &pAdapter->prev_fwd_rx_packets); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1330 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1331 | hdd_bus_bw_compute_timer_start(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1332 | #endif |
| 1333 | #endif |
| 1334 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
| 1335 | pHddStaCtx->conn_info.connState) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1336 | policy_mgr_update_connection_info(pHddCtx->hdd_psoc, |
| 1337 | pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1338 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1339 | ETH_ALEN); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1340 | hdd_info("wlan: new IBSS connection to " MAC_ADDRESS_STR, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1341 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes)); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1342 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1343 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1344 | QDF_IBSS_MODE, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1345 | pCsrRoamInfo->bssid.bytes, |
| 1346 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1347 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1348 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1349 | MAC_ADDR_ARRAY(pCsrRoamInfo->bssid.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1350 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1351 | WLAN_ASSOC_STATE); |
Mukul Sharma | eb01e13 | 2017-02-16 13:01:03 +0530 | [diff] [blame] | 1352 | if (ret) |
| 1353 | hdd_err("Peer object %pM fail to set associated state", |
| 1354 | peerMacAddr.bytes); |
| 1355 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1356 | } else { /* Not Associated */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1357 | hdd_info("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1358 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1359 | policy_mgr_decr_session_set_pcl(pHddCtx->hdd_psoc, |
| 1360 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1361 | |
| 1362 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1363 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1364 | #endif |
| 1365 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1366 | if ((pAdapter->device_mode == QDF_STA_MODE) || |
| 1367 | (pAdapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1368 | qdf_copy_macaddr(&peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1369 | &pHddStaCtx->conn_info.bssId); |
| 1370 | |
| 1371 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1372 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1373 | ePeerDisconnected, 0, |
| 1374 | pAdapter->sessionId, |
| 1375 | NULL, |
| 1376 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1377 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1378 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1379 | ret = hdd_objmgr_remove_peer_object(pAdapter->hdd_vdev, |
| 1380 | peerMacAddr.bytes); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 1381 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1382 | hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails", |
| 1383 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
| 1384 | |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 1385 | hdd_lpass_notify_disconnect(pAdapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1386 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1387 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1388 | false, |
| 1389 | pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1390 | wlan_hdd_tdls_notify_disconnect(pAdapter, false); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1391 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1392 | #ifdef MSM_PLATFORM |
| 1393 | /* stop timer in sta/p2p_cli */ |
| 1394 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1395 | pAdapter->prev_tx_packets = 0; |
| 1396 | pAdapter->prev_rx_packets = 0; |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1397 | pAdapter->prev_fwd_tx_packets = 0; |
| 1398 | pAdapter->prev_fwd_rx_packets = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1399 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1400 | hdd_bus_bw_compute_timer_try_stop(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1401 | #endif |
| 1402 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1403 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1404 | /* Send SCC/MCC Switching event to IPA */ |
| 1405 | hdd_ipa_send_mcc_scc_msg(pHddCtx, pHddCtx->mcc_mode); |
| 1406 | |
| 1407 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1408 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1409 | * driver so not sending the status of the connection to supplicant |
| 1410 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1411 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1412 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1413 | #ifdef FEATURE_WLAN_ESE |
| 1414 | if (eConnectionState_Associated == |
| 1415 | pHddStaCtx->conn_info.connState) { |
| 1416 | if ((pRoamProfile->AuthType.authType[0] == |
| 1417 | eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1418 | (pRoamProfile->AuthType.authType[0] == |
| 1419 | eCSR_AUTH_TYPE_CCKM_WPA)) |
| 1420 | hdd_send_new_ap_channel_info(dev, pAdapter, |
| 1421 | pCsrRoamInfo); |
| 1422 | } |
| 1423 | #endif |
| 1424 | } |
| 1425 | } |
| 1426 | |
| 1427 | /** |
| 1428 | * hdd_conn_remove_connect_info() - remove connection info |
| 1429 | * @pHddStaCtx: pointer to global HDD station context |
| 1430 | * @pCsrRoamInfo: pointer to roam info |
| 1431 | * |
| 1432 | * Return: none |
| 1433 | */ |
| 1434 | static void hdd_conn_remove_connect_info(hdd_station_ctx_t *pHddStaCtx) |
| 1435 | { |
| 1436 | /* Remove staId, bssId and peerMacAddress */ |
| 1437 | pHddStaCtx->conn_info.staId[0] = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1438 | qdf_mem_zero(&pHddStaCtx->conn_info.bssId, QDF_MAC_ADDR_SIZE); |
| 1439 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1440 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1441 | |
| 1442 | /* Clear all security settings */ |
| 1443 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1444 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1445 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1446 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1447 | qdf_mem_zero(&pHddStaCtx->conn_info.Keys, sizeof(tCsrKeys)); |
| 1448 | qdf_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1449 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1450 | pHddStaCtx->conn_info.proxyARPService = 0; |
| 1451 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1452 | qdf_mem_zero(&pHddStaCtx->conn_info.SSID, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1453 | } |
| 1454 | |
| 1455 | /** |
| 1456 | * hdd_roam_deregister_sta() - deregister station |
| 1457 | * @pAdapter: pointer to adapter |
| 1458 | * @staId: station identifier |
| 1459 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1460 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1461 | */ |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1462 | 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] | 1463 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1464 | QDF_STATUS qdf_status; |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1465 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 1466 | int ret = 0; |
| 1467 | uint8_t *peer_mac = NULL; |
| 1468 | struct qdf_mac_addr broadcastMacAddr = |
| 1469 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1470 | if (eConnectionState_IbssDisconnected == |
| 1471 | pHddStaCtx->conn_info.connState) { |
| 1472 | /* |
| 1473 | * Do not set the carrier off when the last peer leaves. |
| 1474 | * We will set the carrier off while stopping the IBSS. |
| 1475 | */ |
| 1476 | } |
| 1477 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 1478 | 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] | 1479 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1480 | staid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1481 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1482 | hdd_err("cdp_clear_peer() failed for staid %d. Status(%d) [0x%08X]", |
| 1483 | staid, qdf_status, qdf_status); |
| 1484 | } |
| 1485 | |
| 1486 | if (adapter->device_mode == QDF_STA_MODE) { |
| 1487 | peer_mac = pHddStaCtx->conn_info.bssId.bytes; |
| 1488 | } else if (adapter->device_mode == QDF_IBSS_MODE) { |
| 1489 | if (pHddStaCtx->broadcast_staid == staid) |
| 1490 | peer_mac = broadcastMacAddr.bytes; |
| 1491 | else |
| 1492 | peer_mac = pHddStaCtx->conn_info. |
| 1493 | peerMacAddress[staid].bytes; |
| 1494 | } |
| 1495 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1496 | ret = hdd_objmgr_remove_peer_object(adapter->hdd_vdev, peer_mac); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1497 | if (ret) { |
| 1498 | hdd_err("Peer obj %pM delete fails", peer_mac); |
| 1499 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1500 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1501 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1502 | } |
| 1503 | |
| 1504 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1505 | * hdd_print_bss_info() - print bss info |
| 1506 | * @hdd_sta_ctx: pointer to hdd station context |
| 1507 | * |
| 1508 | * Return: None |
| 1509 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1510 | 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] | 1511 | { |
| 1512 | uint32_t *cap_info; |
| 1513 | |
| 1514 | hdd_info("WIFI DATA LOGGER"); |
| 1515 | hdd_info("channel: %d", |
| 1516 | hdd_sta_ctx->conn_info.freq); |
| 1517 | hdd_info("dot11mode: %d", |
| 1518 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1519 | hdd_info("AKM: %d", |
| 1520 | hdd_sta_ctx->conn_info.authType); |
| 1521 | hdd_info("ssid: %.*s", |
| 1522 | hdd_sta_ctx->conn_info.SSID.SSID.length, |
| 1523 | hdd_sta_ctx->conn_info.SSID.SSID.ssId); |
| 1524 | hdd_info("roam count: %d", |
| 1525 | hdd_sta_ctx->conn_info.roam_count); |
| 1526 | hdd_info("ant_info: %d", |
| 1527 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1528 | hdd_info("datarate legacy %d", |
| 1529 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1530 | hdd_info("datarate mcs: %d", |
| 1531 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1532 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1533 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1534 | hdd_info("ht caps: %x", *cap_info); |
| 1535 | } |
| 1536 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1537 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1538 | hdd_info("vht caps: %x", *cap_info); |
| 1539 | } |
| 1540 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1541 | hdd_info("hs20 info: %x", |
| 1542 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1543 | hdd_info("signal: %d", |
| 1544 | hdd_sta_ctx->conn_info.signal); |
| 1545 | hdd_info("noise: %d", |
| 1546 | hdd_sta_ctx->conn_info.noise); |
| 1547 | } |
| 1548 | |
| 1549 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1550 | * hdd_dis_connect_handler() - disconnect event handler |
| 1551 | * @pAdapter: pointer to adapter |
| 1552 | * @pRoamInfo: pointer to roam info |
| 1553 | * @roamId: roam identifier |
| 1554 | * @roamStatus: roam status |
| 1555 | * @roamResult: roam result |
| 1556 | * |
| 1557 | * This function handles disconnect event: |
| 1558 | * 1. Disable transmit queues; |
| 1559 | * 2. Clean up internal connection states and data structures; |
| 1560 | * 3. Send disconnect indication to supplicant. |
| 1561 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1562 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1563 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1564 | static QDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1565 | tCsrRoamInfo *pRoamInfo, |
| 1566 | uint32_t roamId, |
| 1567 | eRoamCmdStatus roamStatus, |
| 1568 | eCsrRoamResult roamResult) |
| 1569 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1570 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1571 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1572 | struct net_device *dev = pAdapter->dev; |
| 1573 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1574 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1575 | uint8_t sta_id; |
| 1576 | bool sendDisconInd = true; |
| 1577 | |
| 1578 | if (dev == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1579 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1580 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1581 | } |
| 1582 | /* notify apps that we can't pass traffic anymore */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1583 | hdd_notice("Disabling queues"); |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1584 | wlan_hdd_netif_queue_control(pAdapter, |
| 1585 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1586 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1587 | |
| 1588 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 1589 | hdd_ipa_wlan_evt(pAdapter, pHddStaCtx->conn_info.staId[0], |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 1590 | HDD_IPA_STA_DISCONNECT, |
| 1591 | pHddStaCtx->conn_info.bssId.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1592 | |
| 1593 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1594 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1595 | #endif |
| 1596 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1597 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 1598 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1599 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1600 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1601 | |
| 1602 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1603 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1604 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1605 | * to cfg80211_disconnected. |
| 1606 | */ |
| 1607 | if ((eConnectionState_Disconnecting == |
| 1608 | pHddStaCtx->conn_info.connState) || |
| 1609 | (eConnectionState_NotConnected == |
| 1610 | pHddStaCtx->conn_info.connState)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1611 | 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] | 1612 | sendDisconInd = false; |
| 1613 | } |
| 1614 | |
| 1615 | if (pHddStaCtx->conn_info.connState != eConnectionState_Disconnecting) { |
| 1616 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1617 | hdd_conn_set_connection_state(pAdapter, |
| 1618 | eConnectionState_Disconnecting); |
| 1619 | } |
| 1620 | |
| 1621 | hdd_clear_roam_profile_ie(pAdapter); |
| 1622 | hdd_wmm_init(pAdapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1623 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1624 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1625 | |
| 1626 | /* indicate 'disconnect' status to wpa_supplicant... */ |
| 1627 | hdd_send_association_event(dev, pRoamInfo); |
| 1628 | /* indicate disconnected event to nl80211 */ |
| 1629 | if (roamStatus != eCSR_ROAM_IBSS_LEAVE) { |
| 1630 | /* |
| 1631 | * Only send indication to kernel if not initiated |
| 1632 | * by kernel |
| 1633 | */ |
| 1634 | if (sendDisconInd) { |
| 1635 | /* |
| 1636 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1637 | * to ICS UI. |
| 1638 | */ |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1639 | if (eCSR_ROAM_LOSTLINK == roamStatus) { |
| 1640 | if (pRoamInfo->reasonCode == |
| 1641 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
| 1642 | 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] | 1643 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1644 | dev, false, |
| 1645 | pRoamInfo->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1646 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1647 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1648 | dev, false, |
| 1649 | WLAN_REASON_UNSPECIFIED |
| 1650 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1651 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1652 | |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1653 | hdd_info("sent disconnected event to nl80211, reason code %d", |
| 1654 | (eCSR_ROAM_LOSTLINK == roamStatus) ? |
| 1655 | pRoamInfo->reasonCode : |
| 1656 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1657 | } |
| 1658 | /* |
| 1659 | * During the WLAN uninitialization,supplicant is stopped |
| 1660 | * before the driver so not sending the status of the |
| 1661 | * connection to supplicant. |
| 1662 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1663 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1664 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1665 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1666 | if (global_p2p_connection_status == |
| 1667 | P2P_CLIENT_CONNECTED_STATE_1) { |
| 1668 | global_p2p_connection_status = |
| 1669 | P2P_CLIENT_DISCONNECTED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1670 | 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] | 1671 | } else if (global_p2p_connection_status == |
| 1672 | P2P_CLIENT_COMPLETED_STATE) { |
| 1673 | global_p2p_connection_status = |
| 1674 | P2P_NOT_ACTIVE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1675 | 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] | 1676 | } |
| 1677 | } |
| 1678 | #endif |
| 1679 | |
| 1680 | } |
| 1681 | } |
| 1682 | |
| 1683 | hdd_wmm_adapter_clear(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1684 | sme_ft_reset(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1685 | if (hdd_remove_beacon_filter(pAdapter) != 0) |
| 1686 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1687 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1689 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1690 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 1691 | sta_id = pHddStaCtx->broadcast_staid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1692 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1693 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1694 | 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] | 1695 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1696 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1697 | } |
| 1698 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1699 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1700 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1701 | if (HDD_WLAN_INVALID_STA_ID == |
| 1702 | pHddStaCtx->conn_info.staId[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1703 | continue; |
| 1704 | sta_id = pHddStaCtx->conn_info.staId[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1705 | hdd_debug("Deregister StaID %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1706 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1707 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1708 | 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] | 1709 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1710 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1711 | } |
| 1712 | /* set the staid and peer mac as 0, all other |
| 1713 | * reset are done in hdd_connRemoveConnectInfo. |
| 1714 | */ |
| 1715 | pHddStaCtx->conn_info.staId[i] = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1716 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1717 | sizeof(struct qdf_mac_addr)); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1718 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1719 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1720 | } |
| 1721 | } else { |
| 1722 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1723 | hdd_debug("roamResult: %d", roamResult); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1724 | |
| 1725 | /* clear scan cache for Link Lost */ |
Sandeep Puligilla | f0b3058 | 2017-01-12 08:39:41 -0800 | [diff] [blame] | 1726 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roamResult || |
| 1727 | eCSR_ROAM_RESULT_DISASSOC_IND == roamResult || |
yeshwanth sriram guntuka | 951725a | 2017-03-15 19:33:04 +0530 | [diff] [blame] | 1728 | eCSR_ROAM_LOSTLINK == roamStatus) { |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1729 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 1730 | pHddStaCtx->conn_info.bssId.bytes); |
| 1731 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1732 | pHddStaCtx->conn_info.bssId.bytes); |
| 1733 | } |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1734 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1735 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1736 | /* Clear saved connection information in HDD */ |
| 1737 | hdd_conn_remove_connect_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1738 | hdd_conn_set_connection_state(pAdapter, eConnectionState_NotConnected); |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 1739 | pmo_ucfg_flush_gtk_offload_req(pAdapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1740 | |
| 1741 | #ifdef FEATURE_WLAN_TDLS |
| 1742 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1743 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1744 | #endif |
| 1745 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1746 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 1747 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX |
| 1749 | (pAdapter), |
| 1750 | pAdapter->sessionId); |
| 1751 | } |
Mahesh A Saptasagar | 6dda202 | 2016-09-03 12:59:09 +0530 | [diff] [blame] | 1752 | wlan_hdd_clear_link_layer_stats(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1753 | /* Unblock anyone waiting for disconnect to complete */ |
| 1754 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1755 | hdd_print_bss_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1756 | return status; |
| 1757 | } |
| 1758 | |
| 1759 | /** |
| 1760 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1761 | * @vdev_id: vdevid |
| 1762 | * |
| 1763 | * Return: None |
| 1764 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1765 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1766 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1767 | hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1768 | hdd_adapter_t *adapter = NULL; |
| 1769 | |
| 1770 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 1771 | if (adapter == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1772 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1773 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1774 | } |
| 1775 | complete(&adapter->sta_authorized_event); |
| 1776 | } |
| 1777 | |
| 1778 | /** |
| 1779 | * hdd_change_peer_state() - change peer state |
| 1780 | * @pAdapter: HDD adapter |
| 1781 | * @sta_state: peer state |
| 1782 | * @roam_synch_in_progress: roam synch in progress |
| 1783 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1784 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1785 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1786 | QDF_STATUS hdd_change_peer_state(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1787 | uint8_t sta_id, |
| 1788 | enum ol_txrx_peer_state sta_state, |
| 1789 | bool roam_synch_in_progress) |
| 1790 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1791 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1792 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1793 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1794 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1795 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1796 | |
| 1797 | if (!pdev) { |
| 1798 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1799 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1800 | } |
| 1801 | |
| 1802 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1803 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1804 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1805 | } |
| 1806 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1807 | peer = cdp_peer_find_by_local_id(soc, |
| 1808 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1809 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1810 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1811 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1812 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1813 | if (peer_mac_addr == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1814 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1815 | return QDF_STATUS_E_FAULT; |
| 1816 | } |
| 1817 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1818 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1819 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1820 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1821 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1822 | } |
| 1823 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1824 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1825 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | #endif |
| 1827 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1828 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1830 | /* make sure event is reset */ |
| 1831 | INIT_COMPLETION(pAdapter->sta_authorized_event); |
| 1832 | #endif |
| 1833 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1834 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1835 | hdd_set_peer_authorized_event, |
| 1836 | pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1837 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1838 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1839 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1840 | } |
| 1841 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1842 | if (pAdapter->device_mode == QDF_STA_MODE || |
| 1843 | pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1844 | #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] | 1845 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1846 | unsigned long rc; |
| 1847 | |
| 1848 | /* wait for event from firmware to set the event */ |
| 1849 | rc = wait_for_completion_timeout( |
| 1850 | &pAdapter->sta_authorized_event, |
| 1851 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1852 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1853 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1854 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1855 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 1856 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1857 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1858 | #endif |
| 1859 | } |
| 1860 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1861 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1862 | } |
| 1863 | |
| 1864 | /** |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1865 | * hdd_update_dp_vdev_flags() - update datapath vdev flags |
| 1866 | * @cbk_data: callback data |
| 1867 | * @sta_id: station id |
| 1868 | * @vdev_param: vdev parameter |
| 1869 | * @is_link_up: link state up or down |
| 1870 | * |
| 1871 | * Return: QDF status |
| 1872 | */ |
| 1873 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
| 1874 | uint8_t sta_id, |
| 1875 | uint32_t vdev_param, |
| 1876 | bool is_link_up) |
| 1877 | { |
| 1878 | struct cdp_vdev *data_vdev; |
| 1879 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1880 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1881 | hdd_context_t *hdd_ctx; |
| 1882 | struct wlan_objmgr_psoc **psoc; |
| 1883 | |
| 1884 | if (!cbk_data) |
| 1885 | return status; |
| 1886 | |
| 1887 | psoc = cbk_data; |
| 1888 | hdd_ctx = container_of(psoc, hdd_context_t, hdd_psoc); |
| 1889 | |
| 1890 | if (!hdd_ctx->tdls_nap_active) |
| 1891 | return status; |
| 1892 | |
| 1893 | data_vdev = cdp_peer_get_vdev_by_sta_id(soc, sta_id); |
| 1894 | if (NULL == data_vdev) { |
| 1895 | status = QDF_STATUS_E_FAILURE; |
| 1896 | return status; |
| 1897 | } |
| 1898 | |
| 1899 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 1900 | |
| 1901 | return status; |
| 1902 | } |
| 1903 | |
| 1904 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1905 | * hdd_roam_register_sta() - register station |
| 1906 | * @pAdapter: pointer to adapter |
| 1907 | * @pRoamInfo: pointer to roam info |
| 1908 | * @staId: station identifier |
| 1909 | * @pPeerMacAddress: peer MAC address |
| 1910 | * @pBssDesc: pointer to BSS description |
| 1911 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1912 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1913 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 1914 | QDF_STATUS hdd_roam_register_sta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1915 | tCsrRoamInfo *pRoamInfo, |
| 1916 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1917 | struct qdf_mac_addr *pPeerMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1918 | tSirBssDescription *pBssDesc) |
| 1919 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1920 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1921 | struct ol_txrx_desc_type staDesc = { 0 }; |
| 1922 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 1923 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1924 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1925 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1926 | |
| 1927 | if (NULL == pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1928 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1929 | |
| 1930 | /* Get the Station ID from the one saved during the association */ |
| 1931 | staDesc.sta_id = staId; |
| 1932 | |
| 1933 | /* set the QoS field appropriately */ |
| 1934 | if (hdd_wmm_is_active(pAdapter)) |
| 1935 | staDesc.is_qos_enabled = 1; |
| 1936 | else |
| 1937 | staDesc.is_qos_enabled = 0; |
| 1938 | |
| 1939 | #ifdef FEATURE_WLAN_WAPI |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 1940 | hdd_debug("WAPI STA Registered: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1941 | pAdapter->wapi_info.fIsWapiSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1942 | if (pAdapter->wapi_info.fIsWapiSta) |
| 1943 | staDesc.is_wapi_supported = 1; |
| 1944 | else |
| 1945 | staDesc.is_wapi_supported = 0; |
| 1946 | #endif /* FEATURE_WLAN_WAPI */ |
| 1947 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1948 | /* Register the vdev transmit and receive functions */ |
| 1949 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 1950 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1951 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1952 | pAdapter->txrx_vdev = (void *)cdp_get_vdev_from_vdev_id(soc, |
| 1953 | (struct cdp_pdev *)pdev, |
| 1954 | pAdapter->sessionId); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1955 | if (!pAdapter->txrx_vdev) { |
| 1956 | hdd_err("%s find vdev fail", __func__); |
| 1957 | return QDF_STATUS_E_FAILURE; |
| 1958 | } |
| 1959 | |
| 1960 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1961 | cdp_vdev_register(soc, |
| 1962 | (struct cdp_vdev *)pAdapter->txrx_vdev, pAdapter, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1963 | if (!txrx_ops.tx.tx) { |
| 1964 | hdd_err("%s vdev register fail", __func__); |
| 1965 | return QDF_STATUS_E_FAILURE; |
| 1966 | } |
| 1967 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1968 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1969 | qdf_status = cdp_peer_register(soc, |
| 1970 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1971 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1972 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1973 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1974 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1975 | } |
| 1976 | |
| 1977 | if (!pRoamInfo->fAuthRequired) { |
| 1978 | /* |
| 1979 | * Connections that do not need Upper layer auth, transition |
| 1980 | * TLSHIM directly to 'Authenticated' state |
| 1981 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1982 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1983 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1984 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1985 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1986 | pRoamInfo->roamSynchInProgress |
| 1987 | #else |
| 1988 | false |
| 1989 | #endif |
| 1990 | ); |
| 1991 | |
| 1992 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 1993 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1994 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1995 | 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] | 1996 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1997 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1998 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1999 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2000 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2001 | pRoamInfo->roamSynchInProgress |
| 2002 | #else |
| 2003 | false |
| 2004 | #endif |
| 2005 | ); |
| 2006 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2007 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2008 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2009 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | } |
| 2011 | |
| 2012 | /** |
| 2013 | * hdd_send_re_assoc_event() - send reassoc event |
| 2014 | * @dev: pointer to net device |
| 2015 | * @pAdapter: pointer to adapter |
| 2016 | * @pCsrRoamInfo: pointer to roam info |
| 2017 | * @reqRsnIe: pointer to RSN Information element |
| 2018 | * @reqRsnLength: length of RSN IE |
| 2019 | * |
| 2020 | * Return: none |
| 2021 | */ |
| 2022 | static void hdd_send_re_assoc_event(struct net_device *dev, |
| 2023 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo, |
| 2024 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2025 | { |
| 2026 | unsigned int len = 0; |
| 2027 | u8 *pFTAssocRsp = NULL; |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2028 | uint8_t *rspRsnIe = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
| 2029 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2030 | uint32_t rspRsnLength = 0; |
| 2031 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2032 | uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes-EID and len */ |
| 2033 | uint8_t *buf_ptr, ssid_ie_len; |
| 2034 | struct cfg80211_bss *bss = NULL; |
| 2035 | uint8_t *final_req_ie = NULL; |
| 2036 | tCsrRoamConnectedProfile roam_profile; |
| 2037 | tHalHandle hal_handle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2038 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2039 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2040 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2041 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2042 | if (!rspRsnIe) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2043 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2044 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2045 | } |
| 2046 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2047 | if (!assoc_req_ies) { |
| 2048 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2049 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2050 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2051 | if (pCsrRoamInfo == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2052 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2053 | goto done; |
| 2054 | } |
| 2055 | |
| 2056 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2057 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2058 | goto done; |
| 2059 | } |
| 2060 | |
| 2061 | pFTAssocRsp = |
| 2062 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2063 | pCsrRoamInfo->nAssocReqLength); |
| 2064 | if (pFTAssocRsp == NULL) |
| 2065 | goto done; |
| 2066 | |
| 2067 | /* pFTAssocRsp needs to point to the IEs */ |
| 2068 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2069 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2070 | (unsigned int)pFTAssocRsp[0], (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2071 | |
| 2072 | /* |
| 2073 | * Active session count is decremented upon disconnection, but during |
| 2074 | * roaming, there is no disconnect indication and hence active session |
| 2075 | * count is not decremented. |
| 2076 | * After roaming is completed, active session count is incremented |
| 2077 | * as a part of connect indication but effectively after roaming the |
| 2078 | * active session count should still be the same and hence upon |
| 2079 | * successful reassoc decrement the active session count here. |
| 2080 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2081 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2082 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
| 2083 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2084 | |
| 2085 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
| 2086 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2087 | rspRsnLength = len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2088 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2089 | qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | |
| 2091 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2092 | (int)pCsrRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2093 | sme_roam_get_connect_profile(hal_handle, pAdapter->sessionId, |
| 2094 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2095 | |
| 2096 | bss = hdd_cfg80211_get_bss(pAdapter->wdev.wiphy, |
| 2097 | chan, pCsrRoamInfo->bssid.bytes, |
| 2098 | &roam_profile.SSID.ssId[0], |
| 2099 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2100 | |
| 2101 | if (bss == NULL) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2102 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2103 | buf_ptr = buf_ssid_ie; |
| 2104 | *buf_ptr = SIR_MAC_SSID_EID; |
| 2105 | buf_ptr++; |
| 2106 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2107 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2108 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2109 | roam_profile.SSID.length); |
| 2110 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2111 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2112 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2113 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2114 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2115 | if (final_req_ie == NULL) { |
| 2116 | if (bss) |
| 2117 | cfg80211_put_bss(pAdapter->wdev.wiphy, bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2118 | goto done; |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2119 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2120 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2121 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2122 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2123 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2124 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2125 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2126 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2127 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2128 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2129 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Varun Reddy Yeturu | c13305e | 2017-03-10 14:05:02 -0800 | [diff] [blame] | 2130 | cfg80211_roamed_bss(dev, bss, |
| 2131 | final_req_ie, (ssid_ie_len + reqRsnLength), |
| 2132 | rspRsnIe, rspRsnLength, GFP_KERNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2133 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2134 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2135 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2136 | pCsrRoamInfo->nAssocReqLength); |
| 2137 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2138 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2139 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2140 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2141 | |
Prakash Dhavali | 989127d | 2016-11-29 14:56:44 +0530 | [diff] [blame] | 2142 | wlan_hdd_send_roam_auth_event(pAdapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2143 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2144 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2145 | pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2146 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2147 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2148 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2149 | qdf_mem_free(final_req_ie); |
| 2150 | qdf_mem_free(rspRsnIe); |
| 2151 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2152 | } |
| 2153 | |
| 2154 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2155 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2156 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2157 | * |
| 2158 | * Return: roam sync status if roaming offloaded else false |
| 2159 | */ |
| 2160 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2161 | bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2162 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2163 | if (roaminfo) |
| 2164 | return roaminfo->roamSynchInProgress; |
| 2165 | else |
| 2166 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2167 | } |
| 2168 | #endif |
| 2169 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2170 | /** |
| 2171 | * hdd_get_ibss_peer_staid() - get sta id for IBSS peer |
| 2172 | * @hddstactx: pointer to HDD sta context |
| 2173 | * @roaminfo: pointer to roaminfo structure |
| 2174 | * |
| 2175 | * This function returns staid for IBSS peer. If peer is broadcast |
| 2176 | * MAC address return self staid(0) else find the peer sta id of |
| 2177 | * the peer. |
| 2178 | * |
| 2179 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2180 | */ |
| 2181 | static uint8_t hdd_get_ibss_peer_staid(hdd_station_ctx_t *hddstactx, |
| 2182 | tCsrRoamInfo *roaminfo) |
| 2183 | { |
| 2184 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
| 2185 | QDF_STATUS status; |
| 2186 | |
| 2187 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
| 2188 | staid = 0; |
| 2189 | } else { |
| 2190 | status = hdd_get_peer_sta_id(hddstactx, |
| 2191 | &roaminfo->peerMac, &staid); |
| 2192 | if (status != QDF_STATUS_SUCCESS) { |
| 2193 | hdd_err("Unable to find staid for " MAC_ADDRESS_STR, |
| 2194 | MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
| 2195 | } |
| 2196 | } |
| 2197 | |
| 2198 | return staid; |
| 2199 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2200 | |
| 2201 | /** |
| 2202 | * hdd_change_sta_state_authenticated()- |
| 2203 | * This function changes STA state to authenticated |
| 2204 | * @adapter: pointer to the adapter structure. |
| 2205 | * @roaminfo: pointer to the RoamInfo structure. |
| 2206 | * |
| 2207 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2208 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2209 | * |
| 2210 | * Return: 0 on success and errno on failure |
| 2211 | */ |
| 2212 | static int hdd_change_sta_state_authenticated(hdd_adapter_t *adapter, |
| 2213 | tCsrRoamInfo *roaminfo) |
| 2214 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2215 | QDF_STATUS status; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2216 | uint32_t timeout; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2217 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2218 | 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] | 2219 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2220 | |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2221 | timeout = hddstactx->hdd_ReassocScenario ? |
| 2222 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2223 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2224 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2225 | if (QDF_IBSS_MODE == adapter->device_mode) |
| 2226 | staid = hdd_get_ibss_peer_staid(hddstactx, roaminfo); |
| 2227 | else |
| 2228 | staid = hddstactx->conn_info.staId[0]; |
| 2229 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2230 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", staid); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2231 | |
| 2232 | /* Connections that do not need Upper layer authentication, |
| 2233 | * transition TL to 'Authenticated' state after the keys are set |
| 2234 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2235 | status = hdd_change_peer_state(adapter, staid, OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2236 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2237 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2238 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
| 2239 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2240 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 2241 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2242 | sme_ps_enable_auto_ps_timer( |
| 2243 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 2244 | adapter->sessionId, |
Dustin Brown | 84411b0 | 2017-07-21 16:44:44 -0700 | [diff] [blame] | 2245 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2246 | } |
| 2247 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2248 | return qdf_status_to_os_return(status); |
| 2249 | } |
| 2250 | |
| 2251 | /** |
| 2252 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2253 | * if key installation is required |
| 2254 | * @encr_type: encryption type |
| 2255 | * |
| 2256 | * Return: true if key installation is required and false otherwise. |
| 2257 | */ |
| 2258 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2259 | eCsrEncryptionType encr_type) |
| 2260 | { |
| 2261 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2262 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2263 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
| 2264 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2265 | return true; |
| 2266 | else |
| 2267 | return false; |
| 2268 | } |
| 2269 | |
| 2270 | /** |
| 2271 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2272 | * complete |
| 2273 | * @adapter: pointer to HDD adapter |
| 2274 | * @roaminfo: pointer to roam info |
| 2275 | * @roam_result: roam result |
| 2276 | * |
| 2277 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2278 | * This function checks for the successful set key completion and update |
| 2279 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2280 | * |
| 2281 | * Return: None |
| 2282 | */ |
| 2283 | static void hdd_change_peer_state_after_set_key(hdd_adapter_t *adapter, |
| 2284 | tCsrRoamInfo *roaminfo, eCsrRoamResult roam_result) |
| 2285 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2286 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 2287 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.ucEncryptionType; |
| 2288 | |
| 2289 | /* |
| 2290 | * If the security mode is one of the following, IBSS peer will be |
| 2291 | * waiting in CONN state and we will move the peer state to AUTH |
| 2292 | * here. For non-secure connection, no need to wait for set-key complete |
| 2293 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2294 | */ |
| 2295 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2296 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2297 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2298 | |
| 2299 | return; |
| 2300 | } |
| 2301 | |
| 2302 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2303 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2304 | /* |
| 2305 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2306 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2307 | * after roaming. STA TL state moves to authenticated only if |
| 2308 | * ptk_installed is true. So, make ptk_installed to true in |
| 2309 | * case of 11R roaming. |
| 2310 | */ |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2311 | if (sme_neighbor_roam_is11r_assoc(WLAN_HDD_GET_HAL_CTX(adapter), |
| 2312 | adapter->sessionId)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2313 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2314 | } else { |
| 2315 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2316 | } |
| 2317 | |
| 2318 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2319 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2320 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2321 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2322 | * set the unicast and broadcast key. |
| 2323 | */ |
| 2324 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2325 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2326 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2327 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2328 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2329 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2330 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2331 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2332 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2333 | } |
| 2334 | |
| 2335 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2336 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2337 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2338 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2339 | } |
| 2340 | |
| 2341 | hdd_sta_ctx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2342 | |
| 2343 | return; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2344 | } |
| 2345 | |
| 2346 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2347 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
| 2348 | * @pAdapter: pointer to adapter |
| 2349 | * @pRoamInfo: pointer to roam info |
| 2350 | * @roamId: roam id |
| 2351 | * @roamStatus: roam status |
| 2352 | * @roamResult: roam result |
| 2353 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2354 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2355 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2356 | 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] | 2357 | tCsrRoamInfo *pRoamInfo, |
| 2358 | uint32_t roamId, |
| 2359 | eRoamCmdStatus roamStatus, |
| 2360 | eCsrRoamResult roamResult) |
| 2361 | { |
| 2362 | eCsrEncryptionType connectedCipherAlgo; |
| 2363 | bool fConnected = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2364 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2365 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2366 | ENTER(); |
| 2367 | |
| 2368 | if (NULL == pRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2369 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2370 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2371 | } |
| 2372 | /* |
| 2373 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2374 | * then go to 'authenticated'. For all other authentication types |
| 2375 | * (those that do not require upper layer authentication) we can put TL |
| 2376 | * directly into 'authenticated' state. |
| 2377 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2378 | hdd_info("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2379 | MAC_ADDRESS_STR, roamStatus, roamResult, |
| 2380 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 2381 | |
| 2382 | fConnected = hdd_conn_get_connected_cipher_algo(pHddStaCtx, |
| 2383 | &connectedCipherAlgo); |
| 2384 | if (fConnected) { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2385 | hdd_change_peer_state_after_set_key(pAdapter, pRoamInfo, |
| 2386 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2387 | } else { |
| 2388 | /* |
| 2389 | * possible disassoc after issuing set key and waiting |
| 2390 | * set key complete. |
| 2391 | */ |
| 2392 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2393 | } |
| 2394 | |
| 2395 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2396 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2397 | } |
| 2398 | |
| 2399 | /** |
| 2400 | * hdd_perform_roam_set_key_complete() - perform set key complete |
| 2401 | * @pAdapter: pointer to adapter |
| 2402 | * |
| 2403 | * Return: none |
| 2404 | */ |
| 2405 | void hdd_perform_roam_set_key_complete(hdd_adapter_t *pAdapter) |
| 2406 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2407 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2408 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2409 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2410 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2411 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2412 | qdf_mem_copy(roamInfo.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2413 | pHddStaCtx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2414 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2415 | pHddStaCtx->roam_info.peerMac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2416 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2417 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2418 | hdd_roam_set_key_complete_handler(pAdapter, |
| 2419 | &roamInfo, |
| 2420 | pHddStaCtx->roam_info.roamId, |
| 2421 | pHddStaCtx->roam_info.roamStatus, |
| 2422 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2423 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2424 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2425 | |
| 2426 | pHddStaCtx->roam_info.deferKeyComplete = false; |
| 2427 | } |
| 2428 | |
| 2429 | /** |
| 2430 | * hdd_association_completion_handler() - association completion handler |
| 2431 | * @pAdapter: pointer to adapter |
| 2432 | * @pRoamInfo: pointer to roam info |
| 2433 | * @roamId: roam id |
| 2434 | * @roamStatus: roam status |
| 2435 | * @roamResult: roam result |
| 2436 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2437 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2438 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2439 | static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2440 | tCsrRoamInfo *pRoamInfo, |
| 2441 | uint32_t roamId, |
| 2442 | eRoamCmdStatus roamStatus, |
| 2443 | eCsrRoamResult roamResult) |
| 2444 | { |
| 2445 | struct net_device *dev = pAdapter->dev; |
| 2446 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2447 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2448 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2449 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2450 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2451 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2452 | bool hddDisconInProgress = false; |
| 2453 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2454 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2455 | bool ok; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2456 | |
| 2457 | if (!pHddCtx) { |
| 2458 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2459 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2460 | } |
| 2461 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2462 | /* validate config */ |
| 2463 | if (!pHddCtx->config) { |
| 2464 | hdd_err("config is NULL"); |
| 2465 | return QDF_STATUS_E_NULL_VALUE; |
| 2466 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2467 | /* HDD has initiated disconnect, do not send connect result indication |
| 2468 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2469 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2470 | if (((eConnectionState_Disconnecting == |
| 2471 | pHddStaCtx->conn_info.connState) || |
| 2472 | (eConnectionState_NotConnected == |
| 2473 | pHddStaCtx->conn_info.connState)) && |
| 2474 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2475 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2476 | hdd_info("hddDisconInProgress state=%d, result=%d, status=%d", |
| 2477 | pHddStaCtx->conn_info.connState, |
| 2478 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2479 | hddDisconInProgress = true; |
| 2480 | } |
| 2481 | |
| 2482 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
| 2483 | if (NULL == pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2484 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2485 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2486 | } |
| 2487 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2488 | hdd_conn_set_connection_state(pAdapter, |
| 2489 | eConnectionState_Associated); |
| 2490 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2491 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2492 | /* Save the connection info from CSR... */ |
| 2493 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, |
| 2494 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2495 | |
| 2496 | if (hdd_add_beacon_filter(pAdapter) != 0) |
| 2497 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2498 | #ifdef FEATURE_WLAN_WAPI |
| 2499 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2500 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
| 2501 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2502 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
| 2503 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2504 | } else { |
| 2505 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2506 | } |
| 2507 | #endif /* FEATURE_WLAN_WAPI */ |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2508 | hdd_debug("bss_descr[%d] devicemode[%d]", !!pRoamInfo->pBssDesc, |
| 2509 | pAdapter->device_mode); |
| 2510 | if ((QDF_STA_MODE == pAdapter->device_mode) && |
| 2511 | pRoamInfo->pBssDesc) { |
| 2512 | ie_len = GET_IE_LEN_IN_BSS(pRoamInfo->pBssDesc->length); |
| 2513 | pHddStaCtx->ap_supports_immediate_power_save = |
| 2514 | wlan_hdd_is_ap_supports_immediate_power_save( |
| 2515 | (uint8_t *) pRoamInfo->pBssDesc->ieFields, |
| 2516 | ie_len); |
| 2517 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
| 2518 | pHddStaCtx->ap_supports_immediate_power_save); |
| 2519 | } |
| 2520 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2521 | /* Indicate 'connect' status to user space */ |
| 2522 | hdd_send_association_event(dev, pRoamInfo); |
| 2523 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2524 | if (policy_mgr_is_mcc_in_24G(pHddCtx->hdd_psoc)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2525 | if (pHddCtx->miracast_value) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2526 | wlan_hdd_set_mas(pAdapter, |
| 2527 | pHddCtx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2528 | } |
| 2529 | |
| 2530 | /* Initialize the Linkup event completion variable */ |
| 2531 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2532 | |
| 2533 | /* |
| 2534 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2535 | * the device properly. Before allowing any packet to go up to |
| 2536 | * the application, device activation has to be ensured for |
| 2537 | * proper queue mapping by the kernel. we have registered net |
| 2538 | * device notifier for device change notification. With this we |
| 2539 | * will come to know that the device is getting |
| 2540 | * activated properly. |
| 2541 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2542 | if (pHddStaCtx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2543 | /* |
| 2544 | * Enable Linkup Event Servicing which allows the net |
| 2545 | * device notifier to set the linkup event variable. |
| 2546 | */ |
| 2547 | pAdapter->isLinkUpSvcNeeded = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2548 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2549 | /* Switch on the Carrier to activate the device */ |
| 2550 | wlan_hdd_netif_queue_control(pAdapter, |
| 2551 | WLAN_NETIF_CARRIER_ON, |
| 2552 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2553 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2554 | /* |
| 2555 | * Wait for the Link to up to ensure all the queues |
| 2556 | * are set properly by the kernel. |
| 2557 | */ |
| 2558 | rc = wait_for_completion_timeout( |
| 2559 | &pAdapter->linkup_event_var, |
| 2560 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2561 | ); |
| 2562 | if (!rc) |
| 2563 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2564 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2565 | /* |
| 2566 | * Disable Linkup Event Servicing - no more service |
| 2567 | * required from the net device notifier call. |
| 2568 | */ |
| 2569 | pAdapter->isLinkUpSvcNeeded = false; |
| 2570 | } else { |
| 2571 | pHddStaCtx->ft_carrier_on = false; |
| 2572 | ft_carrier_on = true; |
| 2573 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2574 | if ((WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId) |
| 2575 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2576 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2577 | hdd_err("Wrong Staid: %d", pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2578 | |
| 2579 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2580 | |
| 2581 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 2582 | hdd_ipa_wlan_evt(pAdapter, pRoamInfo->staId, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 2583 | HDD_IPA_STA_CONNECT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2584 | pRoamInfo->bssid.bytes); |
| 2585 | |
| 2586 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2587 | wlan_hdd_auto_shutdown_enable(pHddCtx, false); |
| 2588 | #endif |
| 2589 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2590 | hdd_debug("check if STA chan ok for DNBS"); |
| 2591 | if (policy_mgr_is_chan_ok_for_dnbs(pHddCtx->hdd_psoc, |
| 2592 | pHddStaCtx->conn_info.operationChannel, |
| 2593 | &ok)) { |
| 2594 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
| 2595 | pHddStaCtx->conn_info.operationChannel); |
| 2596 | return QDF_STATUS_E_FAILURE; |
| 2597 | } |
| 2598 | |
| 2599 | if (!ok) { |
| 2600 | hdd_err("Chan:%d not suitable for DNBS", |
| 2601 | pHddStaCtx->conn_info.operationChannel); |
| 2602 | wlan_hdd_netif_queue_control(pAdapter, |
| 2603 | WLAN_NETIF_CARRIER_OFF, |
| 2604 | WLAN_CONTROL_PATH); |
| 2605 | if (!hddDisconInProgress) { |
| 2606 | hdd_err("Disconnecting..."); |
| 2607 | sme_roam_disconnect( |
| 2608 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2609 | pAdapter->sessionId, |
| 2610 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2611 | } |
| 2612 | return QDF_STATUS_E_FAILURE; |
| 2613 | } |
| 2614 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2615 | hdd_debug("check for SAP restart"); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2616 | policy_mgr_check_concurrent_intf_and_restart_sap( |
| 2617 | pHddCtx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2618 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2619 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 2620 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2621 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2622 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2623 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2624 | /* |
| 2625 | * For reassoc, the station is already registered, all we need |
| 2626 | * is to change the state of the STA in TL. |
| 2627 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2628 | * CONNECTED instead of AUTHENTICATED. |
| 2629 | */ |
| 2630 | if (!pRoamInfo->fReassocReq) { |
| 2631 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2632 | u8 *pFTAssocRsp = NULL; |
| 2633 | unsigned int assocRsplen = 0; |
| 2634 | u8 *pFTAssocReq = NULL; |
| 2635 | unsigned int assocReqlen = 0; |
| 2636 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2637 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2638 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2639 | |
| 2640 | /* add bss_id to cfg80211 data base */ |
| 2641 | bss = |
| 2642 | wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 2643 | pRoamInfo); |
| 2644 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2645 | hdd_err("wlan: Not able to create BSS entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2646 | wlan_hdd_netif_queue_control(pAdapter, |
| 2647 | WLAN_NETIF_CARRIER_OFF, |
| 2648 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2649 | if (!hddDisconInProgress) { |
| 2650 | /* |
| 2651 | * Here driver was not able to add bss |
| 2652 | * in cfg80211 database this can happen |
| 2653 | * if connected channel is not valid, |
| 2654 | * i.e reg domain was changed during |
| 2655 | * connection. Queue disconnect for the |
| 2656 | * session if disconnect is not in |
| 2657 | * progress. |
| 2658 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2659 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2660 | sme_roam_disconnect( |
| 2661 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2662 | pAdapter->sessionId, |
| 2663 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2664 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2665 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2666 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2667 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2668 | eCSR_AUTH_TYPE_FT_RSN |
| 2669 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2670 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
| 2671 | |
| 2672 | /* Association Response */ |
| 2673 | pFTAssocRsp = |
| 2674 | (u8 *) (pRoamInfo->pbFrames + |
| 2675 | pRoamInfo->nBeaconLength + |
| 2676 | pRoamInfo->nAssocReqLength); |
| 2677 | if (pFTAssocRsp != NULL) { |
| 2678 | /* |
| 2679 | * pFTAssocRsp needs to point to the IEs |
| 2680 | */ |
| 2681 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2682 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2683 | (unsigned int)pFTAssocRsp[0], |
| 2684 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2685 | assocRsplen = |
| 2686 | pRoamInfo->nAssocRspLength - |
| 2687 | FT_ASSOC_RSP_IES_OFFSET; |
| 2688 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2689 | hdd_debug("AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2690 | assocRsplen = 0; |
| 2691 | } |
| 2692 | |
| 2693 | /* Association Request */ |
| 2694 | pFTAssocReq = (u8 *) (pRoamInfo->pbFrames + |
| 2695 | pRoamInfo->nBeaconLength); |
| 2696 | if (pFTAssocReq != NULL) { |
| 2697 | if (!ft_carrier_on) { |
| 2698 | /* |
| 2699 | * pFTAssocReq needs to point to |
| 2700 | * the IEs |
| 2701 | */ |
| 2702 | pFTAssocReq += |
| 2703 | FT_ASSOC_REQ_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2704 | hdd_debug("pFTAssocReq is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2705 | (unsigned int) |
| 2706 | pFTAssocReq[0], |
| 2707 | (unsigned int) |
| 2708 | pFTAssocReq[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2709 | assocReqlen = |
| 2710 | pRoamInfo->nAssocReqLength - |
| 2711 | FT_ASSOC_REQ_IES_OFFSET; |
| 2712 | } else { |
| 2713 | /* |
| 2714 | * This should contain only the |
| 2715 | * FTIEs |
| 2716 | */ |
| 2717 | assocReqlen = |
| 2718 | pRoamInfo->nAssocReqLength; |
| 2719 | } |
| 2720 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2721 | hdd_debug("AssocReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2722 | assocReqlen = 0; |
| 2723 | } |
| 2724 | |
| 2725 | if (ft_carrier_on) { |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 2726 | if (!hddDisconInProgress && |
| 2727 | pRoamInfo->pBssDesc) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2728 | struct cfg80211_bss *roam_bss; |
| 2729 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2730 | /* |
| 2731 | * After roaming is completed, |
| 2732 | * active session count is |
| 2733 | * incremented as a part of |
| 2734 | * connect indication but |
| 2735 | * effectively the active |
| 2736 | * session count should still |
| 2737 | * be the same and hence upon |
| 2738 | * successful reassoc |
| 2739 | * decrement the active session |
| 2740 | * count here. |
| 2741 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2742 | if (!hdd_is_roam_sync_in_progress |
| 2743 | (pRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2744 | policy_mgr_decr_session_set_pcl( |
| 2745 | pHddCtx->hdd_psoc, |
| 2746 | pAdapter->device_mode, |
| 2747 | pAdapter->sessionId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2748 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2749 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2750 | chan = |
| 2751 | ieee80211_get_channel |
| 2752 | (pAdapter->wdev.wiphy, |
| 2753 | (int)pRoamInfo->pBssDesc-> |
| 2754 | channelId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2755 | hdd_debug( |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2756 | "assocReqlen %d assocRsplen %d", |
| 2757 | assocReqlen, |
| 2758 | assocRsplen); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2759 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2760 | hdd_debug( |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2761 | "Reassoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2762 | QDF_TRACE_HEX_DUMP( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2763 | QDF_MODULE_ID_HDD, |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2764 | QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2765 | pFTAssocReq, |
| 2766 | assocReqlen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2767 | roam_bss = |
| 2768 | hdd_cfg80211_get_bss( |
| 2769 | pAdapter->wdev.wiphy, |
| 2770 | chan, |
| 2771 | pRoamInfo->bssid.bytes, |
| 2772 | pRoamInfo->u. |
| 2773 | pConnectedProfile->SSID.ssId, |
| 2774 | pRoamInfo->u. |
| 2775 | pConnectedProfile->SSID.length); |
| 2776 | cfg80211_roamed_bss(dev, |
| 2777 | roam_bss, |
| 2778 | pFTAssocReq, |
| 2779 | assocReqlen, |
| 2780 | pFTAssocRsp, |
| 2781 | assocRsplen, |
| 2782 | GFP_KERNEL); |
| 2783 | wlan_hdd_send_roam_auth_event( |
| 2784 | pAdapter, |
| 2785 | pRoamInfo->bssid.bytes, |
| 2786 | pFTAssocReq, |
| 2787 | assocReqlen, |
| 2788 | pFTAssocRsp, |
| 2789 | assocRsplen, |
| 2790 | pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2791 | } |
| 2792 | if (sme_get_ftptk_state |
| 2793 | (WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2794 | pAdapter->sessionId)) { |
| 2795 | sme_set_ftptk_state |
| 2796 | (WLAN_HDD_GET_HAL_CTX |
| 2797 | (pAdapter), |
| 2798 | pAdapter->sessionId, |
| 2799 | false); |
| 2800 | pRoamInfo->fAuthRequired = |
| 2801 | false; |
| 2802 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2803 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2804 | roam_info.bssid, |
| 2805 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2806 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2807 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2808 | roam_info.peerMac, |
| 2809 | pRoamInfo->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2810 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2811 | pHddStaCtx->roam_info.roamId = |
| 2812 | roamId; |
| 2813 | pHddStaCtx->roam_info. |
| 2814 | roamStatus = roamStatus; |
| 2815 | pHddStaCtx->roam_info. |
| 2816 | deferKeyComplete = true; |
| 2817 | } |
| 2818 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2819 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2820 | ft_carrier_on); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2821 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2822 | pRoamInfo-> |
| 2823 | bssid.bytes, |
| 2824 | pRoamInfo, |
| 2825 | pFTAssocReq, |
| 2826 | assocReqlen, |
| 2827 | pFTAssocRsp, |
| 2828 | assocRsplen, |
| 2829 | WLAN_STATUS_SUCCESS, |
| 2830 | GFP_KERNEL, |
| 2831 | false, |
| 2832 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2833 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 2834 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2835 | /* |
| 2836 | * wpa supplicant expecting WPA/RSN IE in |
| 2837 | * connect result. |
| 2838 | */ |
| 2839 | csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX |
| 2840 | (pAdapter), |
| 2841 | pAdapter->sessionId, |
| 2842 | &reqRsnLength, |
| 2843 | reqRsnIe); |
| 2844 | |
| 2845 | csr_roam_get_wpa_rsn_rsp_ie(WLAN_HDD_GET_HAL_CTX |
| 2846 | (pAdapter), |
| 2847 | pAdapter->sessionId, |
| 2848 | &rspRsnLength, |
| 2849 | rspRsnIe); |
| 2850 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2851 | if (ft_carrier_on) |
| 2852 | hdd_send_re_assoc_event(dev, |
| 2853 | pAdapter, |
| 2854 | pRoamInfo, |
| 2855 | reqRsnIe, |
| 2856 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2857 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2858 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2859 | MAC_ADDRESS_STR |
| 2860 | " result:%d and Status:%d", |
| 2861 | MAC_ADDR_ARRAY |
| 2862 | (pRoamInfo->bssid.bytes), |
| 2863 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2864 | |
| 2865 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2866 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2867 | pRoamInfo-> |
| 2868 | bssid.bytes, |
| 2869 | pRoamInfo, |
| 2870 | reqRsnIe, |
| 2871 | reqRsnLength, |
| 2872 | rspRsnIe, |
| 2873 | rspRsnLength, |
| 2874 | WLAN_STATUS_SUCCESS, |
| 2875 | GFP_KERNEL, |
| 2876 | false, |
| 2877 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2878 | } |
| 2879 | } |
| 2880 | } |
| 2881 | if (!hddDisconInProgress) { |
| 2882 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2883 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2884 | bss); |
| 2885 | |
| 2886 | /* |
| 2887 | * Perform any WMM-related association |
| 2888 | * processing. |
| 2889 | */ |
| 2890 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2891 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2892 | |
| 2893 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2894 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2895 | */ |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2896 | qdf_status = hdd_roam_register_sta(pAdapter, |
| 2897 | pRoamInfo, |
| 2898 | pHddStaCtx->conn_info.staId[0], |
| 2899 | NULL, pRoamInfo->pBssDesc); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2900 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2901 | wlan_hdd_netif_queue_control(pAdapter, |
| 2902 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2903 | WLAN_CONTROL_PATH); |
| 2904 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2905 | } |
| 2906 | } else { |
| 2907 | /* |
| 2908 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 2909 | * in case of reassociation also need to indicate it to |
| 2910 | * supplicant. |
| 2911 | */ |
| 2912 | csr_roam_get_wpa_rsn_req_ie( |
| 2913 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2914 | pAdapter->sessionId, |
| 2915 | &reqRsnLength, reqRsnIe); |
| 2916 | |
| 2917 | hdd_send_re_assoc_event(dev, pAdapter, pRoamInfo, |
| 2918 | reqRsnIe, reqRsnLength); |
| 2919 | /* Reassoc successfully */ |
| 2920 | if (pRoamInfo->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2921 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2922 | hdd_change_peer_state(pAdapter, |
| 2923 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2924 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2925 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2926 | pRoamInfo->roamSynchInProgress |
| 2927 | #else |
| 2928 | false |
| 2929 | #endif |
| 2930 | ); |
| 2931 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2932 | hdd_objmgr_set_peer_mlme_auth_state( |
| 2933 | pAdapter->hdd_vdev, |
| 2934 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2935 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2936 | hdd_debug("staId: %d Changing TL state to AUTHENTICATED", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2937 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2938 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2939 | hdd_change_peer_state(pAdapter, |
| 2940 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2941 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2942 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2943 | pRoamInfo->roamSynchInProgress |
| 2944 | #else |
| 2945 | false |
| 2946 | #endif |
| 2947 | ); |
| 2948 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2949 | hdd_objmgr_set_peer_mlme_auth_state( |
| 2950 | pAdapter->hdd_vdev, |
| 2951 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2952 | } |
| 2953 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2954 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | /* |
| 2956 | * Perform any WMM-related association |
| 2957 | * processing |
| 2958 | */ |
| 2959 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2960 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2961 | } |
| 2962 | |
| 2963 | /* Start the tx queues */ |
| 2964 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2965 | if (pRoamInfo->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2966 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2967 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2968 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2969 | wlan_hdd_netif_queue_control(pAdapter, |
| 2970 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2971 | WLAN_CONTROL_PATH); |
| 2972 | } |
| 2973 | |
Padma, Santhosh Kumar | 724f63d | 2016-08-09 16:04:31 +0530 | [diff] [blame] | 2974 | #ifdef FEATURE_WLAN_TDLS |
| 2975 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 2976 | #endif |
| 2977 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2978 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2979 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2980 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2981 | } |
| 2982 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2983 | qdf_mem_zero(&pAdapter->hdd_stats.hddPmfStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2984 | sizeof(pAdapter->hdd_stats.hddPmfStats)); |
| 2985 | #endif |
| 2986 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2987 | bool connect_timeout = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2988 | hdd_wext_state_t *pWextState = |
| 2989 | WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2990 | if (pRoamInfo) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2991 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2992 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2993 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 2994 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2995 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2996 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2997 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2998 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 2999 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3000 | |
| 3001 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 3002 | (pRoamInfo && |
| 3003 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
| 3004 | pRoamInfo->statusCode) || |
| 3005 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
| 3006 | pRoamInfo->statusCode) || |
| 3007 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
| 3008 | pRoamInfo->statusCode)))) { |
| 3009 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 3010 | pRoamInfo ? |
| 3011 | pRoamInfo->bssid.bytes : |
| 3012 | pWextState->req_bssId.bytes); |
| 3013 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 3014 | pRoamInfo ? |
| 3015 | pRoamInfo->bssid.bytes : |
| 3016 | pWextState->req_bssId.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3017 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3018 | } |
| 3019 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3020 | /* |
| 3021 | * CR465478: Only send up a connection failure result when CSR |
| 3022 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3023 | */ |
| 3024 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 3025 | && !hddDisconInProgress) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3026 | if (pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3027 | hdd_err("send connect failure to nl80211: for bssid " |
| 3028 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3029 | " result: %d and Status: %d reasoncode: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3030 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3031 | roamResult, roamStatus, |
| 3032 | pRoamInfo->reasonCode); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3033 | pHddStaCtx->conn_info.assoc_status_code = |
| 3034 | pRoamInfo->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3035 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3036 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3037 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3038 | " result: %d and status: %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3039 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3040 | roamResult, roamStatus); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3041 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3042 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3043 | wlan_deregister_txrx_packetdump(); |
| 3044 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3045 | /* inform association failure event to nl80211 */ |
| 3046 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 3047 | roamResult) { |
| 3048 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3049 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3050 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3051 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3052 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3053 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3054 | connect_timeout, |
| 3055 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3056 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3057 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3058 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3059 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3060 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3061 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3062 | connect_timeout, |
| 3063 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3064 | } else { |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3065 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3066 | hdd_connect_result(dev, |
| 3067 | pRoamInfo->bssid.bytes, |
| 3068 | NULL, NULL, 0, NULL, 0, |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3069 | pRoamInfo->reasonCode ? |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3070 | pRoamInfo->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3071 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3072 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3073 | connect_timeout, |
| 3074 | pRoamInfo->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3075 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3076 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3077 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3078 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3079 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3080 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3081 | connect_timeout, |
| 3082 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3083 | } |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3084 | hdd_clear_roam_profile_ie(pAdapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3085 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 3086 | && !hddDisconInProgress)) { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3087 | hdd_connect_result(dev, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3088 | pWextState->req_bssId.bytes, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3089 | NULL, NULL, 0, NULL, 0, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3090 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3091 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3092 | connect_timeout, |
| 3093 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3094 | } |
| 3095 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3096 | /* |
| 3097 | * Set connection state to eConnectionState_NotConnected only |
| 3098 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3099 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3100 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3101 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 3102 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3103 | && !hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3104 | hdd_conn_set_connection_state(pAdapter, |
| 3105 | eConnectionState_NotConnected); |
| 3106 | } |
| 3107 | hdd_wmm_init(pAdapter); |
| 3108 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3109 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3110 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3111 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3112 | WLAN_CONTROL_PATH); |
| 3113 | } |
| 3114 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3115 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3116 | } |
| 3117 | |
| 3118 | /** |
| 3119 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
| 3120 | * @pAdapter: pointer to adapter |
| 3121 | * @pRoamInfo: pointer to roam info |
| 3122 | * @roamId: roam id |
| 3123 | * @roamStatus: roam status |
| 3124 | * @roamResult: roam result |
| 3125 | * |
| 3126 | * Here we update the status of the Ibss when we receive information that we |
| 3127 | * have started/joined an ibss session. |
| 3128 | * |
| 3129 | * Return: none |
| 3130 | */ |
| 3131 | static void hdd_roam_ibss_indication_handler(hdd_adapter_t *pAdapter, |
| 3132 | tCsrRoamInfo *pRoamInfo, |
| 3133 | uint32_t roamId, |
| 3134 | eRoamCmdStatus roamStatus, |
| 3135 | eCsrRoamResult roamResult) |
| 3136 | { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3137 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3138 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3139 | hdd_debug("%s: id %d, status %d, result %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3140 | pAdapter->dev->name, roamId, |
| 3141 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3142 | |
| 3143 | switch (roamResult) { |
| 3144 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3145 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3146 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3147 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3148 | { |
| 3149 | hdd_context_t *pHddCtx = |
| 3150 | (hdd_context_t *) pAdapter->pHddCtx; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3151 | hdd_station_ctx_t *hdd_sta_ctx = |
| 3152 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3153 | struct qdf_mac_addr broadcastMacAddr = |
| 3154 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3155 | |
| 3156 | if (NULL == pRoamInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3157 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3158 | return; |
| 3159 | } |
| 3160 | |
| 3161 | /* When IBSS Started comes from CSR, we need to move |
| 3162 | * connection state to IBSS Disconnected (meaning no peers |
| 3163 | * are in the IBSS). |
| 3164 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3165 | hdd_conn_set_connection_state(pAdapter, |
| 3166 | eConnectionState_IbssDisconnected); |
| 3167 | /* notify wmm */ |
| 3168 | hdd_wmm_connect(pAdapter, pRoamInfo, |
| 3169 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3170 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 3171 | hdd_sta_ctx->broadcast_staid = pRoamInfo->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3172 | |
| 3173 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3174 | pAdapter; |
| 3175 | hdd_roam_register_sta(pAdapter, pRoamInfo, |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3176 | pRoamInfo->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3177 | &broadcastMacAddr, |
| 3178 | pRoamInfo->pBssDesc); |
| 3179 | |
| 3180 | if (pRoamInfo->pBssDesc) { |
| 3181 | struct cfg80211_bss *bss; |
| 3182 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3183 | struct ieee80211_channel *chan; |
| 3184 | int chan_no; |
| 3185 | unsigned int freq; |
| 3186 | #endif |
| 3187 | /* we created the IBSS, notify supplicant */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3188 | hdd_info("%s: created ibss " MAC_ADDRESS_STR, |
| 3189 | pAdapter->dev->name, |
| 3190 | MAC_ADDR_ARRAY( |
| 3191 | pRoamInfo->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3192 | |
| 3193 | /* we must first give cfg80211 the BSS information */ |
| 3194 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 3195 | pRoamInfo); |
| 3196 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3197 | hdd_err("%s: unable to create IBSS entry", |
| 3198 | pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3199 | return; |
| 3200 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3201 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3202 | wlan_hdd_netif_queue_control(pAdapter, |
| 3203 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3204 | WLAN_CONTROL_PATH); |
| 3205 | |
| 3206 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3207 | chan_no = pRoamInfo->pBssDesc->channelId; |
| 3208 | |
| 3209 | if (chan_no <= 14) |
| 3210 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3211 | HDD_NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3212 | else |
| 3213 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3214 | HDD_NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3215 | |
| 3216 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3217 | |
| 3218 | if (chan) |
| 3219 | cfg80211_ibss_joined(pAdapter->dev, |
| 3220 | bss->bssid, chan, |
| 3221 | GFP_KERNEL); |
| 3222 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3223 | hdd_warn("%s: chanId: %d, can't find channel", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3224 | pAdapter->dev->name, |
| 3225 | (int)pRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3226 | #else |
| 3227 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3228 | GFP_KERNEL); |
| 3229 | #endif |
| 3230 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3232 | bss); |
| 3233 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3234 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3235 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
| 3236 | pAdapter->device_mode, pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3237 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3238 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3239 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
| 3240 | pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3241 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3242 | break; |
| 3243 | } |
| 3244 | |
| 3245 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3246 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3247 | hdd_err("%s: unable to create IBSS", pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3248 | break; |
| 3249 | } |
| 3250 | |
| 3251 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3252 | hdd_err("%s: unexpected result %d", |
| 3253 | pAdapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3254 | break; |
| 3255 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3256 | } |
| 3257 | |
| 3258 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3259 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3260 | * @sta_ctx: pointer to hdd station context |
| 3261 | * @sta_id: station ID |
| 3262 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3263 | * |
| 3264 | * This information is passed to iwconfig later. The peer that joined |
| 3265 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3266 | |
| 3267 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3269 | bool hdd_save_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id, |
| 3270 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3271 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3272 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3273 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3274 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
| 3275 | if (0 == sta_ctx->conn_info.staId[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3276 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3277 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3278 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3279 | qdf_copy_macaddr( |
| 3280 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3281 | peer_mac_addr); |
| 3282 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | } |
| 3284 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3285 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3286 | } |
| 3287 | |
| 3288 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3289 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3290 | * @sta_ctx: pointer to hdd station context |
| 3291 | * @sta_id: station ID |
| 3292 | * |
| 3293 | * Return: None |
| 3294 | */ |
| 3295 | void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id) |
| 3296 | { |
| 3297 | int i; |
| 3298 | |
| 3299 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3300 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
| 3301 | sta_ctx->conn_info.staId[i] = 0; |
| 3302 | return; |
| 3303 | } |
| 3304 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3305 | } |
| 3306 | |
| 3307 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | * roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter |
| 3309 | * @pAdapter: pointer to adapter |
| 3310 | * @staId: station id |
| 3311 | * |
| 3312 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3313 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3314 | * false otherwise. |
| 3315 | */ |
| 3316 | static bool roam_remove_ibss_station(hdd_adapter_t *pAdapter, uint8_t staId) |
| 3317 | { |
| 3318 | bool fSuccess = false; |
| 3319 | int idx = 0; |
| 3320 | uint8_t valid_idx = 0; |
| 3321 | uint8_t del_idx = 0; |
| 3322 | uint8_t empty_slots = 0; |
| 3323 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3324 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3325 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3326 | if (staId == pHddStaCtx->conn_info.staId[idx]) { |
| 3327 | pHddStaCtx->conn_info.staId[idx] = 0; |
| 3328 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3329 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3330 | peerMacAddress[idx]); |
| 3331 | |
| 3332 | fSuccess = true; |
| 3333 | |
| 3334 | /* |
| 3335 | * Note the deleted Index, if its 0 we need special |
| 3336 | * handling. |
| 3337 | */ |
| 3338 | del_idx = idx; |
| 3339 | |
| 3340 | empty_slots++; |
| 3341 | } else { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3342 | if (pHddStaCtx->conn_info.staId[idx] != |
| 3343 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3344 | valid_idx = idx; |
| 3345 | } else { |
| 3346 | /* Found an empty slot */ |
| 3347 | empty_slots++; |
| 3348 | } |
| 3349 | } |
| 3350 | } |
| 3351 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3352 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3353 | /* Last peer departed, set the IBSS state appropriately */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 3354 | hdd_conn_set_connection_state(pAdapter, |
| 3355 | eConnectionState_IbssDisconnected); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3356 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3357 | } |
| 3358 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3359 | if (fSuccess == true) { |
| 3360 | if (del_idx == 0) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3361 | if (pHddStaCtx->conn_info.staId[valid_idx] != |
| 3362 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3363 | pHddStaCtx->conn_info.staId[0] = |
| 3364 | pHddStaCtx->conn_info.staId[valid_idx]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3365 | qdf_copy_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3366 | peerMacAddress[0], |
| 3367 | &pHddStaCtx->conn_info. |
| 3368 | peerMacAddress[valid_idx]); |
| 3369 | |
| 3370 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3371 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3372 | peerMacAddress[valid_idx]); |
| 3373 | } |
| 3374 | } |
| 3375 | } |
| 3376 | return fSuccess; |
| 3377 | } |
| 3378 | |
| 3379 | /** |
| 3380 | * roam_ibss_connect_handler() - IBSS connection handler |
| 3381 | * @pAdapter: pointer to adapter |
| 3382 | * @pRoamInfo: pointer to roam info |
| 3383 | * |
| 3384 | * We update the status of the IBSS to connected in this function. |
| 3385 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3386 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3387 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3388 | static QDF_STATUS roam_ibss_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3389 | tCsrRoamInfo *pRoamInfo) |
| 3390 | { |
| 3391 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3392 | /* |
| 3393 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3394 | * a partner stations). |
| 3395 | */ |
| 3396 | hdd_conn_set_connection_state(pAdapter, eConnectionState_IbssConnected); |
| 3397 | |
| 3398 | /* Save the connection info from CSR... */ |
| 3399 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
| 3400 | |
| 3401 | /* Send the bssid address to the wext. */ |
| 3402 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3403 | /* add bss_id to cfg80211 data base */ |
| 3404 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3405 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3406 | hdd_err("%s: unable to create IBSS entry", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3407 | pAdapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3408 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3409 | } |
| 3410 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3411 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3412 | bss); |
| 3413 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3414 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3415 | } |
| 3416 | |
| 3417 | /** |
| 3418 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
| 3419 | * @pAdapter: pointer to adapter |
| 3420 | * @pRoamInfo: pointer to roam info |
| 3421 | * @roamId: roam id |
| 3422 | * @roamStatus: roam status |
| 3423 | * @roamResult: roam result |
| 3424 | * |
| 3425 | * This function indicates the Mic failure to the supplicant |
| 3426 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3427 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3428 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3429 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3430 | hdd_roam_mic_error_indication_handler(hdd_adapter_t *pAdapter, |
| 3431 | tCsrRoamInfo *pRoamInfo, |
| 3432 | uint32_t roamId, |
| 3433 | eRoamCmdStatus roamStatus, |
| 3434 | eCsrRoamResult roamResult) |
| 3435 | { |
| 3436 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3437 | |
| 3438 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3439 | TKIP_COUNTER_MEASURE_STOPED == |
| 3440 | pHddStaCtx->WextState.mTKIPCounterMeasures) { |
| 3441 | struct iw_michaelmicfailure msg; |
| 3442 | union iwreq_data wreq; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3443 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3444 | memset(&msg, '\0', sizeof(msg)); |
| 3445 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3446 | memcpy(msg.src_addr.sa_data, |
| 3447 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3448 | sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3449 | hdd_debug("MIC MAC " MAC_ADDRESS_STR, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3450 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3451 | |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 3452 | if (pRoamInfo->u.pMICFailureInfo->multicast == true) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3453 | msg.flags = IW_MICFAILURE_GROUP; |
| 3454 | else |
| 3455 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3456 | memset(&wreq, 0, sizeof(wreq)); |
| 3457 | wreq.data.length = sizeof(msg); |
| 3458 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, |
| 3459 | (char *)&msg); |
| 3460 | /* inform mic failure to nl80211 */ |
| 3461 | cfg80211_michael_mic_failure(pAdapter->dev, |
| 3462 | pRoamInfo->u.pMICFailureInfo-> |
| 3463 | taMacAddr, |
| 3464 | ((pRoamInfo->u.pMICFailureInfo-> |
| 3465 | multicast == |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 3466 | true) ? |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3467 | NL80211_KEYTYPE_GROUP : |
| 3468 | NL80211_KEYTYPE_PAIRWISE), |
| 3469 | pRoamInfo->u.pMICFailureInfo-> |
| 3470 | keyId, |
| 3471 | pRoamInfo->u.pMICFailureInfo->TSC, |
| 3472 | GFP_KERNEL); |
| 3473 | |
| 3474 | } |
| 3475 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3476 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3477 | } |
| 3478 | |
| 3479 | /** |
| 3480 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
| 3481 | * @pAdapter: pointer to adapter |
| 3482 | * @pRoamInfo: pointer to roam info |
| 3483 | * @roamId: roam id |
| 3484 | * @roamStatus: roam status |
| 3485 | * @roamResult: roam result |
| 3486 | * |
| 3487 | * The Ibss connection status is updated regularly here in this function. |
| 3488 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3489 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3490 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3491 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3492 | roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter, |
| 3493 | tCsrRoamInfo *pRoamInfo, |
| 3494 | uint32_t roamId, |
| 3495 | eRoamCmdStatus roamStatus, |
| 3496 | eCsrRoamResult roamResult) |
| 3497 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3498 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3499 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3500 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3501 | switch (roamResult) { |
| 3502 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3503 | { |
| 3504 | hdd_station_ctx_t *pHddStaCtx = |
| 3505 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3506 | struct station_info *stainfo; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3507 | eCsrEncryptionType encr_type = pHddStaCtx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3509 | hdd_info("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3510 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3511 | MAC_ADDRESS_STR " and stationID= %d", |
| 3512 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3513 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3514 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3515 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3516 | if (!hdd_save_peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3517 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 3518 | pRoamInfo->staId, |
| 3519 | &pRoamInfo->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3520 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3521 | break; |
| 3522 | } |
| 3523 | |
| 3524 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3525 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3526 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 3527 | pRoamInfo->fAuthRequired = true; |
| 3528 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3529 | /* Register the Station with TL for the new peer. */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3530 | qdf_status = hdd_roam_register_sta(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3531 | pRoamInfo, |
| 3532 | pRoamInfo->staId, |
| 3533 | &pRoamInfo->peerMac, |
| 3534 | pRoamInfo->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3535 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3536 | 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] | 3537 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3538 | } |
| 3539 | pHddStaCtx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3540 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3541 | if (stainfo == NULL) { |
| 3542 | hdd_err("memory allocation for station_info failed"); |
| 3543 | return QDF_STATUS_E_NOMEM; |
| 3544 | } |
| 3545 | stainfo->filled = 0; |
| 3546 | stainfo->generation = pHddStaCtx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3547 | |
| 3548 | cfg80211_new_sta(pAdapter->dev, |
| 3549 | (const u8 *)pRoamInfo->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3550 | stainfo, GFP_KERNEL); |
| 3551 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3552 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3553 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3554 | pHddStaCtx->ibss_enc_key.keyDirection = |
| 3555 | eSIR_TX_RX; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3556 | qdf_copy_macaddr(&pHddStaCtx->ibss_enc_key.peerMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3557 | &pRoamInfo->peerMac); |
| 3558 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3559 | hdd_info("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3560 | encr_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3561 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3562 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3563 | sme_roam_set_key(WLAN_HDD_GET_HAL_CTX |
| 3564 | (pAdapter), |
| 3565 | pAdapter->sessionId, |
| 3566 | &pHddStaCtx->ibss_enc_key, |
| 3567 | &roamId); |
| 3568 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3569 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3570 | hdd_err("sme_roam_set_key failed, status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3571 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3572 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3573 | } |
| 3574 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3575 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3576 | wlan_hdd_netif_queue_control(pAdapter, |
| 3577 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3578 | WLAN_CONTROL_PATH); |
| 3579 | break; |
| 3580 | } |
| 3581 | |
| 3582 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3583 | { |
| 3584 | |
| 3585 | roam_ibss_connect_handler(pAdapter, pRoamInfo); |
| 3586 | |
| 3587 | break; |
| 3588 | } |
| 3589 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3590 | { |
| 3591 | hdd_station_ctx_t *pHddStaCtx = |
| 3592 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3593 | |
| 3594 | if (!roam_remove_ibss_station(pAdapter, pRoamInfo->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3595 | 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] | 3596 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3597 | hdd_info("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3598 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3599 | MAC_ADDRESS_STR " and stationID= %d", |
| 3600 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3601 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3602 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3603 | |
| 3604 | hdd_roam_deregister_sta(pAdapter, pRoamInfo->staId); |
| 3605 | |
| 3606 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 3607 | pHddStaCtx->ibss_sta_generation++; |
| 3608 | |
| 3609 | cfg80211_del_sta(pAdapter->dev, |
| 3610 | (const u8 *)&pRoamInfo->peerMac.bytes, |
| 3611 | GFP_KERNEL); |
| 3612 | break; |
| 3613 | } |
| 3614 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3615 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3616 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3617 | /* Stop only when we are inactive */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3618 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3619 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3620 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3621 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3622 | hdd_conn_set_connection_state(pAdapter, |
| 3623 | eConnectionState_NotConnected); |
| 3624 | |
| 3625 | /* Send the bssid address to the wext. */ |
| 3626 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3627 | break; |
| 3628 | } |
| 3629 | default: |
| 3630 | break; |
| 3631 | |
| 3632 | } |
| 3633 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3634 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3635 | } |
| 3636 | |
| 3637 | #ifdef FEATURE_WLAN_TDLS |
| 3638 | /** |
| 3639 | * hdd_roam_register_tdlssta() - register new TDLS station |
| 3640 | * @pAdapter: pointer to adapter |
| 3641 | * @peerMac: pointer to peer MAC address |
| 3642 | * @staId: station identifier |
| 3643 | * @ucastSig: unicast signature |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3644 | * @qos: QOS capability of TDLS station/link |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3645 | * |
| 3646 | * Construct the staDesc and register with TL the new STA. |
| 3647 | * This is called as part of ADD_STA in the TDLS setup. |
| 3648 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3649 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3651 | QDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3652 | const uint8_t *peerMac, uint16_t staId, |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3653 | uint8_t ucastSig, uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3654 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3655 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3656 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3657 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3658 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3659 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3660 | |
| 3661 | /* |
| 3662 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3663 | * be peer MAC, here we are working on direct Link |
| 3664 | */ |
| 3665 | staDesc.sta_id = staId; |
| 3666 | |
| 3667 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3668 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3669 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3670 | /* Register the vdev transmit and receive functions */ |
| 3671 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3672 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3673 | cdp_vdev_register(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3674 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
| 3675 | (struct cdp_pdev *)pdev, pAdapter->sessionId), |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3676 | pAdapter, &txrx_ops); |
| 3677 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3678 | |
| 3679 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3680 | qdf_status = cdp_peer_register(soc, |
| 3681 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3682 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3683 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3684 | qdf_status, qdf_status); |
| 3685 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3686 | } |
| 3687 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3688 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3689 | } |
| 3690 | |
| 3691 | /** |
| 3692 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
| 3693 | * @pAdapter: pointer to adapter |
| 3694 | * @staId: station identifier |
| 3695 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3696 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3697 | */ |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3698 | 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] | 3699 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3700 | QDF_STATUS qdf_status; |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 3701 | 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] | 3702 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 3703 | staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3704 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3705 | 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] | 3706 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3707 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3708 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3709 | } |
| 3710 | |
| 3711 | /** |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3712 | * hdd_tdls_connection_tracker_update() - update connection tracker state |
| 3713 | * @adapter: pointer to adapter |
| 3714 | * @roam_info: pointer to roam info |
| 3715 | * @hdd_tdls_ctx: tdls context |
| 3716 | * |
| 3717 | * Return: QDF_STATUS enumeration |
| 3718 | */ |
| 3719 | static QDF_STATUS hdd_tdls_connection_tracker_update(hdd_adapter_t *adapter, |
| 3720 | tCsrRoamInfo *roam_info, |
| 3721 | tdlsCtx_t *hdd_tdls_ctx) |
| 3722 | { |
| 3723 | hddTdlsPeer_t *curr_peer; |
| 3724 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3725 | |
| 3726 | curr_peer = wlan_hdd_tdls_find_peer(adapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3727 | roam_info->peerMac.bytes); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3728 | |
| 3729 | if (!curr_peer) { |
| 3730 | hdd_err("curr_peer is null"); |
| 3731 | return QDF_STATUS_E_FAILURE; |
| 3732 | } |
| 3733 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3734 | if (eTDLS_LINK_CONNECTED == |
| 3735 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3736 | hdd_debug("Received CONNECTION_TRACKER_NOTIFICATION " |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3737 | MAC_ADDRESS_STR |
| 3738 | " staId: %d, reason: %d", |
| 3739 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3740 | roam_info->staId, |
| 3741 | roam_info->reasonCode); |
| 3742 | |
| 3743 | if (roam_info->reasonCode == |
| 3744 | eWNI_TDLS_PEER_ENTER_BUF_STA || |
| 3745 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3746 | eWNI_TDLS_ENTER_BT_BUSY_MODE || |
| 3747 | roam_info->reasonCode == |
| 3748 | eWMI_TDLS_SCAN_STARTED_EVENT) |
| 3749 | hdd_ctx->enable_tdls_connection_tracker = false; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3750 | else if (roam_info->reasonCode == |
| 3751 | eWNI_TDLS_PEER_EXIT_BUF_STA || |
| 3752 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3753 | eWNI_TDLS_EXIT_BT_BUSY_MODE || |
| 3754 | roam_info->reasonCode == |
| 3755 | eWMI_TDLS_SCAN_COMPLETED_EVENT) |
| 3756 | hdd_ctx->enable_tdls_connection_tracker = true; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3757 | hdd_debug("hdd_ctx->enable_tdls_connection_tracker %d", |
Nitesh Shah | c549dd5 | 2017-02-23 16:45:44 +0530 | [diff] [blame] | 3758 | hdd_ctx->enable_tdls_connection_tracker); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3759 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3760 | hdd_debug("TDLS not connected, ignore notification, reason: %d", |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3761 | roam_info->reasonCode); |
| 3762 | } |
| 3763 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3764 | return QDF_STATUS_SUCCESS; |
| 3765 | } |
| 3766 | |
| 3767 | |
| 3768 | |
| 3769 | |
| 3770 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3771 | * hdd_roam_tdls_status_update_handler() - TDLS status update handler |
| 3772 | * @pAdapter: pointer to adapter |
| 3773 | * @pRoamInfo: pointer to roam info |
| 3774 | * @roamId: roam id |
| 3775 | * @roamStatus: roam status |
| 3776 | * @roamResult: roam result |
| 3777 | * |
| 3778 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3779 | * TL in case of new TDLS client is added and deregistration at the time |
| 3780 | * TDLS client is deleted. |
| 3781 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3782 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3783 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3784 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3785 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 3786 | tCsrRoamInfo *pRoamInfo, |
| 3787 | uint32_t roamId, |
| 3788 | eRoamCmdStatus roamStatus, |
| 3789 | eCsrRoamResult roamResult) |
| 3790 | { |
| 3791 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3792 | tdlsCtx_t *pHddTdlsCtx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3793 | tSmeTdlsPeerStateParams smeTdlsPeerStateParams; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3794 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3795 | uint8_t staIdx; |
| 3796 | hddTdlsPeer_t *curr_peer; |
| 3797 | uint32_t reason; |
| 3798 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3799 | hdd_debug("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | roamResult == |
| 3801 | eCSR_ROAM_RESULT_ADD_TDLS_PEER ? "ADD_TDLS_PEER" : roamResult |
| 3802 | == |
| 3803 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? "DEL_TDLS_PEER" : |
| 3804 | roamResult == |
| 3805 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? "DEL_TDLS_PEER_IND" |
| 3806 | : roamResult == |
| 3807 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3808 | "DEL_ALL_TDLS_PEER_IND" : roamResult == |
| 3809 | eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? "UPDATE_TDLS_PEER" : |
| 3810 | roamResult == |
| 3811 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
| 3812 | "LINK_ESTABLISH_REQ_RSP" : roamResult == |
| 3813 | eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER ? "TDLS_SHOULD_DISCOVER" |
| 3814 | : roamResult == |
| 3815 | eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN ? "TDLS_SHOULD_TEARDOWN" |
| 3816 | : roamResult == |
| 3817 | eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED ? |
| 3818 | "TDLS_SHOULD_PEER_DISCONNECTED" : "UNKNOWN", pRoamInfo->staId, |
| 3819 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 3820 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3821 | switch (roamResult) { |
| 3822 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3823 | { |
| 3824 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3825 | hdd_err("Add Sta failed. status code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3826 | pRoamInfo->statusCode); |
Selvaraj, Sridhar | 5d95e63 | 2016-09-14 17:00:38 +0530 | [diff] [blame] | 3827 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3828 | } else { |
| 3829 | /* |
| 3830 | * Check if there is available index for this new TDLS |
| 3831 | * STA. |
| 3832 | */ |
| 3833 | for (staIdx = 0; |
| 3834 | staIdx < pHddCtx->max_num_tdls_sta; |
| 3835 | staIdx++) { |
| 3836 | if (0 == |
| 3837 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3838 | staId) { |
| 3839 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3840 | sessionId = |
| 3841 | pRoamInfo->sessionId; |
| 3842 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3843 | staId = pRoamInfo->staId; |
| 3844 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3845 | hdd_debug("TDLS: STA IDX at %d is %d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3846 | "of mac " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3847 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | staIdx, |
| 3849 | pHddCtx-> |
| 3850 | tdlsConnInfo[staIdx]. |
| 3851 | staId, |
| 3852 | MAC_ADDR_ARRAY |
| 3853 | (pRoamInfo->peerMac.bytes)); |
| 3854 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3855 | qdf_copy_macaddr(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | tdlsConnInfo |
| 3857 | [staIdx]. |
| 3858 | peerMac, |
| 3859 | &pRoamInfo-> |
| 3860 | peerMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3861 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3862 | break; |
| 3863 | } |
| 3864 | } |
| 3865 | if (staIdx < pHddCtx->max_num_tdls_sta) { |
| 3866 | if (-1 == |
| 3867 | wlan_hdd_tdls_set_sta_id(pAdapter, |
| 3868 | pRoamInfo-> |
| 3869 | peerMac.bytes, |
| 3870 | pRoamInfo-> |
| 3871 | staId)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3872 | hdd_err("wlan_hdd_tdls_set_sta_id() failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3873 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3874 | } |
| 3875 | |
| 3876 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 3877 | sta_to_adapter[pRoamInfo->staId] = |
| 3878 | pAdapter; |
| 3879 | /* |
| 3880 | * store the ucast signature, |
| 3881 | * if required for further reference. |
| 3882 | */ |
| 3883 | |
| 3884 | wlan_hdd_tdls_set_signature(pAdapter, |
| 3885 | pRoamInfo-> |
| 3886 | peerMac.bytes, |
| 3887 | pRoamInfo-> |
| 3888 | ucastSig); |
| 3889 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3890 | status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3891 | 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] | 3892 | pRoamInfo->staId); |
| 3893 | } |
| 3894 | pAdapter->tdlsAddStaStatus = status; |
| 3895 | } |
| 3896 | complete(&pAdapter->tdls_add_station_comp); |
| 3897 | break; |
| 3898 | } |
| 3899 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3900 | { |
| 3901 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3902 | hdd_err("Add Sta failed. status code: %d", |
Varun Reddy Yeturu | ed1215e | 2017-07-07 16:40:28 -0700 | [diff] [blame] | 3903 | pRoamInfo->statusCode); |
| 3904 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
| 3905 | } else { |
| 3906 | pAdapter->tdlsAddStaStatus = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3907 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3908 | complete(&pAdapter->tdls_add_station_comp); |
| 3909 | break; |
| 3910 | } |
| 3911 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3912 | { |
| 3913 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3914 | hdd_err("Link Establish Request failed. status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3915 | pRoamInfo->statusCode); |
| 3916 | } |
| 3917 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3918 | break; |
| 3919 | } |
| 3920 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
| 3921 | { |
| 3922 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 3923 | staIdx++) { |
| 3924 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 3925 | pRoamInfo->sessionId) |
| 3926 | && pRoamInfo->staId == |
| 3927 | pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3928 | hdd_debug("HDD: del STA IDX = %x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3929 | pRoamInfo->staId); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3930 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3931 | curr_peer = |
| 3932 | wlan_hdd_tdls_find_peer(pAdapter, |
| 3933 | pRoamInfo-> |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3934 | peerMac.bytes); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3935 | if (NULL != curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3936 | hdd_debug("Current status for peer " MAC_ADDRESS_STR " is %d", |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3937 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3938 | curr_peer->link_status); |
| 3939 | if (TDLS_IS_CONNECTED(curr_peer)) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3940 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3941 | hdd_roam_deregister_tdlssta |
| 3942 | (pAdapter, |
| 3943 | pRoamInfo->staId); |
| 3944 | wlan_hdd_tdls_decrement_peer_count |
| 3945 | (pAdapter); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3946 | } else if (eTDLS_LINK_CONNECTING == |
| 3947 | curr_peer->link_status) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3948 | mutex_unlock(&pHddCtx->tdls_lock); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3949 | hdd_roam_deregister_tdlssta |
| 3950 | (pAdapter, |
| 3951 | pRoamInfo->staId); |
Nitesh Shah | 0bf768f | 2017-03-31 15:01:37 +0530 | [diff] [blame] | 3952 | } else |
| 3953 | mutex_unlock(&pHddCtx->tdls_lock); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3954 | } else |
| 3955 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3956 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3957 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3958 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 3959 | pRoamInfo-> |
| 3960 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3961 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3962 | |
| 3963 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 3964 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3965 | sessionId = 255; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3966 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3967 | tdlsConnInfo[staIdx]. |
| 3968 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3969 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3970 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3971 | break; |
| 3972 | } |
| 3973 | } |
| 3974 | complete(&pAdapter->tdls_del_station_comp); |
| 3975 | } |
| 3976 | break; |
| 3977 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 3978 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3979 | hdd_debug("Sending teardown to supplicant with reason code %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3980 | pRoamInfo->reasonCode); |
| 3981 | |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3982 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3983 | curr_peer = |
| 3984 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3985 | pRoamInfo->peerMac.bytes); |
Ganesh Kondabattini | 9c8dc46 | 2017-04-19 10:52:54 +0530 | [diff] [blame] | 3986 | |
| 3987 | if (!curr_peer) { |
| 3988 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3989 | hdd_debug("peer doesn't exists"); |
| 3990 | status = QDF_STATUS_SUCCESS; |
| 3991 | break; |
| 3992 | } |
| 3993 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3994 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 3995 | pRoamInfo->reasonCode); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 3996 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3997 | curr_peer->peerMac); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3998 | mutex_unlock(&pHddCtx->tdls_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3999 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4000 | break; |
| 4001 | } |
| 4002 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 4003 | { |
| 4004 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
| 4005 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 4006 | staIdx++) { |
| 4007 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 4008 | pRoamInfo->sessionId) |
| 4009 | && pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4010 | hdd_debug("hdd_tdlsStatusUpdate: staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4011 | MAC_ADDRESS_STR, |
| 4012 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4013 | staId, |
| 4014 | MAC_ADDR_ARRAY(pHddCtx-> |
| 4015 | tdlsConnInfo |
| 4016 | [staIdx]. |
| 4017 | peerMac. |
| 4018 | bytes)); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4019 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4020 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4021 | pHddCtx-> |
| 4022 | tdlsConnInfo |
| 4023 | [staIdx]. |
| 4024 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4025 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4026 | hdd_roam_deregister_tdlssta(pAdapter, |
| 4027 | pHddCtx-> |
| 4028 | tdlsConnInfo |
| 4029 | [staIdx]. |
| 4030 | staId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4031 | qdf_mem_zero(&smeTdlsPeerStateParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4032 | sizeof |
| 4033 | (smeTdlsPeerStateParams)); |
| 4034 | smeTdlsPeerStateParams.vdevId = |
| 4035 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4036 | sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4037 | qdf_mem_copy(&smeTdlsPeerStateParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4038 | peerMacAddr, |
| 4039 | &pHddCtx-> |
| 4040 | tdlsConnInfo[staIdx]. |
| 4041 | peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4042 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4043 | smeTdlsPeerStateParams.peerState = |
| 4044 | eSME_TDLS_PEER_STATE_TEARDOWN; |
| 4045 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4046 | hdd_debug("calling sme_update_tdls_peer_state for staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4047 | MAC_ADDRESS_STR, |
| 4048 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4049 | staId, |
| 4050 | MAC_ADDR_ARRAY(pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4051 | tdlsConnInfo |
| 4052 | [staIdx]. |
| 4053 | peerMac. |
| 4054 | bytes)); |
| 4055 | status = |
| 4056 | sme_update_tdls_peer_state( |
| 4057 | pHddCtx->hHal, |
| 4058 | &smeTdlsPeerStateParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4059 | if (QDF_STATUS_SUCCESS != status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4060 | hdd_err("sme_update_tdls_peer_state failed for " |
| 4061 | MAC_ADDRESS_STR, |
| 4062 | MAC_ADDR_ARRAY |
| 4063 | (pHddCtx-> |
| 4064 | tdlsConnInfo[staIdx]. |
| 4065 | peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4066 | } |
| 4067 | wlan_hdd_tdls_decrement_peer_count |
| 4068 | (pAdapter); |
| 4069 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4070 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4071 | tdlsConnInfo[staIdx]. |
| 4072 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4073 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4074 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4075 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4076 | sessionId = 255; |
| 4077 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4078 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4079 | } |
| 4080 | } |
| 4081 | break; |
| 4082 | } |
| 4083 | case eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER: |
| 4084 | { |
| 4085 | /* ignore TDLS_SHOULD_DISCOVER if any concurrency detected */ |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 4086 | if (!cds_check_is_tdls_allowed(pAdapter->device_mode)) { |
| 4087 | hdd_err("TDLS not allowed, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4088 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4089 | break; |
| 4090 | } |
| 4091 | |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4092 | if (pHddCtx->tdls_nss_switch_in_progress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4093 | hdd_debug("TDLS antenna switch is in progress, ignore SHOULD_DISCOVER"); |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4094 | status = QDF_STATUS_SUCCESS; |
| 4095 | break; |
| 4096 | } |
| 4097 | |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4098 | mutex_lock(&pHddCtx->tdls_lock); |
| 4099 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4100 | if (!pHddTdlsCtx) { |
| 4101 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4102 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4103 | roamResult); |
| 4104 | status = QDF_STATUS_E_FAILURE; |
| 4105 | break; |
| 4106 | } |
| 4107 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4108 | curr_peer = |
| 4109 | wlan_hdd_tdls_get_peer(pAdapter, |
Nitesh Shah | 379449e | 2017-01-31 19:11:29 +0530 | [diff] [blame] | 4110 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4111 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4112 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4113 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4114 | } else { |
| 4115 | if (eTDLS_LINK_CONNECTED == |
| 4116 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4117 | hdd_debug("TDLS link status is connected, ignore SHOULD_DISCOVER"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4118 | } else { |
| 4119 | /* |
| 4120 | * If external control is enabled then initiate |
| 4121 | * TDLS only if forced peer is set otherwise |
| 4122 | * ignore should Discover trigger from fw. |
| 4123 | */ |
| 4124 | if (pHddCtx->config-> |
| 4125 | fTDLSExternalControl |
| 4126 | && (false == |
| 4127 | curr_peer->isForcedPeer)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4128 | 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] | 4129 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4130 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4131 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4132 | 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] | 4133 | pHddCtx->config-> |
| 4134 | fTDLSExternalControl, |
| 4135 | curr_peer->isForcedPeer, |
| 4136 | pRoamInfo->reasonCode); |
Nitesh Shah | 983e8f5 | 2016-11-25 12:36:29 +0530 | [diff] [blame] | 4137 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 4138 | wlan_hdd_tdls_implicit_send_discovery_request( |
| 4139 | pHddTdlsCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4140 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4141 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4142 | } |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4143 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4144 | break; |
| 4145 | } |
| 4146 | |
| 4147 | case eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN: |
| 4148 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4149 | mutex_lock(&pHddCtx->tdls_lock); |
| 4150 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4151 | if (!pHddTdlsCtx) { |
| 4152 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4153 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4154 | roamResult); |
| 4155 | status = QDF_STATUS_E_FAILURE; |
| 4156 | break; |
| 4157 | } |
| 4158 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4159 | curr_peer = |
| 4160 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4161 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4162 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4163 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4164 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4165 | } else { |
| 4166 | if (eTDLS_LINK_CONNECTED == |
| 4167 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4168 | hdd_debug("Received SHOULD_TEARDOWN for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4169 | MAC_ADDRESS_STR |
| 4170 | " staId: %d, reason: %d", |
| 4171 | MAC_ADDR_ARRAY(pRoamInfo-> |
| 4172 | peerMac.bytes), |
| 4173 | pRoamInfo->staId, |
| 4174 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4175 | |
| 4176 | if (pRoamInfo->reasonCode == |
| 4177 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4178 | pRoamInfo->reasonCode == |
| 4179 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4180 | pRoamInfo->reasonCode == |
| 4181 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4182 | pRoamInfo->reasonCode == |
| 4183 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4184 | reason = |
| 4185 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4186 | } else |
| 4187 | reason = |
| 4188 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4189 | |
| 4190 | wlan_hdd_tdls_indicate_teardown |
| 4191 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4192 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4193 | hdd_send_wlan_tdls_teardown_event( |
| 4194 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4195 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4196 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4197 | hdd_debug("TDLS link is not connected, ignore SHOULD_TEARDOWN, reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4198 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4199 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4200 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4201 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4202 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4203 | break; |
| 4204 | } |
| 4205 | |
| 4206 | case eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED: |
| 4207 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4208 | mutex_lock(&pHddCtx->tdls_lock); |
| 4209 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4210 | if (!pHddTdlsCtx) { |
| 4211 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4212 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4213 | roamResult); |
| 4214 | status = QDF_STATUS_E_FAILURE; |
| 4215 | break; |
| 4216 | } |
| 4217 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4218 | curr_peer = |
| 4219 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4220 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4221 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4222 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4223 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4224 | } else { |
| 4225 | if (eTDLS_LINK_CONNECTED == |
| 4226 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4227 | hdd_debug("Received SHOULD_PEER_DISCONNECTED for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4228 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4229 | " staId: %d reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4230 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4231 | pRoamInfo->staId, |
| 4232 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4233 | |
| 4234 | if (pRoamInfo->reasonCode == |
| 4235 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4236 | pRoamInfo->reasonCode == |
| 4237 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4238 | pRoamInfo->reasonCode == |
| 4239 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4240 | pRoamInfo->reasonCode == |
| 4241 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4242 | reason = |
| 4243 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4244 | } else |
| 4245 | reason = |
| 4246 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4247 | |
| 4248 | wlan_hdd_tdls_indicate_teardown |
| 4249 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4250 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4251 | hdd_send_wlan_tdls_teardown_event( |
| 4252 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4253 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4254 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4255 | 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] | 4256 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4257 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4258 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4259 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4260 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4261 | break; |
| 4262 | } |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4263 | |
| 4264 | case eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4265 | mutex_lock(&pHddCtx->tdls_lock); |
| 4266 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4267 | if (!pHddTdlsCtx) { |
| 4268 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4269 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4270 | roamResult); |
| 4271 | status = QDF_STATUS_E_FAILURE; |
| 4272 | break; |
| 4273 | } |
| 4274 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4275 | status = hdd_tdls_connection_tracker_update(pAdapter, |
| 4276 | pRoamInfo, |
| 4277 | pHddTdlsCtx); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4278 | mutex_unlock(&pHddCtx->tdls_lock); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4279 | break; |
| 4280 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4281 | default: |
| 4282 | { |
| 4283 | break; |
| 4284 | } |
| 4285 | } |
| 4286 | |
| 4287 | return status; |
| 4288 | } |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4289 | #else |
| 4290 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4291 | inline QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4292 | uint8_t staId) |
| 4293 | { |
| 4294 | return QDF_STATUS_SUCCESS; |
| 4295 | } |
| 4296 | |
| 4297 | static inline QDF_STATUS |
| 4298 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 4299 | tCsrRoamInfo *pRoamInfo, |
| 4300 | uint32_t roamId, |
| 4301 | eRoamCmdStatus roamStatus, |
| 4302 | eCsrRoamResult roamResult) |
| 4303 | { |
| 4304 | return QDF_STATUS_SUCCESS; |
| 4305 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4306 | #endif |
| 4307 | |
| 4308 | #ifdef WLAN_FEATURE_11W |
| 4309 | /** |
| 4310 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
| 4311 | * @pAdapter: pointer to the adapter |
| 4312 | * @nFrameLength: Length of the unprotected frame being passed |
| 4313 | * @pbFrames: Pointer to the frame buffer |
| 4314 | * @frameType: 802.11 frame type |
| 4315 | * |
| 4316 | * This function forwards the unprotected management frame to the supplicant. |
| 4317 | * |
| 4318 | * Return: nothing |
| 4319 | */ |
| 4320 | static void |
| 4321 | hdd_indicate_unprot_mgmt_frame(hdd_adapter_t *pAdapter, uint32_t nFrameLength, |
| 4322 | uint8_t *pbFrames, uint8_t frameType) |
| 4323 | { |
| 4324 | uint8_t type = 0; |
| 4325 | uint8_t subType = 0; |
| 4326 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4327 | hdd_debug("Frame Type = %d Frame Length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4328 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4329 | |
| 4330 | /* Sanity Checks */ |
| 4331 | if (NULL == pAdapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4332 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4333 | return; |
| 4334 | } |
| 4335 | |
| 4336 | if (NULL == pAdapter->dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4337 | hdd_err("pAdapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4338 | return; |
| 4339 | } |
| 4340 | |
| 4341 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4342 | hdd_err("pAdapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4343 | return; |
| 4344 | } |
| 4345 | |
| 4346 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4347 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4348 | return; |
| 4349 | } |
| 4350 | |
| 4351 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4352 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4353 | return; |
| 4354 | } |
| 4355 | |
| 4356 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4357 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4358 | |
| 4359 | /* Get pAdapter from Destination mac address of the frame */ |
| 4360 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 4361 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4362 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4363 | nFrameLength); |
| 4364 | #else |
| 4365 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, |
| 4366 | nFrameLength); |
| 4367 | #endif |
| 4368 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 4369 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 4370 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 4371 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4372 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4373 | nFrameLength); |
| 4374 | #else |
| 4375 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, |
| 4376 | nFrameLength); |
| 4377 | #endif |
| 4378 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 4379 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4380 | hdd_warn("Frame type %d and subtype %d are not valid", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4381 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4382 | return; |
| 4383 | } |
| 4384 | } |
| 4385 | #endif |
| 4386 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4387 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4388 | /** |
| 4389 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
| 4390 | * @pAdapter: pointer to adapter |
| 4391 | * @tid: traffic identifier |
| 4392 | * @state: state |
| 4393 | * @measInterval: measurement interval |
| 4394 | * |
| 4395 | * This function sends traffic stream metrics IE information to |
| 4396 | * the supplicant via wireless event. |
| 4397 | * |
| 4398 | * Return: none |
| 4399 | */ |
| 4400 | static void |
| 4401 | hdd_indicate_tsm_ie(hdd_adapter_t *pAdapter, uint8_t tid, |
| 4402 | uint8_t state, uint16_t measInterval) |
| 4403 | { |
| 4404 | union iwreq_data wrqu; |
| 4405 | char buf[IW_CUSTOM_MAX + 1]; |
| 4406 | int nBytes = 0; |
| 4407 | |
| 4408 | if (NULL == pAdapter) |
| 4409 | return; |
| 4410 | |
| 4411 | /* create the event */ |
| 4412 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4413 | memset(buf, '\0', sizeof(buf)); |
| 4414 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4415 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4416 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4417 | |
| 4418 | nBytes = |
| 4419 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4420 | measInterval); |
| 4421 | |
| 4422 | wrqu.data.pointer = buf; |
| 4423 | wrqu.data.length = nBytes; |
| 4424 | /* send the event */ |
| 4425 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4426 | } |
| 4427 | |
| 4428 | /** |
| 4429 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
| 4430 | * @pAdapter: pointer to adapter |
| 4431 | * @pRoamInfo: pointer to roam info |
| 4432 | * |
| 4433 | * This function sends cckm preauth indication to the supplicant |
| 4434 | * via wireless custom event. |
| 4435 | * |
| 4436 | * Return: none |
| 4437 | */ |
| 4438 | static void |
| 4439 | hdd_indicate_cckm_pre_auth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 4440 | { |
| 4441 | union iwreq_data wrqu; |
| 4442 | char buf[IW_CUSTOM_MAX + 1]; |
| 4443 | char *pos = buf; |
| 4444 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4445 | |
| 4446 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4447 | return; |
| 4448 | |
| 4449 | /* create the event */ |
| 4450 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4451 | memset(buf, '\0', sizeof(buf)); |
| 4452 | |
| 4453 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4454 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4455 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 4456 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4457 | |
| 4458 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4459 | pos += nBytes; |
| 4460 | freeBytes -= nBytes; |
| 4461 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4462 | qdf_mem_copy(pos, pRoamInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4463 | pos += QDF_MAC_ADDR_SIZE; |
| 4464 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4465 | |
| 4466 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
| 4467 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 4468 | freeBytes -= nBytes; |
| 4469 | |
| 4470 | wrqu.data.pointer = buf; |
| 4471 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4472 | |
| 4473 | /* send the event */ |
| 4474 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4475 | } |
| 4476 | |
| 4477 | /** |
| 4478 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
| 4479 | * @pAdapter: pointer to adapter |
| 4480 | * @pRoamInfo: pointer to roam info |
| 4481 | * |
| 4482 | * Return: none |
| 4483 | */ |
| 4484 | static void |
| 4485 | hdd_indicate_ese_adj_ap_rep_ind(hdd_adapter_t *pAdapter, |
| 4486 | tCsrRoamInfo *pRoamInfo) |
| 4487 | { |
| 4488 | union iwreq_data wrqu; |
| 4489 | char buf[IW_CUSTOM_MAX + 1]; |
| 4490 | int nBytes = 0; |
| 4491 | |
| 4492 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4493 | return; |
| 4494 | |
| 4495 | /* create the event */ |
| 4496 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4497 | memset(buf, '\0', sizeof(buf)); |
| 4498 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4499 | hdd_debug("CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4500 | |
| 4501 | nBytes = |
| 4502 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
| 4503 | pRoamInfo->tsmRoamDelay); |
| 4504 | |
| 4505 | wrqu.data.pointer = buf; |
| 4506 | wrqu.data.length = nBytes; |
| 4507 | |
| 4508 | /* send the event */ |
| 4509 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4510 | } |
| 4511 | |
| 4512 | /** |
| 4513 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
| 4514 | * @pAdapter: pointer to adapter |
| 4515 | * @measurementToken: measurement token |
| 4516 | * @flag: flag |
| 4517 | * @numBss: number of bss |
| 4518 | * |
| 4519 | * If the measurement is none and no scan results found, |
| 4520 | * indicate the supplicant about measurement done. |
| 4521 | * |
| 4522 | * Return: none |
| 4523 | */ |
| 4524 | void |
| 4525 | hdd_indicate_ese_bcn_report_no_results(const hdd_adapter_t *pAdapter, |
| 4526 | const uint16_t measurementToken, |
| 4527 | const bool flag, const uint8_t numBss) |
| 4528 | { |
| 4529 | union iwreq_data wrqu; |
| 4530 | char buf[IW_CUSTOM_MAX]; |
| 4531 | char *pos = buf; |
| 4532 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4533 | |
| 4534 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4535 | memset(buf, '\0', sizeof(buf)); |
| 4536 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4537 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4538 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4539 | |
| 4540 | nBytes = |
| 4541 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4542 | flag, numBss); |
| 4543 | |
| 4544 | wrqu.data.pointer = buf; |
| 4545 | wrqu.data.length = nBytes; |
| 4546 | /* send the event */ |
| 4547 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4548 | } |
| 4549 | |
| 4550 | /** |
| 4551 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
| 4552 | * @pAdapter: pointer to adapter |
| 4553 | * @pRoamInfo: pointer to roam info |
| 4554 | * |
| 4555 | * If the measurement is none and no scan results found, |
| 4556 | * indicate the supplicant about measurement done. |
| 4557 | * |
| 4558 | * Return: none |
| 4559 | */ |
| 4560 | static void |
| 4561 | hdd_indicate_ese_bcn_report_ind(const hdd_adapter_t *pAdapter, |
| 4562 | const tCsrRoamInfo *pRoamInfo) |
| 4563 | { |
| 4564 | union iwreq_data wrqu; |
| 4565 | char buf[IW_CUSTOM_MAX]; |
| 4566 | char *pos = buf; |
| 4567 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4568 | uint8_t i = 0, len = 0; |
| 4569 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4570 | uint8_t lastSent = 0, sendBss = 0; |
| 4571 | int bcnRepFieldSize = |
| 4572 | sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0]. |
| 4573 | bcnReportFields); |
| 4574 | uint8_t ieLenByte = 1; |
| 4575 | /* |
| 4576 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4577 | */ |
| 4578 | #define ESEBCNREPHEADER_LEN (18) |
| 4579 | |
| 4580 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4581 | return; |
| 4582 | |
| 4583 | /* |
| 4584 | * Custom event can pass maximum of 256 bytes of data, |
| 4585 | * based on the IE len we need to identify how many BSS info can |
| 4586 | * be filled in to custom event data. |
| 4587 | */ |
| 4588 | /* |
| 4589 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4590 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4591 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4592 | */ |
| 4593 | |
| 4594 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) |
| 4595 | && (!pRoamInfo->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4596 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4597 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4598 | * indicate the supplicant about measurement done |
| 4599 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4600 | hdd_indicate_ese_bcn_report_no_results( |
| 4601 | pAdapter, |
| 4602 | pRoamInfo->pEseBcnReportRsp-> |
| 4603 | measurementToken, |
| 4604 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4605 | pRoamInfo->pEseBcnReportRsp->numBss); |
| 4606 | } else { |
| 4607 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) { |
| 4608 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4609 | memset(buf, '\0', sizeof(buf)); |
| 4610 | tot_bcn_ieLen = 0; |
| 4611 | sendBss = 0; |
| 4612 | pos = buf; |
| 4613 | freeBytes = IW_CUSTOM_MAX; |
| 4614 | |
| 4615 | for (i = lastSent; |
| 4616 | i < pRoamInfo->pEseBcnReportRsp->numBss; i++) { |
| 4617 | len = |
| 4618 | bcnRepFieldSize + ieLenByte + |
| 4619 | pRoamInfo->pEseBcnReportRsp-> |
| 4620 | bcnRepBssInfo[i].ieLen; |
| 4621 | if ((len + tot_bcn_ieLen) > |
| 4622 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4623 | break; |
| 4624 | } |
| 4625 | tot_bcn_ieLen += len; |
| 4626 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4627 | 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] | 4628 | i, bcnRepFieldSize, 1, |
| 4629 | pRoamInfo->pEseBcnReportRsp-> |
| 4630 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4631 | } |
| 4632 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4633 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4634 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4635 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 4636 | pRoamInfo->pEseBcnReportRsp->flag, sendBss, |
| 4637 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4638 | |
| 4639 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
| 4640 | pRoamInfo->pEseBcnReportRsp-> |
| 4641 | measurementToken, |
| 4642 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4643 | sendBss); |
| 4644 | pos += nBytes; |
| 4645 | freeBytes -= nBytes; |
| 4646 | |
| 4647 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4648 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4649 | sizeof(tot_bcn_ieLen)); |
| 4650 | pos += sizeof(tot_bcn_ieLen); |
| 4651 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4652 | |
| 4653 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4654 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4655 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4656 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4657 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
| 4658 | pRoamInfo->pEseBcnReportRsp-> |
| 4659 | bcnRepBssInfo[i + |
| 4660 | lastSent].bcnReportFields. |
| 4661 | ChanNum, |
| 4662 | pRoamInfo->pEseBcnReportRsp-> |
| 4663 | bcnRepBssInfo[i + |
| 4664 | lastSent].bcnReportFields. |
| 4665 | Spare, |
| 4666 | pRoamInfo->pEseBcnReportRsp-> |
| 4667 | bcnRepBssInfo[i + |
| 4668 | lastSent].bcnReportFields. |
| 4669 | MeasDuration, |
| 4670 | pRoamInfo->pEseBcnReportRsp-> |
| 4671 | bcnRepBssInfo[i + |
| 4672 | lastSent].bcnReportFields. |
| 4673 | PhyType, |
| 4674 | pRoamInfo->pEseBcnReportRsp-> |
| 4675 | bcnRepBssInfo[i + |
| 4676 | lastSent].bcnReportFields. |
| 4677 | RecvSigPower, |
| 4678 | pRoamInfo->pEseBcnReportRsp-> |
| 4679 | bcnRepBssInfo[i + |
| 4680 | lastSent].bcnReportFields. |
| 4681 | ParentTsf, |
| 4682 | pRoamInfo->pEseBcnReportRsp-> |
| 4683 | bcnRepBssInfo[i + |
| 4684 | lastSent].bcnReportFields. |
| 4685 | TargetTsf[0], |
| 4686 | pRoamInfo->pEseBcnReportRsp-> |
| 4687 | bcnRepBssInfo[i + |
| 4688 | lastSent].bcnReportFields. |
| 4689 | TargetTsf[1], |
| 4690 | pRoamInfo->pEseBcnReportRsp-> |
| 4691 | bcnRepBssInfo[i + |
| 4692 | lastSent].bcnReportFields. |
| 4693 | BcnInterval, |
| 4694 | pRoamInfo->pEseBcnReportRsp-> |
| 4695 | bcnRepBssInfo[i + |
| 4696 | lastSent].bcnReportFields. |
| 4697 | CapabilityInfo, |
| 4698 | pRoamInfo->pEseBcnReportRsp-> |
| 4699 | bcnRepBssInfo[i + |
| 4700 | lastSent].bcnReportFields. |
| 4701 | Bssid[0], |
| 4702 | pRoamInfo->pEseBcnReportRsp-> |
| 4703 | bcnRepBssInfo[i + |
| 4704 | lastSent].bcnReportFields. |
| 4705 | Bssid[1], |
| 4706 | pRoamInfo->pEseBcnReportRsp-> |
| 4707 | bcnRepBssInfo[i + |
| 4708 | lastSent].bcnReportFields. |
| 4709 | Bssid[2], |
| 4710 | pRoamInfo->pEseBcnReportRsp-> |
| 4711 | bcnRepBssInfo[i + |
| 4712 | lastSent].bcnReportFields. |
| 4713 | Bssid[3], |
| 4714 | pRoamInfo->pEseBcnReportRsp-> |
| 4715 | bcnRepBssInfo[i + |
| 4716 | lastSent].bcnReportFields. |
| 4717 | Bssid[4], |
| 4718 | pRoamInfo->pEseBcnReportRsp-> |
| 4719 | bcnRepBssInfo[i + |
| 4720 | lastSent].bcnReportFields. |
| 4721 | Bssid[5]); |
| 4722 | |
| 4723 | /* bcn report fields are copied */ |
| 4724 | len = |
| 4725 | sizeof(pRoamInfo->pEseBcnReportRsp-> |
| 4726 | bcnRepBssInfo[i + |
| 4727 | lastSent]. |
| 4728 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4729 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4730 | (char *)&pRoamInfo-> |
| 4731 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4732 | lastSent]. |
| 4733 | bcnReportFields, len); |
| 4734 | pos += len; |
| 4735 | freeBytes -= len; |
| 4736 | |
| 4737 | /* Add 1 byte of ie len */ |
| 4738 | len = |
| 4739 | pRoamInfo->pEseBcnReportRsp-> |
| 4740 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4741 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4742 | pos += sizeof(len); |
| 4743 | freeBytes -= sizeof(len); |
| 4744 | |
| 4745 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4746 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4747 | (char *)pRoamInfo-> |
| 4748 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4749 | lastSent]. |
| 4750 | pBuf, len); |
| 4751 | pos += len; |
| 4752 | freeBytes -= len; |
| 4753 | } |
| 4754 | |
| 4755 | wrqu.data.pointer = buf; |
| 4756 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4757 | |
| 4758 | /* send the event */ |
| 4759 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, |
| 4760 | buf); |
| 4761 | lastSent += sendBss; |
| 4762 | } |
| 4763 | } |
| 4764 | } |
| 4765 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4766 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4767 | |
| 4768 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4769 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
| 4770 | * @pHddStaCtx: Station Context |
| 4771 | * |
| 4772 | * API to check if the connection authentication type is 8021x_sha256. |
| 4773 | * |
| 4774 | * Return: bool |
| 4775 | */ |
| 4776 | #ifdef WLAN_FEATURE_11W |
| 4777 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4778 | { |
| 4779 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
| 4780 | pHddStaCtx->conn_info.authType; |
| 4781 | } |
| 4782 | #else |
| 4783 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4784 | { |
| 4785 | return false; |
| 4786 | } |
| 4787 | #endif |
| 4788 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4789 | /* |
| 4790 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4791 | * @adapter: Pointer to adapter context |
| 4792 | * @roam_info: Pointer to roam info |
| 4793 | * |
| 4794 | * Return: None |
| 4795 | */ |
| 4796 | static void hdd_roam_channel_switch_handler(hdd_adapter_t *adapter, |
| 4797 | tCsrRoamInfo *roam_info) |
| 4798 | { |
| 4799 | struct hdd_chan_change_params chan_change; |
| 4800 | struct cfg80211_bss *bss; |
| 4801 | struct net_device *dev = adapter->dev; |
| 4802 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4803 | struct wiphy *wiphy = wdev->wiphy; |
| 4804 | QDF_STATUS status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4805 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4806 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4807 | hdd_debug("channel switch for session:%d to channel:%d", |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4808 | adapter->sessionId, roam_info->chan_info.chan_id); |
| 4809 | |
| 4810 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4811 | chan_change.chan_params.ch_width = |
| 4812 | roam_info->chan_info.ch_width; |
| 4813 | chan_change.chan_params.sec_ch_offset = |
| 4814 | roam_info->chan_info.sec_ch_offset; |
| 4815 | chan_change.chan_params.center_freq_seg0 = |
| 4816 | roam_info->chan_info.band_center_freq1; |
| 4817 | chan_change.chan_params.center_freq_seg1 = |
| 4818 | roam_info->chan_info.band_center_freq2; |
| 4819 | |
| 4820 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4821 | if (NULL == bss) |
| 4822 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4823 | else |
| 4824 | cfg80211_put_bss(wiphy, bss); |
| 4825 | |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 4826 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change, |
| 4827 | roam_info->mode == SIR_SME_PHY_MODE_LEGACY); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4828 | if (QDF_IS_STATUS_ERROR(status)) |
| 4829 | hdd_err("channel change notification failed"); |
| 4830 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4831 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->hdd_psoc, |
| 4832 | adapter->sessionId); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4833 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4834 | hdd_debug("set hw mode change not done"); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4835 | } |
| 4836 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4837 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4838 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4839 | * @pContext: pointer to adapter context |
| 4840 | * @pRoamInfo: pointer to roam info |
| 4841 | * @roamId: roam id |
| 4842 | * @roamStatus: roam status |
| 4843 | * @roamResult: roam result |
| 4844 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4845 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4846 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4847 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4848 | hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, |
| 4849 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4850 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4851 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4852 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 4853 | hdd_wext_state_t *pWextState = NULL; |
| 4854 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4855 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4856 | struct cfg80211_bss *bss_status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4857 | hdd_context_t *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4858 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4859 | hdd_debug("CSR Callback: status= %d result= %d roamID=%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4860 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4861 | |
| 4862 | /* Sanity check */ |
| 4863 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4864 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4865 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4866 | } |
| 4867 | |
| 4868 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4869 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4870 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4871 | |
Sreelakshmi Konamki | 075431a | 2017-03-16 15:23:30 +0530 | [diff] [blame] | 4872 | /* Omitting eCSR_ROAM_UPDATE_SCAN_RESULT as this is too frequent */ |
| 4873 | if (eCSR_ROAM_UPDATE_SCAN_RESULT != roamStatus) |
| 4874 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4875 | pAdapter->sessionId, roamStatus)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4876 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4877 | switch (roamStatus) { |
| 4878 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 6f3a865 | 2015-09-25 10:58:15 +0530 | [diff] [blame] | 4879 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4880 | complete(&pAdapter->session_open_comp_var); |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 4881 | hdd_debug("session %d opened", pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4882 | break; |
| 4883 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4884 | /* |
| 4885 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4886 | * reassoc failed due to failure, timeout, reject from ap |
| 4887 | * in any case tell the OS, our carrier is off and mark |
| 4888 | * interface down. |
| 4889 | */ |
| 4890 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4891 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
| 4892 | roamStatus, roamResult, pAdapter->sessionId); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4893 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4894 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4895 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4896 | pHddStaCtx->ft_carrier_on = false; |
| 4897 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4898 | hdd_debug("hdd_ReassocScenario set to: %d, ReAssoc Failed, session: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4899 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4900 | break; |
| 4901 | |
| 4902 | case eCSR_ROAM_FT_START: |
| 4903 | /* |
| 4904 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4905 | * informed that the link is down. So mark the link ready for |
| 4906 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4907 | * be received. Where in we will not mark the link down |
| 4908 | * Also we want to stop tx at this point when we will be |
| 4909 | * doing disassoc at this time. This saves 30-60 msec |
| 4910 | * after reassoc. |
| 4911 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4912 | hdd_info("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4913 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4914 | hdd_napi_serialize(1); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4915 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4916 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4917 | WLAN_CONTROL_PATH); |
| 4918 | status = hdd_roam_deregister_sta(pAdapter, |
| 4919 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4920 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4921 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4922 | pHddStaCtx->ft_carrier_on = true; |
| 4923 | pHddStaCtx->hdd_ReassocScenario = true; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4924 | hdd_info("hdd_ReassocScenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
| 4925 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4926 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4927 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4928 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4929 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4930 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4931 | if (roamResult == eCSR_ROAM_RESULT_FAILURE) |
| 4932 | pAdapter->roam_ho_fail = true; |
| 4933 | else |
| 4934 | pAdapter->roam_ho_fail = false; |
| 4935 | complete(&pAdapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4936 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4937 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4938 | /* notify apps that we can't pass traffic anymore */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4939 | hdd_debug("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4940 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4941 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4942 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4943 | if (pHddStaCtx->ft_carrier_on == false) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4944 | wlan_hdd_netif_queue_control(pAdapter, |
| 4945 | WLAN_NETIF_CARRIER_OFF, |
| 4946 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4947 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4948 | break; |
| 4949 | case eCSR_ROAM_LOSTLINK: |
| 4950 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4951 | hdd_debug("Roaming started due to connection lost"); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4952 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4953 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4954 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4955 | WLAN_CONTROL_PATH); |
| 4956 | break; |
| 4957 | } |
| 4958 | case eCSR_ROAM_DISASSOCIATED: |
| 4959 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4960 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4961 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 4962 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4963 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4964 | pAdapter->roam_ho_fail = false; |
| 4965 | complete(&pAdapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4966 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4967 | /* Call to clear any MC Addr List filter applied after |
| 4968 | * successful connection. |
| 4969 | */ |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4970 | hdd_disable_and_flush_mc_addr_list(pAdapter, |
| 4971 | pmo_peer_disconnect); |
| 4972 | qdf_ret_status = |
| 4973 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4974 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4975 | } |
| 4976 | break; |
| 4977 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4978 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4979 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4980 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4981 | roamStatus, roamResult); |
| 4982 | break; |
| 4983 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4984 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4985 | /* |
| 4986 | * To Do - address probable memory leak with WEP encryption upon |
| 4987 | * successful association. |
| 4988 | */ |
| 4989 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 4990 | /* Clear saved connection information in HDD */ |
| 4991 | hdd_conn_remove_connect_info( |
| 4992 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 4993 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4994 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4995 | hdd_association_completion_handler(pAdapter, pRoamInfo, |
| 4996 | roamId, roamStatus, |
| 4997 | roamResult); |
| 4998 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4999 | if (pRoamInfo) |
| 5000 | pRoamInfo->roamSynchInProgress = false; |
| 5001 | #endif |
| 5002 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 5003 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5004 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5005 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5006 | qdf_ret_status = hdd_association_completion_handler(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5007 | pRoamInfo, |
| 5008 | roamId, |
| 5009 | roamStatus, |
| 5010 | roamResult); |
| 5011 | break; |
| 5012 | case eCSR_ROAM_IBSS_IND: |
| 5013 | hdd_roam_ibss_indication_handler(pAdapter, pRoamInfo, roamId, |
| 5014 | roamStatus, roamResult); |
| 5015 | break; |
| 5016 | |
| 5017 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5018 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5019 | roam_roam_connect_status_update_handler(pAdapter, |
| 5020 | pRoamInfo, |
| 5021 | roamId, |
| 5022 | roamStatus, |
| 5023 | roamResult); |
| 5024 | break; |
| 5025 | |
| 5026 | case eCSR_ROAM_MIC_ERROR_IND: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5027 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5028 | hdd_roam_mic_error_indication_handler(pAdapter, |
| 5029 | pRoamInfo, |
| 5030 | roamId, |
| 5031 | roamStatus, |
| 5032 | roamResult); |
| 5033 | break; |
| 5034 | |
| 5035 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 5036 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5037 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5038 | hdd_roam_set_key_complete_handler(pAdapter, pRoamInfo, |
| 5039 | roamId, roamStatus, |
| 5040 | roamResult); |
| 5041 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
| 5042 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5043 | hdd_debug("hdd_ReassocScenario set to: %d, set key complete, session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5044 | pHddStaCtx->hdd_ReassocScenario, |
| 5045 | pAdapter->sessionId); |
| 5046 | } |
| 5047 | } |
| 5048 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5049 | if (pRoamInfo != NULL) |
| 5050 | pRoamInfo->roamSynchInProgress = false; |
| 5051 | #endif |
| 5052 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5053 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5054 | case eCSR_ROAM_FT_RESPONSE: |
| 5055 | hdd_send_ft_event(pAdapter); |
| 5056 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5057 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5058 | case eCSR_ROAM_PMK_NOTIFY: |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 5059 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType |
| 5060 | || hdd_is_8021x_sha256_auth_type(pHddStaCtx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5061 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5062 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5063 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
| 5064 | pAdapter, pRoamInfo, 1, false); |
| 5065 | } |
| 5066 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5067 | |
| 5068 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 5069 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 5070 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5071 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5072 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, |
| 5073 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5074 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5075 | } |
| 5076 | break; |
| 5077 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 5078 | /* |
| 5079 | * This event will notify pre-auth completion in case of success |
| 5080 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5081 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5082 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5083 | pRoamInfo, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5084 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5085 | } |
| 5086 | break; |
| 5087 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 5088 | /* |
| 5089 | * This event will notify pre-auth completion incase of failure. |
| 5090 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5091 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5092 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5093 | pRoamInfo, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5094 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5095 | } |
| 5096 | break; |
| 5097 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 5098 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 5099 | * It will be only invoked on success |
| 5100 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5101 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5102 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, |
| 5103 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5104 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5105 | } |
| 5106 | break; |
| 5107 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5108 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 5109 | hdd_remain_chan_ready_handler(pAdapter, pRoamInfo->roc_scan_id); |
| 5110 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5111 | #ifdef FEATURE_WLAN_TDLS |
| 5112 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5113 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5114 | hdd_roam_tdls_status_update_handler(pAdapter, pRoamInfo, |
| 5115 | roamId, |
| 5116 | roamStatus, |
| 5117 | roamResult); |
| 5118 | break; |
| 5119 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 5120 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, |
| 5121 | pRoamInfo->reasonCode); |
| 5122 | break; |
| 5123 | #endif |
| 5124 | #ifdef WLAN_FEATURE_11W |
| 5125 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 5126 | hdd_indicate_unprot_mgmt_frame(pAdapter, |
| 5127 | pRoamInfo->nFrameLength, |
| 5128 | pRoamInfo->pbFrames, |
| 5129 | pRoamInfo->frameType); |
| 5130 | break; |
| 5131 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5132 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5133 | case eCSR_ROAM_TSM_IE_IND: |
| 5134 | hdd_indicate_tsm_ie(pAdapter, pRoamInfo->tsmIe.tsid, |
| 5135 | pRoamInfo->tsmIe.state, |
| 5136 | pRoamInfo->tsmIe.msmt_interval); |
| 5137 | break; |
| 5138 | |
| 5139 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 5140 | { |
| 5141 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
| 5142 | pHddStaCtx->conn_info.authType |
| 5143 | || eCSR_AUTH_TYPE_CCKM_RSN == |
| 5144 | pHddStaCtx->conn_info.authType) { |
| 5145 | hdd_indicate_cckm_pre_auth(pAdapter, pRoamInfo); |
| 5146 | } |
| 5147 | break; |
| 5148 | } |
| 5149 | |
| 5150 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 5151 | { |
| 5152 | hdd_indicate_ese_adj_ap_rep_ind(pAdapter, pRoamInfo); |
| 5153 | break; |
| 5154 | } |
| 5155 | |
| 5156 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 5157 | { |
| 5158 | hdd_indicate_ese_bcn_report_ind(pAdapter, pRoamInfo); |
| 5159 | break; |
| 5160 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5161 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5162 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5163 | hdd_roam_channel_switch_handler(pAdapter, pRoamInfo); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5164 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5165 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5166 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 5167 | if ((NULL != pRoamInfo) && (NULL != pRoamInfo->pBssDesc)) { |
| 5168 | bss_status = wlan_hdd_cfg80211_inform_bss_frame( |
| 5169 | pAdapter, pRoamInfo->pBssDesc); |
| 5170 | if (NULL == bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5171 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5172 | else |
| 5173 | cfg80211_put_bss( |
| 5174 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 5175 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 5176 | #endif |
| 5177 | bss_status); |
| 5178 | } |
| 5179 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 5180 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
| 5181 | hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, |
| 5182 | roamResult); |
| 5183 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5184 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5185 | hdd_debug("Process ROAM_START from firmware"); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5186 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5187 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5188 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5189 | hdd_napi_serialize(1); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5190 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5191 | hdd_set_roaming_in_progress(true); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 5192 | policy_mgr_restart_opportunistic_timer(hdd_ctx->hdd_psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5193 | break; |
| 5194 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5195 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5196 | hdd_napi_serialize(0); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5197 | wlan_hdd_netif_queue_control(pAdapter, |
| 5198 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 5199 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5200 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5201 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5202 | pAdapter->roam_ho_fail = false; |
| 5203 | complete(&pAdapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5204 | break; |
| 5205 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5206 | default: |
| 5207 | break; |
| 5208 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5209 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5210 | } |
| 5211 | |
| 5212 | /** |
| 5213 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 5214 | * @auth_suite: auth suite |
| 5215 | * |
| 5216 | * Return: eCsrAuthType enumeration |
| 5217 | */ |
| 5218 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5219 | { |
| 5220 | eCsrAuthType auth_type; |
| 5221 | /* is the auth type supported? */ |
| 5222 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 5223 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 5224 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 5225 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5226 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5227 | /* Check for 11r FT Authentication with PSK */ |
| 5228 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5229 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5230 | /* Check for 11R FT Authentication with 802.1X */ |
| 5231 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5232 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5233 | #ifdef FEATURE_WLAN_ESE |
| 5234 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5235 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5236 | } else |
| 5237 | #endif /* FEATURE_WLAN_ESE */ |
| 5238 | #ifdef WLAN_FEATURE_11W |
| 5239 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5240 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5241 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5242 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5243 | } else |
| 5244 | #endif |
| 5245 | { |
| 5246 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5247 | } |
| 5248 | return auth_type; |
| 5249 | } |
| 5250 | |
| 5251 | /** |
| 5252 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5253 | * @auth_suite: auth suite |
| 5254 | * |
| 5255 | * Return: eCsrAuthType enumeration |
| 5256 | */ |
| 5257 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5258 | { |
| 5259 | eCsrAuthType auth_type; |
| 5260 | /* is the auth type supported? */ |
| 5261 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5262 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5263 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5264 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5265 | } else |
| 5266 | #ifdef FEATURE_WLAN_ESE |
| 5267 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5268 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5269 | } else |
| 5270 | #endif /* FEATURE_WLAN_ESE */ |
| 5271 | { |
| 5272 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5273 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5274 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5275 | return auth_type; |
| 5276 | } |
| 5277 | |
| 5278 | /** |
| 5279 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5280 | * Translate RSN to CSR encryption type |
| 5281 | * @cipher_suite: cipher suite |
| 5282 | * |
| 5283 | * Return: eCsrEncryptionType enumeration |
| 5284 | */ |
| 5285 | eCsrEncryptionType |
| 5286 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5287 | { |
| 5288 | eCsrEncryptionType cipher_type; |
| 5289 | |
| 5290 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5291 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5292 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5293 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5294 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5295 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5296 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5297 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5298 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5299 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5300 | else |
| 5301 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5302 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5303 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5304 | return cipher_type; |
| 5305 | } |
| 5306 | |
| 5307 | /** |
| 5308 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5309 | * Translate WPA to CSR encryption type |
| 5310 | * @cipher_suite: cipher suite |
| 5311 | * |
| 5312 | * Return: eCsrEncryptionType enumeration |
| 5313 | */ |
| 5314 | eCsrEncryptionType |
| 5315 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5316 | { |
| 5317 | eCsrEncryptionType cipher_type; |
| 5318 | |
| 5319 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5320 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5321 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5322 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5323 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5324 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5325 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5326 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5327 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5328 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5329 | else |
| 5330 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5331 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5332 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5333 | return cipher_type; |
| 5334 | } |
| 5335 | |
| 5336 | /** |
| 5337 | * hdd_process_genie() - process gen ie |
| 5338 | * @pAdapter: pointer to adapter |
| 5339 | * @bssid: pointer to mac address |
| 5340 | * @pEncryptType: pointer to encryption type |
| 5341 | * @mcEncryptType: pointer to multicast encryption type |
| 5342 | * @pAuthType: pointer to auth type |
| 5343 | * |
| 5344 | * Return: 0 on success, error number otherwise |
| 5345 | */ |
| 5346 | static int32_t hdd_process_genie(hdd_adapter_t *pAdapter, |
| 5347 | u8 *bssid, |
| 5348 | eCsrEncryptionType *pEncryptType, |
| 5349 | eCsrEncryptionType *mcEncryptType, |
| 5350 | eCsrAuthType *pAuthType, |
| 5351 | #ifdef WLAN_FEATURE_11W |
| 5352 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5353 | #endif |
| 5354 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5355 | { |
| 5356 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5357 | QDF_STATUS result; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5358 | tDot11fIERSN dot11RSNIE; |
| 5359 | tDot11fIEWPA dot11WPAIE; |
| 5360 | uint32_t i; |
| 5361 | uint8_t *pRsnIe; |
| 5362 | uint16_t RSNIeLen; |
| 5363 | tPmkidCacheInfo PMKIDCache[4]; /* Local transfer memory */ |
| 5364 | bool updatePMKCache = false; |
| 5365 | |
| 5366 | /* |
| 5367 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5368 | * setting present flag to 0. |
| 5369 | */ |
| 5370 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5371 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5372 | |
| 5373 | /* Type check */ |
| 5374 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5375 | /* Validity checks */ |
| 5376 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5377 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5378 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5379 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5380 | return -EINVAL; |
| 5381 | } |
| 5382 | /* Skip past the EID byte and length byte */ |
| 5383 | pRsnIe = gen_ie + 2; |
| 5384 | RSNIeLen = gen_ie_len - 2; |
| 5385 | /* Unpack the RSN IE */ |
| 5386 | dot11f_unpack_ie_rsn((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5387 | pRsnIe, RSNIeLen, &dot11RSNIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5388 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5389 | hdd_debug("pairwise cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5390 | dot11RSNIE.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5391 | hdd_debug("authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5392 | dot11RSNIE.akm_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5393 | /* dot11RSNIE.akm_suite_count */ |
| 5394 | /* Just translate the FIRST one */ |
| 5395 | *pAuthType = |
| 5396 | hdd_translate_rsn_to_csr_auth_type( |
| 5397 | dot11RSNIE.akm_suites[0]); |
| 5398 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5399 | *pEncryptType = |
| 5400 | hdd_translate_rsn_to_csr_encryption_type( |
| 5401 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5402 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5403 | *mcEncryptType = |
| 5404 | hdd_translate_rsn_to_csr_encryption_type( |
| 5405 | dot11RSNIE.gp_cipher_suite); |
| 5406 | #ifdef WLAN_FEATURE_11W |
| 5407 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
| 5408 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1; |
| 5409 | #endif |
| 5410 | /* Set the PMKSA ID Cache for this interface */ |
| 5411 | for (i = 0; i < dot11RSNIE.pmkid_count; i++) { |
| 5412 | if (is_zero_ether_addr(bssid)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5413 | hdd_warn("MAC address is all zeroes"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5414 | break; |
| 5415 | } |
| 5416 | updatePMKCache = true; |
| 5417 | /* |
| 5418 | * For right now, I assume setASSOCIATE() has passed |
| 5419 | * in the bssid. |
| 5420 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5421 | qdf_mem_copy(PMKIDCache[i].BSSID.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5422 | bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5423 | qdf_mem_copy(PMKIDCache[i].PMKID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5424 | dot11RSNIE.pmkid[i], CSR_RSN_PMKID_SIZE); |
| 5425 | } |
| 5426 | |
| 5427 | if (updatePMKCache) { |
| 5428 | /* |
| 5429 | * Calling csr_roam_set_pmkid_cache to configure the |
| 5430 | * PMKIDs into the cache. |
| 5431 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5432 | hdd_debug("Calling sme_roam_set_pmkid_cache with cache entry %d.", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5433 | i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5434 | /* Finally set the PMKSA ID Cache in CSR */ |
| 5435 | result = |
| 5436 | sme_roam_set_pmkid_cache(halHandle, |
| 5437 | pAdapter->sessionId, |
| 5438 | PMKIDCache, |
| 5439 | dot11RSNIE.pmkid_count, |
| 5440 | false); |
| 5441 | } |
| 5442 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5443 | /* Validity checks */ |
| 5444 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5445 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5446 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5447 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5448 | return -EINVAL; |
| 5449 | } |
| 5450 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5451 | pRsnIe = gen_ie + 2 + 4; |
| 5452 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5453 | /* Unpack the WPA IE */ |
| 5454 | dot11f_unpack_ie_wpa((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5455 | pRsnIe, RSNIeLen, &dot11WPAIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5456 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5457 | hdd_debug("WPA unicast cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5458 | dot11WPAIE.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5459 | hdd_debug("WPA authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5460 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5461 | /* dot11WPAIE.auth_suite_count */ |
| 5462 | /* Just translate the FIRST one */ |
| 5463 | *pAuthType = |
| 5464 | hdd_translate_wpa_to_csr_auth_type( |
| 5465 | dot11WPAIE.auth_suites[0]); |
| 5466 | /* dot11WPAIE.unicast_cipher_count */ |
| 5467 | *pEncryptType = |
| 5468 | hdd_translate_wpa_to_csr_encryption_type( |
| 5469 | dot11WPAIE.unicast_ciphers[0]); |
| 5470 | /* dot11WPAIE.unicast_cipher_count */ |
| 5471 | *mcEncryptType = |
| 5472 | hdd_translate_wpa_to_csr_encryption_type( |
| 5473 | dot11WPAIE.multicast_cipher); |
| 5474 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5475 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5476 | return -EINVAL; |
| 5477 | } |
| 5478 | return 0; |
| 5479 | } |
| 5480 | |
| 5481 | /** |
| 5482 | * hdd_set_genie_to_csr() - set genie to csr |
| 5483 | * @pAdapter: pointer to adapter |
| 5484 | * @RSNAuthType: pointer to auth type |
| 5485 | * |
| 5486 | * Return: 0 on success, error number otherwise |
| 5487 | */ |
| 5488 | int hdd_set_genie_to_csr(hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 5489 | { |
| 5490 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5491 | uint32_t status = 0; |
| 5492 | eCsrEncryptionType RSNEncryptType; |
| 5493 | eCsrEncryptionType mcRSNEncryptType; |
| 5494 | #ifdef WLAN_FEATURE_11W |
| 5495 | uint8_t RSNMfpRequired = 0; |
| 5496 | uint8_t RSNMfpCapable = 0; |
| 5497 | #endif |
| 5498 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
| 5499 | /* MAC address of assoc peer */ |
| 5500 | /* But, this routine is only called when we are NOT associated. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5501 | qdf_mem_copy(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5502 | pWextState->roamProfile.BSSIDs.bssid, |
| 5503 | sizeof(bssid)); |
| 5504 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN |
| 5505 | || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) { |
| 5506 | /* continue */ |
| 5507 | } else { |
| 5508 | return 0; |
| 5509 | } |
| 5510 | /* The actual processing may eventually be more extensive than this. */ |
| 5511 | /* Right now, just consume any PMKIDs that are sent in by the app. */ |
| 5512 | status = hdd_process_genie(pAdapter, bssid, |
| 5513 | &RSNEncryptType, |
| 5514 | &mcRSNEncryptType, RSNAuthType, |
| 5515 | #ifdef WLAN_FEATURE_11W |
| 5516 | &RSNMfpRequired, &RSNMfpCapable, |
| 5517 | #endif |
| 5518 | pWextState->WPARSNIE[1] + 2, |
| 5519 | pWextState->WPARSNIE); |
| 5520 | if (status == 0) { |
| 5521 | /* |
| 5522 | * Now copy over all the security attributes |
| 5523 | * you have parsed out. |
| 5524 | */ |
| 5525 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5526 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5527 | |
| 5528 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; /* Use the cipher type in the RSN IE */ |
| 5529 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5530 | mcRSNEncryptType; |
| 5531 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5532 | if ((QDF_IBSS_MODE == pAdapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5533 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 5534 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5535 | /* |
| 5536 | * For wpa none supplicant sends the WPA IE with unicast |
| 5537 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5538 | * multicast cipher as either AES/TKIP based on group |
| 5539 | * cipher configuration mentioned in the |
| 5540 | * wpa_supplicant.conf. |
| 5541 | */ |
| 5542 | |
| 5543 | /* Set the unicast cipher same as multicast cipher */ |
| 5544 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 5545 | = mcRSNEncryptType; |
| 5546 | } |
| 5547 | #ifdef WLAN_FEATURE_11W |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5548 | hdd_debug("RSNMfpRequired = %d, RSNMfpCapable = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5549 | RSNMfpRequired, RSNMfpCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5550 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 5551 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 5552 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5553 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5554 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5555 | } |
| 5556 | return 0; |
| 5557 | } |
| 5558 | |
| 5559 | /** |
| 5560 | * hdd_set_csr_auth_type() - set csr auth type |
| 5561 | * @pAdapter: pointer to adapter |
| 5562 | * @RSNAuthType: auth type |
| 5563 | * |
| 5564 | * Return: 0 on success, error number otherwise |
| 5565 | */ |
| 5566 | int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 5567 | { |
| 5568 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5569 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 5570 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5571 | |
| 5572 | pRoamProfile->AuthType.numEntries = 1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5573 | hdd_debug("pHddStaCtx->conn_info.authType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5574 | pHddStaCtx->conn_info.authType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5575 | |
| 5576 | switch (pHddStaCtx->conn_info.authType) { |
| 5577 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5578 | #ifdef FEATURE_WLAN_ESE |
| 5579 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5580 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5581 | #endif |
| 5582 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 5583 | |
| 5584 | pRoamProfile->AuthType.authType[0] = |
| 5585 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5586 | } else if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
| 5587 | |
| 5588 | #ifdef FEATURE_WLAN_ESE |
| 5589 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 5590 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5591 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5592 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5593 | pRoamProfile->AuthType.authType[0] = |
| 5594 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5595 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5596 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5597 | pRoamProfile->AuthType.authType[0] = |
| 5598 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5599 | } else |
| 5600 | #endif |
| 5601 | if ((pWextState-> |
| 5602 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5603 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5604 | pRoamProfile->AuthType.authType[0] = |
| 5605 | eCSR_AUTH_TYPE_WPA; |
| 5606 | } else |
| 5607 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5608 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5609 | pRoamProfile->AuthType.authType[0] = |
| 5610 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5611 | } else { |
| 5612 | pRoamProfile->AuthType.authType[0] = |
| 5613 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5614 | } |
| 5615 | } |
| 5616 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
| 5617 | #ifdef FEATURE_WLAN_ESE |
| 5618 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 5619 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5620 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5621 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5622 | pRoamProfile->AuthType.authType[0] = |
| 5623 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5624 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5625 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5626 | pRoamProfile->AuthType.authType[0] = |
| 5627 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5628 | } else |
| 5629 | #endif |
| 5630 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5631 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 5632 | ((pWextState-> |
| 5633 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5634 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5635 | pRoamProfile->AuthType.authType[0] = |
| 5636 | eCSR_AUTH_TYPE_FT_RSN; |
| 5637 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5638 | && |
| 5639 | ((pWextState-> |
| 5640 | authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5641 | == IW_AUTH_KEY_MGMT_PSK)) { |
| 5642 | pRoamProfile->AuthType.authType[0] = |
| 5643 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5644 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5645 | |
| 5646 | #ifdef WLAN_FEATURE_11W |
| 5647 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5648 | pRoamProfile->AuthType.authType[0] = |
| 5649 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5650 | } else if (RSNAuthType == |
| 5651 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5652 | pRoamProfile->AuthType.authType[0] = |
| 5653 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5654 | } else |
| 5655 | #endif |
| 5656 | |
| 5657 | if ((pWextState-> |
| 5658 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5659 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5660 | pRoamProfile->AuthType.authType[0] = |
| 5661 | eCSR_AUTH_TYPE_RSN; |
| 5662 | } else |
| 5663 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5664 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5665 | pRoamProfile->AuthType.authType[0] = |
| 5666 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5667 | } else { |
| 5668 | pRoamProfile->AuthType.authType[0] = |
| 5669 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5670 | } |
| 5671 | } |
| 5672 | break; |
| 5673 | |
| 5674 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5675 | |
| 5676 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5677 | break; |
| 5678 | default: |
| 5679 | |
| 5680 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5681 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5682 | #endif /* FEATURE_WLAN_ESE */ |
| 5683 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5684 | break; |
| 5685 | } |
| 5686 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5687 | hdd_debug("Set roam Authtype to %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5688 | pWextState->roamProfile.AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5689 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5690 | return 0; |
| 5691 | } |
| 5692 | |
| 5693 | /** |
| 5694 | * __iw_set_essid() - This function sets the ssid received from wpa_supplicant |
| 5695 | * to the CSR roam profile. |
| 5696 | * |
| 5697 | * @dev: Pointer to the net device. |
| 5698 | * @info: Pointer to the iw_request_info. |
| 5699 | * @wrqu: Pointer to the iwreq_data. |
| 5700 | * @extra: Pointer to the data. |
| 5701 | * |
| 5702 | * Return: 0 for success, error number on failure |
| 5703 | */ |
| 5704 | static int __iw_set_essid(struct net_device *dev, |
| 5705 | struct iw_request_info *info, |
| 5706 | union iwreq_data *wrqu, char *extra) |
| 5707 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5708 | uint32_t status = 0; |
| 5709 | hdd_wext_state_t *pWextState; |
| 5710 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5711 | hdd_context_t *hdd_ctx; |
| 5712 | uint32_t roamId; |
| 5713 | tCsrRoamProfile *pRoamProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5714 | eCsrAuthType RSNAuthType; |
| 5715 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5716 | int ret; |
| 5717 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5718 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5719 | |
| 5720 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5721 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5722 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5723 | return ret; |
| 5724 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5725 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5726 | if (0 != ret) |
| 5727 | return ret; |
| 5728 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5729 | if (pAdapter->device_mode != QDF_STA_MODE && |
Jeff Johnson | d6e4b63 | 2016-10-03 13:49:27 -0700 | [diff] [blame] | 5730 | pAdapter->device_mode != QDF_IBSS_MODE && |
| 5731 | pAdapter->device_mode != QDF_P2P_CLIENT_MODE) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5732 | hdd_warn("device mode %s(%d) is not allowed", |
| 5733 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 5734 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5735 | return -EINVAL; |
| 5736 | } |
| 5737 | |
| 5738 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5739 | |
| 5740 | if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5741 | hdd_warn("Counter measure is in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5742 | return -EBUSY; |
| 5743 | } |
| 5744 | if (SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length) |
| 5745 | return -EINVAL; |
| 5746 | |
| 5747 | pRoamProfile = &pWextState->roamProfile; |
Agrawal Ashish | 3d000b4 | 2017-02-07 13:44:50 +0530 | [diff] [blame] | 5748 | /*Try disconnecting if already in connected state*/ |
| 5749 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5750 | if (0 > status) { |
| 5751 | hdd_err("Failed to disconnect the existing connection"); |
| 5752 | return -EALREADY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5753 | } |
| 5754 | |
| 5755 | /* |
| 5756 | * when cfg80211 defined, wpa_supplicant wext driver uses |
| 5757 | * zero-length, null-string ssid for force disconnection. |
| 5758 | * after disconnection (if previously connected) and cleaning ssid, |
| 5759 | * driver MUST return success. |
| 5760 | */ |
| 5761 | if (0 == wrqu->essid.length) |
| 5762 | return 0; |
| 5763 | |
| 5764 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5765 | &pWextState->roamProfile.uapsd_mask); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5766 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5767 | pWextState->roamProfile.uapsd_mask = 0; |
| 5768 | |
| 5769 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
| 5770 | |
| 5771 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = |
| 5772 | wrqu->essid.length; |
| 5773 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5774 | qdf_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5775 | sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5776 | qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5777 | ssId), extra, wrqu->essid.length); |
| 5778 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion |
| 5779 | || IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion) { |
| 5780 | |
| 5781 | /* set gen ie */ |
| 5782 | hdd_set_genie_to_csr(pAdapter, &RSNAuthType); |
| 5783 | |
| 5784 | /* set auth */ |
| 5785 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5786 | } |
| 5787 | #ifdef FEATURE_WLAN_WAPI |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5788 | hdd_debug("Setting WAPI AUTH Type and Encryption Mode values"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5789 | if (pAdapter->wapi_info.nWapiMode) { |
| 5790 | switch (pAdapter->wapi_info.wapiAuthMode) { |
| 5791 | case WAPI_AUTH_MODE_PSK: |
| 5792 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5793 | hdd_debug("WAPI AUTH TYPE: PSK: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5794 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5795 | pRoamProfile->AuthType.numEntries = 1; |
| 5796 | pRoamProfile->AuthType.authType[0] = |
| 5797 | eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5798 | break; |
| 5799 | } |
| 5800 | case WAPI_AUTH_MODE_CERT: |
| 5801 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5802 | hdd_debug("WAPI AUTH TYPE: CERT: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5803 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5804 | pRoamProfile->AuthType.numEntries = 1; |
| 5805 | pRoamProfile->AuthType.authType[0] = |
| 5806 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5807 | break; |
| 5808 | } |
| 5809 | } /* End of switch */ |
| 5810 | if (pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5811 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5812 | hdd_debug("WAPI PAIRWISE/GROUP ENCRYPTION: WPI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5813 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5814 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 5815 | eCSR_ENCRYPT_TYPE_WPI; |
| 5816 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5817 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 5818 | eCSR_ENCRYPT_TYPE_WPI; |
| 5819 | } |
| 5820 | } |
| 5821 | #endif /* FEATURE_WLAN_WAPI */ |
| 5822 | /* if previous genIE is not NULL, update AssocIE */ |
| 5823 | if (0 != pWextState->genIE.length) { |
| 5824 | memset(&pWextState->assocAddIE, 0, |
| 5825 | sizeof(pWextState->assocAddIE)); |
| 5826 | memcpy(pWextState->assocAddIE.addIEdata, |
| 5827 | pWextState->genIE.addIEdata, pWextState->genIE.length); |
| 5828 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5829 | pWextState->roamProfile.pAddIEAssoc = |
| 5830 | pWextState->assocAddIE.addIEdata; |
| 5831 | pWextState->roamProfile.nAddIEAssocLength = |
| 5832 | pWextState->assocAddIE.length; |
| 5833 | |
| 5834 | /* clear previous genIE after use it */ |
| 5835 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 5836 | } |
| 5837 | |
| 5838 | /* |
| 5839 | * Assumes it is not WPS Association by default, except when |
| 5840 | * pAddIEAssoc has WPS IE. |
| 5841 | */ |
| 5842 | pWextState->roamProfile.bWPSAssociation = false; |
| 5843 | |
| 5844 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5845 | pWextState->roamProfile. |
| 5846 | nAddIEAssocLength)) |
| 5847 | pWextState->roamProfile.bWPSAssociation = true; |
| 5848 | |
| 5849 | /* Disable auto BMPS entry by PMC until DHCP is done */ |
| 5850 | sme_set_dhcp_till_power_active_flag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5851 | true); |
| 5852 | |
| 5853 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 5854 | |
| 5855 | if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType) { |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5856 | pRoamProfile->ch_params.ch_width = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5857 | hdd_select_cbmode(pAdapter, |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5858 | (WLAN_HDD_GET_CTX(pAdapter))->config->AdHocChannel5G, |
| 5859 | &pRoamProfile->ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5860 | } |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5861 | |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5862 | /* |
| 5863 | * Change conn_state to connecting before sme_roam_connect(), |
| 5864 | * because sme_roam_connect() has a direct path to call |
| 5865 | * hdd_sme_roam_callback(), which will change the conn_state |
| 5866 | * If direct path, conn_state will be accordingly changed to |
| 5867 | * NotConnected or Associated by either |
| 5868 | * hdd_association_completion_handler() or hdd_dis_connect_handler() |
| 5869 | * in sme_RoamCallback()if sme_RomConnect is to be queued, |
| 5870 | * Connecting state will remain until it is completed. |
| 5871 | * |
| 5872 | * If connection state is not changed, |
| 5873 | * connection state will remain in eConnectionState_NotConnected state. |
| 5874 | * In hdd_association_completion_handler, "hddDisconInProgress" is |
| 5875 | * set to true if conn state is eConnectionState_NotConnected. |
| 5876 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5877 | * informed of connect result indication which is an issue. |
| 5878 | */ |
| 5879 | if (QDF_STA_MODE == pAdapter->device_mode || |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5880 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode) |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5881 | hdd_conn_set_connection_state(pAdapter, |
| 5882 | eConnectionState_Connecting); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5883 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5884 | status = sme_roam_connect(hHal, pAdapter->sessionId, |
| 5885 | &(pWextState->roamProfile), &roamId); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5886 | if ((QDF_STATUS_SUCCESS != status) && |
| 5887 | (QDF_STA_MODE == pAdapter->device_mode || |
| 5888 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5889 | hdd_err("sme_roam_connect failed session_id: %d status %d -> NotConnected", |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5890 | pAdapter->sessionId, status); |
| 5891 | /* change back to NotAssociated */ |
| 5892 | hdd_conn_set_connection_state(pAdapter, |
| 5893 | eConnectionState_NotConnected); |
| 5894 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5895 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5896 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5897 | |
| 5898 | EXIT(); |
| 5899 | return status; |
| 5900 | } |
| 5901 | |
| 5902 | /** |
| 5903 | * iw_set_essid() - set essid handler function |
| 5904 | * @dev: Pointer to the net device. |
| 5905 | * @info: Pointer to the iw_request_info. |
| 5906 | * @wrqu: Pointer to the iwreq_data. |
| 5907 | * @extra: Pointer to the data. |
| 5908 | * |
| 5909 | * Return: 0 for success, error number on failure |
| 5910 | */ |
| 5911 | int iw_set_essid(struct net_device *dev, |
| 5912 | struct iw_request_info *info, |
| 5913 | union iwreq_data *wrqu, char *extra) |
| 5914 | { |
| 5915 | int ret; |
| 5916 | |
| 5917 | cds_ssr_protect(__func__); |
| 5918 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5919 | cds_ssr_unprotect(__func__); |
| 5920 | |
| 5921 | return ret; |
| 5922 | } |
| 5923 | |
| 5924 | /** |
| 5925 | * __iw_get_essid() - This function returns the essid to the wpa_supplicant |
| 5926 | * @dev: pointer to the net device |
| 5927 | * @info: pointer to the iw request info |
| 5928 | * @dwrq: pointer to iw_point |
| 5929 | * @extra: pointer to the data |
| 5930 | * |
| 5931 | * Return: 0 on success, error number otherwise |
| 5932 | */ |
| 5933 | static int __iw_get_essid(struct net_device *dev, |
| 5934 | struct iw_request_info *info, |
| 5935 | struct iw_point *dwrq, char *extra) |
| 5936 | { |
| 5937 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5938 | hdd_context_t *hdd_ctx; |
| 5939 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5940 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5941 | int ret; |
| 5942 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5943 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5944 | |
| 5945 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5946 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5947 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5948 | return ret; |
| 5949 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5950 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5951 | if (0 != ret) |
| 5952 | return ret; |
| 5953 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5954 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 5955 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 5956 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected |
| 5957 | || pHddStaCtx->conn_info.connState == |
| 5958 | eConnectionState_IbssDisconnected) |
| 5959 | && wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) { |
| 5960 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 5961 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 5962 | dwrq->length); |
| 5963 | dwrq->flags = 1; |
| 5964 | } else { |
| 5965 | memset(extra, 0, dwrq->length); |
| 5966 | dwrq->length = 0; |
| 5967 | dwrq->flags = 0; |
| 5968 | } |
| 5969 | EXIT(); |
| 5970 | return 0; |
| 5971 | } |
| 5972 | |
| 5973 | /** |
| 5974 | * iw_get_essid() - get essid handler function |
| 5975 | * @dev: Pointer to the net device. |
| 5976 | * @info: Pointer to the iw_request_info. |
| 5977 | * @wrqu: Pointer to the iwreq_data. |
| 5978 | * @extra: Pointer to the data. |
| 5979 | * |
| 5980 | * Return: 0 for success, error number on failure |
| 5981 | */ |
| 5982 | int iw_get_essid(struct net_device *dev, |
| 5983 | struct iw_request_info *info, |
| 5984 | struct iw_point *wrqu, char *extra) |
| 5985 | { |
| 5986 | int ret; |
| 5987 | |
| 5988 | cds_ssr_protect(__func__); |
| 5989 | ret = __iw_get_essid(dev, info, wrqu, extra); |
| 5990 | cds_ssr_unprotect(__func__); |
| 5991 | |
| 5992 | return ret; |
| 5993 | } |
| 5994 | |
| 5995 | /** |
| 5996 | * __iw_set_auth() - |
| 5997 | * This function sets the auth type received from the wpa_supplicant |
| 5998 | * @dev: pointer to the net device |
| 5999 | * @info: pointer to the iw request info |
| 6000 | * @wrqu: pointer to iwreq_data |
| 6001 | * @extra: pointer to the data |
| 6002 | * |
| 6003 | * Return: 0 on success, error number otherwise |
| 6004 | */ |
| 6005 | static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6006 | union iwreq_data *wrqu, char *extra) |
| 6007 | { |
| 6008 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6009 | hdd_context_t *hdd_ctx; |
| 6010 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6011 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6012 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6013 | eCsrEncryptionType mcEncryptionType; |
| 6014 | eCsrEncryptionType ucEncryptionType; |
| 6015 | int ret; |
| 6016 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6017 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6018 | |
| 6019 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6020 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6021 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6022 | return ret; |
| 6023 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6024 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6025 | if (0 != ret) |
| 6026 | return ret; |
| 6027 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6028 | switch (wrqu->param.flags & IW_AUTH_INDEX) { |
| 6029 | case IW_AUTH_WPA_VERSION: |
| 6030 | pWextState->wpaVersion = wrqu->param.value; |
| 6031 | break; |
| 6032 | |
| 6033 | case IW_AUTH_CIPHER_PAIRWISE: |
| 6034 | { |
| 6035 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6036 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6037 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6038 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6039 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6040 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6041 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6042 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6043 | == |
| 6044 | (pWextState-> |
| 6045 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6046 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6047 | pHddStaCtx->conn_info.authType)) |
| 6048 | /*Dynamic WEP key */ |
| 6049 | ucEncryptionType = |
| 6050 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6051 | else |
| 6052 | /*Static WEP key */ |
| 6053 | ucEncryptionType = |
| 6054 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6055 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6056 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6057 | == |
| 6058 | (pWextState-> |
| 6059 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6060 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6061 | pHddStaCtx->conn_info.authType)) |
| 6062 | /*Dynamic WEP key */ |
| 6063 | ucEncryptionType = |
| 6064 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6065 | else |
| 6066 | /*Static WEP key */ |
| 6067 | ucEncryptionType = |
| 6068 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6069 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6070 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
| 6071 | wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6072 | return -EINVAL; |
| 6073 | } |
| 6074 | |
| 6075 | pRoamProfile->EncryptionType.numEntries = 1; |
| 6076 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 6077 | ucEncryptionType; |
| 6078 | } |
| 6079 | break; |
| 6080 | case IW_AUTH_CIPHER_GROUP: |
| 6081 | { |
| 6082 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6083 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6084 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6085 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6086 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6087 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6088 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6089 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6090 | == |
| 6091 | (pWextState-> |
| 6092 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6093 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6094 | pHddStaCtx->conn_info.authType)) |
| 6095 | mcEncryptionType = |
| 6096 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6097 | else |
| 6098 | mcEncryptionType = |
| 6099 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6100 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6101 | /* Dynamic WEP keys won't work with shared keys */ |
| 6102 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6103 | == |
| 6104 | (pWextState-> |
| 6105 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6106 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6107 | pHddStaCtx->conn_info.authType)) { |
| 6108 | mcEncryptionType = |
| 6109 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6110 | } else { |
| 6111 | mcEncryptionType = |
| 6112 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6113 | } |
| 6114 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6115 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6116 | wrqu->param.value); |
| 6117 | return -EINVAL; |
| 6118 | } |
| 6119 | |
| 6120 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 6121 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 6122 | mcEncryptionType; |
| 6123 | } |
| 6124 | break; |
| 6125 | |
| 6126 | case IW_AUTH_80211_AUTH_ALG: |
| 6127 | { |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 6128 | /* Save the auth algo here and set auth type to SME |
| 6129 | * Roam profile in the iw_set_ap_address |
| 6130 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6131 | if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
| 6132 | pHddStaCtx->conn_info.authType = |
| 6133 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6134 | |
| 6135 | else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 6136 | pHddStaCtx->conn_info.authType = |
| 6137 | eCSR_AUTH_TYPE_SHARED_KEY; |
| 6138 | |
| 6139 | else if (wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 6140 | /*Not supported */ |
| 6141 | pHddStaCtx->conn_info.authType = |
| 6142 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6143 | pWextState->roamProfile.AuthType.authType[0] = |
| 6144 | pHddStaCtx->conn_info.authType; |
| 6145 | } |
| 6146 | break; |
| 6147 | |
| 6148 | case IW_AUTH_KEY_MGMT: |
| 6149 | { |
| 6150 | #ifdef FEATURE_WLAN_ESE |
| 6151 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 6152 | /*Check for CCKM AKM type */ |
| 6153 | if (wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6154 | hdd_debug("CCKM AKM Set %d", wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6155 | /* Set the CCKM bit in authKeyMgmt */ |
| 6156 | /* |
| 6157 | * Right now, this breaks all ref to authKeyMgmt because |
| 6158 | * our code doesn't realize it is a "bitfield" |
| 6159 | */ |
| 6160 | pWextState->authKeyMgmt |= |
| 6161 | IW_AUTH_KEY_MGMT_CCKM; |
| 6162 | /* Set the key management to 802.1X */ |
| 6163 | /* pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; */ |
| 6164 | pWextState->isESEConnection = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6165 | } else if (wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 6166 | /* Save the key management */ |
| 6167 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
Jeff Johnson | 3474602 | 2017-02-07 16:32:57 -0800 | [diff] [blame] | 6168 | } else if (!(wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6169 | /* Save the key management anyway */ |
| 6170 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6171 | } else { /* It must be IW_AUTH_KEY_MGMT_802_1X */ |
| 6172 | /* Save the key management */ |
| 6173 | pWextState->authKeyMgmt |= |
| 6174 | IW_AUTH_KEY_MGMT_802_1X; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6175 | } |
| 6176 | #else |
| 6177 | /* Save the key management */ |
| 6178 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6179 | #endif /* FEATURE_WLAN_ESE */ |
| 6180 | } |
| 6181 | break; |
| 6182 | |
| 6183 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 6184 | { |
| 6185 | if (wrqu->param.value) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6186 | hdd_debug("Counter Measure started %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6187 | wrqu->param.value); |
| 6188 | pWextState->mTKIPCounterMeasures = |
| 6189 | TKIP_COUNTER_MEASURE_STARTED; |
| 6190 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6191 | hdd_debug("Counter Measure stopped=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6192 | wrqu->param.value); |
| 6193 | pWextState->mTKIPCounterMeasures = |
| 6194 | TKIP_COUNTER_MEASURE_STOPED; |
| 6195 | } |
| 6196 | } |
| 6197 | break; |
| 6198 | case IW_AUTH_DROP_UNENCRYPTED: |
| 6199 | case IW_AUTH_WPA_ENABLED: |
| 6200 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 6201 | case IW_AUTH_ROAMING_CONTROL: |
| 6202 | case IW_AUTH_PRIVACY_INVOKED: |
| 6203 | |
| 6204 | default: |
| 6205 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6206 | hdd_warn("called with unsupported auth type %d", |
| 6207 | wrqu->param.flags & IW_AUTH_INDEX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6208 | break; |
| 6209 | } |
| 6210 | |
| 6211 | EXIT(); |
| 6212 | return 0; |
| 6213 | } |
| 6214 | |
| 6215 | /** |
| 6216 | * iw_set_auth() - set auth callback function |
| 6217 | * @dev: Pointer to the net device. |
| 6218 | * @info: Pointer to the iw_request_info. |
| 6219 | * @wrqu: Pointer to the iwreq_data. |
| 6220 | * @extra: Pointer to the data. |
| 6221 | * |
| 6222 | * Return: 0 for success, error number on failure. |
| 6223 | */ |
| 6224 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6225 | union iwreq_data *wrqu, char *extra) |
| 6226 | { |
| 6227 | int ret; |
| 6228 | |
| 6229 | cds_ssr_protect(__func__); |
| 6230 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 6231 | cds_ssr_unprotect(__func__); |
| 6232 | |
| 6233 | return ret; |
| 6234 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6235 | /** |
| 6236 | * __iw_get_auth() - |
| 6237 | * This function returns the auth type to the wpa_supplicant |
| 6238 | * @dev: pointer to the net device |
| 6239 | * @info: pointer to the iw request info |
| 6240 | * @wrqu: pointer to iwreq_data |
| 6241 | * @extra: pointer to the data |
| 6242 | * |
| 6243 | * Return: 0 on success, error number otherwise |
| 6244 | */ |
| 6245 | static int __iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6246 | union iwreq_data *wrqu, char *extra) |
| 6247 | { |
| 6248 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6249 | hdd_context_t *hdd_ctx; |
| 6250 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6251 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6252 | int ret; |
| 6253 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6254 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6255 | |
| 6256 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6257 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6258 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6259 | return ret; |
| 6260 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6261 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6262 | if (0 != ret) |
| 6263 | return ret; |
| 6264 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6265 | switch (pRoamProfile->negotiatedAuthType) { |
| 6266 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 6267 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6268 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 6269 | break; |
| 6270 | case eCSR_AUTH_TYPE_WPA: |
| 6271 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6272 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 6273 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6274 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6275 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6276 | case eCSR_AUTH_TYPE_RSN: |
| 6277 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6278 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 6279 | break; |
| 6280 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 6281 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6282 | break; |
| 6283 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 6284 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 6285 | break; |
| 6286 | case eCSR_AUTH_TYPE_UNKNOWN: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6287 | hdd_debug("called with unknown auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6288 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6289 | break; |
| 6290 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 6291 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6292 | break; |
| 6293 | case eCSR_AUTH_TYPE_WPA_PSK: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6294 | hdd_debug("called with WPA PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6295 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6296 | return -EIO; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6297 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6298 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6299 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 6300 | #ifdef WLAN_FEATURE_11W |
| 6301 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 6302 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 6303 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6304 | hdd_debug("called with RSN PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6305 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6306 | return -EIO; |
| 6307 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6308 | hdd_warn("Unknown auth type: %d", |
| 6309 | pRoamProfile->negotiatedAuthType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6310 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6311 | return -EIO; |
| 6312 | } |
| 6313 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) { |
| 6314 | switch (pRoamProfile->negotiatedUCEncryptionType) { |
| 6315 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6316 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6317 | break; |
| 6318 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6319 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6320 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6321 | break; |
| 6322 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6323 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6324 | break; |
| 6325 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6326 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6327 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6328 | break; |
| 6329 | case eCSR_ENCRYPT_TYPE_AES: |
| 6330 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6331 | break; |
| 6332 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6333 | hdd_warn("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6334 | pRoamProfile->negotiatedUCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6335 | return -EIO; |
| 6336 | } |
| 6337 | } |
| 6338 | |
| 6339 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) { |
| 6340 | switch (pRoamProfile->negotiatedMCEncryptionType) { |
| 6341 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6342 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6343 | break; |
| 6344 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6345 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6346 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6347 | break; |
| 6348 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6349 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6350 | break; |
| 6351 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6352 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6353 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6354 | break; |
| 6355 | case eCSR_ENCRYPT_TYPE_AES: |
| 6356 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6357 | break; |
| 6358 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6359 | hdd_err("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6360 | pRoamProfile->negotiatedMCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6361 | return -EIO; |
| 6362 | } |
| 6363 | } |
| 6364 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6365 | hdd_debug("called with auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6366 | pRoamProfile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6367 | EXIT(); |
| 6368 | return 0; |
| 6369 | } |
| 6370 | |
| 6371 | /** |
| 6372 | * iw_get_auth() - get auth callback function |
| 6373 | * @dev: Pointer to the net device. |
| 6374 | * @info: Pointer to the iw_request_info. |
| 6375 | * @wrqu: Pointer to the iwreq_data. |
| 6376 | * @extra: Pointer to the data. |
| 6377 | * |
| 6378 | * Return: 0 for success, error number on failure. |
| 6379 | */ |
| 6380 | int iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6381 | union iwreq_data *wrqu, char *extra) |
| 6382 | { |
| 6383 | int ret; |
| 6384 | |
| 6385 | cds_ssr_protect(__func__); |
| 6386 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 6387 | cds_ssr_unprotect(__func__); |
| 6388 | |
| 6389 | return ret; |
| 6390 | } |
| 6391 | |
| 6392 | /** |
| 6393 | * __iw_set_ap_address() - set ap address |
| 6394 | * @dev: pointer to the net device |
| 6395 | * @info: pointer to the iw request info |
| 6396 | * @wrqu: pointer to iwreq_data |
| 6397 | * @extra: pointer to the data |
| 6398 | * |
| 6399 | * This function updates the HDD global station context connection info |
| 6400 | * BSSID with the MAC address received from the wpa_supplicant. |
| 6401 | * |
| 6402 | * Return: 0 on success, error number otherwise |
| 6403 | */ |
| 6404 | static int __iw_set_ap_address(struct net_device *dev, |
| 6405 | struct iw_request_info *info, |
| 6406 | union iwreq_data *wrqu, char *extra) |
| 6407 | { |
| 6408 | |
| 6409 | hdd_adapter_t *adapter; |
| 6410 | hdd_context_t *hdd_ctx; |
| 6411 | hdd_station_ctx_t *pHddStaCtx = |
| 6412 | WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 6413 | uint8_t *pMacAddress = NULL; |
| 6414 | int ret; |
| 6415 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6416 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6417 | |
| 6418 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6419 | |
| 6420 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6421 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6422 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6423 | return ret; |
| 6424 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6425 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6426 | if (0 != ret) |
| 6427 | return ret; |
| 6428 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6429 | pMacAddress = (uint8_t *) wrqu->ap_addr.sa_data; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6430 | hdd_debug(" " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMacAddress)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6431 | qdf_mem_copy(pHddStaCtx->conn_info.bssId.bytes, pMacAddress, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6432 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6433 | EXIT(); |
| 6434 | |
| 6435 | return 0; |
| 6436 | } |
| 6437 | |
| 6438 | /** |
| 6439 | * iw_set_ap_address() - set ap addresses callback function |
| 6440 | * @dev: Pointer to the net device. |
| 6441 | * @info: Pointer to the iw_request_info. |
| 6442 | * @wrqu: Pointer to the iwreq_data. |
| 6443 | * @extra: Pointer to the data. |
| 6444 | * |
| 6445 | * Return: 0 for success, error number on failure. |
| 6446 | */ |
| 6447 | int iw_set_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6448 | union iwreq_data *wrqu, char *extra) |
| 6449 | { |
| 6450 | int ret; |
| 6451 | |
| 6452 | cds_ssr_protect(__func__); |
| 6453 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 6454 | cds_ssr_unprotect(__func__); |
| 6455 | |
| 6456 | return ret; |
| 6457 | } |
| 6458 | |
| 6459 | /** |
| 6460 | * __iw_get_ap_address() - get ap address |
| 6461 | * @dev: pointer to the net device |
| 6462 | * @info: pointer to the iw request info |
| 6463 | * @wrqu: pointer to iwreq_data |
| 6464 | * @extra: pointer to the data |
| 6465 | * |
| 6466 | * This function returns currently associated BSSID. |
| 6467 | * |
| 6468 | * Return: 0 on success, error number otherwise |
| 6469 | */ |
| 6470 | static int __iw_get_ap_address(struct net_device *dev, |
| 6471 | struct iw_request_info *info, |
| 6472 | union iwreq_data *wrqu, char *extra) |
| 6473 | { |
| 6474 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6475 | hdd_context_t *hdd_ctx; |
| 6476 | hdd_station_ctx_t *pHddStaCtx = |
| 6477 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6478 | int ret; |
| 6479 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6480 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6481 | |
| 6482 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6483 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6484 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6485 | return ret; |
| 6486 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6487 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6488 | if (0 != ret) |
| 6489 | return ret; |
| 6490 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6491 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated || |
| 6492 | eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6493 | qdf_mem_copy(wrqu->ap_addr.sa_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6494 | pHddStaCtx->conn_info.bssId.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6495 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6496 | } else { |
| 6497 | memset(wrqu->ap_addr.sa_data, 0, sizeof(wrqu->ap_addr.sa_data)); |
| 6498 | } |
| 6499 | EXIT(); |
| 6500 | return 0; |
| 6501 | } |
| 6502 | |
| 6503 | /** |
| 6504 | * iw_get_ap_address() - get ap addresses callback function |
| 6505 | * @dev: Pointer to the net device. |
| 6506 | * @info: Pointer to the iw_request_info. |
| 6507 | * @wrqu: Pointer to the iwreq_data. |
| 6508 | * @extra: Pointer to the data. |
| 6509 | * |
| 6510 | * Return: 0 for success, error number on failure. |
| 6511 | */ |
| 6512 | int iw_get_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6513 | union iwreq_data *wrqu, char *extra) |
| 6514 | { |
| 6515 | int ret; |
| 6516 | |
| 6517 | cds_ssr_protect(__func__); |
| 6518 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 6519 | cds_ssr_unprotect(__func__); |
| 6520 | |
| 6521 | return ret; |
| 6522 | } |