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 |
| 168 | * @pAdapter: pointer to the adapter |
| 169 | * @connState: connection state |
| 170 | * |
| 171 | * This function updates the global HDD station context connection state. |
| 172 | * |
| 173 | * Return: none |
| 174 | */ |
| 175 | void hdd_conn_set_connection_state(hdd_adapter_t *pAdapter, |
| 176 | eConnectionState connState) |
| 177 | { |
| 178 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 179 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 180 | |
| 181 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 182 | hdd_debug("%pS Changed connectionState Changed from oldState:%d to State:%d", |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 183 | (void *)_RET_IP_, pHddStaCtx->conn_info.connState, |
| 184 | connState); |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame^] | 185 | |
| 186 | hdd_tsf_notify_wlan_state_change(pAdapter, |
| 187 | pHddStaCtx->conn_info.connState, |
| 188 | connState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 189 | pHddStaCtx->conn_info.connState = connState; |
| 190 | |
| 191 | /* Check is pending ROC request or not when connection state changed */ |
| 192 | schedule_delayed_work(&pHddCtx->roc_req_work, 0); |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * hdd_conn_get_connection_state() - get connection state |
| 197 | * @pAdapter: pointer to the adapter |
| 198 | * @pConnState: pointer to connection state |
| 199 | * |
| 200 | * This function updates the global HDD station context connection state. |
| 201 | * |
| 202 | * Return: true if (Infra Associated or IBSS Connected) |
| 203 | * and sets output parameter pConnState; |
| 204 | * false otherwise |
| 205 | */ |
| 206 | static inline bool hdd_conn_get_connection_state(hdd_station_ctx_t *pHddStaCtx, |
| 207 | eConnectionState *pConnState) |
| 208 | { |
| 209 | bool fConnected = false; |
| 210 | eConnectionState connState; |
| 211 | |
| 212 | /* get the connection state. */ |
| 213 | connState = pHddStaCtx->conn_info.connState; |
| 214 | |
| 215 | if (eConnectionState_Associated == connState || |
| 216 | eConnectionState_IbssConnected == connState || |
| 217 | eConnectionState_IbssDisconnected == connState) { |
| 218 | fConnected = true; |
| 219 | } |
| 220 | |
| 221 | if (pConnState) |
| 222 | *pConnState = connState; |
| 223 | |
| 224 | return fConnected; |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * hdd_is_connecting() - Function to check connection progress |
| 229 | * @hdd_sta_ctx: pointer to global HDD Station context |
| 230 | * |
| 231 | * Return: true if connecting, false otherwise |
| 232 | */ |
| 233 | bool hdd_is_connecting(hdd_station_ctx_t *hdd_sta_ctx) |
| 234 | { |
| 235 | return hdd_sta_ctx->conn_info.connState == |
| 236 | eConnectionState_Connecting; |
| 237 | } |
| 238 | |
| 239 | /** |
| 240 | * hdd_conn_is_connected() - Function to check connection status |
| 241 | * @pHddStaCtx: pointer to global HDD Station context |
| 242 | * |
| 243 | * Return: false if any errors encountered, true otherwise |
| 244 | */ |
| 245 | bool hdd_conn_is_connected(hdd_station_ctx_t *pHddStaCtx) |
| 246 | { |
| 247 | return hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * hdd_conn_get_connected_band() - get current connection radio band |
| 252 | * @pHddStaCtx: pointer to global HDD Station context |
| 253 | * |
| 254 | * Return: eCSR_BAND_24 or eCSR_BAND_5G based on current AP connection |
| 255 | * eCSR_BAND_ALL if not connected |
| 256 | */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 257 | 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] | 258 | { |
| 259 | uint8_t staChannel = 0; |
| 260 | |
| 261 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 262 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 263 | |
| 264 | if (staChannel > 0 && staChannel < 14) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 265 | return BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 266 | else if (staChannel >= 36 && staChannel <= 184) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 267 | return BAND_5G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 268 | else /* If station is not connected return as eCSR_BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 269 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | /** |
| 273 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
| 274 | * @pHddStaCtx: pointer to global HDD Station context |
| 275 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 276 | * |
| 277 | * Return: false if any errors encountered, true otherwise |
| 278 | */ |
| 279 | static inline bool |
| 280 | hdd_conn_get_connected_cipher_algo(hdd_station_ctx_t *pHddStaCtx, |
| 281 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 282 | { |
| 283 | bool fConnected = false; |
| 284 | |
| 285 | fConnected = hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 286 | |
| 287 | if (pConnectedCipherAlgo) |
| 288 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 289 | |
| 290 | return fConnected; |
| 291 | } |
| 292 | |
| 293 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 294 | * hdd_remove_beacon_filter() - remove beacon filter |
| 295 | * @adapter: Pointer to the hdd adapter |
| 296 | * |
| 297 | * Return: 0 on success and errno on failure |
| 298 | */ |
| 299 | static int hdd_remove_beacon_filter(hdd_adapter_t *adapter) |
| 300 | { |
| 301 | QDF_STATUS status; |
| 302 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 303 | |
| 304 | status = sme_remove_beacon_filter(hdd_ctx->hHal, |
| 305 | adapter->sessionId); |
| 306 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 307 | hdd_err("sme_remove_beacon_filter() failed"); |
| 308 | return -EFAULT; |
| 309 | } |
| 310 | |
| 311 | return 0; |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * hdd_add_beacon_filter() - add beacon filter |
| 316 | * @adapter: Pointer to the hdd adapter |
| 317 | * |
| 318 | * Return: 0 on success and errno on failure |
| 319 | */ |
| 320 | static int hdd_add_beacon_filter(hdd_adapter_t *adapter) |
| 321 | { |
| 322 | int i; |
| 323 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 324 | QDF_STATUS status; |
| 325 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 326 | |
| 327 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 328 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 329 | (unsigned long int *)ie_map); |
| 330 | |
| 331 | status = sme_add_beacon_filter(hdd_ctx->hHal, |
| 332 | adapter->sessionId, ie_map); |
| 333 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 334 | hdd_err("sme_add_beacon_filter() failed"); |
| 335 | return -EFAULT; |
| 336 | } |
| 337 | return 0; |
| 338 | } |
| 339 | |
| 340 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 341 | * hdd_copy_vht_caps()- copy vht caps info from roam info to |
| 342 | * hdd station context. |
| 343 | * @hdd_sta_ctx: pointer to hdd station context |
| 344 | * @roam_info: pointer to roam info |
| 345 | * |
| 346 | * Return: None |
| 347 | */ |
| 348 | static void hdd_copy_ht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 349 | tCsrRoamInfo *roam_info) |
| 350 | { |
| 351 | tDot11fIEHTCaps *roam_ht_cap = &roam_info->ht_caps; |
| 352 | struct ieee80211_ht_cap *hdd_ht_cap = &hdd_sta_ctx->conn_info.ht_caps; |
| 353 | uint32_t i, temp_ht_cap; |
| 354 | |
| 355 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 356 | |
| 357 | if (roam_ht_cap->advCodingCap) |
| 358 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 359 | if (roam_ht_cap->supportedChannelWidthSet) |
| 360 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 361 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 362 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 363 | if (temp_ht_cap) |
| 364 | hdd_ht_cap->cap_info |= |
| 365 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 366 | if (roam_ht_cap->greenField) |
| 367 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 368 | if (roam_ht_cap->shortGI20MHz) |
| 369 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 370 | if (roam_ht_cap->shortGI40MHz) |
| 371 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 372 | if (roam_ht_cap->txSTBC) |
| 373 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 374 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 375 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 376 | if (temp_ht_cap) |
| 377 | hdd_ht_cap->cap_info |= |
| 378 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 379 | if (roam_ht_cap->delayedBA) |
| 380 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 381 | if (roam_ht_cap->maximalAMSDUsize) |
| 382 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 383 | if (roam_ht_cap->dsssCckMode40MHz) |
| 384 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 385 | if (roam_ht_cap->psmp) |
| 386 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 387 | if (roam_ht_cap->stbcControlFrame) |
| 388 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 389 | if (roam_ht_cap->lsigTXOPProtection) |
| 390 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 391 | |
| 392 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 393 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 394 | hdd_ht_cap->ampdu_params_info |= |
| 395 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 396 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 397 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 398 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 399 | if (temp_ht_cap) |
| 400 | hdd_ht_cap->ampdu_params_info |= |
| 401 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 402 | |
| 403 | /* 802.11n HT extended capabilities masks */ |
| 404 | if (roam_ht_cap->pco) |
| 405 | hdd_ht_cap->extended_ht_cap_info |= |
| 406 | IEEE80211_HT_EXT_CAP_PCO; |
| 407 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 408 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 409 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 410 | if (temp_ht_cap) |
| 411 | hdd_ht_cap->extended_ht_cap_info |= |
| 412 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 413 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 414 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 415 | if (temp_ht_cap) |
| 416 | hdd_ht_cap->extended_ht_cap_info |= |
| 417 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 418 | |
| 419 | /* tx_bf_cap_info capabilities */ |
| 420 | if (roam_ht_cap->txBF) |
| 421 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 422 | if (roam_ht_cap->rxStaggeredSounding) |
| 423 | hdd_ht_cap->tx_BF_cap_info |= |
| 424 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 425 | if (roam_ht_cap->txStaggeredSounding) |
| 426 | hdd_ht_cap->tx_BF_cap_info |= |
| 427 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 428 | if (roam_ht_cap->rxZLF) |
| 429 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 430 | if (roam_ht_cap->txZLF) |
| 431 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 432 | if (roam_ht_cap->implicitTxBF) |
| 433 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 434 | temp_ht_cap = roam_ht_cap->calibration & |
| 435 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 436 | if (temp_ht_cap) |
| 437 | hdd_ht_cap->tx_BF_cap_info |= |
| 438 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 439 | if (roam_ht_cap->explicitCSITxBF) |
| 440 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 441 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 442 | hdd_ht_cap->tx_BF_cap_info |= |
| 443 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 444 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 445 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 446 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 447 | if (temp_ht_cap) |
| 448 | hdd_ht_cap->tx_BF_cap_info |= |
| 449 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 450 | temp_ht_cap = |
| 451 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 452 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 453 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 454 | if (temp_ht_cap) |
| 455 | hdd_ht_cap->tx_BF_cap_info |= |
| 456 | temp_ht_cap << |
| 457 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 458 | temp_ht_cap = |
| 459 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 460 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 461 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 462 | if (temp_ht_cap) |
| 463 | hdd_ht_cap->tx_BF_cap_info |= |
| 464 | temp_ht_cap << |
| 465 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 466 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 467 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 468 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 469 | if (temp_ht_cap) |
| 470 | hdd_ht_cap->tx_BF_cap_info |= |
| 471 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 472 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 473 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 474 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 475 | if (temp_ht_cap) |
| 476 | hdd_ht_cap->tx_BF_cap_info |= |
| 477 | temp_ht_cap << |
| 478 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 479 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 480 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 481 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 482 | if (temp_ht_cap) |
| 483 | hdd_ht_cap->tx_BF_cap_info |= |
| 484 | temp_ht_cap << |
| 485 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 486 | |
| 487 | /* antenna selection */ |
| 488 | if (roam_ht_cap->antennaSelection) |
| 489 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 490 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 491 | hdd_ht_cap->antenna_selection_info |= |
| 492 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 493 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 494 | hdd_ht_cap->antenna_selection_info |= |
| 495 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 496 | if (roam_ht_cap->explicitCSIFeedback) |
| 497 | hdd_ht_cap->antenna_selection_info |= |
| 498 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 499 | if (roam_ht_cap->antennaIndicesFeedback) |
| 500 | hdd_ht_cap->antenna_selection_info |= |
| 501 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 502 | if (roam_ht_cap->rxAS) |
| 503 | hdd_ht_cap->antenna_selection_info |= |
| 504 | ANTENNA_SEL_INFO_RX_AS; |
| 505 | if (roam_ht_cap->txSoundingPPDUs) |
| 506 | hdd_ht_cap->antenna_selection_info |= |
| 507 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 508 | |
| 509 | /* mcs data rate */ |
| 510 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 511 | hdd_ht_cap->mcs.rx_mask[i] = |
| 512 | roam_ht_cap->supportedMCSSet[i]; |
| 513 | hdd_ht_cap->mcs.rx_highest = |
| 514 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 515 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
| 516 | hdd_ht_cap->mcs.tx_params = |
| 517 | roam_ht_cap->supportedMCSSet[12]; |
| 518 | } |
| 519 | |
| 520 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 521 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 522 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 523 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 524 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 525 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 526 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 527 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 528 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 529 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 530 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 531 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 532 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 533 | |
| 534 | /** |
| 535 | * hdd_copy_ht_caps()- copy ht caps info from roam info to |
| 536 | * hdd station context. |
| 537 | * @hdd_sta_ctx: pointer to hdd station context |
| 538 | * @roam_info: pointer to roam info |
| 539 | * |
| 540 | * Return: None |
| 541 | */ |
| 542 | static void hdd_copy_vht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 543 | tCsrRoamInfo *roam_info) |
| 544 | { |
| 545 | tDot11fIEVHTCaps *roam_vht_cap = &roam_info->vht_caps; |
| 546 | struct ieee80211_vht_cap *hdd_vht_cap = |
| 547 | &hdd_sta_ctx->conn_info.vht_caps; |
| 548 | uint32_t temp_vht_cap; |
| 549 | |
| 550 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 551 | |
| 552 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 553 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 554 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 555 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 556 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
| 557 | if (temp_vht_cap) |
| 558 | if (roam_vht_cap->supportedChannelWidthSet & |
| 559 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 560 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 561 | hdd_vht_cap->vht_cap_info |= |
| 562 | temp_vht_cap << |
| 563 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 564 | if (roam_vht_cap->supportedChannelWidthSet & |
| 565 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 566 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 567 | hdd_vht_cap->vht_cap_info |= |
| 568 | temp_vht_cap << |
| 569 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
| 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 |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1940 | hdd_notice("WAPI STA Registered: %d", |
| 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); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2115 | if (final_req_ie == NULL) |
| 2116 | goto done; |
| 2117 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2118 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2119 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2120 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2121 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2122 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2123 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2124 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2125 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2126 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Varun Reddy Yeturu | c13305e | 2017-03-10 14:05:02 -0800 | [diff] [blame] | 2127 | cfg80211_roamed_bss(dev, bss, |
| 2128 | final_req_ie, (ssid_ie_len + reqRsnLength), |
| 2129 | rspRsnIe, rspRsnLength, GFP_KERNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2130 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2131 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2132 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2133 | pCsrRoamInfo->nAssocReqLength); |
| 2134 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2135 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2136 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2137 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2138 | |
Prakash Dhavali | 989127d | 2016-11-29 14:56:44 +0530 | [diff] [blame] | 2139 | wlan_hdd_send_roam_auth_event(pAdapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2140 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2141 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2142 | pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2143 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2144 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2145 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2146 | qdf_mem_free(final_req_ie); |
| 2147 | qdf_mem_free(rspRsnIe); |
| 2148 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2149 | } |
| 2150 | |
| 2151 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2152 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2153 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2154 | * |
| 2155 | * Return: roam sync status if roaming offloaded else false |
| 2156 | */ |
| 2157 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2158 | bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2159 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2160 | if (roaminfo) |
| 2161 | return roaminfo->roamSynchInProgress; |
| 2162 | else |
| 2163 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2164 | } |
| 2165 | #endif |
| 2166 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2167 | /** |
| 2168 | * hdd_get_ibss_peer_staid() - get sta id for IBSS peer |
| 2169 | * @hddstactx: pointer to HDD sta context |
| 2170 | * @roaminfo: pointer to roaminfo structure |
| 2171 | * |
| 2172 | * This function returns staid for IBSS peer. If peer is broadcast |
| 2173 | * MAC address return self staid(0) else find the peer sta id of |
| 2174 | * the peer. |
| 2175 | * |
| 2176 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2177 | */ |
| 2178 | static uint8_t hdd_get_ibss_peer_staid(hdd_station_ctx_t *hddstactx, |
| 2179 | tCsrRoamInfo *roaminfo) |
| 2180 | { |
| 2181 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
| 2182 | QDF_STATUS status; |
| 2183 | |
| 2184 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
| 2185 | staid = 0; |
| 2186 | } else { |
| 2187 | status = hdd_get_peer_sta_id(hddstactx, |
| 2188 | &roaminfo->peerMac, &staid); |
| 2189 | if (status != QDF_STATUS_SUCCESS) { |
| 2190 | hdd_err("Unable to find staid for " MAC_ADDRESS_STR, |
| 2191 | MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | return staid; |
| 2196 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2197 | |
| 2198 | /** |
| 2199 | * hdd_change_sta_state_authenticated()- |
| 2200 | * This function changes STA state to authenticated |
| 2201 | * @adapter: pointer to the adapter structure. |
| 2202 | * @roaminfo: pointer to the RoamInfo structure. |
| 2203 | * |
| 2204 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2205 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2206 | * |
| 2207 | * Return: 0 on success and errno on failure |
| 2208 | */ |
| 2209 | static int hdd_change_sta_state_authenticated(hdd_adapter_t *adapter, |
| 2210 | tCsrRoamInfo *roaminfo) |
| 2211 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2212 | QDF_STATUS status; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2213 | uint32_t timeout; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2214 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2215 | 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] | 2216 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2217 | |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2218 | timeout = hddstactx->hdd_ReassocScenario ? |
| 2219 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2220 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2221 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2222 | if (QDF_IBSS_MODE == adapter->device_mode) |
| 2223 | staid = hdd_get_ibss_peer_staid(hddstactx, roaminfo); |
| 2224 | else |
| 2225 | staid = hddstactx->conn_info.staId[0]; |
| 2226 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2227 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", staid); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2228 | |
| 2229 | /* Connections that do not need Upper layer authentication, |
| 2230 | * transition TL to 'Authenticated' state after the keys are set |
| 2231 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2232 | status = hdd_change_peer_state(adapter, staid, OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2233 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2234 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2235 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
| 2236 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2237 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 2238 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2239 | sme_ps_enable_auto_ps_timer( |
| 2240 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 2241 | adapter->sessionId, |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2242 | timeout, false); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2243 | } |
| 2244 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2245 | return qdf_status_to_os_return(status); |
| 2246 | } |
| 2247 | |
| 2248 | /** |
| 2249 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2250 | * if key installation is required |
| 2251 | * @encr_type: encryption type |
| 2252 | * |
| 2253 | * Return: true if key installation is required and false otherwise. |
| 2254 | */ |
| 2255 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2256 | eCsrEncryptionType encr_type) |
| 2257 | { |
| 2258 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2259 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2260 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
| 2261 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2262 | return true; |
| 2263 | else |
| 2264 | return false; |
| 2265 | } |
| 2266 | |
| 2267 | /** |
| 2268 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2269 | * complete |
| 2270 | * @adapter: pointer to HDD adapter |
| 2271 | * @roaminfo: pointer to roam info |
| 2272 | * @roam_result: roam result |
| 2273 | * |
| 2274 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2275 | * This function checks for the successful set key completion and update |
| 2276 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2277 | * |
| 2278 | * Return: None |
| 2279 | */ |
| 2280 | static void hdd_change_peer_state_after_set_key(hdd_adapter_t *adapter, |
| 2281 | tCsrRoamInfo *roaminfo, eCsrRoamResult roam_result) |
| 2282 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2283 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 2284 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.ucEncryptionType; |
| 2285 | |
| 2286 | /* |
| 2287 | * If the security mode is one of the following, IBSS peer will be |
| 2288 | * waiting in CONN state and we will move the peer state to AUTH |
| 2289 | * here. For non-secure connection, no need to wait for set-key complete |
| 2290 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2291 | */ |
| 2292 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2293 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2294 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2295 | |
| 2296 | return; |
| 2297 | } |
| 2298 | |
| 2299 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2300 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2301 | /* |
| 2302 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2303 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2304 | * after roaming. STA TL state moves to authenticated only if |
| 2305 | * ptk_installed is true. So, make ptk_installed to true in |
| 2306 | * case of 11R roaming. |
| 2307 | */ |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2308 | if (sme_neighbor_roam_is11r_assoc(WLAN_HDD_GET_HAL_CTX(adapter), |
| 2309 | adapter->sessionId)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2310 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2311 | } else { |
| 2312 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2313 | } |
| 2314 | |
| 2315 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2316 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2317 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2318 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2319 | * set the unicast and broadcast key. |
| 2320 | */ |
| 2321 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2322 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2323 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2324 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2325 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2326 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2327 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2328 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2329 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2330 | } |
| 2331 | |
| 2332 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2333 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2334 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2335 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2336 | } |
| 2337 | |
| 2338 | hdd_sta_ctx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2339 | |
| 2340 | return; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2341 | } |
| 2342 | |
| 2343 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2344 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
| 2345 | * @pAdapter: pointer to adapter |
| 2346 | * @pRoamInfo: pointer to roam info |
| 2347 | * @roamId: roam id |
| 2348 | * @roamStatus: roam status |
| 2349 | * @roamResult: roam result |
| 2350 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2351 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2352 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2353 | 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] | 2354 | tCsrRoamInfo *pRoamInfo, |
| 2355 | uint32_t roamId, |
| 2356 | eRoamCmdStatus roamStatus, |
| 2357 | eCsrRoamResult roamResult) |
| 2358 | { |
| 2359 | eCsrEncryptionType connectedCipherAlgo; |
| 2360 | bool fConnected = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2361 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2362 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2363 | ENTER(); |
| 2364 | |
| 2365 | if (NULL == pRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2366 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2367 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2368 | } |
| 2369 | /* |
| 2370 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2371 | * then go to 'authenticated'. For all other authentication types |
| 2372 | * (those that do not require upper layer authentication) we can put TL |
| 2373 | * directly into 'authenticated' state. |
| 2374 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2375 | hdd_info("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2376 | MAC_ADDRESS_STR, roamStatus, roamResult, |
| 2377 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 2378 | |
| 2379 | fConnected = hdd_conn_get_connected_cipher_algo(pHddStaCtx, |
| 2380 | &connectedCipherAlgo); |
| 2381 | if (fConnected) { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2382 | hdd_change_peer_state_after_set_key(pAdapter, pRoamInfo, |
| 2383 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2384 | } else { |
| 2385 | /* |
| 2386 | * possible disassoc after issuing set key and waiting |
| 2387 | * set key complete. |
| 2388 | */ |
| 2389 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2390 | } |
| 2391 | |
| 2392 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2393 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2394 | } |
| 2395 | |
| 2396 | /** |
| 2397 | * hdd_perform_roam_set_key_complete() - perform set key complete |
| 2398 | * @pAdapter: pointer to adapter |
| 2399 | * |
| 2400 | * Return: none |
| 2401 | */ |
| 2402 | void hdd_perform_roam_set_key_complete(hdd_adapter_t *pAdapter) |
| 2403 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2404 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2405 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2406 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2407 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2408 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2409 | qdf_mem_copy(roamInfo.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2410 | pHddStaCtx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2411 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2412 | pHddStaCtx->roam_info.peerMac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2413 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2414 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2415 | hdd_roam_set_key_complete_handler(pAdapter, |
| 2416 | &roamInfo, |
| 2417 | pHddStaCtx->roam_info.roamId, |
| 2418 | pHddStaCtx->roam_info.roamStatus, |
| 2419 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2420 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2421 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2422 | |
| 2423 | pHddStaCtx->roam_info.deferKeyComplete = false; |
| 2424 | } |
| 2425 | |
| 2426 | /** |
| 2427 | * hdd_association_completion_handler() - association completion handler |
| 2428 | * @pAdapter: pointer to adapter |
| 2429 | * @pRoamInfo: pointer to roam info |
| 2430 | * @roamId: roam id |
| 2431 | * @roamStatus: roam status |
| 2432 | * @roamResult: roam result |
| 2433 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2434 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2435 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2436 | static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2437 | tCsrRoamInfo *pRoamInfo, |
| 2438 | uint32_t roamId, |
| 2439 | eRoamCmdStatus roamStatus, |
| 2440 | eCsrRoamResult roamResult) |
| 2441 | { |
| 2442 | struct net_device *dev = pAdapter->dev; |
| 2443 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2444 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2445 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2446 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2447 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2448 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2449 | bool hddDisconInProgress = false; |
| 2450 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2451 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2452 | bool ok; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2453 | |
| 2454 | if (!pHddCtx) { |
| 2455 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2456 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2457 | } |
| 2458 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2459 | /* validate config */ |
| 2460 | if (!pHddCtx->config) { |
| 2461 | hdd_err("config is NULL"); |
| 2462 | return QDF_STATUS_E_NULL_VALUE; |
| 2463 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2464 | /* HDD has initiated disconnect, do not send connect result indication |
| 2465 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2466 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2467 | if (((eConnectionState_Disconnecting == |
| 2468 | pHddStaCtx->conn_info.connState) || |
| 2469 | (eConnectionState_NotConnected == |
| 2470 | pHddStaCtx->conn_info.connState)) && |
| 2471 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2472 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2473 | hdd_info("Disconnect from HDD in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2474 | hddDisconInProgress = true; |
| 2475 | } |
| 2476 | |
| 2477 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
| 2478 | if (NULL == pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2479 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2480 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2481 | } |
| 2482 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2483 | hdd_conn_set_connection_state(pAdapter, |
| 2484 | eConnectionState_Associated); |
| 2485 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2486 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2487 | /* Save the connection info from CSR... */ |
| 2488 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, |
| 2489 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2490 | |
| 2491 | if (hdd_add_beacon_filter(pAdapter) != 0) |
| 2492 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2493 | #ifdef FEATURE_WLAN_WAPI |
| 2494 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2495 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
| 2496 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2497 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
| 2498 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2499 | } else { |
| 2500 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2501 | } |
| 2502 | #endif /* FEATURE_WLAN_WAPI */ |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2503 | hdd_debug("bss_descr[%d] devicemode[%d]", !!pRoamInfo->pBssDesc, |
| 2504 | pAdapter->device_mode); |
| 2505 | if ((QDF_STA_MODE == pAdapter->device_mode) && |
| 2506 | pRoamInfo->pBssDesc) { |
| 2507 | ie_len = GET_IE_LEN_IN_BSS(pRoamInfo->pBssDesc->length); |
| 2508 | pHddStaCtx->ap_supports_immediate_power_save = |
| 2509 | wlan_hdd_is_ap_supports_immediate_power_save( |
| 2510 | (uint8_t *) pRoamInfo->pBssDesc->ieFields, |
| 2511 | ie_len); |
| 2512 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
| 2513 | pHddStaCtx->ap_supports_immediate_power_save); |
| 2514 | } |
| 2515 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2516 | /* Indicate 'connect' status to user space */ |
| 2517 | hdd_send_association_event(dev, pRoamInfo); |
| 2518 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2519 | if (policy_mgr_is_mcc_in_24G(pHddCtx->hdd_psoc)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2520 | if (pHddCtx->miracast_value) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2521 | wlan_hdd_set_mas(pAdapter, |
| 2522 | pHddCtx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2523 | } |
| 2524 | |
| 2525 | /* Initialize the Linkup event completion variable */ |
| 2526 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2527 | |
| 2528 | /* |
| 2529 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2530 | * the device properly. Before allowing any packet to go up to |
| 2531 | * the application, device activation has to be ensured for |
| 2532 | * proper queue mapping by the kernel. we have registered net |
| 2533 | * device notifier for device change notification. With this we |
| 2534 | * will come to know that the device is getting |
| 2535 | * activated properly. |
| 2536 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2537 | if (pHddStaCtx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2538 | /* |
| 2539 | * Enable Linkup Event Servicing which allows the net |
| 2540 | * device notifier to set the linkup event variable. |
| 2541 | */ |
| 2542 | pAdapter->isLinkUpSvcNeeded = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2543 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2544 | /* Switch on the Carrier to activate the device */ |
| 2545 | wlan_hdd_netif_queue_control(pAdapter, |
| 2546 | WLAN_NETIF_CARRIER_ON, |
| 2547 | WLAN_CONTROL_PATH); |
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 | /* |
| 2550 | * Wait for the Link to up to ensure all the queues |
| 2551 | * are set properly by the kernel. |
| 2552 | */ |
| 2553 | rc = wait_for_completion_timeout( |
| 2554 | &pAdapter->linkup_event_var, |
| 2555 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2556 | ); |
| 2557 | if (!rc) |
| 2558 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2559 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2560 | /* |
| 2561 | * Disable Linkup Event Servicing - no more service |
| 2562 | * required from the net device notifier call. |
| 2563 | */ |
| 2564 | pAdapter->isLinkUpSvcNeeded = false; |
| 2565 | } else { |
| 2566 | pHddStaCtx->ft_carrier_on = false; |
| 2567 | ft_carrier_on = true; |
| 2568 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2569 | if ((WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId) |
| 2570 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2571 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2572 | hdd_err("Wrong Staid: %d", pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2573 | |
| 2574 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2575 | |
| 2576 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 2577 | hdd_ipa_wlan_evt(pAdapter, pRoamInfo->staId, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 2578 | HDD_IPA_STA_CONNECT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2579 | pRoamInfo->bssid.bytes); |
| 2580 | |
| 2581 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2582 | wlan_hdd_auto_shutdown_enable(pHddCtx, false); |
| 2583 | #endif |
| 2584 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2585 | hdd_debug("check if STA chan ok for DNBS"); |
| 2586 | if (policy_mgr_is_chan_ok_for_dnbs(pHddCtx->hdd_psoc, |
| 2587 | pHddStaCtx->conn_info.operationChannel, |
| 2588 | &ok)) { |
| 2589 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
| 2590 | pHddStaCtx->conn_info.operationChannel); |
| 2591 | return QDF_STATUS_E_FAILURE; |
| 2592 | } |
| 2593 | |
| 2594 | if (!ok) { |
| 2595 | hdd_err("Chan:%d not suitable for DNBS", |
| 2596 | pHddStaCtx->conn_info.operationChannel); |
| 2597 | wlan_hdd_netif_queue_control(pAdapter, |
| 2598 | WLAN_NETIF_CARRIER_OFF, |
| 2599 | WLAN_CONTROL_PATH); |
| 2600 | if (!hddDisconInProgress) { |
| 2601 | hdd_err("Disconnecting..."); |
| 2602 | sme_roam_disconnect( |
| 2603 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2604 | pAdapter->sessionId, |
| 2605 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2606 | } |
| 2607 | return QDF_STATUS_E_FAILURE; |
| 2608 | } |
| 2609 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2610 | hdd_debug("check for SAP restart"); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2611 | policy_mgr_check_concurrent_intf_and_restart_sap( |
| 2612 | pHddCtx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2613 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2614 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 2615 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2616 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2617 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2618 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2619 | /* |
| 2620 | * For reassoc, the station is already registered, all we need |
| 2621 | * is to change the state of the STA in TL. |
| 2622 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2623 | * CONNECTED instead of AUTHENTICATED. |
| 2624 | */ |
| 2625 | if (!pRoamInfo->fReassocReq) { |
| 2626 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2627 | u8 *pFTAssocRsp = NULL; |
| 2628 | unsigned int assocRsplen = 0; |
| 2629 | u8 *pFTAssocReq = NULL; |
| 2630 | unsigned int assocReqlen = 0; |
| 2631 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2632 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2633 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2634 | |
| 2635 | /* add bss_id to cfg80211 data base */ |
| 2636 | bss = |
| 2637 | wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 2638 | pRoamInfo); |
| 2639 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2640 | hdd_err("wlan: Not able to create BSS entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2641 | wlan_hdd_netif_queue_control(pAdapter, |
| 2642 | WLAN_NETIF_CARRIER_OFF, |
| 2643 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2644 | if (!hddDisconInProgress) { |
| 2645 | /* |
| 2646 | * Here driver was not able to add bss |
| 2647 | * in cfg80211 database this can happen |
| 2648 | * if connected channel is not valid, |
| 2649 | * i.e reg domain was changed during |
| 2650 | * connection. Queue disconnect for the |
| 2651 | * session if disconnect is not in |
| 2652 | * progress. |
| 2653 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2654 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2655 | sme_roam_disconnect( |
| 2656 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2657 | pAdapter->sessionId, |
| 2658 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2659 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2660 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2661 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2662 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2663 | eCSR_AUTH_TYPE_FT_RSN |
| 2664 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2665 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
| 2666 | |
| 2667 | /* Association Response */ |
| 2668 | pFTAssocRsp = |
| 2669 | (u8 *) (pRoamInfo->pbFrames + |
| 2670 | pRoamInfo->nBeaconLength + |
| 2671 | pRoamInfo->nAssocReqLength); |
| 2672 | if (pFTAssocRsp != NULL) { |
| 2673 | /* |
| 2674 | * pFTAssocRsp needs to point to the IEs |
| 2675 | */ |
| 2676 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2677 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2678 | (unsigned int)pFTAssocRsp[0], |
| 2679 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2680 | assocRsplen = |
| 2681 | pRoamInfo->nAssocRspLength - |
| 2682 | FT_ASSOC_RSP_IES_OFFSET; |
| 2683 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2684 | hdd_debug("AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2685 | assocRsplen = 0; |
| 2686 | } |
| 2687 | |
| 2688 | /* Association Request */ |
| 2689 | pFTAssocReq = (u8 *) (pRoamInfo->pbFrames + |
| 2690 | pRoamInfo->nBeaconLength); |
| 2691 | if (pFTAssocReq != NULL) { |
| 2692 | if (!ft_carrier_on) { |
| 2693 | /* |
| 2694 | * pFTAssocReq needs to point to |
| 2695 | * the IEs |
| 2696 | */ |
| 2697 | pFTAssocReq += |
| 2698 | FT_ASSOC_REQ_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2699 | hdd_debug("pFTAssocReq is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2700 | (unsigned int) |
| 2701 | pFTAssocReq[0], |
| 2702 | (unsigned int) |
| 2703 | pFTAssocReq[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2704 | assocReqlen = |
| 2705 | pRoamInfo->nAssocReqLength - |
| 2706 | FT_ASSOC_REQ_IES_OFFSET; |
| 2707 | } else { |
| 2708 | /* |
| 2709 | * This should contain only the |
| 2710 | * FTIEs |
| 2711 | */ |
| 2712 | assocReqlen = |
| 2713 | pRoamInfo->nAssocReqLength; |
| 2714 | } |
| 2715 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2716 | hdd_debug("AssocReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2717 | assocReqlen = 0; |
| 2718 | } |
| 2719 | |
| 2720 | if (ft_carrier_on) { |
| 2721 | if (!hddDisconInProgress) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2722 | struct cfg80211_bss *roam_bss; |
| 2723 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2724 | /* |
| 2725 | * After roaming is completed, |
| 2726 | * active session count is |
| 2727 | * incremented as a part of |
| 2728 | * connect indication but |
| 2729 | * effectively the active |
| 2730 | * session count should still |
| 2731 | * be the same and hence upon |
| 2732 | * successful reassoc |
| 2733 | * decrement the active session |
| 2734 | * count here. |
| 2735 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2736 | if (!hdd_is_roam_sync_in_progress |
| 2737 | (pRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2738 | policy_mgr_decr_session_set_pcl( |
| 2739 | pHddCtx->hdd_psoc, |
| 2740 | pAdapter->device_mode, |
| 2741 | pAdapter->sessionId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2742 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2743 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | chan = |
| 2745 | ieee80211_get_channel |
| 2746 | (pAdapter->wdev.wiphy, |
| 2747 | (int)pRoamInfo->pBssDesc-> |
| 2748 | channelId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2749 | hdd_debug( |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2750 | "assocReqlen %d assocRsplen %d", |
| 2751 | assocReqlen, |
| 2752 | assocRsplen); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2753 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2754 | hdd_debug( |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2755 | "Reassoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2756 | QDF_TRACE_HEX_DUMP( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2757 | QDF_MODULE_ID_HDD, |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2758 | QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2759 | pFTAssocReq, |
| 2760 | assocReqlen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2761 | roam_bss = |
| 2762 | hdd_cfg80211_get_bss( |
| 2763 | pAdapter->wdev.wiphy, |
| 2764 | chan, |
| 2765 | pRoamInfo->bssid.bytes, |
| 2766 | pRoamInfo->u. |
| 2767 | pConnectedProfile->SSID.ssId, |
| 2768 | pRoamInfo->u. |
| 2769 | pConnectedProfile->SSID.length); |
| 2770 | cfg80211_roamed_bss(dev, |
| 2771 | roam_bss, |
| 2772 | pFTAssocReq, |
| 2773 | assocReqlen, |
| 2774 | pFTAssocRsp, |
| 2775 | assocRsplen, |
| 2776 | GFP_KERNEL); |
| 2777 | wlan_hdd_send_roam_auth_event( |
| 2778 | pAdapter, |
| 2779 | pRoamInfo->bssid.bytes, |
| 2780 | pFTAssocReq, |
| 2781 | assocReqlen, |
| 2782 | pFTAssocRsp, |
| 2783 | assocRsplen, |
| 2784 | pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2785 | } |
| 2786 | if (sme_get_ftptk_state |
| 2787 | (WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2788 | pAdapter->sessionId)) { |
| 2789 | sme_set_ftptk_state |
| 2790 | (WLAN_HDD_GET_HAL_CTX |
| 2791 | (pAdapter), |
| 2792 | pAdapter->sessionId, |
| 2793 | false); |
| 2794 | pRoamInfo->fAuthRequired = |
| 2795 | false; |
| 2796 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2797 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2798 | roam_info.bssid, |
| 2799 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2800 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2801 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2802 | roam_info.peerMac, |
| 2803 | pRoamInfo->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2804 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2805 | pHddStaCtx->roam_info.roamId = |
| 2806 | roamId; |
| 2807 | pHddStaCtx->roam_info. |
| 2808 | roamStatus = roamStatus; |
| 2809 | pHddStaCtx->roam_info. |
| 2810 | deferKeyComplete = true; |
| 2811 | } |
| 2812 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2813 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2814 | ft_carrier_on); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2815 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2816 | pRoamInfo-> |
| 2817 | bssid.bytes, |
| 2818 | pRoamInfo, |
| 2819 | pFTAssocReq, |
| 2820 | assocReqlen, |
| 2821 | pFTAssocRsp, |
| 2822 | assocRsplen, |
| 2823 | WLAN_STATUS_SUCCESS, |
| 2824 | GFP_KERNEL, |
| 2825 | false, |
| 2826 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2827 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 2828 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2829 | /* |
| 2830 | * wpa supplicant expecting WPA/RSN IE in |
| 2831 | * connect result. |
| 2832 | */ |
| 2833 | csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX |
| 2834 | (pAdapter), |
| 2835 | pAdapter->sessionId, |
| 2836 | &reqRsnLength, |
| 2837 | reqRsnIe); |
| 2838 | |
| 2839 | csr_roam_get_wpa_rsn_rsp_ie(WLAN_HDD_GET_HAL_CTX |
| 2840 | (pAdapter), |
| 2841 | pAdapter->sessionId, |
| 2842 | &rspRsnLength, |
| 2843 | rspRsnIe); |
| 2844 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2845 | if (ft_carrier_on) |
| 2846 | hdd_send_re_assoc_event(dev, |
| 2847 | pAdapter, |
| 2848 | pRoamInfo, |
| 2849 | reqRsnIe, |
| 2850 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2851 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2852 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2853 | MAC_ADDRESS_STR |
| 2854 | " result:%d and Status:%d", |
| 2855 | MAC_ADDR_ARRAY |
| 2856 | (pRoamInfo->bssid.bytes), |
| 2857 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2858 | |
| 2859 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2860 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2861 | pRoamInfo-> |
| 2862 | bssid.bytes, |
| 2863 | pRoamInfo, |
| 2864 | reqRsnIe, |
| 2865 | reqRsnLength, |
| 2866 | rspRsnIe, |
| 2867 | rspRsnLength, |
| 2868 | WLAN_STATUS_SUCCESS, |
| 2869 | GFP_KERNEL, |
| 2870 | false, |
| 2871 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2872 | } |
| 2873 | } |
| 2874 | } |
| 2875 | if (!hddDisconInProgress) { |
| 2876 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2877 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2878 | bss); |
| 2879 | |
| 2880 | /* |
| 2881 | * Perform any WMM-related association |
| 2882 | * processing. |
| 2883 | */ |
| 2884 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2885 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2886 | |
| 2887 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2888 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2889 | */ |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2890 | qdf_status = hdd_roam_register_sta(pAdapter, |
| 2891 | pRoamInfo, |
| 2892 | pHddStaCtx->conn_info.staId[0], |
| 2893 | NULL, pRoamInfo->pBssDesc); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2894 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2895 | wlan_hdd_netif_queue_control(pAdapter, |
| 2896 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2897 | WLAN_CONTROL_PATH); |
| 2898 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2899 | } |
| 2900 | } else { |
| 2901 | /* |
| 2902 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 2903 | * in case of reassociation also need to indicate it to |
| 2904 | * supplicant. |
| 2905 | */ |
| 2906 | csr_roam_get_wpa_rsn_req_ie( |
| 2907 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2908 | pAdapter->sessionId, |
| 2909 | &reqRsnLength, reqRsnIe); |
| 2910 | |
| 2911 | hdd_send_re_assoc_event(dev, pAdapter, pRoamInfo, |
| 2912 | reqRsnIe, reqRsnLength); |
| 2913 | /* Reassoc successfully */ |
| 2914 | if (pRoamInfo->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2915 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2916 | hdd_change_peer_state(pAdapter, |
| 2917 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2918 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2919 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2920 | pRoamInfo->roamSynchInProgress |
| 2921 | #else |
| 2922 | false |
| 2923 | #endif |
| 2924 | ); |
| 2925 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2926 | hdd_objmgr_set_peer_mlme_auth_state( |
| 2927 | pAdapter->hdd_vdev, |
| 2928 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2929 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2930 | hdd_debug("staId: %d Changing TL state to AUTHENTICATED", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2931 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2932 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2933 | hdd_change_peer_state(pAdapter, |
| 2934 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2935 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2936 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2937 | pRoamInfo->roamSynchInProgress |
| 2938 | #else |
| 2939 | false |
| 2940 | #endif |
| 2941 | ); |
| 2942 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2943 | hdd_objmgr_set_peer_mlme_auth_state( |
| 2944 | pAdapter->hdd_vdev, |
| 2945 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2946 | } |
| 2947 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2948 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2949 | /* |
| 2950 | * Perform any WMM-related association |
| 2951 | * processing |
| 2952 | */ |
| 2953 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2954 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2955 | } |
| 2956 | |
| 2957 | /* Start the tx queues */ |
| 2958 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2959 | if (pRoamInfo->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2960 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2961 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2962 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2963 | wlan_hdd_netif_queue_control(pAdapter, |
| 2964 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2965 | WLAN_CONTROL_PATH); |
| 2966 | } |
| 2967 | |
Padma, Santhosh Kumar | 724f63d | 2016-08-09 16:04:31 +0530 | [diff] [blame] | 2968 | #ifdef FEATURE_WLAN_TDLS |
| 2969 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 2970 | #endif |
| 2971 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2972 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2973 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2974 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2975 | } |
| 2976 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2977 | qdf_mem_zero(&pAdapter->hdd_stats.hddPmfStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2978 | sizeof(pAdapter->hdd_stats.hddPmfStats)); |
| 2979 | #endif |
| 2980 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2981 | bool connect_timeout = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2982 | hdd_wext_state_t *pWextState = |
| 2983 | WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2984 | if (pRoamInfo) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2985 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2986 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2987 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 2988 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2989 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2990 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2991 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2992 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 2993 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 2994 | |
| 2995 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 2996 | (pRoamInfo && |
| 2997 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
| 2998 | pRoamInfo->statusCode) || |
| 2999 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
| 3000 | pRoamInfo->statusCode) || |
| 3001 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
| 3002 | pRoamInfo->statusCode)))) { |
| 3003 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 3004 | pRoamInfo ? |
| 3005 | pRoamInfo->bssid.bytes : |
| 3006 | pWextState->req_bssId.bytes); |
| 3007 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 3008 | pRoamInfo ? |
| 3009 | pRoamInfo->bssid.bytes : |
| 3010 | pWextState->req_bssId.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3011 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3012 | } |
| 3013 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3014 | /* |
| 3015 | * CR465478: Only send up a connection failure result when CSR |
| 3016 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3017 | */ |
| 3018 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 3019 | && !hddDisconInProgress) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3020 | if (pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3021 | hdd_err("send connect failure to nl80211: for bssid " |
| 3022 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3023 | " result: %d and Status: %d reasoncode: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3024 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3025 | roamResult, roamStatus, |
| 3026 | pRoamInfo->reasonCode); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3027 | pHddStaCtx->conn_info.assoc_status_code = |
| 3028 | pRoamInfo->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3029 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3030 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3031 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3032 | " result: %d and status: %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3033 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3034 | roamResult, roamStatus); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3035 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3036 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3037 | wlan_deregister_txrx_packetdump(); |
| 3038 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3039 | /* inform association failure event to nl80211 */ |
| 3040 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 3041 | roamResult) { |
| 3042 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3043 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3044 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3045 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3046 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3047 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3048 | connect_timeout, |
| 3049 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3050 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3051 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3052 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3053 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3054 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3055 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3056 | connect_timeout, |
| 3057 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3058 | } else { |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3059 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3060 | hdd_connect_result(dev, |
| 3061 | pRoamInfo->bssid.bytes, |
| 3062 | NULL, NULL, 0, NULL, 0, |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3063 | pRoamInfo->reasonCode ? |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3064 | pRoamInfo->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3065 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3066 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3067 | connect_timeout, |
| 3068 | pRoamInfo->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3069 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3070 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3071 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3072 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3073 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3074 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3075 | connect_timeout, |
| 3076 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3077 | } |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3078 | hdd_clear_roam_profile_ie(pAdapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3079 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 3080 | && !hddDisconInProgress)) { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3081 | hdd_connect_result(dev, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3082 | pWextState->req_bssId.bytes, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3083 | NULL, NULL, 0, NULL, 0, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3084 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3085 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3086 | connect_timeout, |
| 3087 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3088 | } |
| 3089 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | /* |
| 3091 | * Set connection state to eConnectionState_NotConnected only |
| 3092 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3093 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3094 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3095 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 3096 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3097 | && !hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3098 | hdd_conn_set_connection_state(pAdapter, |
| 3099 | eConnectionState_NotConnected); |
| 3100 | } |
| 3101 | hdd_wmm_init(pAdapter); |
| 3102 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3103 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3104 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3105 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3106 | WLAN_CONTROL_PATH); |
| 3107 | } |
| 3108 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3109 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3110 | } |
| 3111 | |
| 3112 | /** |
| 3113 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
| 3114 | * @pAdapter: pointer to adapter |
| 3115 | * @pRoamInfo: pointer to roam info |
| 3116 | * @roamId: roam id |
| 3117 | * @roamStatus: roam status |
| 3118 | * @roamResult: roam result |
| 3119 | * |
| 3120 | * Here we update the status of the Ibss when we receive information that we |
| 3121 | * have started/joined an ibss session. |
| 3122 | * |
| 3123 | * Return: none |
| 3124 | */ |
| 3125 | static void hdd_roam_ibss_indication_handler(hdd_adapter_t *pAdapter, |
| 3126 | tCsrRoamInfo *pRoamInfo, |
| 3127 | uint32_t roamId, |
| 3128 | eRoamCmdStatus roamStatus, |
| 3129 | eCsrRoamResult roamResult) |
| 3130 | { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3131 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3132 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3133 | hdd_debug("%s: id %d, status %d, result %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3134 | pAdapter->dev->name, roamId, |
| 3135 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3136 | |
| 3137 | switch (roamResult) { |
| 3138 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3139 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3140 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3141 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3142 | { |
| 3143 | hdd_context_t *pHddCtx = |
| 3144 | (hdd_context_t *) pAdapter->pHddCtx; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3145 | hdd_station_ctx_t *hdd_sta_ctx = |
| 3146 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3147 | struct qdf_mac_addr broadcastMacAddr = |
| 3148 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3149 | |
| 3150 | if (NULL == pRoamInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3151 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3152 | return; |
| 3153 | } |
| 3154 | |
| 3155 | /* When IBSS Started comes from CSR, we need to move |
| 3156 | * connection state to IBSS Disconnected (meaning no peers |
| 3157 | * are in the IBSS). |
| 3158 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3159 | hdd_conn_set_connection_state(pAdapter, |
| 3160 | eConnectionState_IbssDisconnected); |
| 3161 | /* notify wmm */ |
| 3162 | hdd_wmm_connect(pAdapter, pRoamInfo, |
| 3163 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3164 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 3165 | hdd_sta_ctx->broadcast_staid = pRoamInfo->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3166 | |
| 3167 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3168 | pAdapter; |
| 3169 | hdd_roam_register_sta(pAdapter, pRoamInfo, |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3170 | pRoamInfo->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3171 | &broadcastMacAddr, |
| 3172 | pRoamInfo->pBssDesc); |
| 3173 | |
| 3174 | if (pRoamInfo->pBssDesc) { |
| 3175 | struct cfg80211_bss *bss; |
| 3176 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3177 | struct ieee80211_channel *chan; |
| 3178 | int chan_no; |
| 3179 | unsigned int freq; |
| 3180 | #endif |
| 3181 | /* we created the IBSS, notify supplicant */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3182 | hdd_info("%s: created ibss " MAC_ADDRESS_STR, |
| 3183 | pAdapter->dev->name, |
| 3184 | MAC_ADDR_ARRAY( |
| 3185 | pRoamInfo->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3186 | |
| 3187 | /* we must first give cfg80211 the BSS information */ |
| 3188 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 3189 | pRoamInfo); |
| 3190 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3191 | hdd_err("%s: unable to create IBSS entry", |
| 3192 | pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3193 | return; |
| 3194 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3195 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3196 | wlan_hdd_netif_queue_control(pAdapter, |
| 3197 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3198 | WLAN_CONTROL_PATH); |
| 3199 | |
| 3200 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3201 | chan_no = pRoamInfo->pBssDesc->channelId; |
| 3202 | |
| 3203 | if (chan_no <= 14) |
| 3204 | freq = ieee80211_channel_to_frequency(chan_no, |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 3205 | NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3206 | else |
| 3207 | freq = ieee80211_channel_to_frequency(chan_no, |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 3208 | NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3209 | |
| 3210 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3211 | |
| 3212 | if (chan) |
| 3213 | cfg80211_ibss_joined(pAdapter->dev, |
| 3214 | bss->bssid, chan, |
| 3215 | GFP_KERNEL); |
| 3216 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3217 | hdd_warn("%s: chanId: %d, can't find channel", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3218 | pAdapter->dev->name, |
| 3219 | (int)pRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3220 | #else |
| 3221 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3222 | GFP_KERNEL); |
| 3223 | #endif |
| 3224 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3225 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3226 | bss); |
| 3227 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3228 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3229 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
| 3230 | pAdapter->device_mode, pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3231 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3232 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3233 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
| 3234 | pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3235 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3236 | break; |
| 3237 | } |
| 3238 | |
| 3239 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3240 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3241 | hdd_err("%s: unable to create IBSS", pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3242 | break; |
| 3243 | } |
| 3244 | |
| 3245 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3246 | hdd_err("%s: unexpected result %d", |
| 3247 | pAdapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3248 | break; |
| 3249 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3250 | } |
| 3251 | |
| 3252 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3253 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3254 | * @sta_ctx: pointer to hdd station context |
| 3255 | * @sta_id: station ID |
| 3256 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3257 | * |
| 3258 | * This information is passed to iwconfig later. The peer that joined |
| 3259 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3260 | |
| 3261 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3262 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3263 | bool hdd_save_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id, |
| 3264 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3266 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3267 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3268 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
| 3269 | if (0 == sta_ctx->conn_info.staId[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3270 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3271 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3272 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3273 | qdf_copy_macaddr( |
| 3274 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3275 | peer_mac_addr); |
| 3276 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3277 | } |
| 3278 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3279 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3280 | } |
| 3281 | |
| 3282 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3283 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3284 | * @sta_ctx: pointer to hdd station context |
| 3285 | * @sta_id: station ID |
| 3286 | * |
| 3287 | * Return: None |
| 3288 | */ |
| 3289 | void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id) |
| 3290 | { |
| 3291 | int i; |
| 3292 | |
| 3293 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3294 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
| 3295 | sta_ctx->conn_info.staId[i] = 0; |
| 3296 | return; |
| 3297 | } |
| 3298 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3299 | } |
| 3300 | |
| 3301 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3302 | * roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter |
| 3303 | * @pAdapter: pointer to adapter |
| 3304 | * @staId: station id |
| 3305 | * |
| 3306 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3307 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | * false otherwise. |
| 3309 | */ |
| 3310 | static bool roam_remove_ibss_station(hdd_adapter_t *pAdapter, uint8_t staId) |
| 3311 | { |
| 3312 | bool fSuccess = false; |
| 3313 | int idx = 0; |
| 3314 | uint8_t valid_idx = 0; |
| 3315 | uint8_t del_idx = 0; |
| 3316 | uint8_t empty_slots = 0; |
| 3317 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3318 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3319 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3320 | if (staId == pHddStaCtx->conn_info.staId[idx]) { |
| 3321 | pHddStaCtx->conn_info.staId[idx] = 0; |
| 3322 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3323 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3324 | peerMacAddress[idx]); |
| 3325 | |
| 3326 | fSuccess = true; |
| 3327 | |
| 3328 | /* |
| 3329 | * Note the deleted Index, if its 0 we need special |
| 3330 | * handling. |
| 3331 | */ |
| 3332 | del_idx = idx; |
| 3333 | |
| 3334 | empty_slots++; |
| 3335 | } else { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3336 | if (pHddStaCtx->conn_info.staId[idx] != |
| 3337 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3338 | valid_idx = idx; |
| 3339 | } else { |
| 3340 | /* Found an empty slot */ |
| 3341 | empty_slots++; |
| 3342 | } |
| 3343 | } |
| 3344 | } |
| 3345 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3346 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3347 | /* Last peer departed, set the IBSS state appropriately */ |
| 3348 | pHddStaCtx->conn_info.connState = |
| 3349 | eConnectionState_IbssDisconnected; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3350 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3351 | } |
| 3352 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3353 | if (fSuccess == true) { |
| 3354 | if (del_idx == 0) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3355 | if (pHddStaCtx->conn_info.staId[valid_idx] != |
| 3356 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3357 | pHddStaCtx->conn_info.staId[0] = |
| 3358 | pHddStaCtx->conn_info.staId[valid_idx]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3359 | qdf_copy_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3360 | peerMacAddress[0], |
| 3361 | &pHddStaCtx->conn_info. |
| 3362 | peerMacAddress[valid_idx]); |
| 3363 | |
| 3364 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3365 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3366 | peerMacAddress[valid_idx]); |
| 3367 | } |
| 3368 | } |
| 3369 | } |
| 3370 | return fSuccess; |
| 3371 | } |
| 3372 | |
| 3373 | /** |
| 3374 | * roam_ibss_connect_handler() - IBSS connection handler |
| 3375 | * @pAdapter: pointer to adapter |
| 3376 | * @pRoamInfo: pointer to roam info |
| 3377 | * |
| 3378 | * We update the status of the IBSS to connected in this function. |
| 3379 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3380 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3381 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3382 | static QDF_STATUS roam_ibss_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3383 | tCsrRoamInfo *pRoamInfo) |
| 3384 | { |
| 3385 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3386 | /* |
| 3387 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3388 | * a partner stations). |
| 3389 | */ |
| 3390 | hdd_conn_set_connection_state(pAdapter, eConnectionState_IbssConnected); |
| 3391 | |
| 3392 | /* Save the connection info from CSR... */ |
| 3393 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
| 3394 | |
| 3395 | /* Send the bssid address to the wext. */ |
| 3396 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3397 | /* add bss_id to cfg80211 data base */ |
| 3398 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3399 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3400 | hdd_err("%s: unable to create IBSS entry", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3401 | pAdapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3402 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3403 | } |
| 3404 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3405 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3406 | bss); |
| 3407 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3408 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3409 | } |
| 3410 | |
| 3411 | /** |
| 3412 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
| 3413 | * @pAdapter: pointer to adapter |
| 3414 | * @pRoamInfo: pointer to roam info |
| 3415 | * @roamId: roam id |
| 3416 | * @roamStatus: roam status |
| 3417 | * @roamResult: roam result |
| 3418 | * |
| 3419 | * This function indicates the Mic failure to the supplicant |
| 3420 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3421 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3422 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3423 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3424 | hdd_roam_mic_error_indication_handler(hdd_adapter_t *pAdapter, |
| 3425 | tCsrRoamInfo *pRoamInfo, |
| 3426 | uint32_t roamId, |
| 3427 | eRoamCmdStatus roamStatus, |
| 3428 | eCsrRoamResult roamResult) |
| 3429 | { |
| 3430 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3431 | |
| 3432 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3433 | TKIP_COUNTER_MEASURE_STOPED == |
| 3434 | pHddStaCtx->WextState.mTKIPCounterMeasures) { |
| 3435 | struct iw_michaelmicfailure msg; |
| 3436 | union iwreq_data wreq; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3437 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3438 | memset(&msg, '\0', sizeof(msg)); |
| 3439 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3440 | memcpy(msg.src_addr.sa_data, |
| 3441 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3442 | sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3443 | hdd_debug("MIC MAC " MAC_ADDRESS_STR, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3444 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3445 | |
| 3446 | if (pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 3447 | msg.flags = IW_MICFAILURE_GROUP; |
| 3448 | else |
| 3449 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3450 | memset(&wreq, 0, sizeof(wreq)); |
| 3451 | wreq.data.length = sizeof(msg); |
| 3452 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, |
| 3453 | (char *)&msg); |
| 3454 | /* inform mic failure to nl80211 */ |
| 3455 | cfg80211_michael_mic_failure(pAdapter->dev, |
| 3456 | pRoamInfo->u.pMICFailureInfo-> |
| 3457 | taMacAddr, |
| 3458 | ((pRoamInfo->u.pMICFailureInfo-> |
| 3459 | multicast == |
| 3460 | eSIR_TRUE) ? |
| 3461 | NL80211_KEYTYPE_GROUP : |
| 3462 | NL80211_KEYTYPE_PAIRWISE), |
| 3463 | pRoamInfo->u.pMICFailureInfo-> |
| 3464 | keyId, |
| 3465 | pRoamInfo->u.pMICFailureInfo->TSC, |
| 3466 | GFP_KERNEL); |
| 3467 | |
| 3468 | } |
| 3469 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3470 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3471 | } |
| 3472 | |
| 3473 | /** |
| 3474 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
| 3475 | * @pAdapter: pointer to adapter |
| 3476 | * @pRoamInfo: pointer to roam info |
| 3477 | * @roamId: roam id |
| 3478 | * @roamStatus: roam status |
| 3479 | * @roamResult: roam result |
| 3480 | * |
| 3481 | * The Ibss connection status is updated regularly here in this function. |
| 3482 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3483 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3484 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3485 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3486 | roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter, |
| 3487 | tCsrRoamInfo *pRoamInfo, |
| 3488 | uint32_t roamId, |
| 3489 | eRoamCmdStatus roamStatus, |
| 3490 | eCsrRoamResult roamResult) |
| 3491 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3492 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3493 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3494 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3495 | switch (roamResult) { |
| 3496 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3497 | { |
| 3498 | hdd_station_ctx_t *pHddStaCtx = |
| 3499 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3500 | struct station_info *stainfo; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3501 | eCsrEncryptionType encr_type = pHddStaCtx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3502 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3503 | hdd_info("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3504 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3505 | MAC_ADDRESS_STR " and stationID= %d", |
| 3506 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3507 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3508 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3509 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3510 | if (!hdd_save_peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3511 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 3512 | pRoamInfo->staId, |
| 3513 | &pRoamInfo->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3514 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3515 | break; |
| 3516 | } |
| 3517 | |
| 3518 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3519 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3520 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 3521 | pRoamInfo->fAuthRequired = true; |
| 3522 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3523 | /* Register the Station with TL for the new peer. */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3524 | qdf_status = hdd_roam_register_sta(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3525 | pRoamInfo, |
| 3526 | pRoamInfo->staId, |
| 3527 | &pRoamInfo->peerMac, |
| 3528 | pRoamInfo->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3529 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3530 | 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] | 3531 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3532 | } |
| 3533 | pHddStaCtx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3534 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3535 | if (stainfo == NULL) { |
| 3536 | hdd_err("memory allocation for station_info failed"); |
| 3537 | return QDF_STATUS_E_NOMEM; |
| 3538 | } |
| 3539 | stainfo->filled = 0; |
| 3540 | stainfo->generation = pHddStaCtx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | |
| 3542 | cfg80211_new_sta(pAdapter->dev, |
| 3543 | (const u8 *)pRoamInfo->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3544 | stainfo, GFP_KERNEL); |
| 3545 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3546 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3547 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3548 | pHddStaCtx->ibss_enc_key.keyDirection = |
| 3549 | eSIR_TX_RX; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3550 | qdf_copy_macaddr(&pHddStaCtx->ibss_enc_key.peerMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3551 | &pRoamInfo->peerMac); |
| 3552 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3553 | hdd_info("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3554 | encr_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3555 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3556 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3557 | sme_roam_set_key(WLAN_HDD_GET_HAL_CTX |
| 3558 | (pAdapter), |
| 3559 | pAdapter->sessionId, |
| 3560 | &pHddStaCtx->ibss_enc_key, |
| 3561 | &roamId); |
| 3562 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3563 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3564 | hdd_err("sme_roam_set_key failed, status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3565 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3566 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3567 | } |
| 3568 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3569 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3570 | wlan_hdd_netif_queue_control(pAdapter, |
| 3571 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3572 | WLAN_CONTROL_PATH); |
| 3573 | break; |
| 3574 | } |
| 3575 | |
| 3576 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3577 | { |
| 3578 | |
| 3579 | roam_ibss_connect_handler(pAdapter, pRoamInfo); |
| 3580 | |
| 3581 | break; |
| 3582 | } |
| 3583 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3584 | { |
| 3585 | hdd_station_ctx_t *pHddStaCtx = |
| 3586 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3587 | |
| 3588 | if (!roam_remove_ibss_station(pAdapter, pRoamInfo->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3589 | 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] | 3590 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3591 | hdd_info("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3592 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3593 | MAC_ADDRESS_STR " and stationID= %d", |
| 3594 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3595 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3596 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3597 | |
| 3598 | hdd_roam_deregister_sta(pAdapter, pRoamInfo->staId); |
| 3599 | |
| 3600 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 3601 | pHddStaCtx->ibss_sta_generation++; |
| 3602 | |
| 3603 | cfg80211_del_sta(pAdapter->dev, |
| 3604 | (const u8 *)&pRoamInfo->peerMac.bytes, |
| 3605 | GFP_KERNEL); |
| 3606 | break; |
| 3607 | } |
| 3608 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3609 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3610 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3611 | /* Stop only when we are inactive */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3612 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3613 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3614 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3615 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3616 | hdd_conn_set_connection_state(pAdapter, |
| 3617 | eConnectionState_NotConnected); |
| 3618 | |
| 3619 | /* Send the bssid address to the wext. */ |
| 3620 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3621 | break; |
| 3622 | } |
| 3623 | default: |
| 3624 | break; |
| 3625 | |
| 3626 | } |
| 3627 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3628 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3629 | } |
| 3630 | |
| 3631 | #ifdef FEATURE_WLAN_TDLS |
| 3632 | /** |
| 3633 | * hdd_roam_register_tdlssta() - register new TDLS station |
| 3634 | * @pAdapter: pointer to adapter |
| 3635 | * @peerMac: pointer to peer MAC address |
| 3636 | * @staId: station identifier |
| 3637 | * @ucastSig: unicast signature |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3638 | * @qos: QOS capability of TDLS station/link |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3639 | * |
| 3640 | * Construct the staDesc and register with TL the new STA. |
| 3641 | * This is called as part of ADD_STA in the TDLS setup. |
| 3642 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3643 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3644 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3645 | QDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3646 | const uint8_t *peerMac, uint16_t staId, |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3647 | uint8_t ucastSig, uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3648 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3649 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3651 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3652 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3653 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3654 | |
| 3655 | /* |
| 3656 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3657 | * be peer MAC, here we are working on direct Link |
| 3658 | */ |
| 3659 | staDesc.sta_id = staId; |
| 3660 | |
| 3661 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3662 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3663 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3664 | /* Register the vdev transmit and receive functions */ |
| 3665 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3666 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3667 | cdp_vdev_register(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3668 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
| 3669 | (struct cdp_pdev *)pdev, pAdapter->sessionId), |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3670 | pAdapter, &txrx_ops); |
| 3671 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3672 | |
| 3673 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3674 | qdf_status = cdp_peer_register(soc, |
| 3675 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3676 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3677 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3678 | qdf_status, qdf_status); |
| 3679 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3680 | } |
| 3681 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3682 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3683 | } |
| 3684 | |
| 3685 | /** |
| 3686 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
| 3687 | * @pAdapter: pointer to adapter |
| 3688 | * @staId: station identifier |
| 3689 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3690 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3691 | */ |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3692 | 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] | 3693 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3694 | QDF_STATUS qdf_status; |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 3695 | 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] | 3696 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 3697 | staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3698 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3699 | 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] | 3700 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3701 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3702 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3703 | } |
| 3704 | |
| 3705 | /** |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3706 | * hdd_tdls_connection_tracker_update() - update connection tracker state |
| 3707 | * @adapter: pointer to adapter |
| 3708 | * @roam_info: pointer to roam info |
| 3709 | * @hdd_tdls_ctx: tdls context |
| 3710 | * |
| 3711 | * Return: QDF_STATUS enumeration |
| 3712 | */ |
| 3713 | static QDF_STATUS hdd_tdls_connection_tracker_update(hdd_adapter_t *adapter, |
| 3714 | tCsrRoamInfo *roam_info, |
| 3715 | tdlsCtx_t *hdd_tdls_ctx) |
| 3716 | { |
| 3717 | hddTdlsPeer_t *curr_peer; |
| 3718 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3719 | |
| 3720 | curr_peer = wlan_hdd_tdls_find_peer(adapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3721 | roam_info->peerMac.bytes); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3722 | |
| 3723 | if (!curr_peer) { |
| 3724 | hdd_err("curr_peer is null"); |
| 3725 | return QDF_STATUS_E_FAILURE; |
| 3726 | } |
| 3727 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3728 | if (eTDLS_LINK_CONNECTED == |
| 3729 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3730 | hdd_debug("Received CONNECTION_TRACKER_NOTIFICATION " |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3731 | MAC_ADDRESS_STR |
| 3732 | " staId: %d, reason: %d", |
| 3733 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3734 | roam_info->staId, |
| 3735 | roam_info->reasonCode); |
| 3736 | |
| 3737 | if (roam_info->reasonCode == |
| 3738 | eWNI_TDLS_PEER_ENTER_BUF_STA || |
| 3739 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3740 | eWNI_TDLS_ENTER_BT_BUSY_MODE || |
| 3741 | roam_info->reasonCode == |
| 3742 | eWMI_TDLS_SCAN_STARTED_EVENT) |
| 3743 | hdd_ctx->enable_tdls_connection_tracker = false; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3744 | else if (roam_info->reasonCode == |
| 3745 | eWNI_TDLS_PEER_EXIT_BUF_STA || |
| 3746 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3747 | eWNI_TDLS_EXIT_BT_BUSY_MODE || |
| 3748 | roam_info->reasonCode == |
| 3749 | eWMI_TDLS_SCAN_COMPLETED_EVENT) |
| 3750 | hdd_ctx->enable_tdls_connection_tracker = true; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3751 | hdd_debug("hdd_ctx->enable_tdls_connection_tracker %d", |
Nitesh Shah | c549dd5 | 2017-02-23 16:45:44 +0530 | [diff] [blame] | 3752 | hdd_ctx->enable_tdls_connection_tracker); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3753 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3754 | hdd_debug("TDLS not connected, ignore notification, reason: %d", |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3755 | roam_info->reasonCode); |
| 3756 | } |
| 3757 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3758 | return QDF_STATUS_SUCCESS; |
| 3759 | } |
| 3760 | |
| 3761 | |
| 3762 | |
| 3763 | |
| 3764 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3765 | * hdd_roam_tdls_status_update_handler() - TDLS status update handler |
| 3766 | * @pAdapter: pointer to adapter |
| 3767 | * @pRoamInfo: pointer to roam info |
| 3768 | * @roamId: roam id |
| 3769 | * @roamStatus: roam status |
| 3770 | * @roamResult: roam result |
| 3771 | * |
| 3772 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3773 | * TL in case of new TDLS client is added and deregistration at the time |
| 3774 | * TDLS client is deleted. |
| 3775 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3776 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3777 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3778 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3779 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 3780 | tCsrRoamInfo *pRoamInfo, |
| 3781 | uint32_t roamId, |
| 3782 | eRoamCmdStatus roamStatus, |
| 3783 | eCsrRoamResult roamResult) |
| 3784 | { |
| 3785 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3786 | tdlsCtx_t *pHddTdlsCtx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3787 | tSmeTdlsPeerStateParams smeTdlsPeerStateParams; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3788 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3789 | uint8_t staIdx; |
| 3790 | hddTdlsPeer_t *curr_peer; |
| 3791 | uint32_t reason; |
| 3792 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3793 | hdd_debug("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3794 | roamResult == |
| 3795 | eCSR_ROAM_RESULT_ADD_TDLS_PEER ? "ADD_TDLS_PEER" : roamResult |
| 3796 | == |
| 3797 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? "DEL_TDLS_PEER" : |
| 3798 | roamResult == |
| 3799 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? "DEL_TDLS_PEER_IND" |
| 3800 | : roamResult == |
| 3801 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3802 | "DEL_ALL_TDLS_PEER_IND" : roamResult == |
| 3803 | eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? "UPDATE_TDLS_PEER" : |
| 3804 | roamResult == |
| 3805 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
| 3806 | "LINK_ESTABLISH_REQ_RSP" : roamResult == |
| 3807 | eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER ? "TDLS_SHOULD_DISCOVER" |
| 3808 | : roamResult == |
| 3809 | eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN ? "TDLS_SHOULD_TEARDOWN" |
| 3810 | : roamResult == |
| 3811 | eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED ? |
| 3812 | "TDLS_SHOULD_PEER_DISCONNECTED" : "UNKNOWN", pRoamInfo->staId, |
| 3813 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 3814 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3815 | switch (roamResult) { |
| 3816 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3817 | { |
| 3818 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3819 | hdd_err("Add Sta failed. status code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3820 | pRoamInfo->statusCode); |
Selvaraj, Sridhar | 5d95e63 | 2016-09-14 17:00:38 +0530 | [diff] [blame] | 3821 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3822 | } else { |
| 3823 | /* |
| 3824 | * Check if there is available index for this new TDLS |
| 3825 | * STA. |
| 3826 | */ |
| 3827 | for (staIdx = 0; |
| 3828 | staIdx < pHddCtx->max_num_tdls_sta; |
| 3829 | staIdx++) { |
| 3830 | if (0 == |
| 3831 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3832 | staId) { |
| 3833 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3834 | sessionId = |
| 3835 | pRoamInfo->sessionId; |
| 3836 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3837 | staId = pRoamInfo->staId; |
| 3838 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3839 | hdd_debug("TDLS: STA IDX at %d is %d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3840 | "of mac " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3841 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3842 | staIdx, |
| 3843 | pHddCtx-> |
| 3844 | tdlsConnInfo[staIdx]. |
| 3845 | staId, |
| 3846 | MAC_ADDR_ARRAY |
| 3847 | (pRoamInfo->peerMac.bytes)); |
| 3848 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3849 | qdf_copy_macaddr(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3850 | tdlsConnInfo |
| 3851 | [staIdx]. |
| 3852 | peerMac, |
| 3853 | &pRoamInfo-> |
| 3854 | peerMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3855 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | break; |
| 3857 | } |
| 3858 | } |
| 3859 | if (staIdx < pHddCtx->max_num_tdls_sta) { |
| 3860 | if (-1 == |
| 3861 | wlan_hdd_tdls_set_sta_id(pAdapter, |
| 3862 | pRoamInfo-> |
| 3863 | peerMac.bytes, |
| 3864 | pRoamInfo-> |
| 3865 | staId)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3866 | hdd_err("wlan_hdd_tdls_set_sta_id() failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3867 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3868 | } |
| 3869 | |
| 3870 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 3871 | sta_to_adapter[pRoamInfo->staId] = |
| 3872 | pAdapter; |
| 3873 | /* |
| 3874 | * store the ucast signature, |
| 3875 | * if required for further reference. |
| 3876 | */ |
| 3877 | |
| 3878 | wlan_hdd_tdls_set_signature(pAdapter, |
| 3879 | pRoamInfo-> |
| 3880 | peerMac.bytes, |
| 3881 | pRoamInfo-> |
| 3882 | ucastSig); |
| 3883 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3884 | status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3885 | 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] | 3886 | pRoamInfo->staId); |
| 3887 | } |
| 3888 | pAdapter->tdlsAddStaStatus = status; |
| 3889 | } |
| 3890 | complete(&pAdapter->tdls_add_station_comp); |
| 3891 | break; |
| 3892 | } |
| 3893 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3894 | { |
| 3895 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3896 | hdd_err("Add Sta failed. status code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3897 | pRoamInfo->statusCode); |
| 3898 | } |
| 3899 | /* store the ucast signature which will be used later when |
| 3900 | * registering to TL |
| 3901 | */ |
| 3902 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 3903 | complete(&pAdapter->tdls_add_station_comp); |
| 3904 | break; |
| 3905 | } |
| 3906 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3907 | { |
| 3908 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3909 | hdd_err("Link Establish Request failed. status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3910 | pRoamInfo->statusCode); |
| 3911 | } |
| 3912 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3913 | break; |
| 3914 | } |
| 3915 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
| 3916 | { |
| 3917 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 3918 | staIdx++) { |
| 3919 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 3920 | pRoamInfo->sessionId) |
| 3921 | && pRoamInfo->staId == |
| 3922 | pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3923 | hdd_debug("HDD: del STA IDX = %x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3924 | pRoamInfo->staId); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3925 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3926 | curr_peer = |
| 3927 | wlan_hdd_tdls_find_peer(pAdapter, |
| 3928 | pRoamInfo-> |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3929 | peerMac.bytes); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3930 | if (NULL != curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3931 | hdd_debug("Current status for peer " MAC_ADDRESS_STR " is %d", |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3932 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3933 | curr_peer->link_status); |
| 3934 | if (TDLS_IS_CONNECTED(curr_peer)) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3935 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3936 | hdd_roam_deregister_tdlssta |
| 3937 | (pAdapter, |
| 3938 | pRoamInfo->staId); |
| 3939 | wlan_hdd_tdls_decrement_peer_count |
| 3940 | (pAdapter); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3941 | } else if (eTDLS_LINK_CONNECTING == |
| 3942 | curr_peer->link_status) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3943 | mutex_unlock(&pHddCtx->tdls_lock); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3944 | hdd_roam_deregister_tdlssta |
| 3945 | (pAdapter, |
| 3946 | pRoamInfo->staId); |
Nitesh Shah | 0bf768f | 2017-03-31 15:01:37 +0530 | [diff] [blame] | 3947 | } else |
| 3948 | mutex_unlock(&pHddCtx->tdls_lock); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3949 | } else |
| 3950 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3951 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3952 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3953 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 3954 | pRoamInfo-> |
| 3955 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3956 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3957 | |
| 3958 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 3959 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3960 | sessionId = 255; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3961 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3962 | tdlsConnInfo[staIdx]. |
| 3963 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3964 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3965 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3966 | break; |
| 3967 | } |
| 3968 | } |
| 3969 | complete(&pAdapter->tdls_del_station_comp); |
| 3970 | } |
| 3971 | break; |
| 3972 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 3973 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3974 | hdd_debug("Sending teardown to supplicant with reason code %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3975 | pRoamInfo->reasonCode); |
| 3976 | |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3977 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3978 | curr_peer = |
| 3979 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3980 | pRoamInfo->peerMac.bytes); |
Ganesh Kondabattini | 9c8dc46 | 2017-04-19 10:52:54 +0530 | [diff] [blame] | 3981 | |
| 3982 | if (!curr_peer) { |
| 3983 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3984 | hdd_debug("peer doesn't exists"); |
| 3985 | status = QDF_STATUS_SUCCESS; |
| 3986 | break; |
| 3987 | } |
| 3988 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3989 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 3990 | pRoamInfo->reasonCode); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 3991 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3992 | curr_peer->peerMac); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3993 | mutex_unlock(&pHddCtx->tdls_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3994 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3995 | break; |
| 3996 | } |
| 3997 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 3998 | { |
| 3999 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
| 4000 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 4001 | staIdx++) { |
| 4002 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 4003 | pRoamInfo->sessionId) |
| 4004 | && pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4005 | hdd_debug("hdd_tdlsStatusUpdate: staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4006 | MAC_ADDRESS_STR, |
| 4007 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4008 | staId, |
| 4009 | MAC_ADDR_ARRAY(pHddCtx-> |
| 4010 | tdlsConnInfo |
| 4011 | [staIdx]. |
| 4012 | peerMac. |
| 4013 | bytes)); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4014 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4015 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4016 | pHddCtx-> |
| 4017 | tdlsConnInfo |
| 4018 | [staIdx]. |
| 4019 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4020 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4021 | hdd_roam_deregister_tdlssta(pAdapter, |
| 4022 | pHddCtx-> |
| 4023 | tdlsConnInfo |
| 4024 | [staIdx]. |
| 4025 | staId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4026 | qdf_mem_zero(&smeTdlsPeerStateParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4027 | sizeof |
| 4028 | (smeTdlsPeerStateParams)); |
| 4029 | smeTdlsPeerStateParams.vdevId = |
| 4030 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4031 | sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4032 | qdf_mem_copy(&smeTdlsPeerStateParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4033 | peerMacAddr, |
| 4034 | &pHddCtx-> |
| 4035 | tdlsConnInfo[staIdx]. |
| 4036 | peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4037 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4038 | smeTdlsPeerStateParams.peerState = |
| 4039 | eSME_TDLS_PEER_STATE_TEARDOWN; |
| 4040 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4041 | hdd_debug("calling sme_update_tdls_peer_state for staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4042 | MAC_ADDRESS_STR, |
| 4043 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4044 | staId, |
| 4045 | MAC_ADDR_ARRAY(pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4046 | tdlsConnInfo |
| 4047 | [staIdx]. |
| 4048 | peerMac. |
| 4049 | bytes)); |
| 4050 | status = |
| 4051 | sme_update_tdls_peer_state( |
| 4052 | pHddCtx->hHal, |
| 4053 | &smeTdlsPeerStateParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4054 | if (QDF_STATUS_SUCCESS != status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4055 | hdd_err("sme_update_tdls_peer_state failed for " |
| 4056 | MAC_ADDRESS_STR, |
| 4057 | MAC_ADDR_ARRAY |
| 4058 | (pHddCtx-> |
| 4059 | tdlsConnInfo[staIdx]. |
| 4060 | peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4061 | } |
| 4062 | wlan_hdd_tdls_decrement_peer_count |
| 4063 | (pAdapter); |
| 4064 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4065 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4066 | tdlsConnInfo[staIdx]. |
| 4067 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4068 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4069 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4070 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4071 | sessionId = 255; |
| 4072 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4073 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4074 | } |
| 4075 | } |
| 4076 | break; |
| 4077 | } |
| 4078 | case eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER: |
| 4079 | { |
| 4080 | /* ignore TDLS_SHOULD_DISCOVER if any concurrency detected */ |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 4081 | if (!cds_check_is_tdls_allowed(pAdapter->device_mode)) { |
| 4082 | hdd_err("TDLS not allowed, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4083 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4084 | break; |
| 4085 | } |
| 4086 | |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4087 | if (pHddCtx->tdls_nss_switch_in_progress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4088 | hdd_debug("TDLS antenna switch is in progress, ignore SHOULD_DISCOVER"); |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4089 | status = QDF_STATUS_SUCCESS; |
| 4090 | break; |
| 4091 | } |
| 4092 | |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4093 | mutex_lock(&pHddCtx->tdls_lock); |
| 4094 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4095 | if (!pHddTdlsCtx) { |
| 4096 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4097 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4098 | roamResult); |
| 4099 | status = QDF_STATUS_E_FAILURE; |
| 4100 | break; |
| 4101 | } |
| 4102 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4103 | curr_peer = |
| 4104 | wlan_hdd_tdls_get_peer(pAdapter, |
Nitesh Shah | 379449e | 2017-01-31 19:11:29 +0530 | [diff] [blame] | 4105 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4107 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4108 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4109 | } else { |
| 4110 | if (eTDLS_LINK_CONNECTED == |
| 4111 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4112 | hdd_debug("TDLS link status is connected, ignore SHOULD_DISCOVER"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4113 | } else { |
| 4114 | /* |
| 4115 | * If external control is enabled then initiate |
| 4116 | * TDLS only if forced peer is set otherwise |
| 4117 | * ignore should Discover trigger from fw. |
| 4118 | */ |
| 4119 | if (pHddCtx->config-> |
| 4120 | fTDLSExternalControl |
| 4121 | && (false == |
| 4122 | curr_peer->isForcedPeer)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4123 | 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] | 4124 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4125 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4126 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4127 | 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] | 4128 | pHddCtx->config-> |
| 4129 | fTDLSExternalControl, |
| 4130 | curr_peer->isForcedPeer, |
| 4131 | pRoamInfo->reasonCode); |
Nitesh Shah | 983e8f5 | 2016-11-25 12:36:29 +0530 | [diff] [blame] | 4132 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 4133 | wlan_hdd_tdls_implicit_send_discovery_request( |
| 4134 | pHddTdlsCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4135 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4136 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4137 | } |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4138 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4139 | break; |
| 4140 | } |
| 4141 | |
| 4142 | case eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN: |
| 4143 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4144 | mutex_lock(&pHddCtx->tdls_lock); |
| 4145 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4146 | if (!pHddTdlsCtx) { |
| 4147 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4148 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4149 | roamResult); |
| 4150 | status = QDF_STATUS_E_FAILURE; |
| 4151 | break; |
| 4152 | } |
| 4153 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4154 | curr_peer = |
| 4155 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4156 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4157 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4158 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4159 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4160 | } else { |
| 4161 | if (eTDLS_LINK_CONNECTED == |
| 4162 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4163 | hdd_debug("Received SHOULD_TEARDOWN for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4164 | MAC_ADDRESS_STR |
| 4165 | " staId: %d, reason: %d", |
| 4166 | MAC_ADDR_ARRAY(pRoamInfo-> |
| 4167 | peerMac.bytes), |
| 4168 | pRoamInfo->staId, |
| 4169 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4170 | |
| 4171 | if (pRoamInfo->reasonCode == |
| 4172 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4173 | pRoamInfo->reasonCode == |
| 4174 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4175 | pRoamInfo->reasonCode == |
| 4176 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4177 | pRoamInfo->reasonCode == |
| 4178 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4179 | reason = |
| 4180 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4181 | } else |
| 4182 | reason = |
| 4183 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4184 | |
| 4185 | wlan_hdd_tdls_indicate_teardown |
| 4186 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4187 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4188 | hdd_send_wlan_tdls_teardown_event( |
| 4189 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4190 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4191 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4192 | hdd_debug("TDLS link is not connected, ignore SHOULD_TEARDOWN, reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4193 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4194 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4195 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4196 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4197 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4198 | break; |
| 4199 | } |
| 4200 | |
| 4201 | case eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED: |
| 4202 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4203 | mutex_lock(&pHddCtx->tdls_lock); |
| 4204 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4205 | if (!pHddTdlsCtx) { |
| 4206 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4207 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4208 | roamResult); |
| 4209 | status = QDF_STATUS_E_FAILURE; |
| 4210 | break; |
| 4211 | } |
| 4212 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4213 | curr_peer = |
| 4214 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4215 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4216 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4217 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4218 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4219 | } else { |
| 4220 | if (eTDLS_LINK_CONNECTED == |
| 4221 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4222 | hdd_debug("Received SHOULD_PEER_DISCONNECTED for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4223 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4224 | " staId: %d reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4225 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4226 | pRoamInfo->staId, |
| 4227 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4228 | |
| 4229 | if (pRoamInfo->reasonCode == |
| 4230 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4231 | pRoamInfo->reasonCode == |
| 4232 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4233 | pRoamInfo->reasonCode == |
| 4234 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4235 | pRoamInfo->reasonCode == |
| 4236 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4237 | reason = |
| 4238 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4239 | } else |
| 4240 | reason = |
| 4241 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4242 | |
| 4243 | wlan_hdd_tdls_indicate_teardown |
| 4244 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4245 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4246 | hdd_send_wlan_tdls_teardown_event( |
| 4247 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4248 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4249 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4250 | 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] | 4251 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4252 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4253 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4254 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4255 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4256 | break; |
| 4257 | } |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4258 | |
| 4259 | case eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4260 | mutex_lock(&pHddCtx->tdls_lock); |
| 4261 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4262 | if (!pHddTdlsCtx) { |
| 4263 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4264 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4265 | roamResult); |
| 4266 | status = QDF_STATUS_E_FAILURE; |
| 4267 | break; |
| 4268 | } |
| 4269 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4270 | status = hdd_tdls_connection_tracker_update(pAdapter, |
| 4271 | pRoamInfo, |
| 4272 | pHddTdlsCtx); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4273 | mutex_unlock(&pHddCtx->tdls_lock); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4274 | break; |
| 4275 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4276 | default: |
| 4277 | { |
| 4278 | break; |
| 4279 | } |
| 4280 | } |
| 4281 | |
| 4282 | return status; |
| 4283 | } |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4284 | #else |
| 4285 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4286 | inline QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4287 | uint8_t staId) |
| 4288 | { |
| 4289 | return QDF_STATUS_SUCCESS; |
| 4290 | } |
| 4291 | |
| 4292 | static inline QDF_STATUS |
| 4293 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 4294 | tCsrRoamInfo *pRoamInfo, |
| 4295 | uint32_t roamId, |
| 4296 | eRoamCmdStatus roamStatus, |
| 4297 | eCsrRoamResult roamResult) |
| 4298 | { |
| 4299 | return QDF_STATUS_SUCCESS; |
| 4300 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4301 | #endif |
| 4302 | |
| 4303 | #ifdef WLAN_FEATURE_11W |
| 4304 | /** |
| 4305 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
| 4306 | * @pAdapter: pointer to the adapter |
| 4307 | * @nFrameLength: Length of the unprotected frame being passed |
| 4308 | * @pbFrames: Pointer to the frame buffer |
| 4309 | * @frameType: 802.11 frame type |
| 4310 | * |
| 4311 | * This function forwards the unprotected management frame to the supplicant. |
| 4312 | * |
| 4313 | * Return: nothing |
| 4314 | */ |
| 4315 | static void |
| 4316 | hdd_indicate_unprot_mgmt_frame(hdd_adapter_t *pAdapter, uint32_t nFrameLength, |
| 4317 | uint8_t *pbFrames, uint8_t frameType) |
| 4318 | { |
| 4319 | uint8_t type = 0; |
| 4320 | uint8_t subType = 0; |
| 4321 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4322 | hdd_debug("Frame Type = %d Frame Length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4323 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4324 | |
| 4325 | /* Sanity Checks */ |
| 4326 | if (NULL == pAdapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4327 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4328 | return; |
| 4329 | } |
| 4330 | |
| 4331 | if (NULL == pAdapter->dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4332 | hdd_err("pAdapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4333 | return; |
| 4334 | } |
| 4335 | |
| 4336 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4337 | hdd_err("pAdapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4338 | return; |
| 4339 | } |
| 4340 | |
| 4341 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4342 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4343 | return; |
| 4344 | } |
| 4345 | |
| 4346 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4347 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4348 | return; |
| 4349 | } |
| 4350 | |
| 4351 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4352 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4353 | |
| 4354 | /* Get pAdapter from Destination mac address of the frame */ |
| 4355 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 4356 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4357 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4358 | nFrameLength); |
| 4359 | #else |
| 4360 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, |
| 4361 | nFrameLength); |
| 4362 | #endif |
| 4363 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 4364 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 4365 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 4366 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4367 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4368 | nFrameLength); |
| 4369 | #else |
| 4370 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, |
| 4371 | nFrameLength); |
| 4372 | #endif |
| 4373 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 4374 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4375 | hdd_warn("Frame type %d and subtype %d are not valid", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4376 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4377 | return; |
| 4378 | } |
| 4379 | } |
| 4380 | #endif |
| 4381 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4382 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4383 | /** |
| 4384 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
| 4385 | * @pAdapter: pointer to adapter |
| 4386 | * @tid: traffic identifier |
| 4387 | * @state: state |
| 4388 | * @measInterval: measurement interval |
| 4389 | * |
| 4390 | * This function sends traffic stream metrics IE information to |
| 4391 | * the supplicant via wireless event. |
| 4392 | * |
| 4393 | * Return: none |
| 4394 | */ |
| 4395 | static void |
| 4396 | hdd_indicate_tsm_ie(hdd_adapter_t *pAdapter, uint8_t tid, |
| 4397 | uint8_t state, uint16_t measInterval) |
| 4398 | { |
| 4399 | union iwreq_data wrqu; |
| 4400 | char buf[IW_CUSTOM_MAX + 1]; |
| 4401 | int nBytes = 0; |
| 4402 | |
| 4403 | if (NULL == pAdapter) |
| 4404 | return; |
| 4405 | |
| 4406 | /* create the event */ |
| 4407 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4408 | memset(buf, '\0', sizeof(buf)); |
| 4409 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4410 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4411 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4412 | |
| 4413 | nBytes = |
| 4414 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4415 | measInterval); |
| 4416 | |
| 4417 | wrqu.data.pointer = buf; |
| 4418 | wrqu.data.length = nBytes; |
| 4419 | /* send the event */ |
| 4420 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4421 | } |
| 4422 | |
| 4423 | /** |
| 4424 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
| 4425 | * @pAdapter: pointer to adapter |
| 4426 | * @pRoamInfo: pointer to roam info |
| 4427 | * |
| 4428 | * This function sends cckm preauth indication to the supplicant |
| 4429 | * via wireless custom event. |
| 4430 | * |
| 4431 | * Return: none |
| 4432 | */ |
| 4433 | static void |
| 4434 | hdd_indicate_cckm_pre_auth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 4435 | { |
| 4436 | union iwreq_data wrqu; |
| 4437 | char buf[IW_CUSTOM_MAX + 1]; |
| 4438 | char *pos = buf; |
| 4439 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4440 | |
| 4441 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4442 | return; |
| 4443 | |
| 4444 | /* create the event */ |
| 4445 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4446 | memset(buf, '\0', sizeof(buf)); |
| 4447 | |
| 4448 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4449 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4450 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 4451 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4452 | |
| 4453 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4454 | pos += nBytes; |
| 4455 | freeBytes -= nBytes; |
| 4456 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4457 | qdf_mem_copy(pos, pRoamInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4458 | pos += QDF_MAC_ADDR_SIZE; |
| 4459 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4460 | |
| 4461 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
| 4462 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 4463 | freeBytes -= nBytes; |
| 4464 | |
| 4465 | wrqu.data.pointer = buf; |
| 4466 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4467 | |
| 4468 | /* send the event */ |
| 4469 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4470 | } |
| 4471 | |
| 4472 | /** |
| 4473 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
| 4474 | * @pAdapter: pointer to adapter |
| 4475 | * @pRoamInfo: pointer to roam info |
| 4476 | * |
| 4477 | * Return: none |
| 4478 | */ |
| 4479 | static void |
| 4480 | hdd_indicate_ese_adj_ap_rep_ind(hdd_adapter_t *pAdapter, |
| 4481 | tCsrRoamInfo *pRoamInfo) |
| 4482 | { |
| 4483 | union iwreq_data wrqu; |
| 4484 | char buf[IW_CUSTOM_MAX + 1]; |
| 4485 | int nBytes = 0; |
| 4486 | |
| 4487 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4488 | return; |
| 4489 | |
| 4490 | /* create the event */ |
| 4491 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4492 | memset(buf, '\0', sizeof(buf)); |
| 4493 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4494 | hdd_debug("CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4495 | |
| 4496 | nBytes = |
| 4497 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
| 4498 | pRoamInfo->tsmRoamDelay); |
| 4499 | |
| 4500 | wrqu.data.pointer = buf; |
| 4501 | wrqu.data.length = nBytes; |
| 4502 | |
| 4503 | /* send the event */ |
| 4504 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4505 | } |
| 4506 | |
| 4507 | /** |
| 4508 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
| 4509 | * @pAdapter: pointer to adapter |
| 4510 | * @measurementToken: measurement token |
| 4511 | * @flag: flag |
| 4512 | * @numBss: number of bss |
| 4513 | * |
| 4514 | * If the measurement is none and no scan results found, |
| 4515 | * indicate the supplicant about measurement done. |
| 4516 | * |
| 4517 | * Return: none |
| 4518 | */ |
| 4519 | void |
| 4520 | hdd_indicate_ese_bcn_report_no_results(const hdd_adapter_t *pAdapter, |
| 4521 | const uint16_t measurementToken, |
| 4522 | const bool flag, const uint8_t numBss) |
| 4523 | { |
| 4524 | union iwreq_data wrqu; |
| 4525 | char buf[IW_CUSTOM_MAX]; |
| 4526 | char *pos = buf; |
| 4527 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4528 | |
| 4529 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4530 | memset(buf, '\0', sizeof(buf)); |
| 4531 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4532 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4533 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4534 | |
| 4535 | nBytes = |
| 4536 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4537 | flag, numBss); |
| 4538 | |
| 4539 | wrqu.data.pointer = buf; |
| 4540 | wrqu.data.length = nBytes; |
| 4541 | /* send the event */ |
| 4542 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4543 | } |
| 4544 | |
| 4545 | /** |
| 4546 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
| 4547 | * @pAdapter: pointer to adapter |
| 4548 | * @pRoamInfo: pointer to roam info |
| 4549 | * |
| 4550 | * If the measurement is none and no scan results found, |
| 4551 | * indicate the supplicant about measurement done. |
| 4552 | * |
| 4553 | * Return: none |
| 4554 | */ |
| 4555 | static void |
| 4556 | hdd_indicate_ese_bcn_report_ind(const hdd_adapter_t *pAdapter, |
| 4557 | const tCsrRoamInfo *pRoamInfo) |
| 4558 | { |
| 4559 | union iwreq_data wrqu; |
| 4560 | char buf[IW_CUSTOM_MAX]; |
| 4561 | char *pos = buf; |
| 4562 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4563 | uint8_t i = 0, len = 0; |
| 4564 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4565 | uint8_t lastSent = 0, sendBss = 0; |
| 4566 | int bcnRepFieldSize = |
| 4567 | sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0]. |
| 4568 | bcnReportFields); |
| 4569 | uint8_t ieLenByte = 1; |
| 4570 | /* |
| 4571 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4572 | */ |
| 4573 | #define ESEBCNREPHEADER_LEN (18) |
| 4574 | |
| 4575 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4576 | return; |
| 4577 | |
| 4578 | /* |
| 4579 | * Custom event can pass maximum of 256 bytes of data, |
| 4580 | * based on the IE len we need to identify how many BSS info can |
| 4581 | * be filled in to custom event data. |
| 4582 | */ |
| 4583 | /* |
| 4584 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4585 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4586 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4587 | */ |
| 4588 | |
| 4589 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) |
| 4590 | && (!pRoamInfo->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4591 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4592 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4593 | * indicate the supplicant about measurement done |
| 4594 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4595 | hdd_indicate_ese_bcn_report_no_results( |
| 4596 | pAdapter, |
| 4597 | pRoamInfo->pEseBcnReportRsp-> |
| 4598 | measurementToken, |
| 4599 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4600 | pRoamInfo->pEseBcnReportRsp->numBss); |
| 4601 | } else { |
| 4602 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) { |
| 4603 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4604 | memset(buf, '\0', sizeof(buf)); |
| 4605 | tot_bcn_ieLen = 0; |
| 4606 | sendBss = 0; |
| 4607 | pos = buf; |
| 4608 | freeBytes = IW_CUSTOM_MAX; |
| 4609 | |
| 4610 | for (i = lastSent; |
| 4611 | i < pRoamInfo->pEseBcnReportRsp->numBss; i++) { |
| 4612 | len = |
| 4613 | bcnRepFieldSize + ieLenByte + |
| 4614 | pRoamInfo->pEseBcnReportRsp-> |
| 4615 | bcnRepBssInfo[i].ieLen; |
| 4616 | if ((len + tot_bcn_ieLen) > |
| 4617 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4618 | break; |
| 4619 | } |
| 4620 | tot_bcn_ieLen += len; |
| 4621 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4622 | 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] | 4623 | i, bcnRepFieldSize, 1, |
| 4624 | pRoamInfo->pEseBcnReportRsp-> |
| 4625 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4626 | } |
| 4627 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4628 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4629 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4630 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 4631 | pRoamInfo->pEseBcnReportRsp->flag, sendBss, |
| 4632 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4633 | |
| 4634 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
| 4635 | pRoamInfo->pEseBcnReportRsp-> |
| 4636 | measurementToken, |
| 4637 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4638 | sendBss); |
| 4639 | pos += nBytes; |
| 4640 | freeBytes -= nBytes; |
| 4641 | |
| 4642 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4643 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4644 | sizeof(tot_bcn_ieLen)); |
| 4645 | pos += sizeof(tot_bcn_ieLen); |
| 4646 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4647 | |
| 4648 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4649 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4650 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4651 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4652 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
| 4653 | pRoamInfo->pEseBcnReportRsp-> |
| 4654 | bcnRepBssInfo[i + |
| 4655 | lastSent].bcnReportFields. |
| 4656 | ChanNum, |
| 4657 | pRoamInfo->pEseBcnReportRsp-> |
| 4658 | bcnRepBssInfo[i + |
| 4659 | lastSent].bcnReportFields. |
| 4660 | Spare, |
| 4661 | pRoamInfo->pEseBcnReportRsp-> |
| 4662 | bcnRepBssInfo[i + |
| 4663 | lastSent].bcnReportFields. |
| 4664 | MeasDuration, |
| 4665 | pRoamInfo->pEseBcnReportRsp-> |
| 4666 | bcnRepBssInfo[i + |
| 4667 | lastSent].bcnReportFields. |
| 4668 | PhyType, |
| 4669 | pRoamInfo->pEseBcnReportRsp-> |
| 4670 | bcnRepBssInfo[i + |
| 4671 | lastSent].bcnReportFields. |
| 4672 | RecvSigPower, |
| 4673 | pRoamInfo->pEseBcnReportRsp-> |
| 4674 | bcnRepBssInfo[i + |
| 4675 | lastSent].bcnReportFields. |
| 4676 | ParentTsf, |
| 4677 | pRoamInfo->pEseBcnReportRsp-> |
| 4678 | bcnRepBssInfo[i + |
| 4679 | lastSent].bcnReportFields. |
| 4680 | TargetTsf[0], |
| 4681 | pRoamInfo->pEseBcnReportRsp-> |
| 4682 | bcnRepBssInfo[i + |
| 4683 | lastSent].bcnReportFields. |
| 4684 | TargetTsf[1], |
| 4685 | pRoamInfo->pEseBcnReportRsp-> |
| 4686 | bcnRepBssInfo[i + |
| 4687 | lastSent].bcnReportFields. |
| 4688 | BcnInterval, |
| 4689 | pRoamInfo->pEseBcnReportRsp-> |
| 4690 | bcnRepBssInfo[i + |
| 4691 | lastSent].bcnReportFields. |
| 4692 | CapabilityInfo, |
| 4693 | pRoamInfo->pEseBcnReportRsp-> |
| 4694 | bcnRepBssInfo[i + |
| 4695 | lastSent].bcnReportFields. |
| 4696 | Bssid[0], |
| 4697 | pRoamInfo->pEseBcnReportRsp-> |
| 4698 | bcnRepBssInfo[i + |
| 4699 | lastSent].bcnReportFields. |
| 4700 | Bssid[1], |
| 4701 | pRoamInfo->pEseBcnReportRsp-> |
| 4702 | bcnRepBssInfo[i + |
| 4703 | lastSent].bcnReportFields. |
| 4704 | Bssid[2], |
| 4705 | pRoamInfo->pEseBcnReportRsp-> |
| 4706 | bcnRepBssInfo[i + |
| 4707 | lastSent].bcnReportFields. |
| 4708 | Bssid[3], |
| 4709 | pRoamInfo->pEseBcnReportRsp-> |
| 4710 | bcnRepBssInfo[i + |
| 4711 | lastSent].bcnReportFields. |
| 4712 | Bssid[4], |
| 4713 | pRoamInfo->pEseBcnReportRsp-> |
| 4714 | bcnRepBssInfo[i + |
| 4715 | lastSent].bcnReportFields. |
| 4716 | Bssid[5]); |
| 4717 | |
| 4718 | /* bcn report fields are copied */ |
| 4719 | len = |
| 4720 | sizeof(pRoamInfo->pEseBcnReportRsp-> |
| 4721 | bcnRepBssInfo[i + |
| 4722 | lastSent]. |
| 4723 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4724 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4725 | (char *)&pRoamInfo-> |
| 4726 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4727 | lastSent]. |
| 4728 | bcnReportFields, len); |
| 4729 | pos += len; |
| 4730 | freeBytes -= len; |
| 4731 | |
| 4732 | /* Add 1 byte of ie len */ |
| 4733 | len = |
| 4734 | pRoamInfo->pEseBcnReportRsp-> |
| 4735 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4736 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4737 | pos += sizeof(len); |
| 4738 | freeBytes -= sizeof(len); |
| 4739 | |
| 4740 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4741 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4742 | (char *)pRoamInfo-> |
| 4743 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4744 | lastSent]. |
| 4745 | pBuf, len); |
| 4746 | pos += len; |
| 4747 | freeBytes -= len; |
| 4748 | } |
| 4749 | |
| 4750 | wrqu.data.pointer = buf; |
| 4751 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4752 | |
| 4753 | /* send the event */ |
| 4754 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, |
| 4755 | buf); |
| 4756 | lastSent += sendBss; |
| 4757 | } |
| 4758 | } |
| 4759 | } |
| 4760 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4761 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4762 | |
| 4763 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4764 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
| 4765 | * @pHddStaCtx: Station Context |
| 4766 | * |
| 4767 | * API to check if the connection authentication type is 8021x_sha256. |
| 4768 | * |
| 4769 | * Return: bool |
| 4770 | */ |
| 4771 | #ifdef WLAN_FEATURE_11W |
| 4772 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4773 | { |
| 4774 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
| 4775 | pHddStaCtx->conn_info.authType; |
| 4776 | } |
| 4777 | #else |
| 4778 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4779 | { |
| 4780 | return false; |
| 4781 | } |
| 4782 | #endif |
| 4783 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4784 | /* |
| 4785 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4786 | * @adapter: Pointer to adapter context |
| 4787 | * @roam_info: Pointer to roam info |
| 4788 | * |
| 4789 | * Return: None |
| 4790 | */ |
| 4791 | static void hdd_roam_channel_switch_handler(hdd_adapter_t *adapter, |
| 4792 | tCsrRoamInfo *roam_info) |
| 4793 | { |
| 4794 | struct hdd_chan_change_params chan_change; |
| 4795 | struct cfg80211_bss *bss; |
| 4796 | struct net_device *dev = adapter->dev; |
| 4797 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4798 | struct wiphy *wiphy = wdev->wiphy; |
| 4799 | QDF_STATUS status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4800 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4801 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4802 | hdd_debug("channel switch for session:%d to channel:%d", |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4803 | adapter->sessionId, roam_info->chan_info.chan_id); |
| 4804 | |
| 4805 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4806 | chan_change.chan_params.ch_width = |
| 4807 | roam_info->chan_info.ch_width; |
| 4808 | chan_change.chan_params.sec_ch_offset = |
| 4809 | roam_info->chan_info.sec_ch_offset; |
| 4810 | chan_change.chan_params.center_freq_seg0 = |
| 4811 | roam_info->chan_info.band_center_freq1; |
| 4812 | chan_change.chan_params.center_freq_seg1 = |
| 4813 | roam_info->chan_info.band_center_freq2; |
| 4814 | |
| 4815 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4816 | if (NULL == bss) |
| 4817 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4818 | else |
| 4819 | cfg80211_put_bss(wiphy, bss); |
| 4820 | |
| 4821 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change); |
| 4822 | if (QDF_IS_STATUS_ERROR(status)) |
| 4823 | hdd_err("channel change notification failed"); |
| 4824 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4825 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->hdd_psoc, |
| 4826 | adapter->sessionId); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4827 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4828 | hdd_debug("set hw mode change not done"); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4829 | } |
| 4830 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4831 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4832 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4833 | * @pContext: pointer to adapter context |
| 4834 | * @pRoamInfo: pointer to roam info |
| 4835 | * @roamId: roam id |
| 4836 | * @roamStatus: roam status |
| 4837 | * @roamResult: roam result |
| 4838 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4839 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4840 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4841 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4842 | hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, |
| 4843 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4844 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4845 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4846 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 4847 | hdd_wext_state_t *pWextState = NULL; |
| 4848 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4849 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4850 | struct cfg80211_bss *bss_status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4851 | hdd_context_t *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4852 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4853 | hdd_debug("CSR Callback: status= %d result= %d roamID=%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4854 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4855 | |
| 4856 | /* Sanity check */ |
| 4857 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4858 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4859 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4860 | } |
| 4861 | |
| 4862 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4863 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4864 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4865 | |
Sreelakshmi Konamki | 075431a | 2017-03-16 15:23:30 +0530 | [diff] [blame] | 4866 | /* Omitting eCSR_ROAM_UPDATE_SCAN_RESULT as this is too frequent */ |
| 4867 | if (eCSR_ROAM_UPDATE_SCAN_RESULT != roamStatus) |
| 4868 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4869 | pAdapter->sessionId, roamStatus)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4870 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4871 | switch (roamStatus) { |
| 4872 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 6f3a865 | 2015-09-25 10:58:15 +0530 | [diff] [blame] | 4873 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4874 | complete(&pAdapter->session_open_comp_var); |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 4875 | hdd_debug("session %d opened", pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4876 | break; |
| 4877 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4878 | /* |
| 4879 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4880 | * reassoc failed due to failure, timeout, reject from ap |
| 4881 | * in any case tell the OS, our carrier is off and mark |
| 4882 | * interface down. |
| 4883 | */ |
| 4884 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4885 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
| 4886 | roamStatus, roamResult, pAdapter->sessionId); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4887 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4888 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4889 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4890 | pHddStaCtx->ft_carrier_on = false; |
| 4891 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4892 | hdd_debug("hdd_ReassocScenario set to: %d, ReAssoc Failed, session: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4893 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4894 | break; |
| 4895 | |
| 4896 | case eCSR_ROAM_FT_START: |
| 4897 | /* |
| 4898 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4899 | * informed that the link is down. So mark the link ready for |
| 4900 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4901 | * be received. Where in we will not mark the link down |
| 4902 | * Also we want to stop tx at this point when we will be |
| 4903 | * doing disassoc at this time. This saves 30-60 msec |
| 4904 | * after reassoc. |
| 4905 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4906 | hdd_info("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4907 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4908 | hdd_napi_serialize(1); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4909 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4910 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4911 | WLAN_CONTROL_PATH); |
| 4912 | status = hdd_roam_deregister_sta(pAdapter, |
| 4913 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4914 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4915 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4916 | pHddStaCtx->ft_carrier_on = true; |
| 4917 | pHddStaCtx->hdd_ReassocScenario = true; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4918 | hdd_info("hdd_ReassocScenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
| 4919 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4920 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4921 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4922 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4923 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4924 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4925 | if (roamResult == eCSR_ROAM_RESULT_FAILURE) |
| 4926 | pAdapter->roam_ho_fail = true; |
| 4927 | else |
| 4928 | pAdapter->roam_ho_fail = false; |
| 4929 | complete(&pAdapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4930 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4931 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4932 | /* notify apps that we can't pass traffic anymore */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4933 | hdd_debug("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4934 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4935 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4936 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4937 | if (pHddStaCtx->ft_carrier_on == false) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4938 | wlan_hdd_netif_queue_control(pAdapter, |
| 4939 | WLAN_NETIF_CARRIER_OFF, |
| 4940 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4941 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4942 | break; |
| 4943 | case eCSR_ROAM_LOSTLINK: |
| 4944 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4945 | hdd_debug("Roaming started due to connection lost"); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4946 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4947 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4948 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4949 | WLAN_CONTROL_PATH); |
| 4950 | break; |
| 4951 | } |
| 4952 | case eCSR_ROAM_DISASSOCIATED: |
| 4953 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4954 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4955 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 4956 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4957 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4958 | pAdapter->roam_ho_fail = false; |
| 4959 | complete(&pAdapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4960 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4961 | /* Call to clear any MC Addr List filter applied after |
| 4962 | * successful connection. |
| 4963 | */ |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4964 | hdd_disable_and_flush_mc_addr_list(pAdapter, |
| 4965 | pmo_peer_disconnect); |
| 4966 | qdf_ret_status = |
| 4967 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4968 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4969 | } |
| 4970 | break; |
| 4971 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4972 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4973 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4974 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4975 | roamStatus, roamResult); |
| 4976 | break; |
| 4977 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4978 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4979 | /* |
| 4980 | * To Do - address probable memory leak with WEP encryption upon |
| 4981 | * successful association. |
| 4982 | */ |
| 4983 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 4984 | /* Clear saved connection information in HDD */ |
| 4985 | hdd_conn_remove_connect_info( |
| 4986 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 4987 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4988 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4989 | hdd_association_completion_handler(pAdapter, pRoamInfo, |
| 4990 | roamId, roamStatus, |
| 4991 | roamResult); |
| 4992 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4993 | if (pRoamInfo) |
| 4994 | pRoamInfo->roamSynchInProgress = false; |
| 4995 | #endif |
| 4996 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 4997 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4998 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4999 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5000 | qdf_ret_status = hdd_association_completion_handler(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5001 | pRoamInfo, |
| 5002 | roamId, |
| 5003 | roamStatus, |
| 5004 | roamResult); |
| 5005 | break; |
| 5006 | case eCSR_ROAM_IBSS_IND: |
| 5007 | hdd_roam_ibss_indication_handler(pAdapter, pRoamInfo, roamId, |
| 5008 | roamStatus, roamResult); |
| 5009 | break; |
| 5010 | |
| 5011 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5012 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5013 | roam_roam_connect_status_update_handler(pAdapter, |
| 5014 | pRoamInfo, |
| 5015 | roamId, |
| 5016 | roamStatus, |
| 5017 | roamResult); |
| 5018 | break; |
| 5019 | |
| 5020 | case eCSR_ROAM_MIC_ERROR_IND: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5021 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5022 | hdd_roam_mic_error_indication_handler(pAdapter, |
| 5023 | pRoamInfo, |
| 5024 | roamId, |
| 5025 | roamStatus, |
| 5026 | roamResult); |
| 5027 | break; |
| 5028 | |
| 5029 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 5030 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5031 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5032 | hdd_roam_set_key_complete_handler(pAdapter, pRoamInfo, |
| 5033 | roamId, roamStatus, |
| 5034 | roamResult); |
| 5035 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
| 5036 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5037 | hdd_debug("hdd_ReassocScenario set to: %d, set key complete, session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5038 | pHddStaCtx->hdd_ReassocScenario, |
| 5039 | pAdapter->sessionId); |
| 5040 | } |
| 5041 | } |
| 5042 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5043 | if (pRoamInfo != NULL) |
| 5044 | pRoamInfo->roamSynchInProgress = false; |
| 5045 | #endif |
| 5046 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5047 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5048 | case eCSR_ROAM_FT_RESPONSE: |
| 5049 | hdd_send_ft_event(pAdapter); |
| 5050 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5051 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5052 | case eCSR_ROAM_PMK_NOTIFY: |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 5053 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType |
| 5054 | || hdd_is_8021x_sha256_auth_type(pHddStaCtx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5055 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5056 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5057 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
| 5058 | pAdapter, pRoamInfo, 1, false); |
| 5059 | } |
| 5060 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5061 | |
| 5062 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 5063 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 5064 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5065 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5066 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, |
| 5067 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5068 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5069 | } |
| 5070 | break; |
| 5071 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 5072 | /* |
| 5073 | * This event will notify pre-auth completion in case of success |
| 5074 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5075 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5076 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5077 | pRoamInfo, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5078 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5079 | } |
| 5080 | break; |
| 5081 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 5082 | /* |
| 5083 | * This event will notify pre-auth completion incase of failure. |
| 5084 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5085 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5086 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5087 | pRoamInfo, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5088 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5089 | } |
| 5090 | break; |
| 5091 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 5092 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 5093 | * It will be only invoked on success |
| 5094 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5095 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5096 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, |
| 5097 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5098 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5099 | } |
| 5100 | break; |
| 5101 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5102 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 5103 | hdd_remain_chan_ready_handler(pAdapter, pRoamInfo->roc_scan_id); |
| 5104 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5105 | #ifdef FEATURE_WLAN_TDLS |
| 5106 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5107 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5108 | hdd_roam_tdls_status_update_handler(pAdapter, pRoamInfo, |
| 5109 | roamId, |
| 5110 | roamStatus, |
| 5111 | roamResult); |
| 5112 | break; |
| 5113 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 5114 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, |
| 5115 | pRoamInfo->reasonCode); |
| 5116 | break; |
| 5117 | #endif |
| 5118 | #ifdef WLAN_FEATURE_11W |
| 5119 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 5120 | hdd_indicate_unprot_mgmt_frame(pAdapter, |
| 5121 | pRoamInfo->nFrameLength, |
| 5122 | pRoamInfo->pbFrames, |
| 5123 | pRoamInfo->frameType); |
| 5124 | break; |
| 5125 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5126 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5127 | case eCSR_ROAM_TSM_IE_IND: |
| 5128 | hdd_indicate_tsm_ie(pAdapter, pRoamInfo->tsmIe.tsid, |
| 5129 | pRoamInfo->tsmIe.state, |
| 5130 | pRoamInfo->tsmIe.msmt_interval); |
| 5131 | break; |
| 5132 | |
| 5133 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 5134 | { |
| 5135 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
| 5136 | pHddStaCtx->conn_info.authType |
| 5137 | || eCSR_AUTH_TYPE_CCKM_RSN == |
| 5138 | pHddStaCtx->conn_info.authType) { |
| 5139 | hdd_indicate_cckm_pre_auth(pAdapter, pRoamInfo); |
| 5140 | } |
| 5141 | break; |
| 5142 | } |
| 5143 | |
| 5144 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 5145 | { |
| 5146 | hdd_indicate_ese_adj_ap_rep_ind(pAdapter, pRoamInfo); |
| 5147 | break; |
| 5148 | } |
| 5149 | |
| 5150 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 5151 | { |
| 5152 | hdd_indicate_ese_bcn_report_ind(pAdapter, pRoamInfo); |
| 5153 | break; |
| 5154 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5155 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5156 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5157 | hdd_roam_channel_switch_handler(pAdapter, pRoamInfo); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5158 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5159 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5160 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 5161 | if ((NULL != pRoamInfo) && (NULL != pRoamInfo->pBssDesc)) { |
| 5162 | bss_status = wlan_hdd_cfg80211_inform_bss_frame( |
| 5163 | pAdapter, pRoamInfo->pBssDesc); |
| 5164 | if (NULL == bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5165 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5166 | else |
| 5167 | cfg80211_put_bss( |
| 5168 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 5169 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 5170 | #endif |
| 5171 | bss_status); |
| 5172 | } |
| 5173 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 5174 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
| 5175 | hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, |
| 5176 | roamResult); |
| 5177 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5178 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5179 | hdd_debug("Process ROAM_START from firmware"); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5180 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5181 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5182 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5183 | hdd_napi_serialize(1); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5184 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5185 | hdd_set_roaming_in_progress(true); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 5186 | policy_mgr_restart_opportunistic_timer(hdd_ctx->hdd_psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5187 | break; |
| 5188 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5189 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5190 | hdd_napi_serialize(0); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5191 | wlan_hdd_netif_queue_control(pAdapter, |
| 5192 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 5193 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5194 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5195 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5196 | pAdapter->roam_ho_fail = false; |
| 5197 | complete(&pAdapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5198 | break; |
| 5199 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5200 | default: |
| 5201 | break; |
| 5202 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5203 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5204 | } |
| 5205 | |
| 5206 | /** |
| 5207 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 5208 | * @auth_suite: auth suite |
| 5209 | * |
| 5210 | * Return: eCsrAuthType enumeration |
| 5211 | */ |
| 5212 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5213 | { |
| 5214 | eCsrAuthType auth_type; |
| 5215 | /* is the auth type supported? */ |
| 5216 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 5217 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 5218 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 5219 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5220 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5221 | /* Check for 11r FT Authentication with PSK */ |
| 5222 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5223 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5224 | /* Check for 11R FT Authentication with 802.1X */ |
| 5225 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5226 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5227 | #ifdef FEATURE_WLAN_ESE |
| 5228 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5229 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5230 | } else |
| 5231 | #endif /* FEATURE_WLAN_ESE */ |
| 5232 | #ifdef WLAN_FEATURE_11W |
| 5233 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5234 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5235 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5236 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5237 | } else |
| 5238 | #endif |
| 5239 | { |
| 5240 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5241 | } |
| 5242 | return auth_type; |
| 5243 | } |
| 5244 | |
| 5245 | /** |
| 5246 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5247 | * @auth_suite: auth suite |
| 5248 | * |
| 5249 | * Return: eCsrAuthType enumeration |
| 5250 | */ |
| 5251 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5252 | { |
| 5253 | eCsrAuthType auth_type; |
| 5254 | /* is the auth type supported? */ |
| 5255 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5256 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5257 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5258 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5259 | } else |
| 5260 | #ifdef FEATURE_WLAN_ESE |
| 5261 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5262 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5263 | } else |
| 5264 | #endif /* FEATURE_WLAN_ESE */ |
| 5265 | { |
| 5266 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5267 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5268 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5269 | return auth_type; |
| 5270 | } |
| 5271 | |
| 5272 | /** |
| 5273 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5274 | * Translate RSN to CSR encryption type |
| 5275 | * @cipher_suite: cipher suite |
| 5276 | * |
| 5277 | * Return: eCsrEncryptionType enumeration |
| 5278 | */ |
| 5279 | eCsrEncryptionType |
| 5280 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5281 | { |
| 5282 | eCsrEncryptionType cipher_type; |
| 5283 | |
| 5284 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5285 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5286 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5287 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5288 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5289 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5290 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5291 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5292 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5293 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5294 | else |
| 5295 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5296 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5297 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5298 | return cipher_type; |
| 5299 | } |
| 5300 | |
| 5301 | /** |
| 5302 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5303 | * Translate WPA to CSR encryption type |
| 5304 | * @cipher_suite: cipher suite |
| 5305 | * |
| 5306 | * Return: eCsrEncryptionType enumeration |
| 5307 | */ |
| 5308 | eCsrEncryptionType |
| 5309 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5310 | { |
| 5311 | eCsrEncryptionType cipher_type; |
| 5312 | |
| 5313 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5314 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5315 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5316 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5317 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5318 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5319 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5320 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5321 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5322 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5323 | else |
| 5324 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5325 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5326 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5327 | return cipher_type; |
| 5328 | } |
| 5329 | |
| 5330 | /** |
| 5331 | * hdd_process_genie() - process gen ie |
| 5332 | * @pAdapter: pointer to adapter |
| 5333 | * @bssid: pointer to mac address |
| 5334 | * @pEncryptType: pointer to encryption type |
| 5335 | * @mcEncryptType: pointer to multicast encryption type |
| 5336 | * @pAuthType: pointer to auth type |
| 5337 | * |
| 5338 | * Return: 0 on success, error number otherwise |
| 5339 | */ |
| 5340 | static int32_t hdd_process_genie(hdd_adapter_t *pAdapter, |
| 5341 | u8 *bssid, |
| 5342 | eCsrEncryptionType *pEncryptType, |
| 5343 | eCsrEncryptionType *mcEncryptType, |
| 5344 | eCsrAuthType *pAuthType, |
| 5345 | #ifdef WLAN_FEATURE_11W |
| 5346 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5347 | #endif |
| 5348 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5349 | { |
| 5350 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5351 | QDF_STATUS result; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5352 | tDot11fIERSN dot11RSNIE; |
| 5353 | tDot11fIEWPA dot11WPAIE; |
| 5354 | uint32_t i; |
| 5355 | uint8_t *pRsnIe; |
| 5356 | uint16_t RSNIeLen; |
| 5357 | tPmkidCacheInfo PMKIDCache[4]; /* Local transfer memory */ |
| 5358 | bool updatePMKCache = false; |
| 5359 | |
| 5360 | /* |
| 5361 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5362 | * setting present flag to 0. |
| 5363 | */ |
| 5364 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5365 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5366 | |
| 5367 | /* Type check */ |
| 5368 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5369 | /* Validity checks */ |
| 5370 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5371 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5372 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5373 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5374 | return -EINVAL; |
| 5375 | } |
| 5376 | /* Skip past the EID byte and length byte */ |
| 5377 | pRsnIe = gen_ie + 2; |
| 5378 | RSNIeLen = gen_ie_len - 2; |
| 5379 | /* Unpack the RSN IE */ |
| 5380 | dot11f_unpack_ie_rsn((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5381 | pRsnIe, RSNIeLen, &dot11RSNIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5382 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5383 | hdd_debug("pairwise cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5384 | dot11RSNIE.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5385 | hdd_debug("authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5386 | dot11RSNIE.akm_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5387 | /* dot11RSNIE.akm_suite_count */ |
| 5388 | /* Just translate the FIRST one */ |
| 5389 | *pAuthType = |
| 5390 | hdd_translate_rsn_to_csr_auth_type( |
| 5391 | dot11RSNIE.akm_suites[0]); |
| 5392 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5393 | *pEncryptType = |
| 5394 | hdd_translate_rsn_to_csr_encryption_type( |
| 5395 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5396 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5397 | *mcEncryptType = |
| 5398 | hdd_translate_rsn_to_csr_encryption_type( |
| 5399 | dot11RSNIE.gp_cipher_suite); |
| 5400 | #ifdef WLAN_FEATURE_11W |
| 5401 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
| 5402 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1; |
| 5403 | #endif |
| 5404 | /* Set the PMKSA ID Cache for this interface */ |
| 5405 | for (i = 0; i < dot11RSNIE.pmkid_count; i++) { |
| 5406 | if (is_zero_ether_addr(bssid)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5407 | hdd_warn("MAC address is all zeroes"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5408 | break; |
| 5409 | } |
| 5410 | updatePMKCache = true; |
| 5411 | /* |
| 5412 | * For right now, I assume setASSOCIATE() has passed |
| 5413 | * in the bssid. |
| 5414 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5415 | qdf_mem_copy(PMKIDCache[i].BSSID.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5416 | bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5417 | qdf_mem_copy(PMKIDCache[i].PMKID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5418 | dot11RSNIE.pmkid[i], CSR_RSN_PMKID_SIZE); |
| 5419 | } |
| 5420 | |
| 5421 | if (updatePMKCache) { |
| 5422 | /* |
| 5423 | * Calling csr_roam_set_pmkid_cache to configure the |
| 5424 | * PMKIDs into the cache. |
| 5425 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5426 | hdd_debug("Calling sme_roam_set_pmkid_cache with cache entry %d.", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5427 | i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5428 | /* Finally set the PMKSA ID Cache in CSR */ |
| 5429 | result = |
| 5430 | sme_roam_set_pmkid_cache(halHandle, |
| 5431 | pAdapter->sessionId, |
| 5432 | PMKIDCache, |
| 5433 | dot11RSNIE.pmkid_count, |
| 5434 | false); |
| 5435 | } |
| 5436 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5437 | /* Validity checks */ |
| 5438 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5439 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5440 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5441 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5442 | return -EINVAL; |
| 5443 | } |
| 5444 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5445 | pRsnIe = gen_ie + 2 + 4; |
| 5446 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5447 | /* Unpack the WPA IE */ |
| 5448 | dot11f_unpack_ie_wpa((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5449 | pRsnIe, RSNIeLen, &dot11WPAIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5450 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5451 | hdd_debug("WPA unicast cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5452 | dot11WPAIE.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5453 | hdd_debug("WPA authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5454 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5455 | /* dot11WPAIE.auth_suite_count */ |
| 5456 | /* Just translate the FIRST one */ |
| 5457 | *pAuthType = |
| 5458 | hdd_translate_wpa_to_csr_auth_type( |
| 5459 | dot11WPAIE.auth_suites[0]); |
| 5460 | /* dot11WPAIE.unicast_cipher_count */ |
| 5461 | *pEncryptType = |
| 5462 | hdd_translate_wpa_to_csr_encryption_type( |
| 5463 | dot11WPAIE.unicast_ciphers[0]); |
| 5464 | /* dot11WPAIE.unicast_cipher_count */ |
| 5465 | *mcEncryptType = |
| 5466 | hdd_translate_wpa_to_csr_encryption_type( |
| 5467 | dot11WPAIE.multicast_cipher); |
| 5468 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5469 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5470 | return -EINVAL; |
| 5471 | } |
| 5472 | return 0; |
| 5473 | } |
| 5474 | |
| 5475 | /** |
| 5476 | * hdd_set_genie_to_csr() - set genie to csr |
| 5477 | * @pAdapter: pointer to adapter |
| 5478 | * @RSNAuthType: pointer to auth type |
| 5479 | * |
| 5480 | * Return: 0 on success, error number otherwise |
| 5481 | */ |
| 5482 | int hdd_set_genie_to_csr(hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 5483 | { |
| 5484 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5485 | uint32_t status = 0; |
| 5486 | eCsrEncryptionType RSNEncryptType; |
| 5487 | eCsrEncryptionType mcRSNEncryptType; |
| 5488 | #ifdef WLAN_FEATURE_11W |
| 5489 | uint8_t RSNMfpRequired = 0; |
| 5490 | uint8_t RSNMfpCapable = 0; |
| 5491 | #endif |
| 5492 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
| 5493 | /* MAC address of assoc peer */ |
| 5494 | /* But, this routine is only called when we are NOT associated. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5495 | qdf_mem_copy(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5496 | pWextState->roamProfile.BSSIDs.bssid, |
| 5497 | sizeof(bssid)); |
| 5498 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN |
| 5499 | || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) { |
| 5500 | /* continue */ |
| 5501 | } else { |
| 5502 | return 0; |
| 5503 | } |
| 5504 | /* The actual processing may eventually be more extensive than this. */ |
| 5505 | /* Right now, just consume any PMKIDs that are sent in by the app. */ |
| 5506 | status = hdd_process_genie(pAdapter, bssid, |
| 5507 | &RSNEncryptType, |
| 5508 | &mcRSNEncryptType, RSNAuthType, |
| 5509 | #ifdef WLAN_FEATURE_11W |
| 5510 | &RSNMfpRequired, &RSNMfpCapable, |
| 5511 | #endif |
| 5512 | pWextState->WPARSNIE[1] + 2, |
| 5513 | pWextState->WPARSNIE); |
| 5514 | if (status == 0) { |
| 5515 | /* |
| 5516 | * Now copy over all the security attributes |
| 5517 | * you have parsed out. |
| 5518 | */ |
| 5519 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5520 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5521 | |
| 5522 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; /* Use the cipher type in the RSN IE */ |
| 5523 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5524 | mcRSNEncryptType; |
| 5525 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5526 | if ((QDF_IBSS_MODE == pAdapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5527 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 5528 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5529 | /* |
| 5530 | * For wpa none supplicant sends the WPA IE with unicast |
| 5531 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5532 | * multicast cipher as either AES/TKIP based on group |
| 5533 | * cipher configuration mentioned in the |
| 5534 | * wpa_supplicant.conf. |
| 5535 | */ |
| 5536 | |
| 5537 | /* Set the unicast cipher same as multicast cipher */ |
| 5538 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 5539 | = mcRSNEncryptType; |
| 5540 | } |
| 5541 | #ifdef WLAN_FEATURE_11W |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5542 | hdd_debug("RSNMfpRequired = %d, RSNMfpCapable = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5543 | RSNMfpRequired, RSNMfpCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5544 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 5545 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 5546 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5547 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5548 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5549 | } |
| 5550 | return 0; |
| 5551 | } |
| 5552 | |
| 5553 | /** |
| 5554 | * hdd_set_csr_auth_type() - set csr auth type |
| 5555 | * @pAdapter: pointer to adapter |
| 5556 | * @RSNAuthType: auth type |
| 5557 | * |
| 5558 | * Return: 0 on success, error number otherwise |
| 5559 | */ |
| 5560 | int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 5561 | { |
| 5562 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5563 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 5564 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5565 | |
| 5566 | pRoamProfile->AuthType.numEntries = 1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5567 | hdd_debug("pHddStaCtx->conn_info.authType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5568 | pHddStaCtx->conn_info.authType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5569 | |
| 5570 | switch (pHddStaCtx->conn_info.authType) { |
| 5571 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5572 | #ifdef FEATURE_WLAN_ESE |
| 5573 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5574 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5575 | #endif |
| 5576 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 5577 | |
| 5578 | pRoamProfile->AuthType.authType[0] = |
| 5579 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5580 | } else if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
| 5581 | |
| 5582 | #ifdef FEATURE_WLAN_ESE |
| 5583 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 5584 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5585 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5586 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5587 | pRoamProfile->AuthType.authType[0] = |
| 5588 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5589 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5590 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5591 | pRoamProfile->AuthType.authType[0] = |
| 5592 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5593 | } else |
| 5594 | #endif |
| 5595 | if ((pWextState-> |
| 5596 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5597 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5598 | pRoamProfile->AuthType.authType[0] = |
| 5599 | eCSR_AUTH_TYPE_WPA; |
| 5600 | } else |
| 5601 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5602 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5603 | pRoamProfile->AuthType.authType[0] = |
| 5604 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5605 | } else { |
| 5606 | pRoamProfile->AuthType.authType[0] = |
| 5607 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5608 | } |
| 5609 | } |
| 5610 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
| 5611 | #ifdef FEATURE_WLAN_ESE |
| 5612 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 5613 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5614 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5615 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5616 | pRoamProfile->AuthType.authType[0] = |
| 5617 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5618 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5619 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5620 | pRoamProfile->AuthType.authType[0] = |
| 5621 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5622 | } else |
| 5623 | #endif |
| 5624 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5625 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 5626 | ((pWextState-> |
| 5627 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5628 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5629 | pRoamProfile->AuthType.authType[0] = |
| 5630 | eCSR_AUTH_TYPE_FT_RSN; |
| 5631 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5632 | && |
| 5633 | ((pWextState-> |
| 5634 | authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5635 | == IW_AUTH_KEY_MGMT_PSK)) { |
| 5636 | pRoamProfile->AuthType.authType[0] = |
| 5637 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5638 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5639 | |
| 5640 | #ifdef WLAN_FEATURE_11W |
| 5641 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5642 | pRoamProfile->AuthType.authType[0] = |
| 5643 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5644 | } else if (RSNAuthType == |
| 5645 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5646 | pRoamProfile->AuthType.authType[0] = |
| 5647 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5648 | } else |
| 5649 | #endif |
| 5650 | |
| 5651 | if ((pWextState-> |
| 5652 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5653 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5654 | pRoamProfile->AuthType.authType[0] = |
| 5655 | eCSR_AUTH_TYPE_RSN; |
| 5656 | } else |
| 5657 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5658 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5659 | pRoamProfile->AuthType.authType[0] = |
| 5660 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5661 | } else { |
| 5662 | pRoamProfile->AuthType.authType[0] = |
| 5663 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5664 | } |
| 5665 | } |
| 5666 | break; |
| 5667 | |
| 5668 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5669 | |
| 5670 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5671 | break; |
| 5672 | default: |
| 5673 | |
| 5674 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5675 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5676 | #endif /* FEATURE_WLAN_ESE */ |
| 5677 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5678 | break; |
| 5679 | } |
| 5680 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5681 | hdd_debug("Set roam Authtype to %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5682 | pWextState->roamProfile.AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5683 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5684 | return 0; |
| 5685 | } |
| 5686 | |
| 5687 | /** |
| 5688 | * __iw_set_essid() - This function sets the ssid received from wpa_supplicant |
| 5689 | * to the CSR roam profile. |
| 5690 | * |
| 5691 | * @dev: Pointer to the net device. |
| 5692 | * @info: Pointer to the iw_request_info. |
| 5693 | * @wrqu: Pointer to the iwreq_data. |
| 5694 | * @extra: Pointer to the data. |
| 5695 | * |
| 5696 | * Return: 0 for success, error number on failure |
| 5697 | */ |
| 5698 | static int __iw_set_essid(struct net_device *dev, |
| 5699 | struct iw_request_info *info, |
| 5700 | union iwreq_data *wrqu, char *extra) |
| 5701 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5702 | uint32_t status = 0; |
| 5703 | hdd_wext_state_t *pWextState; |
| 5704 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5705 | hdd_context_t *hdd_ctx; |
| 5706 | uint32_t roamId; |
| 5707 | tCsrRoamProfile *pRoamProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5708 | eCsrAuthType RSNAuthType; |
| 5709 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5710 | int ret; |
| 5711 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5712 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5713 | |
| 5714 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5715 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5716 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5717 | return ret; |
| 5718 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5719 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5720 | if (0 != ret) |
| 5721 | return ret; |
| 5722 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5723 | if (pAdapter->device_mode != QDF_STA_MODE && |
Jeff Johnson | d6e4b63 | 2016-10-03 13:49:27 -0700 | [diff] [blame] | 5724 | pAdapter->device_mode != QDF_IBSS_MODE && |
| 5725 | pAdapter->device_mode != QDF_P2P_CLIENT_MODE) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5726 | hdd_warn("device mode %s(%d) is not allowed", |
| 5727 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 5728 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5729 | return -EINVAL; |
| 5730 | } |
| 5731 | |
| 5732 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5733 | |
| 5734 | if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5735 | hdd_warn("Counter measure is in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5736 | return -EBUSY; |
| 5737 | } |
| 5738 | if (SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length) |
| 5739 | return -EINVAL; |
| 5740 | |
| 5741 | pRoamProfile = &pWextState->roamProfile; |
Agrawal Ashish | 3d000b4 | 2017-02-07 13:44:50 +0530 | [diff] [blame] | 5742 | /*Try disconnecting if already in connected state*/ |
| 5743 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5744 | if (0 > status) { |
| 5745 | hdd_err("Failed to disconnect the existing connection"); |
| 5746 | return -EALREADY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5747 | } |
| 5748 | |
| 5749 | /* |
| 5750 | * when cfg80211 defined, wpa_supplicant wext driver uses |
| 5751 | * zero-length, null-string ssid for force disconnection. |
| 5752 | * after disconnection (if previously connected) and cleaning ssid, |
| 5753 | * driver MUST return success. |
| 5754 | */ |
| 5755 | if (0 == wrqu->essid.length) |
| 5756 | return 0; |
| 5757 | |
| 5758 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5759 | &pWextState->roamProfile.uapsd_mask); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5760 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5761 | pWextState->roamProfile.uapsd_mask = 0; |
| 5762 | |
| 5763 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
| 5764 | |
| 5765 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = |
| 5766 | wrqu->essid.length; |
| 5767 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5768 | qdf_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5769 | sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5770 | qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5771 | ssId), extra, wrqu->essid.length); |
| 5772 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion |
| 5773 | || IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion) { |
| 5774 | |
| 5775 | /* set gen ie */ |
| 5776 | hdd_set_genie_to_csr(pAdapter, &RSNAuthType); |
| 5777 | |
| 5778 | /* set auth */ |
| 5779 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5780 | } |
| 5781 | #ifdef FEATURE_WLAN_WAPI |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5782 | hdd_debug("Setting WAPI AUTH Type and Encryption Mode values"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5783 | if (pAdapter->wapi_info.nWapiMode) { |
| 5784 | switch (pAdapter->wapi_info.wapiAuthMode) { |
| 5785 | case WAPI_AUTH_MODE_PSK: |
| 5786 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5787 | hdd_debug("WAPI AUTH TYPE: PSK: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5788 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5789 | pRoamProfile->AuthType.numEntries = 1; |
| 5790 | pRoamProfile->AuthType.authType[0] = |
| 5791 | eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5792 | break; |
| 5793 | } |
| 5794 | case WAPI_AUTH_MODE_CERT: |
| 5795 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5796 | hdd_debug("WAPI AUTH TYPE: CERT: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5797 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5798 | pRoamProfile->AuthType.numEntries = 1; |
| 5799 | pRoamProfile->AuthType.authType[0] = |
| 5800 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5801 | break; |
| 5802 | } |
| 5803 | } /* End of switch */ |
| 5804 | if (pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5805 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5806 | hdd_debug("WAPI PAIRWISE/GROUP ENCRYPTION: WPI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5807 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5808 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 5809 | eCSR_ENCRYPT_TYPE_WPI; |
| 5810 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5811 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 5812 | eCSR_ENCRYPT_TYPE_WPI; |
| 5813 | } |
| 5814 | } |
| 5815 | #endif /* FEATURE_WLAN_WAPI */ |
| 5816 | /* if previous genIE is not NULL, update AssocIE */ |
| 5817 | if (0 != pWextState->genIE.length) { |
| 5818 | memset(&pWextState->assocAddIE, 0, |
| 5819 | sizeof(pWextState->assocAddIE)); |
| 5820 | memcpy(pWextState->assocAddIE.addIEdata, |
| 5821 | pWextState->genIE.addIEdata, pWextState->genIE.length); |
| 5822 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5823 | pWextState->roamProfile.pAddIEAssoc = |
| 5824 | pWextState->assocAddIE.addIEdata; |
| 5825 | pWextState->roamProfile.nAddIEAssocLength = |
| 5826 | pWextState->assocAddIE.length; |
| 5827 | |
| 5828 | /* clear previous genIE after use it */ |
| 5829 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 5830 | } |
| 5831 | |
| 5832 | /* |
| 5833 | * Assumes it is not WPS Association by default, except when |
| 5834 | * pAddIEAssoc has WPS IE. |
| 5835 | */ |
| 5836 | pWextState->roamProfile.bWPSAssociation = false; |
| 5837 | |
| 5838 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5839 | pWextState->roamProfile. |
| 5840 | nAddIEAssocLength)) |
| 5841 | pWextState->roamProfile.bWPSAssociation = true; |
| 5842 | |
| 5843 | /* Disable auto BMPS entry by PMC until DHCP is done */ |
| 5844 | sme_set_dhcp_till_power_active_flag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5845 | true); |
| 5846 | |
| 5847 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 5848 | |
| 5849 | if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType) { |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5850 | pRoamProfile->ch_params.ch_width = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5851 | hdd_select_cbmode(pAdapter, |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5852 | (WLAN_HDD_GET_CTX(pAdapter))->config->AdHocChannel5G, |
| 5853 | &pRoamProfile->ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5854 | } |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5855 | |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5856 | /* |
| 5857 | * Change conn_state to connecting before sme_roam_connect(), |
| 5858 | * because sme_roam_connect() has a direct path to call |
| 5859 | * hdd_sme_roam_callback(), which will change the conn_state |
| 5860 | * If direct path, conn_state will be accordingly changed to |
| 5861 | * NotConnected or Associated by either |
| 5862 | * hdd_association_completion_handler() or hdd_dis_connect_handler() |
| 5863 | * in sme_RoamCallback()if sme_RomConnect is to be queued, |
| 5864 | * Connecting state will remain until it is completed. |
| 5865 | * |
| 5866 | * If connection state is not changed, |
| 5867 | * connection state will remain in eConnectionState_NotConnected state. |
| 5868 | * In hdd_association_completion_handler, "hddDisconInProgress" is |
| 5869 | * set to true if conn state is eConnectionState_NotConnected. |
| 5870 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5871 | * informed of connect result indication which is an issue. |
| 5872 | */ |
| 5873 | if (QDF_STA_MODE == pAdapter->device_mode || |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5874 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode) |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5875 | hdd_conn_set_connection_state(pAdapter, |
| 5876 | eConnectionState_Connecting); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5877 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5878 | status = sme_roam_connect(hHal, pAdapter->sessionId, |
| 5879 | &(pWextState->roamProfile), &roamId); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5880 | if ((QDF_STATUS_SUCCESS != status) && |
| 5881 | (QDF_STA_MODE == pAdapter->device_mode || |
| 5882 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5883 | hdd_err("sme_roam_connect failed session_id: %d status %d -> NotConnected", |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5884 | pAdapter->sessionId, status); |
| 5885 | /* change back to NotAssociated */ |
| 5886 | hdd_conn_set_connection_state(pAdapter, |
| 5887 | eConnectionState_NotConnected); |
| 5888 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5889 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5890 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5891 | |
| 5892 | EXIT(); |
| 5893 | return status; |
| 5894 | } |
| 5895 | |
| 5896 | /** |
| 5897 | * iw_set_essid() - set essid handler function |
| 5898 | * @dev: Pointer to the net device. |
| 5899 | * @info: Pointer to the iw_request_info. |
| 5900 | * @wrqu: Pointer to the iwreq_data. |
| 5901 | * @extra: Pointer to the data. |
| 5902 | * |
| 5903 | * Return: 0 for success, error number on failure |
| 5904 | */ |
| 5905 | int iw_set_essid(struct net_device *dev, |
| 5906 | struct iw_request_info *info, |
| 5907 | union iwreq_data *wrqu, char *extra) |
| 5908 | { |
| 5909 | int ret; |
| 5910 | |
| 5911 | cds_ssr_protect(__func__); |
| 5912 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5913 | cds_ssr_unprotect(__func__); |
| 5914 | |
| 5915 | return ret; |
| 5916 | } |
| 5917 | |
| 5918 | /** |
| 5919 | * __iw_get_essid() - This function returns the essid to the wpa_supplicant |
| 5920 | * @dev: pointer to the net device |
| 5921 | * @info: pointer to the iw request info |
| 5922 | * @dwrq: pointer to iw_point |
| 5923 | * @extra: pointer to the data |
| 5924 | * |
| 5925 | * Return: 0 on success, error number otherwise |
| 5926 | */ |
| 5927 | static int __iw_get_essid(struct net_device *dev, |
| 5928 | struct iw_request_info *info, |
| 5929 | struct iw_point *dwrq, char *extra) |
| 5930 | { |
| 5931 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5932 | hdd_context_t *hdd_ctx; |
| 5933 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5934 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5935 | int ret; |
| 5936 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5937 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5938 | |
| 5939 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5940 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5941 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5942 | return ret; |
| 5943 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5944 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5945 | if (0 != ret) |
| 5946 | return ret; |
| 5947 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5948 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 5949 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 5950 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected |
| 5951 | || pHddStaCtx->conn_info.connState == |
| 5952 | eConnectionState_IbssDisconnected) |
| 5953 | && wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) { |
| 5954 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 5955 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 5956 | dwrq->length); |
| 5957 | dwrq->flags = 1; |
| 5958 | } else { |
| 5959 | memset(extra, 0, dwrq->length); |
| 5960 | dwrq->length = 0; |
| 5961 | dwrq->flags = 0; |
| 5962 | } |
| 5963 | EXIT(); |
| 5964 | return 0; |
| 5965 | } |
| 5966 | |
| 5967 | /** |
| 5968 | * iw_get_essid() - get essid handler function |
| 5969 | * @dev: Pointer to the net device. |
| 5970 | * @info: Pointer to the iw_request_info. |
| 5971 | * @wrqu: Pointer to the iwreq_data. |
| 5972 | * @extra: Pointer to the data. |
| 5973 | * |
| 5974 | * Return: 0 for success, error number on failure |
| 5975 | */ |
| 5976 | int iw_get_essid(struct net_device *dev, |
| 5977 | struct iw_request_info *info, |
| 5978 | struct iw_point *wrqu, char *extra) |
| 5979 | { |
| 5980 | int ret; |
| 5981 | |
| 5982 | cds_ssr_protect(__func__); |
| 5983 | ret = __iw_get_essid(dev, info, wrqu, extra); |
| 5984 | cds_ssr_unprotect(__func__); |
| 5985 | |
| 5986 | return ret; |
| 5987 | } |
| 5988 | |
| 5989 | /** |
| 5990 | * __iw_set_auth() - |
| 5991 | * This function sets the auth type received from the wpa_supplicant |
| 5992 | * @dev: pointer to the net device |
| 5993 | * @info: pointer to the iw request info |
| 5994 | * @wrqu: pointer to iwreq_data |
| 5995 | * @extra: pointer to the data |
| 5996 | * |
| 5997 | * Return: 0 on success, error number otherwise |
| 5998 | */ |
| 5999 | static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6000 | union iwreq_data *wrqu, char *extra) |
| 6001 | { |
| 6002 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6003 | hdd_context_t *hdd_ctx; |
| 6004 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6005 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6006 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6007 | eCsrEncryptionType mcEncryptionType; |
| 6008 | eCsrEncryptionType ucEncryptionType; |
| 6009 | int ret; |
| 6010 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6011 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6012 | |
| 6013 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6014 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6015 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6016 | return ret; |
| 6017 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6018 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6019 | if (0 != ret) |
| 6020 | return ret; |
| 6021 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6022 | switch (wrqu->param.flags & IW_AUTH_INDEX) { |
| 6023 | case IW_AUTH_WPA_VERSION: |
| 6024 | pWextState->wpaVersion = wrqu->param.value; |
| 6025 | break; |
| 6026 | |
| 6027 | case IW_AUTH_CIPHER_PAIRWISE: |
| 6028 | { |
| 6029 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6030 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6031 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6032 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6033 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6034 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6035 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6036 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6037 | == |
| 6038 | (pWextState-> |
| 6039 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6040 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6041 | pHddStaCtx->conn_info.authType)) |
| 6042 | /*Dynamic WEP key */ |
| 6043 | ucEncryptionType = |
| 6044 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6045 | else |
| 6046 | /*Static WEP key */ |
| 6047 | ucEncryptionType = |
| 6048 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6049 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6050 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6051 | == |
| 6052 | (pWextState-> |
| 6053 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6054 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6055 | pHddStaCtx->conn_info.authType)) |
| 6056 | /*Dynamic WEP key */ |
| 6057 | ucEncryptionType = |
| 6058 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6059 | else |
| 6060 | /*Static WEP key */ |
| 6061 | ucEncryptionType = |
| 6062 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6063 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6064 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
| 6065 | wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6066 | return -EINVAL; |
| 6067 | } |
| 6068 | |
| 6069 | pRoamProfile->EncryptionType.numEntries = 1; |
| 6070 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 6071 | ucEncryptionType; |
| 6072 | } |
| 6073 | break; |
| 6074 | case IW_AUTH_CIPHER_GROUP: |
| 6075 | { |
| 6076 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6077 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6078 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6079 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6080 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6081 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6082 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6083 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6084 | == |
| 6085 | (pWextState-> |
| 6086 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6087 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6088 | pHddStaCtx->conn_info.authType)) |
| 6089 | mcEncryptionType = |
| 6090 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6091 | else |
| 6092 | mcEncryptionType = |
| 6093 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6094 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6095 | /* Dynamic WEP keys won't work with shared keys */ |
| 6096 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6097 | == |
| 6098 | (pWextState-> |
| 6099 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6100 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6101 | pHddStaCtx->conn_info.authType)) { |
| 6102 | mcEncryptionType = |
| 6103 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6104 | } else { |
| 6105 | mcEncryptionType = |
| 6106 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6107 | } |
| 6108 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6109 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6110 | wrqu->param.value); |
| 6111 | return -EINVAL; |
| 6112 | } |
| 6113 | |
| 6114 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 6115 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 6116 | mcEncryptionType; |
| 6117 | } |
| 6118 | break; |
| 6119 | |
| 6120 | case IW_AUTH_80211_AUTH_ALG: |
| 6121 | { |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 6122 | /* Save the auth algo here and set auth type to SME |
| 6123 | * Roam profile in the iw_set_ap_address |
| 6124 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6125 | if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
| 6126 | pHddStaCtx->conn_info.authType = |
| 6127 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6128 | |
| 6129 | else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 6130 | pHddStaCtx->conn_info.authType = |
| 6131 | eCSR_AUTH_TYPE_SHARED_KEY; |
| 6132 | |
| 6133 | else if (wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 6134 | /*Not supported */ |
| 6135 | pHddStaCtx->conn_info.authType = |
| 6136 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6137 | pWextState->roamProfile.AuthType.authType[0] = |
| 6138 | pHddStaCtx->conn_info.authType; |
| 6139 | } |
| 6140 | break; |
| 6141 | |
| 6142 | case IW_AUTH_KEY_MGMT: |
| 6143 | { |
| 6144 | #ifdef FEATURE_WLAN_ESE |
| 6145 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 6146 | /*Check for CCKM AKM type */ |
| 6147 | if (wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6148 | hdd_debug("CCKM AKM Set %d", wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6149 | /* Set the CCKM bit in authKeyMgmt */ |
| 6150 | /* |
| 6151 | * Right now, this breaks all ref to authKeyMgmt because |
| 6152 | * our code doesn't realize it is a "bitfield" |
| 6153 | */ |
| 6154 | pWextState->authKeyMgmt |= |
| 6155 | IW_AUTH_KEY_MGMT_CCKM; |
| 6156 | /* Set the key management to 802.1X */ |
| 6157 | /* pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; */ |
| 6158 | pWextState->isESEConnection = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6159 | } else if (wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 6160 | /* Save the key management */ |
| 6161 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
Jeff Johnson | 3474602 | 2017-02-07 16:32:57 -0800 | [diff] [blame] | 6162 | } else if (!(wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6163 | /* Save the key management anyway */ |
| 6164 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6165 | } else { /* It must be IW_AUTH_KEY_MGMT_802_1X */ |
| 6166 | /* Save the key management */ |
| 6167 | pWextState->authKeyMgmt |= |
| 6168 | IW_AUTH_KEY_MGMT_802_1X; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6169 | } |
| 6170 | #else |
| 6171 | /* Save the key management */ |
| 6172 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6173 | #endif /* FEATURE_WLAN_ESE */ |
| 6174 | } |
| 6175 | break; |
| 6176 | |
| 6177 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 6178 | { |
| 6179 | if (wrqu->param.value) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6180 | hdd_debug("Counter Measure started %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6181 | wrqu->param.value); |
| 6182 | pWextState->mTKIPCounterMeasures = |
| 6183 | TKIP_COUNTER_MEASURE_STARTED; |
| 6184 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6185 | hdd_debug("Counter Measure stopped=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6186 | wrqu->param.value); |
| 6187 | pWextState->mTKIPCounterMeasures = |
| 6188 | TKIP_COUNTER_MEASURE_STOPED; |
| 6189 | } |
| 6190 | } |
| 6191 | break; |
| 6192 | case IW_AUTH_DROP_UNENCRYPTED: |
| 6193 | case IW_AUTH_WPA_ENABLED: |
| 6194 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 6195 | case IW_AUTH_ROAMING_CONTROL: |
| 6196 | case IW_AUTH_PRIVACY_INVOKED: |
| 6197 | |
| 6198 | default: |
| 6199 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6200 | hdd_warn("called with unsupported auth type %d", |
| 6201 | wrqu->param.flags & IW_AUTH_INDEX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6202 | break; |
| 6203 | } |
| 6204 | |
| 6205 | EXIT(); |
| 6206 | return 0; |
| 6207 | } |
| 6208 | |
| 6209 | /** |
| 6210 | * iw_set_auth() - set auth callback function |
| 6211 | * @dev: Pointer to the net device. |
| 6212 | * @info: Pointer to the iw_request_info. |
| 6213 | * @wrqu: Pointer to the iwreq_data. |
| 6214 | * @extra: Pointer to the data. |
| 6215 | * |
| 6216 | * Return: 0 for success, error number on failure. |
| 6217 | */ |
| 6218 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6219 | union iwreq_data *wrqu, char *extra) |
| 6220 | { |
| 6221 | int ret; |
| 6222 | |
| 6223 | cds_ssr_protect(__func__); |
| 6224 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 6225 | cds_ssr_unprotect(__func__); |
| 6226 | |
| 6227 | return ret; |
| 6228 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6229 | /** |
| 6230 | * __iw_get_auth() - |
| 6231 | * This function returns the auth type to the wpa_supplicant |
| 6232 | * @dev: pointer to the net device |
| 6233 | * @info: pointer to the iw request info |
| 6234 | * @wrqu: pointer to iwreq_data |
| 6235 | * @extra: pointer to the data |
| 6236 | * |
| 6237 | * Return: 0 on success, error number otherwise |
| 6238 | */ |
| 6239 | static int __iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6240 | union iwreq_data *wrqu, char *extra) |
| 6241 | { |
| 6242 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6243 | hdd_context_t *hdd_ctx; |
| 6244 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6245 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6246 | int ret; |
| 6247 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6248 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6249 | |
| 6250 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6251 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6252 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6253 | return ret; |
| 6254 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6255 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6256 | if (0 != ret) |
| 6257 | return ret; |
| 6258 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6259 | switch (pRoamProfile->negotiatedAuthType) { |
| 6260 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 6261 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6262 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 6263 | break; |
| 6264 | case eCSR_AUTH_TYPE_WPA: |
| 6265 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6266 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 6267 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6268 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6269 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6270 | case eCSR_AUTH_TYPE_RSN: |
| 6271 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6272 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 6273 | break; |
| 6274 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 6275 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6276 | break; |
| 6277 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 6278 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 6279 | break; |
| 6280 | case eCSR_AUTH_TYPE_UNKNOWN: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6281 | hdd_debug("called with unknown auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6282 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6283 | break; |
| 6284 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 6285 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6286 | break; |
| 6287 | case eCSR_AUTH_TYPE_WPA_PSK: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6288 | hdd_debug("called with WPA PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6289 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6290 | return -EIO; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6291 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6292 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6293 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 6294 | #ifdef WLAN_FEATURE_11W |
| 6295 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 6296 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 6297 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6298 | hdd_debug("called with RSN PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6299 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6300 | return -EIO; |
| 6301 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6302 | hdd_warn("Unknown auth type: %d", |
| 6303 | pRoamProfile->negotiatedAuthType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6304 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6305 | return -EIO; |
| 6306 | } |
| 6307 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) { |
| 6308 | switch (pRoamProfile->negotiatedUCEncryptionType) { |
| 6309 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6310 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6311 | break; |
| 6312 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6313 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6314 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6315 | break; |
| 6316 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6317 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6318 | break; |
| 6319 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6320 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6321 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6322 | break; |
| 6323 | case eCSR_ENCRYPT_TYPE_AES: |
| 6324 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6325 | break; |
| 6326 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6327 | hdd_warn("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6328 | pRoamProfile->negotiatedUCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6329 | return -EIO; |
| 6330 | } |
| 6331 | } |
| 6332 | |
| 6333 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) { |
| 6334 | switch (pRoamProfile->negotiatedMCEncryptionType) { |
| 6335 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6336 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6337 | break; |
| 6338 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6339 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6340 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6341 | break; |
| 6342 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6343 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6344 | break; |
| 6345 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6346 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6347 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6348 | break; |
| 6349 | case eCSR_ENCRYPT_TYPE_AES: |
| 6350 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6351 | break; |
| 6352 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6353 | hdd_err("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6354 | pRoamProfile->negotiatedMCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6355 | return -EIO; |
| 6356 | } |
| 6357 | } |
| 6358 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6359 | hdd_debug("called with auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6360 | pRoamProfile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6361 | EXIT(); |
| 6362 | return 0; |
| 6363 | } |
| 6364 | |
| 6365 | /** |
| 6366 | * iw_get_auth() - get auth callback function |
| 6367 | * @dev: Pointer to the net device. |
| 6368 | * @info: Pointer to the iw_request_info. |
| 6369 | * @wrqu: Pointer to the iwreq_data. |
| 6370 | * @extra: Pointer to the data. |
| 6371 | * |
| 6372 | * Return: 0 for success, error number on failure. |
| 6373 | */ |
| 6374 | int iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6375 | union iwreq_data *wrqu, char *extra) |
| 6376 | { |
| 6377 | int ret; |
| 6378 | |
| 6379 | cds_ssr_protect(__func__); |
| 6380 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 6381 | cds_ssr_unprotect(__func__); |
| 6382 | |
| 6383 | return ret; |
| 6384 | } |
| 6385 | |
| 6386 | /** |
| 6387 | * __iw_set_ap_address() - set ap address |
| 6388 | * @dev: pointer to the net device |
| 6389 | * @info: pointer to the iw request info |
| 6390 | * @wrqu: pointer to iwreq_data |
| 6391 | * @extra: pointer to the data |
| 6392 | * |
| 6393 | * This function updates the HDD global station context connection info |
| 6394 | * BSSID with the MAC address received from the wpa_supplicant. |
| 6395 | * |
| 6396 | * Return: 0 on success, error number otherwise |
| 6397 | */ |
| 6398 | static int __iw_set_ap_address(struct net_device *dev, |
| 6399 | struct iw_request_info *info, |
| 6400 | union iwreq_data *wrqu, char *extra) |
| 6401 | { |
| 6402 | |
| 6403 | hdd_adapter_t *adapter; |
| 6404 | hdd_context_t *hdd_ctx; |
| 6405 | hdd_station_ctx_t *pHddStaCtx = |
| 6406 | WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 6407 | uint8_t *pMacAddress = NULL; |
| 6408 | int ret; |
| 6409 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6410 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6411 | |
| 6412 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6413 | |
| 6414 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6415 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6416 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6417 | return ret; |
| 6418 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6419 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6420 | if (0 != ret) |
| 6421 | return ret; |
| 6422 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6423 | pMacAddress = (uint8_t *) wrqu->ap_addr.sa_data; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6424 | hdd_debug(" " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMacAddress)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6425 | qdf_mem_copy(pHddStaCtx->conn_info.bssId.bytes, pMacAddress, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6426 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6427 | EXIT(); |
| 6428 | |
| 6429 | return 0; |
| 6430 | } |
| 6431 | |
| 6432 | /** |
| 6433 | * iw_set_ap_address() - set ap addresses callback function |
| 6434 | * @dev: Pointer to the net device. |
| 6435 | * @info: Pointer to the iw_request_info. |
| 6436 | * @wrqu: Pointer to the iwreq_data. |
| 6437 | * @extra: Pointer to the data. |
| 6438 | * |
| 6439 | * Return: 0 for success, error number on failure. |
| 6440 | */ |
| 6441 | int iw_set_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6442 | union iwreq_data *wrqu, char *extra) |
| 6443 | { |
| 6444 | int ret; |
| 6445 | |
| 6446 | cds_ssr_protect(__func__); |
| 6447 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 6448 | cds_ssr_unprotect(__func__); |
| 6449 | |
| 6450 | return ret; |
| 6451 | } |
| 6452 | |
| 6453 | /** |
| 6454 | * __iw_get_ap_address() - get ap address |
| 6455 | * @dev: pointer to the net device |
| 6456 | * @info: pointer to the iw request info |
| 6457 | * @wrqu: pointer to iwreq_data |
| 6458 | * @extra: pointer to the data |
| 6459 | * |
| 6460 | * This function returns currently associated BSSID. |
| 6461 | * |
| 6462 | * Return: 0 on success, error number otherwise |
| 6463 | */ |
| 6464 | static int __iw_get_ap_address(struct net_device *dev, |
| 6465 | struct iw_request_info *info, |
| 6466 | union iwreq_data *wrqu, char *extra) |
| 6467 | { |
| 6468 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6469 | hdd_context_t *hdd_ctx; |
| 6470 | hdd_station_ctx_t *pHddStaCtx = |
| 6471 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6472 | int ret; |
| 6473 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6474 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6475 | |
| 6476 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6477 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6478 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6479 | return ret; |
| 6480 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6481 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6482 | if (0 != ret) |
| 6483 | return ret; |
| 6484 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6485 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated || |
| 6486 | eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6487 | qdf_mem_copy(wrqu->ap_addr.sa_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6488 | pHddStaCtx->conn_info.bssId.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6489 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6490 | } else { |
| 6491 | memset(wrqu->ap_addr.sa_data, 0, sizeof(wrqu->ap_addr.sa_data)); |
| 6492 | } |
| 6493 | EXIT(); |
| 6494 | return 0; |
| 6495 | } |
| 6496 | |
| 6497 | /** |
| 6498 | * iw_get_ap_address() - get ap addresses callback function |
| 6499 | * @dev: Pointer to the net device. |
| 6500 | * @info: Pointer to the iw_request_info. |
| 6501 | * @wrqu: Pointer to the iwreq_data. |
| 6502 | * @extra: Pointer to the data. |
| 6503 | * |
| 6504 | * Return: 0 for success, error number on failure. |
| 6505 | */ |
| 6506 | int iw_get_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6507 | union iwreq_data *wrqu, char *extra) |
| 6508 | { |
| 6509 | int ret; |
| 6510 | |
| 6511 | cds_ssr_protect(__func__); |
| 6512 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 6513 | cds_ssr_unprotect(__func__); |
| 6514 | |
| 6515 | return ret; |
| 6516 | } |