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" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 67 | |
| 68 | /* These are needed to recognize WPA and RSN suite types */ |
| 69 | #define HDD_WPA_OUI_SIZE 4 |
| 70 | #define HDD_RSN_OUI_SIZE 4 |
| 71 | uint8_t ccp_wpa_oui00[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 72 | uint8_t ccp_wpa_oui01[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 73 | uint8_t ccp_wpa_oui02[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 74 | uint8_t ccp_wpa_oui03[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 75 | uint8_t ccp_wpa_oui04[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 76 | uint8_t ccp_wpa_oui05[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x05 }; |
| 77 | |
| 78 | #ifdef FEATURE_WLAN_ESE |
| 79 | /* CCKM */ |
| 80 | uint8_t ccp_wpa_oui06[HDD_WPA_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 81 | /* CCKM */ |
| 82 | uint8_t ccp_rsn_oui06[HDD_RSN_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 83 | #endif /* FEATURE_WLAN_ESE */ |
| 84 | |
| 85 | /* group cipher */ |
| 86 | uint8_t ccp_rsn_oui00[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x00 }; |
| 87 | |
| 88 | /* WEP-40 or RSN */ |
| 89 | uint8_t ccp_rsn_oui01[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x01 }; |
| 90 | |
| 91 | /* TKIP or RSN-PSK */ |
| 92 | uint8_t ccp_rsn_oui02[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x02 }; |
| 93 | |
| 94 | /* Reserved */ |
| 95 | uint8_t ccp_rsn_oui03[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x03 }; |
| 96 | |
| 97 | /* AES-CCMP */ |
| 98 | uint8_t ccp_rsn_oui04[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x04 }; |
| 99 | |
| 100 | /* WEP-104 */ |
| 101 | uint8_t ccp_rsn_oui05[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 102 | |
| 103 | #ifdef WLAN_FEATURE_11W |
| 104 | /* RSN-PSK-SHA256 */ |
| 105 | uint8_t ccp_rsn_oui07[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x06 }; |
| 106 | |
| 107 | /* RSN-8021X-SHA256 */ |
| 108 | uint8_t ccp_rsn_oui08[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 109 | #endif |
| 110 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 111 | /* Offset where the EID-Len-IE, start. */ |
| 112 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 113 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 114 | |
| 115 | #define BEACON_FRAME_IES_OFFSET 12 |
| 116 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 117 | |
| 118 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 119 | * beacon_filter_table - table of IEs used for beacon filtering |
| 120 | */ |
| 121 | static const int beacon_filter_table[] = { |
| 122 | SIR_MAC_DS_PARAM_SET_EID, |
| 123 | SIR_MAC_ERP_INFO_EID, |
| 124 | SIR_MAC_EDCA_PARAM_SET_EID, |
| 125 | SIR_MAC_QOS_CAPABILITY_EID, |
| 126 | SIR_MAC_HT_INFO_EID, |
| 127 | SIR_MAC_VHT_OPMODE_EID, |
| 128 | SIR_MAC_VHT_OPERATION_EID, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 129 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 130 | /* |
| 131 | * EID: 221 vendor IE is being used temporarily by 11AX |
| 132 | * bss-color-change IE till it gets any fixed number. This |
| 133 | * vendor EID needs to be replaced with bss-color-change IE |
| 134 | * number. |
| 135 | */ |
| 136 | SIR_MAC_EID_VENDOR, |
| 137 | #endif |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 138 | }; |
| 139 | |
| 140 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 141 | * hdd_conn_set_authenticated() - set authentication state |
| 142 | * @pAdapter: pointer to the adapter |
| 143 | * @authState: authentication state |
| 144 | * |
| 145 | * This function updates the global HDD station context |
| 146 | * authentication state. |
| 147 | * |
| 148 | * Return: none |
| 149 | */ |
| 150 | static void |
| 151 | hdd_conn_set_authenticated(hdd_adapter_t *pAdapter, uint8_t authState) |
| 152 | { |
| 153 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 154 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 155 | |
| 156 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 157 | hdd_debug("Authenticated state Changed from oldState:%d to State:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 158 | pHddStaCtx->conn_info.uIsAuthenticated, authState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 159 | pHddStaCtx->conn_info.uIsAuthenticated = authState; |
| 160 | |
| 161 | /* Check is pending ROC request or not when auth state changed */ |
| 162 | schedule_delayed_work(&pHddCtx->roc_req_work, 0); |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * hdd_conn_set_connection_state() - set connection state |
| 167 | * @pAdapter: pointer to the adapter |
| 168 | * @connState: connection state |
| 169 | * |
| 170 | * This function updates the global HDD station context connection state. |
| 171 | * |
| 172 | * Return: none |
| 173 | */ |
| 174 | void hdd_conn_set_connection_state(hdd_adapter_t *pAdapter, |
| 175 | eConnectionState connState) |
| 176 | { |
| 177 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 178 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 179 | |
| 180 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 181 | hdd_debug("%pS Changed connectionState Changed from oldState:%d to State:%d", |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 182 | (void *)_RET_IP_, pHddStaCtx->conn_info.connState, |
| 183 | connState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 184 | pHddStaCtx->conn_info.connState = connState; |
| 185 | |
| 186 | /* Check is pending ROC request or not when connection state changed */ |
| 187 | schedule_delayed_work(&pHddCtx->roc_req_work, 0); |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * hdd_conn_get_connection_state() - get connection state |
| 192 | * @pAdapter: pointer to the adapter |
| 193 | * @pConnState: pointer to connection state |
| 194 | * |
| 195 | * This function updates the global HDD station context connection state. |
| 196 | * |
| 197 | * Return: true if (Infra Associated or IBSS Connected) |
| 198 | * and sets output parameter pConnState; |
| 199 | * false otherwise |
| 200 | */ |
| 201 | static inline bool hdd_conn_get_connection_state(hdd_station_ctx_t *pHddStaCtx, |
| 202 | eConnectionState *pConnState) |
| 203 | { |
| 204 | bool fConnected = false; |
| 205 | eConnectionState connState; |
| 206 | |
| 207 | /* get the connection state. */ |
| 208 | connState = pHddStaCtx->conn_info.connState; |
| 209 | |
| 210 | if (eConnectionState_Associated == connState || |
| 211 | eConnectionState_IbssConnected == connState || |
| 212 | eConnectionState_IbssDisconnected == connState) { |
| 213 | fConnected = true; |
| 214 | } |
| 215 | |
| 216 | if (pConnState) |
| 217 | *pConnState = connState; |
| 218 | |
| 219 | return fConnected; |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * hdd_is_connecting() - Function to check connection progress |
| 224 | * @hdd_sta_ctx: pointer to global HDD Station context |
| 225 | * |
| 226 | * Return: true if connecting, false otherwise |
| 227 | */ |
| 228 | bool hdd_is_connecting(hdd_station_ctx_t *hdd_sta_ctx) |
| 229 | { |
| 230 | return hdd_sta_ctx->conn_info.connState == |
| 231 | eConnectionState_Connecting; |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * hdd_conn_is_connected() - Function to check connection status |
| 236 | * @pHddStaCtx: pointer to global HDD Station context |
| 237 | * |
| 238 | * Return: false if any errors encountered, true otherwise |
| 239 | */ |
| 240 | bool hdd_conn_is_connected(hdd_station_ctx_t *pHddStaCtx) |
| 241 | { |
| 242 | return hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * hdd_conn_get_connected_band() - get current connection radio band |
| 247 | * @pHddStaCtx: pointer to global HDD Station context |
| 248 | * |
| 249 | * Return: eCSR_BAND_24 or eCSR_BAND_5G based on current AP connection |
| 250 | * eCSR_BAND_ALL if not connected |
| 251 | */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 252 | 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] | 253 | { |
| 254 | uint8_t staChannel = 0; |
| 255 | |
| 256 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 257 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 258 | |
| 259 | if (staChannel > 0 && staChannel < 14) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 260 | return BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 261 | else if (staChannel >= 36 && staChannel <= 184) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 262 | return BAND_5G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 263 | else /* If station is not connected return as eCSR_BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 264 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | /** |
| 268 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
| 269 | * @pHddStaCtx: pointer to global HDD Station context |
| 270 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 271 | * |
| 272 | * Return: false if any errors encountered, true otherwise |
| 273 | */ |
| 274 | static inline bool |
| 275 | hdd_conn_get_connected_cipher_algo(hdd_station_ctx_t *pHddStaCtx, |
| 276 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 277 | { |
| 278 | bool fConnected = false; |
| 279 | |
| 280 | fConnected = hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 281 | |
| 282 | if (pConnectedCipherAlgo) |
| 283 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 284 | |
| 285 | return fConnected; |
| 286 | } |
| 287 | |
| 288 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 289 | * hdd_remove_beacon_filter() - remove beacon filter |
| 290 | * @adapter: Pointer to the hdd adapter |
| 291 | * |
| 292 | * Return: 0 on success and errno on failure |
| 293 | */ |
| 294 | static int hdd_remove_beacon_filter(hdd_adapter_t *adapter) |
| 295 | { |
| 296 | QDF_STATUS status; |
| 297 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 298 | |
| 299 | status = sme_remove_beacon_filter(hdd_ctx->hHal, |
| 300 | adapter->sessionId); |
| 301 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 302 | hdd_err("sme_remove_beacon_filter() failed"); |
| 303 | return -EFAULT; |
| 304 | } |
| 305 | |
| 306 | return 0; |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * hdd_add_beacon_filter() - add beacon filter |
| 311 | * @adapter: Pointer to the hdd adapter |
| 312 | * |
| 313 | * Return: 0 on success and errno on failure |
| 314 | */ |
| 315 | static int hdd_add_beacon_filter(hdd_adapter_t *adapter) |
| 316 | { |
| 317 | int i; |
| 318 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 319 | QDF_STATUS status; |
| 320 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 321 | |
| 322 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 323 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 324 | (unsigned long int *)ie_map); |
| 325 | |
| 326 | status = sme_add_beacon_filter(hdd_ctx->hHal, |
| 327 | adapter->sessionId, ie_map); |
| 328 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 329 | hdd_err("sme_add_beacon_filter() failed"); |
| 330 | return -EFAULT; |
| 331 | } |
| 332 | return 0; |
| 333 | } |
| 334 | |
| 335 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 336 | * hdd_copy_vht_caps()- copy vht caps info from roam info to |
| 337 | * hdd station context. |
| 338 | * @hdd_sta_ctx: pointer to hdd station context |
| 339 | * @roam_info: pointer to roam info |
| 340 | * |
| 341 | * Return: None |
| 342 | */ |
| 343 | static void hdd_copy_ht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 344 | tCsrRoamInfo *roam_info) |
| 345 | { |
| 346 | tDot11fIEHTCaps *roam_ht_cap = &roam_info->ht_caps; |
| 347 | struct ieee80211_ht_cap *hdd_ht_cap = &hdd_sta_ctx->conn_info.ht_caps; |
| 348 | uint32_t i, temp_ht_cap; |
| 349 | |
| 350 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 351 | |
| 352 | if (roam_ht_cap->advCodingCap) |
| 353 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 354 | if (roam_ht_cap->supportedChannelWidthSet) |
| 355 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 356 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 357 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 358 | if (temp_ht_cap) |
| 359 | hdd_ht_cap->cap_info |= |
| 360 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 361 | if (roam_ht_cap->greenField) |
| 362 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 363 | if (roam_ht_cap->shortGI20MHz) |
| 364 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 365 | if (roam_ht_cap->shortGI40MHz) |
| 366 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 367 | if (roam_ht_cap->txSTBC) |
| 368 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 369 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 370 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 371 | if (temp_ht_cap) |
| 372 | hdd_ht_cap->cap_info |= |
| 373 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 374 | if (roam_ht_cap->delayedBA) |
| 375 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 376 | if (roam_ht_cap->maximalAMSDUsize) |
| 377 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 378 | if (roam_ht_cap->dsssCckMode40MHz) |
| 379 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 380 | if (roam_ht_cap->psmp) |
| 381 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 382 | if (roam_ht_cap->stbcControlFrame) |
| 383 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 384 | if (roam_ht_cap->lsigTXOPProtection) |
| 385 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 386 | |
| 387 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 388 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 389 | hdd_ht_cap->ampdu_params_info |= |
| 390 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 391 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 392 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 393 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 394 | if (temp_ht_cap) |
| 395 | hdd_ht_cap->ampdu_params_info |= |
| 396 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 397 | |
| 398 | /* 802.11n HT extended capabilities masks */ |
| 399 | if (roam_ht_cap->pco) |
| 400 | hdd_ht_cap->extended_ht_cap_info |= |
| 401 | IEEE80211_HT_EXT_CAP_PCO; |
| 402 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 403 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 404 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 405 | if (temp_ht_cap) |
| 406 | hdd_ht_cap->extended_ht_cap_info |= |
| 407 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 408 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 409 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 410 | if (temp_ht_cap) |
| 411 | hdd_ht_cap->extended_ht_cap_info |= |
| 412 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 413 | |
| 414 | /* tx_bf_cap_info capabilities */ |
| 415 | if (roam_ht_cap->txBF) |
| 416 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 417 | if (roam_ht_cap->rxStaggeredSounding) |
| 418 | hdd_ht_cap->tx_BF_cap_info |= |
| 419 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 420 | if (roam_ht_cap->txStaggeredSounding) |
| 421 | hdd_ht_cap->tx_BF_cap_info |= |
| 422 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 423 | if (roam_ht_cap->rxZLF) |
| 424 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 425 | if (roam_ht_cap->txZLF) |
| 426 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 427 | if (roam_ht_cap->implicitTxBF) |
| 428 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 429 | temp_ht_cap = roam_ht_cap->calibration & |
| 430 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 431 | if (temp_ht_cap) |
| 432 | hdd_ht_cap->tx_BF_cap_info |= |
| 433 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 434 | if (roam_ht_cap->explicitCSITxBF) |
| 435 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 436 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 437 | hdd_ht_cap->tx_BF_cap_info |= |
| 438 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 439 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 440 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 441 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 442 | if (temp_ht_cap) |
| 443 | hdd_ht_cap->tx_BF_cap_info |= |
| 444 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 445 | temp_ht_cap = |
| 446 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 447 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 448 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 449 | if (temp_ht_cap) |
| 450 | hdd_ht_cap->tx_BF_cap_info |= |
| 451 | temp_ht_cap << |
| 452 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 453 | temp_ht_cap = |
| 454 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 455 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 456 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 457 | if (temp_ht_cap) |
| 458 | hdd_ht_cap->tx_BF_cap_info |= |
| 459 | temp_ht_cap << |
| 460 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 461 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 462 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 463 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 464 | if (temp_ht_cap) |
| 465 | hdd_ht_cap->tx_BF_cap_info |= |
| 466 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 467 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 468 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 469 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 470 | if (temp_ht_cap) |
| 471 | hdd_ht_cap->tx_BF_cap_info |= |
| 472 | temp_ht_cap << |
| 473 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 474 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 475 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 476 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 477 | if (temp_ht_cap) |
| 478 | hdd_ht_cap->tx_BF_cap_info |= |
| 479 | temp_ht_cap << |
| 480 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 481 | |
| 482 | /* antenna selection */ |
| 483 | if (roam_ht_cap->antennaSelection) |
| 484 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 485 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 486 | hdd_ht_cap->antenna_selection_info |= |
| 487 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 488 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 489 | hdd_ht_cap->antenna_selection_info |= |
| 490 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 491 | if (roam_ht_cap->explicitCSIFeedback) |
| 492 | hdd_ht_cap->antenna_selection_info |= |
| 493 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 494 | if (roam_ht_cap->antennaIndicesFeedback) |
| 495 | hdd_ht_cap->antenna_selection_info |= |
| 496 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 497 | if (roam_ht_cap->rxAS) |
| 498 | hdd_ht_cap->antenna_selection_info |= |
| 499 | ANTENNA_SEL_INFO_RX_AS; |
| 500 | if (roam_ht_cap->txSoundingPPDUs) |
| 501 | hdd_ht_cap->antenna_selection_info |= |
| 502 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 503 | |
| 504 | /* mcs data rate */ |
| 505 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 506 | hdd_ht_cap->mcs.rx_mask[i] = |
| 507 | roam_ht_cap->supportedMCSSet[i]; |
| 508 | hdd_ht_cap->mcs.rx_highest = |
| 509 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 510 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
| 511 | hdd_ht_cap->mcs.tx_params = |
| 512 | roam_ht_cap->supportedMCSSet[12]; |
| 513 | } |
| 514 | |
| 515 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 516 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 517 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 518 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 519 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 520 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 521 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 522 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 523 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 524 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 525 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 526 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 527 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 528 | |
| 529 | /** |
| 530 | * hdd_copy_ht_caps()- copy ht caps info from roam info to |
| 531 | * hdd station context. |
| 532 | * @hdd_sta_ctx: pointer to hdd station context |
| 533 | * @roam_info: pointer to roam info |
| 534 | * |
| 535 | * Return: None |
| 536 | */ |
| 537 | static void hdd_copy_vht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 538 | tCsrRoamInfo *roam_info) |
| 539 | { |
| 540 | tDot11fIEVHTCaps *roam_vht_cap = &roam_info->vht_caps; |
| 541 | struct ieee80211_vht_cap *hdd_vht_cap = |
| 542 | &hdd_sta_ctx->conn_info.vht_caps; |
| 543 | uint32_t temp_vht_cap; |
| 544 | |
| 545 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 546 | |
| 547 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 548 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 549 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 550 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 551 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
| 552 | if (temp_vht_cap) |
| 553 | if (roam_vht_cap->supportedChannelWidthSet & |
| 554 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 555 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 556 | hdd_vht_cap->vht_cap_info |= |
| 557 | temp_vht_cap << |
| 558 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 559 | if (roam_vht_cap->supportedChannelWidthSet & |
| 560 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 561 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 562 | hdd_vht_cap->vht_cap_info |= |
| 563 | temp_vht_cap << |
| 564 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
| 565 | if (roam_vht_cap->ldpcCodingCap) |
| 566 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 567 | if (roam_vht_cap->shortGI80MHz) |
| 568 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 569 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 570 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 571 | if (roam_vht_cap->txSTBC) |
| 572 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 573 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 574 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 575 | if (temp_vht_cap) |
| 576 | hdd_vht_cap->vht_cap_info |= |
| 577 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 578 | if (roam_vht_cap->suBeamFormerCap) |
| 579 | hdd_vht_cap->vht_cap_info |= |
| 580 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 581 | if (roam_vht_cap->suBeamformeeCap) |
| 582 | hdd_vht_cap->vht_cap_info |= |
| 583 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 584 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 585 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 586 | if (temp_vht_cap) |
| 587 | hdd_vht_cap->vht_cap_info |= |
| 588 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 589 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 590 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 591 | if (temp_vht_cap) |
| 592 | hdd_vht_cap->vht_cap_info |= |
| 593 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 594 | if (roam_vht_cap->muBeamformerCap) |
| 595 | hdd_vht_cap->vht_cap_info |= |
| 596 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 597 | if (roam_vht_cap->muBeamformeeCap) |
| 598 | hdd_vht_cap->vht_cap_info |= |
| 599 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 600 | if (roam_vht_cap->vhtTXOPPS) |
| 601 | hdd_vht_cap->vht_cap_info |= |
| 602 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 603 | if (roam_vht_cap->htcVHTCap) |
| 604 | hdd_vht_cap->vht_cap_info |= |
| 605 | IEEE80211_VHT_CAP_HTC_VHT; |
| 606 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 607 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 608 | if (temp_vht_cap) |
| 609 | hdd_vht_cap->vht_cap_info |= |
| 610 | temp_vht_cap << |
| 611 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 612 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 613 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 614 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 615 | if (temp_vht_cap) |
| 616 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 617 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 618 | if (roam_vht_cap->rxAntPattern) |
| 619 | hdd_vht_cap->vht_cap_info |= |
| 620 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 621 | if (roam_vht_cap->txAntPattern) |
| 622 | hdd_vht_cap->vht_cap_info |= |
| 623 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 624 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 625 | hdd_vht_cap->supp_mcs.rx_highest = |
| 626 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 627 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 628 | hdd_vht_cap->supp_mcs.tx_highest = |
| 629 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 630 | } |
| 631 | |
| 632 | /* ht param */ |
| 633 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 634 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 635 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 636 | |
| 637 | /* operatinon mode */ |
| 638 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 639 | |
| 640 | /* stbc_param */ |
| 641 | #define HT_STBC_PARAM_MCS 0x007f |
| 642 | |
| 643 | /** |
| 644 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 645 | * hdd station context. |
| 646 | * @hdd_sta_ctx: pointer to hdd station context |
| 647 | * @roam_info: pointer to roam info |
| 648 | * |
| 649 | * Return: None |
| 650 | */ |
| 651 | static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 652 | tCsrRoamInfo *roam_info) |
| 653 | { |
| 654 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 655 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 656 | &hdd_sta_ctx->conn_info.ht_operation; |
| 657 | uint32_t i, temp_ht_ops; |
| 658 | |
| 659 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 660 | |
| 661 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 662 | |
| 663 | /* HT_PARAMS */ |
| 664 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 665 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 666 | if (temp_ht_ops) |
| 667 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 668 | else |
| 669 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 670 | if (roam_ht_ops->recommendedTxWidthSet) |
| 671 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 672 | if (roam_ht_ops->rifsMode) |
| 673 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 674 | if (roam_ht_ops->controlledAccessOnly) |
| 675 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 676 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 677 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 678 | if (temp_ht_ops) |
| 679 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 680 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 681 | |
| 682 | /* operation mode */ |
| 683 | temp_ht_ops = roam_ht_ops->opMode & |
| 684 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 685 | switch (temp_ht_ops) { |
| 686 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 687 | hdd_ht_ops->operation_mode |= |
| 688 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 689 | break; |
| 690 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 691 | hdd_ht_ops->operation_mode |= |
| 692 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 693 | break; |
| 694 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 695 | hdd_ht_ops->operation_mode |= |
| 696 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 697 | break; |
| 698 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 699 | default: |
| 700 | hdd_ht_ops->operation_mode |= |
| 701 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 702 | } |
| 703 | if (roam_ht_ops->nonGFDevicesPresent) |
| 704 | hdd_ht_ops->operation_mode |= |
| 705 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 706 | if (roam_ht_ops->transmitBurstLimit) |
| 707 | hdd_ht_ops->operation_mode |= |
| 708 | HT_OP_MODE_TX_BURST_LIMIT; |
| 709 | if (roam_ht_ops->obssNonHTStaPresent) |
| 710 | hdd_ht_ops->operation_mode |= |
| 711 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 712 | |
| 713 | /* stbc_param */ |
| 714 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 715 | HT_STBC_PARAM_MCS; |
| 716 | if (temp_ht_ops) |
| 717 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 718 | if (roam_ht_ops->dualCTSProtection) |
| 719 | hdd_ht_ops->stbc_param |= |
| 720 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 721 | if (roam_ht_ops->secondaryBeacon) |
| 722 | hdd_ht_ops->stbc_param |= |
| 723 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 724 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 725 | hdd_ht_ops->stbc_param |= |
| 726 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 727 | if (roam_ht_ops->pcoActive) |
| 728 | hdd_ht_ops->stbc_param |= |
| 729 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 730 | if (roam_ht_ops->pcoPhase) |
| 731 | hdd_ht_ops->stbc_param |= |
| 732 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 733 | |
| 734 | /* basic MCs set */ |
| 735 | for (i = 0; i < 16; ++i) |
| 736 | hdd_ht_ops->basic_set[i] = |
| 737 | roam_ht_ops->basicMCSSet[i]; |
| 738 | } |
| 739 | |
| 740 | /** |
| 741 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 742 | * hdd station context. |
| 743 | * @hdd_sta_ctx: pointer to hdd station context |
| 744 | * @roam_info: pointer to roam info |
| 745 | * |
| 746 | * Return: None |
| 747 | */ |
| 748 | static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 749 | tCsrRoamInfo *roam_info) |
| 750 | { |
| 751 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 752 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 753 | &hdd_sta_ctx->conn_info.vht_operation; |
| 754 | |
| 755 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 756 | |
| 757 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
| 758 | hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; |
| 759 | hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; |
| 760 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 761 | } |
| 762 | |
| 763 | |
| 764 | /** |
| 765 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 766 | * @adapter: Pointer to adapter |
| 767 | * @roam_info: pointer to roam info |
| 768 | * |
| 769 | * Return: None |
| 770 | */ |
| 771 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 772 | tCsrRoamInfo *roam_info) |
| 773 | { |
| 774 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 775 | |
| 776 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
| 777 | hdd_sta_ctx->conn_info.operationChannel); |
| 778 | if (roam_info->vht_caps.present) { |
| 779 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
| 780 | hdd_copy_vht_caps(hdd_sta_ctx, roam_info); |
| 781 | } else { |
| 782 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 783 | } |
| 784 | if (roam_info->ht_caps.present) { |
| 785 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
| 786 | hdd_copy_ht_caps(hdd_sta_ctx, roam_info); |
| 787 | } else { |
| 788 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 789 | } |
| 790 | if (roam_info->reassoc) |
| 791 | hdd_sta_ctx->conn_info.roam_count++; |
| 792 | if (roam_info->hs20vendor_ie.present) { |
| 793 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 794 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 795 | &roam_info->hs20vendor_ie, |
| 796 | sizeof(roam_info->hs20vendor_ie)); |
| 797 | } else { |
| 798 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 799 | } |
| 800 | if (roam_info->ht_operation.present) { |
| 801 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 802 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 803 | } else { |
| 804 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 805 | } |
| 806 | if (roam_info->vht_operation.present) { |
| 807 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 808 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 809 | } else { |
| 810 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 815 | * hdd_conn_save_connect_info() - save current connection information |
| 816 | * @pAdapter: pointer to adapter |
| 817 | * @pRoamInfo: pointer to roam info |
| 818 | * @eBssType: bss type |
| 819 | * |
| 820 | * Return: none |
| 821 | */ |
| 822 | static void |
| 823 | hdd_conn_save_connect_info(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 824 | eCsrRoamBssType eBssType) |
| 825 | { |
| 826 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 827 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 828 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 829 | QDF_ASSERT(pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 830 | |
| 831 | if (pRoamInfo) { |
| 832 | /* Save the BSSID for the connection */ |
| 833 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 834 | QDF_ASSERT(pRoamInfo->pBssDesc); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 835 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 836 | &pRoamInfo->bssid); |
| 837 | |
| 838 | /* |
| 839 | * Save the Station ID for this station from |
| 840 | * the 'Roam Info'. For IBSS mode, staId is |
| 841 | * assigned in NEW_PEER_IND. For reassoc, |
| 842 | * the staID doesn't change and it may be invalid |
| 843 | * in this structure so no change here. |
| 844 | */ |
| 845 | if (!pRoamInfo->fReassocReq) { |
| 846 | pHddStaCtx->conn_info.staId[0] = |
| 847 | pRoamInfo->staId; |
| 848 | } |
| 849 | } else if (eCSR_BSS_TYPE_IBSS == eBssType) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 850 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 851 | &pRoamInfo->bssid); |
| 852 | } else { |
| 853 | /* |
| 854 | * can't happen. We need a valid IBSS or Infra setting |
| 855 | * in the BSSDescription or we can't function. |
| 856 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 857 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 858 | } |
| 859 | |
| 860 | /* notify WMM */ |
| 861 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 862 | |
| 863 | if (!pRoamInfo->u.pConnectedProfile) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 864 | QDF_ASSERT(pRoamInfo->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 865 | } else { |
| 866 | /* Get Multicast Encryption Type */ |
| 867 | encryptType = |
| 868 | pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 869 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 870 | /* Get Unicast Encryption Type */ |
| 871 | encryptType = |
| 872 | pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 873 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 874 | |
| 875 | pHddStaCtx->conn_info.authType = |
| 876 | pRoamInfo->u.pConnectedProfile->AuthType; |
| 877 | |
| 878 | pHddStaCtx->conn_info.operationChannel = |
| 879 | pRoamInfo->u.pConnectedProfile->operationChannel; |
| 880 | |
| 881 | /* Save the ssid for the connection */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 882 | qdf_mem_copy(&pHddStaCtx->conn_info.SSID.SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 883 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 884 | sizeof(tSirMacSSid)); |
| 885 | |
| 886 | /* Save dot11mode in which STA associated to AP */ |
| 887 | pHddStaCtx->conn_info.dot11Mode = |
| 888 | pRoamInfo->u.pConnectedProfile->dot11Mode; |
| 889 | |
| 890 | pHddStaCtx->conn_info.proxyARPService = |
| 891 | pRoamInfo->u.pConnectedProfile->proxyARPService; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 892 | |
| 893 | pHddStaCtx->conn_info.nss = pRoamInfo->chan_info.nss; |
| 894 | |
| 895 | pHddStaCtx->conn_info.rate_flags = |
| 896 | pRoamInfo->chan_info.rate_flags; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 897 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 898 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 899 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 900 | } |
| 901 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 902 | /** |
| 903 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 904 | * @dev: pointer to net device |
| 905 | * @pAdapter: pointer to adapter |
| 906 | * @pCsrRoamInfo: pointer to roam info |
| 907 | * |
| 908 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 909 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 910 | * for the same purpose.) |
| 911 | * |
| 912 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 913 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 914 | * This is the Assoc Response. |
| 915 | * |
| 916 | * Return: none |
| 917 | */ |
| 918 | static void |
| 919 | hdd_send_ft_assoc_response(struct net_device *dev, |
| 920 | hdd_adapter_t *pAdapter, |
| 921 | tCsrRoamInfo *pCsrRoamInfo) |
| 922 | { |
| 923 | union iwreq_data wrqu; |
| 924 | char *buff; |
| 925 | unsigned int len = 0; |
| 926 | u8 *pFTAssocRsp = NULL; |
| 927 | |
| 928 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 929 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 930 | return; |
| 931 | } |
| 932 | |
| 933 | pFTAssocRsp = |
| 934 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 935 | pCsrRoamInfo->nAssocReqLength); |
| 936 | if (pFTAssocRsp == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 937 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 938 | return; |
| 939 | } |
| 940 | /* pFTAssocRsp needs to point to the IEs */ |
| 941 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 942 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 943 | (unsigned int)pFTAssocRsp[0], |
| 944 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 945 | |
| 946 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 947 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 948 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 949 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | return; |
| 951 | } |
| 952 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 953 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 954 | wrqu.data.length = len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 955 | memcpy(buff, pFTAssocRsp, len); |
| 956 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 957 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 958 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 959 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 960 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 961 | /** |
| 962 | * hdd_send_ft_event() - send fast transition event |
| 963 | * @pAdapter: pointer to adapter |
| 964 | * |
| 965 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 966 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 967 | * followed by the auth response IEs to the supplicant. |
| 968 | * Once both are received in the supplicant, an FT event is generated |
| 969 | * to the supplicant. |
| 970 | * |
| 971 | * Return: none |
| 972 | */ |
| 973 | static void hdd_send_ft_event(hdd_adapter_t *pAdapter) |
| 974 | { |
| 975 | uint16_t auth_resp_len = 0; |
| 976 | uint32_t ric_ies_length = 0; |
| 977 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 978 | |
| 979 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 980 | struct cfg80211_ft_event_params ftEvent; |
| 981 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 982 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 983 | struct net_device *dev = pAdapter->dev; |
| 984 | #else |
| 985 | char *buff; |
| 986 | union iwreq_data wrqu; |
| 987 | uint16_t str_len; |
| 988 | #endif |
| 989 | |
| 990 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 991 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 992 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 993 | |
| 994 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, (u8 *) ricIe, |
| 995 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 996 | if (ric_ies_length == 0) |
| 997 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 998 | |
| 999 | ftEvent.ric_ies = ricIe; |
| 1000 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1001 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1002 | |
| 1003 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1004 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1005 | &auth_resp_len); |
| 1006 | |
| 1007 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1008 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1009 | return; |
| 1010 | } |
| 1011 | |
| 1012 | sme_set_ft_pre_auth_state(pHddCtx->hHal, pAdapter->sessionId, true); |
| 1013 | |
| 1014 | ftEvent.target_ap = ftIe; |
| 1015 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1016 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1017 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1018 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1019 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1020 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1021 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1022 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1023 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1024 | ftEvent.target_ap[5]); |
| 1025 | |
| 1026 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1027 | |
| 1028 | #else |
| 1029 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1030 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1031 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1032 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1033 | return; |
| 1034 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1035 | |
| 1036 | /* Sme needs to send the RIC IEs first */ |
| 1037 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
| 1038 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, |
| 1039 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1040 | &ric_ies_length); |
| 1041 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1042 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1043 | } else { |
| 1044 | wrqu.data.length = str_len + ric_ies_length; |
| 1045 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1046 | } |
| 1047 | |
| 1048 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1049 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1050 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
| 1051 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1052 | (u8 *) &buff[str_len], |
| 1053 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1054 | |
| 1055 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1056 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1057 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1058 | return; |
| 1059 | } |
| 1060 | |
| 1061 | wrqu.data.length = str_len + auth_resp_len; |
| 1062 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1063 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1064 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1065 | #endif |
| 1066 | } |
| 1067 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1068 | #ifdef FEATURE_WLAN_ESE |
| 1069 | /** |
| 1070 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1071 | * @dev: pointer to net device |
| 1072 | * @pAdapter: pointer to adapter |
| 1073 | * @pCsrRoamInfo: pointer to roam info |
| 1074 | * |
| 1075 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1076 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1077 | * |
| 1078 | * The current (new AP) channel information is passed in. |
| 1079 | * |
| 1080 | * Return: none |
| 1081 | */ |
| 1082 | static void |
| 1083 | hdd_send_new_ap_channel_info(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 1084 | tCsrRoamInfo *pCsrRoamInfo) |
| 1085 | { |
| 1086 | union iwreq_data wrqu; |
| 1087 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
| 1088 | |
| 1089 | if (descriptor == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1090 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1091 | return; |
| 1092 | } |
| 1093 | /* |
| 1094 | * Send the Channel event, the supplicant needs this to generate |
| 1095 | * the Adjacent AP report. |
| 1096 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1097 | hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1098 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1099 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1100 | wrqu.freq.m = descriptor->channelId; |
| 1101 | wrqu.freq.e = 0; |
| 1102 | wrqu.freq.i = 0; |
| 1103 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1104 | } |
| 1105 | |
| 1106 | #endif /* FEATURE_WLAN_ESE */ |
| 1107 | |
| 1108 | /** |
| 1109 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
| 1110 | * @pAdapter: pointer to adapter |
| 1111 | * @pCsrRoamInfo: pointer to roam info |
| 1112 | * |
| 1113 | * Return: none |
| 1114 | */ |
| 1115 | static void |
| 1116 | hdd_send_update_beacon_ies_event(hdd_adapter_t *pAdapter, |
| 1117 | tCsrRoamInfo *pCsrRoamInfo) |
| 1118 | { |
| 1119 | union iwreq_data wrqu; |
| 1120 | u8 *pBeaconIes; |
| 1121 | u8 currentLen = 0; |
| 1122 | char *buff; |
| 1123 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1124 | |
| 1125 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1126 | |
| 1127 | if (0 == pCsrRoamInfo->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1128 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1129 | return; |
| 1130 | } |
| 1131 | pBeaconIes = (u8 *) (pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 1132 | if (pBeaconIes == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1133 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1134 | return; |
| 1135 | } |
| 1136 | /* pBeaconIes needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1137 | hdd_debug("Beacon IEs is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1138 | (unsigned int)pBeaconIes[0], |
| 1139 | (unsigned int)pBeaconIes[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1140 | hdd_debug("Beacon IEs length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1141 | pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1142 | |
| 1143 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1144 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1145 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1146 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1147 | return; |
| 1148 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1149 | |
| 1150 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1151 | currentLen = strLen + 1; |
| 1152 | |
| 1153 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1154 | do { |
| 1155 | /* |
| 1156 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1157 | * into chunks of CUSTOM event max size and send it to |
| 1158 | * supplicant. Changes are done in supplicant to handle this. |
| 1159 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1160 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1161 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1162 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1163 | qdf_mem_copy(&buff[strLen + 1], pBeaconIes + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1164 | currentLen); |
| 1165 | currentOffset += currentLen; |
| 1166 | totalIeLen -= currentLen; |
| 1167 | wrqu.data.length = strLen + 1 + currentLen; |
| 1168 | if (totalIeLen) |
| 1169 | buff[strLen] = 1; /* more chunks pending */ |
| 1170 | else |
| 1171 | buff[strLen] = 0; /* last chunk */ |
| 1172 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1173 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1174 | currentLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1175 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1176 | } while (totalIeLen > 0); |
| 1177 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1178 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1179 | } |
| 1180 | |
| 1181 | /** |
| 1182 | * hdd_send_association_event() - send association event |
| 1183 | * @dev: pointer to net device |
| 1184 | * @pCsrRoamInfo: pointer to roam info |
| 1185 | * |
| 1186 | * Return: none |
| 1187 | */ |
| 1188 | static void hdd_send_association_event(struct net_device *dev, |
| 1189 | tCsrRoamInfo *pCsrRoamInfo) |
| 1190 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1191 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1192 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1193 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1194 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1195 | union iwreq_data wrqu; |
| 1196 | int we_event; |
| 1197 | char *msg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1198 | struct qdf_mac_addr peerMacAddr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1199 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1200 | /* Added to find the auth type on the fly at run time */ |
| 1201 | /* rather than with cfg to see if FT is enabled */ |
| 1202 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1203 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | |
| 1205 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1206 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1207 | we_event = SIOCGIWAP; |
| 1208 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1209 | if (NULL != pCsrRoamInfo) |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1210 | if (pCsrRoamInfo->roamSynchInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1211 | /* change logging before release */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1212 | hdd_debug("LFR3:hdd_send_association_event"); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1213 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1214 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1215 | true, pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1216 | wlan_hdd_tdls_notify_disconnect(pAdapter, true); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1217 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1218 | #endif |
| 1219 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) { |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1220 | tSirSmeChanInfo chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1221 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1222 | if (!pCsrRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1223 | hdd_warn("STA in associated state but pCsrRoamInfo is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1224 | return; |
| 1225 | } |
| 1226 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1227 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1228 | policy_mgr_incr_active_session(pHddCtx->hdd_psoc, |
| 1229 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1230 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, |
| 1231 | sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1232 | |
| 1233 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1234 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1235 | if (global_p2p_connection_status == |
| 1236 | P2P_CLIENT_CONNECTING_STATE_1) { |
| 1237 | global_p2p_connection_status = |
| 1238 | P2P_CLIENT_CONNECTED_STATE_1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1239 | 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] | 1240 | } else if (global_p2p_connection_status == |
| 1241 | P2P_CLIENT_CONNECTING_STATE_2) { |
| 1242 | global_p2p_connection_status = |
| 1243 | P2P_CLIENT_COMPLETED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1244 | 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] | 1245 | } |
| 1246 | } |
| 1247 | #endif |
| 1248 | pr_info("wlan: " MAC_ADDRESS_STR " connected to " |
| 1249 | MAC_ADDRESS_STR "\n", |
| 1250 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1251 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
| 1252 | hdd_send_update_beacon_ies_event(pAdapter, pCsrRoamInfo); |
| 1253 | |
| 1254 | /* |
| 1255 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1256 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1257 | * fFTEnable is true. |
| 1258 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1259 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1260 | if ((pRoamProfile->AuthType.authType[0] == |
| 1261 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 1262 | || (pRoamProfile->AuthType.authType[0] == |
| 1263 | eCSR_AUTH_TYPE_FT_RSN) |
| 1264 | #ifdef FEATURE_WLAN_ESE |
| 1265 | || (pRoamProfile->AuthType.authType[0] == |
| 1266 | eCSR_AUTH_TYPE_CCKM_RSN) |
| 1267 | || (pRoamProfile->AuthType.authType[0] == |
| 1268 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1269 | #endif |
| 1270 | ) { |
| 1271 | hdd_send_ft_assoc_response(dev, pAdapter, pCsrRoamInfo); |
| 1272 | } |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1273 | qdf_copy_macaddr(&peerMacAddr, |
| 1274 | &pHddStaCtx->conn_info.bssId); |
| 1275 | chan_info.chan_id = pCsrRoamInfo->chan_info.chan_id; |
| 1276 | chan_info.mhz = pCsrRoamInfo->chan_info.mhz; |
| 1277 | chan_info.info = pCsrRoamInfo->chan_info.info; |
| 1278 | chan_info.band_center_freq1 = |
| 1279 | pCsrRoamInfo->chan_info.band_center_freq1; |
| 1280 | chan_info.band_center_freq2 = |
| 1281 | pCsrRoamInfo->chan_info.band_center_freq2; |
| 1282 | chan_info.reg_info_1 = |
| 1283 | pCsrRoamInfo->chan_info.reg_info_1; |
| 1284 | chan_info.reg_info_2 = |
| 1285 | pCsrRoamInfo->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1286 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1287 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1288 | pAdapter->device_mode, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1289 | peerMacAddr.bytes, |
| 1290 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1291 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1292 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1293 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1294 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1295 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1296 | if (ret) |
| 1297 | hdd_err("Peer object %pM fail to set associated state", |
| 1298 | peerMacAddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1299 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1300 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1301 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
| 1302 | ePeerConnected, |
| 1303 | pCsrRoamInfo->timingMeasCap, |
| 1304 | pAdapter->sessionId, &chan_info, |
| 1305 | pAdapter->device_mode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1306 | /* Update tdls module about connection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1307 | hdd_notify_sta_connect(pAdapter->sessionId, |
| 1308 | pCsrRoamInfo->tdls_chan_swit_prohibited, |
| 1309 | pCsrRoamInfo->tdls_prohibited, |
| 1310 | pAdapter->hdd_vdev); |
| 1311 | |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1312 | wlan_hdd_tdls_notify_connect(pAdapter, pCsrRoamInfo); |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 1313 | |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1314 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1315 | #ifdef MSM_PLATFORM |
Ravi Joshi | ae8e9a7 | 2016-08-03 17:38:03 -0700 | [diff] [blame] | 1316 | #if defined(CONFIG_ICNSS) || defined(CONFIG_CNSS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1317 | /* start timer in sta/p2p_cli */ |
| 1318 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1319 | pAdapter->prev_tx_packets = pAdapter->stats.tx_packets; |
| 1320 | pAdapter->prev_rx_packets = pAdapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1321 | cdp_get_intra_bss_fwd_pkts_count( |
| 1322 | cds_get_context(QDF_MODULE_ID_SOC), pAdapter->sessionId, |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1323 | &pAdapter->prev_fwd_tx_packets, |
| 1324 | &pAdapter->prev_fwd_rx_packets); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1325 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1326 | hdd_bus_bw_compute_timer_start(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1327 | #endif |
| 1328 | #endif |
| 1329 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
| 1330 | pHddStaCtx->conn_info.connState) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1331 | policy_mgr_update_connection_info(pHddCtx->hdd_psoc, |
| 1332 | pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1333 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1334 | ETH_ALEN); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1335 | hdd_info("wlan: new IBSS connection to " MAC_ADDRESS_STR, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1336 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes)); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1337 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1338 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1339 | QDF_IBSS_MODE, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1340 | pCsrRoamInfo->bssid.bytes, |
| 1341 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1342 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1343 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1344 | MAC_ADDR_ARRAY(pCsrRoamInfo->bssid.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1345 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1346 | WLAN_ASSOC_STATE); |
Mukul Sharma | eb01e13 | 2017-02-16 13:01:03 +0530 | [diff] [blame] | 1347 | if (ret) |
| 1348 | hdd_err("Peer object %pM fail to set associated state", |
| 1349 | peerMacAddr.bytes); |
| 1350 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1351 | } else { /* Not Associated */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1352 | hdd_info("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1353 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1354 | policy_mgr_decr_session_set_pcl(pHddCtx->hdd_psoc, |
| 1355 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1356 | |
| 1357 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1358 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1359 | #endif |
| 1360 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1361 | if ((pAdapter->device_mode == QDF_STA_MODE) || |
| 1362 | (pAdapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1363 | qdf_copy_macaddr(&peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1364 | &pHddStaCtx->conn_info.bssId); |
| 1365 | |
| 1366 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1367 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1368 | ePeerDisconnected, 0, |
| 1369 | pAdapter->sessionId, |
| 1370 | NULL, |
| 1371 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1372 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1373 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1374 | ret = hdd_objmgr_remove_peer_object(pAdapter->hdd_vdev, |
| 1375 | peerMacAddr.bytes); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 1376 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1377 | hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails", |
| 1378 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
| 1379 | |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 1380 | hdd_lpass_notify_disconnect(pAdapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1381 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1382 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1383 | false, |
| 1384 | pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1385 | wlan_hdd_tdls_notify_disconnect(pAdapter, false); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1386 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1387 | #ifdef MSM_PLATFORM |
| 1388 | /* stop timer in sta/p2p_cli */ |
| 1389 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1390 | pAdapter->prev_tx_packets = 0; |
| 1391 | pAdapter->prev_rx_packets = 0; |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1392 | pAdapter->prev_fwd_tx_packets = 0; |
| 1393 | pAdapter->prev_fwd_rx_packets = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1394 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1395 | hdd_bus_bw_compute_timer_try_stop(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1396 | #endif |
| 1397 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1398 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1399 | /* Send SCC/MCC Switching event to IPA */ |
| 1400 | hdd_ipa_send_mcc_scc_msg(pHddCtx, pHddCtx->mcc_mode); |
| 1401 | |
| 1402 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1403 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1404 | * driver so not sending the status of the connection to supplicant |
| 1405 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1406 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1407 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1408 | #ifdef FEATURE_WLAN_ESE |
| 1409 | if (eConnectionState_Associated == |
| 1410 | pHddStaCtx->conn_info.connState) { |
| 1411 | if ((pRoamProfile->AuthType.authType[0] == |
| 1412 | eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1413 | (pRoamProfile->AuthType.authType[0] == |
| 1414 | eCSR_AUTH_TYPE_CCKM_WPA)) |
| 1415 | hdd_send_new_ap_channel_info(dev, pAdapter, |
| 1416 | pCsrRoamInfo); |
| 1417 | } |
| 1418 | #endif |
| 1419 | } |
| 1420 | } |
| 1421 | |
| 1422 | /** |
| 1423 | * hdd_conn_remove_connect_info() - remove connection info |
| 1424 | * @pHddStaCtx: pointer to global HDD station context |
| 1425 | * @pCsrRoamInfo: pointer to roam info |
| 1426 | * |
| 1427 | * Return: none |
| 1428 | */ |
| 1429 | static void hdd_conn_remove_connect_info(hdd_station_ctx_t *pHddStaCtx) |
| 1430 | { |
| 1431 | /* Remove staId, bssId and peerMacAddress */ |
| 1432 | pHddStaCtx->conn_info.staId[0] = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1433 | qdf_mem_zero(&pHddStaCtx->conn_info.bssId, QDF_MAC_ADDR_SIZE); |
| 1434 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1435 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1436 | |
| 1437 | /* Clear all security settings */ |
| 1438 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1439 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1440 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1441 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1442 | qdf_mem_zero(&pHddStaCtx->conn_info.Keys, sizeof(tCsrKeys)); |
| 1443 | qdf_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1444 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1445 | pHddStaCtx->conn_info.proxyARPService = 0; |
| 1446 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1447 | qdf_mem_zero(&pHddStaCtx->conn_info.SSID, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1448 | } |
| 1449 | |
| 1450 | /** |
| 1451 | * hdd_roam_deregister_sta() - deregister station |
| 1452 | * @pAdapter: pointer to adapter |
| 1453 | * @staId: station identifier |
| 1454 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1455 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1456 | */ |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1457 | 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] | 1458 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1459 | QDF_STATUS qdf_status; |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1460 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 1461 | int ret = 0; |
| 1462 | uint8_t *peer_mac = NULL; |
| 1463 | struct qdf_mac_addr broadcastMacAddr = |
| 1464 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1465 | if (eConnectionState_IbssDisconnected == |
| 1466 | pHddStaCtx->conn_info.connState) { |
| 1467 | /* |
| 1468 | * Do not set the carrier off when the last peer leaves. |
| 1469 | * We will set the carrier off while stopping the IBSS. |
| 1470 | */ |
| 1471 | } |
| 1472 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 1473 | 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] | 1474 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1475 | staid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1476 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1477 | hdd_err("cdp_clear_peer() failed for staid %d. Status(%d) [0x%08X]", |
| 1478 | staid, qdf_status, qdf_status); |
| 1479 | } |
| 1480 | |
| 1481 | if (adapter->device_mode == QDF_STA_MODE) { |
| 1482 | peer_mac = pHddStaCtx->conn_info.bssId.bytes; |
| 1483 | } else if (adapter->device_mode == QDF_IBSS_MODE) { |
| 1484 | if (pHddStaCtx->broadcast_staid == staid) |
| 1485 | peer_mac = broadcastMacAddr.bytes; |
| 1486 | else |
| 1487 | peer_mac = pHddStaCtx->conn_info. |
| 1488 | peerMacAddress[staid].bytes; |
| 1489 | } |
| 1490 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1491 | ret = hdd_objmgr_remove_peer_object(adapter->hdd_vdev, peer_mac); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1492 | if (ret) { |
| 1493 | hdd_err("Peer obj %pM delete fails", peer_mac); |
| 1494 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1495 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1496 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1497 | } |
| 1498 | |
| 1499 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1500 | * hdd_print_bss_info() - print bss info |
| 1501 | * @hdd_sta_ctx: pointer to hdd station context |
| 1502 | * |
| 1503 | * Return: None |
| 1504 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1505 | 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] | 1506 | { |
| 1507 | uint32_t *cap_info; |
| 1508 | |
| 1509 | hdd_info("WIFI DATA LOGGER"); |
| 1510 | hdd_info("channel: %d", |
| 1511 | hdd_sta_ctx->conn_info.freq); |
| 1512 | hdd_info("dot11mode: %d", |
| 1513 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1514 | hdd_info("AKM: %d", |
| 1515 | hdd_sta_ctx->conn_info.authType); |
| 1516 | hdd_info("ssid: %.*s", |
| 1517 | hdd_sta_ctx->conn_info.SSID.SSID.length, |
| 1518 | hdd_sta_ctx->conn_info.SSID.SSID.ssId); |
| 1519 | hdd_info("roam count: %d", |
| 1520 | hdd_sta_ctx->conn_info.roam_count); |
| 1521 | hdd_info("ant_info: %d", |
| 1522 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1523 | hdd_info("datarate legacy %d", |
| 1524 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1525 | hdd_info("datarate mcs: %d", |
| 1526 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1527 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1528 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1529 | hdd_info("ht caps: %x", *cap_info); |
| 1530 | } |
| 1531 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1532 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1533 | hdd_info("vht caps: %x", *cap_info); |
| 1534 | } |
| 1535 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1536 | hdd_info("hs20 info: %x", |
| 1537 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1538 | hdd_info("signal: %d", |
| 1539 | hdd_sta_ctx->conn_info.signal); |
| 1540 | hdd_info("noise: %d", |
| 1541 | hdd_sta_ctx->conn_info.noise); |
| 1542 | } |
| 1543 | |
| 1544 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1545 | * hdd_dis_connect_handler() - disconnect event handler |
| 1546 | * @pAdapter: pointer to adapter |
| 1547 | * @pRoamInfo: pointer to roam info |
| 1548 | * @roamId: roam identifier |
| 1549 | * @roamStatus: roam status |
| 1550 | * @roamResult: roam result |
| 1551 | * |
| 1552 | * This function handles disconnect event: |
| 1553 | * 1. Disable transmit queues; |
| 1554 | * 2. Clean up internal connection states and data structures; |
| 1555 | * 3. Send disconnect indication to supplicant. |
| 1556 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1557 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1558 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1559 | static QDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1560 | tCsrRoamInfo *pRoamInfo, |
| 1561 | uint32_t roamId, |
| 1562 | eRoamCmdStatus roamStatus, |
| 1563 | eCsrRoamResult roamResult) |
| 1564 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1565 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1566 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1567 | struct net_device *dev = pAdapter->dev; |
| 1568 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1569 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1570 | uint8_t sta_id; |
| 1571 | bool sendDisconInd = true; |
| 1572 | |
| 1573 | if (dev == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1574 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1575 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1576 | } |
| 1577 | /* notify apps that we can't pass traffic anymore */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1578 | hdd_notice("Disabling queues"); |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1579 | wlan_hdd_netif_queue_control(pAdapter, |
| 1580 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1581 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1582 | |
| 1583 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 1584 | hdd_ipa_wlan_evt(pAdapter, pHddStaCtx->conn_info.staId[0], |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 1585 | HDD_IPA_STA_DISCONNECT, |
| 1586 | pHddStaCtx->conn_info.bssId.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1587 | |
| 1588 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1589 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1590 | #endif |
| 1591 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1592 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 1593 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1594 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1595 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1596 | |
| 1597 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1598 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1599 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1600 | * to cfg80211_disconnected. |
| 1601 | */ |
| 1602 | if ((eConnectionState_Disconnecting == |
| 1603 | pHddStaCtx->conn_info.connState) || |
| 1604 | (eConnectionState_NotConnected == |
| 1605 | pHddStaCtx->conn_info.connState)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1606 | 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] | 1607 | sendDisconInd = false; |
| 1608 | } |
| 1609 | |
| 1610 | if (pHddStaCtx->conn_info.connState != eConnectionState_Disconnecting) { |
| 1611 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1612 | hdd_conn_set_connection_state(pAdapter, |
| 1613 | eConnectionState_Disconnecting); |
| 1614 | } |
| 1615 | |
| 1616 | hdd_clear_roam_profile_ie(pAdapter); |
| 1617 | hdd_wmm_init(pAdapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1618 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1619 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1620 | |
| 1621 | /* indicate 'disconnect' status to wpa_supplicant... */ |
| 1622 | hdd_send_association_event(dev, pRoamInfo); |
| 1623 | /* indicate disconnected event to nl80211 */ |
| 1624 | if (roamStatus != eCSR_ROAM_IBSS_LEAVE) { |
| 1625 | /* |
| 1626 | * Only send indication to kernel if not initiated |
| 1627 | * by kernel |
| 1628 | */ |
| 1629 | if (sendDisconInd) { |
| 1630 | /* |
| 1631 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1632 | * to ICS UI. |
| 1633 | */ |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1634 | if (eCSR_ROAM_LOSTLINK == roamStatus) { |
| 1635 | if (pRoamInfo->reasonCode == |
| 1636 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
| 1637 | 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] | 1638 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1639 | dev, false, |
| 1640 | pRoamInfo->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1641 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1642 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1643 | dev, false, |
| 1644 | WLAN_REASON_UNSPECIFIED |
| 1645 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1646 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1647 | |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1648 | hdd_info("sent disconnected event to nl80211, reason code %d", |
| 1649 | (eCSR_ROAM_LOSTLINK == roamStatus) ? |
| 1650 | pRoamInfo->reasonCode : |
| 1651 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1652 | } |
| 1653 | /* |
| 1654 | * During the WLAN uninitialization,supplicant is stopped |
| 1655 | * before the driver so not sending the status of the |
| 1656 | * connection to supplicant. |
| 1657 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1658 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1659 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1660 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1661 | if (global_p2p_connection_status == |
| 1662 | P2P_CLIENT_CONNECTED_STATE_1) { |
| 1663 | global_p2p_connection_status = |
| 1664 | P2P_CLIENT_DISCONNECTED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1665 | 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] | 1666 | } else if (global_p2p_connection_status == |
| 1667 | P2P_CLIENT_COMPLETED_STATE) { |
| 1668 | global_p2p_connection_status = |
| 1669 | P2P_NOT_ACTIVE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1670 | 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] | 1671 | } |
| 1672 | } |
| 1673 | #endif |
| 1674 | |
| 1675 | } |
| 1676 | } |
| 1677 | |
| 1678 | hdd_wmm_adapter_clear(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1679 | sme_ft_reset(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1680 | if (hdd_remove_beacon_filter(pAdapter) != 0) |
| 1681 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1682 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1683 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1684 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1685 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 1686 | sta_id = pHddStaCtx->broadcast_staid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1687 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1688 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1689 | 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] | 1690 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1691 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1692 | } |
| 1693 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1694 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1695 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1696 | if (HDD_WLAN_INVALID_STA_ID == |
| 1697 | pHddStaCtx->conn_info.staId[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1698 | continue; |
| 1699 | sta_id = pHddStaCtx->conn_info.staId[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1700 | hdd_debug("Deregister StaID %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1701 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1702 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1703 | 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] | 1704 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1705 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1706 | } |
| 1707 | /* set the staid and peer mac as 0, all other |
| 1708 | * reset are done in hdd_connRemoveConnectInfo. |
| 1709 | */ |
| 1710 | pHddStaCtx->conn_info.staId[i] = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1711 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1712 | sizeof(struct qdf_mac_addr)); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1713 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1714 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1715 | } |
| 1716 | } else { |
| 1717 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1718 | hdd_debug("roamResult: %d", roamResult); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1719 | |
| 1720 | /* clear scan cache for Link Lost */ |
Sandeep Puligilla | f0b3058 | 2017-01-12 08:39:41 -0800 | [diff] [blame] | 1721 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roamResult || |
| 1722 | eCSR_ROAM_RESULT_DISASSOC_IND == roamResult || |
yeshwanth sriram guntuka | 951725a | 2017-03-15 19:33:04 +0530 | [diff] [blame] | 1723 | eCSR_ROAM_LOSTLINK == roamStatus) { |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1724 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 1725 | pHddStaCtx->conn_info.bssId.bytes); |
| 1726 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1727 | pHddStaCtx->conn_info.bssId.bytes); |
| 1728 | } |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1729 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1730 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1731 | /* Clear saved connection information in HDD */ |
| 1732 | hdd_conn_remove_connect_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1733 | hdd_conn_set_connection_state(pAdapter, eConnectionState_NotConnected); |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 1734 | pmo_ucfg_flush_gtk_offload_req(pAdapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1735 | |
| 1736 | #ifdef FEATURE_WLAN_TDLS |
| 1737 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1738 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1739 | #endif |
| 1740 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1741 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 1742 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1743 | sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX |
| 1744 | (pAdapter), |
| 1745 | pAdapter->sessionId); |
| 1746 | } |
Mahesh A Saptasagar | 6dda202 | 2016-09-03 12:59:09 +0530 | [diff] [blame] | 1747 | wlan_hdd_clear_link_layer_stats(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | /* Unblock anyone waiting for disconnect to complete */ |
| 1749 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1750 | hdd_print_bss_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1751 | return status; |
| 1752 | } |
| 1753 | |
| 1754 | /** |
| 1755 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1756 | * @vdev_id: vdevid |
| 1757 | * |
| 1758 | * Return: None |
| 1759 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1760 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1761 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1762 | hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1763 | hdd_adapter_t *adapter = NULL; |
| 1764 | |
| 1765 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 1766 | if (adapter == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1767 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1768 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1769 | } |
| 1770 | complete(&adapter->sta_authorized_event); |
| 1771 | } |
| 1772 | |
| 1773 | /** |
| 1774 | * hdd_change_peer_state() - change peer state |
| 1775 | * @pAdapter: HDD adapter |
| 1776 | * @sta_state: peer state |
| 1777 | * @roam_synch_in_progress: roam synch in progress |
| 1778 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1779 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1780 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1781 | QDF_STATUS hdd_change_peer_state(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1782 | uint8_t sta_id, |
| 1783 | enum ol_txrx_peer_state sta_state, |
| 1784 | bool roam_synch_in_progress) |
| 1785 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1786 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1787 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1788 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1789 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1790 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1791 | |
| 1792 | if (!pdev) { |
| 1793 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1794 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1795 | } |
| 1796 | |
| 1797 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1798 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1799 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1800 | } |
| 1801 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1802 | peer = cdp_peer_find_by_local_id(soc, |
| 1803 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1804 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1805 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1806 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1807 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1808 | if (peer_mac_addr == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1809 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1810 | return QDF_STATUS_E_FAULT; |
| 1811 | } |
| 1812 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1813 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1814 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1815 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1816 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1817 | } |
| 1818 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1819 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1820 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1821 | #endif |
| 1822 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1823 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1824 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1825 | /* make sure event is reset */ |
| 1826 | INIT_COMPLETION(pAdapter->sta_authorized_event); |
| 1827 | #endif |
| 1828 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1829 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1830 | hdd_set_peer_authorized_event, |
| 1831 | pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1832 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1833 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1834 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1835 | } |
| 1836 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1837 | if (pAdapter->device_mode == QDF_STA_MODE || |
| 1838 | pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1839 | #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] | 1840 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1841 | unsigned long rc; |
| 1842 | |
| 1843 | /* wait for event from firmware to set the event */ |
| 1844 | rc = wait_for_completion_timeout( |
| 1845 | &pAdapter->sta_authorized_event, |
| 1846 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1847 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1848 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1849 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1850 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 1851 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1852 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1853 | #endif |
| 1854 | } |
| 1855 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1856 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1857 | } |
| 1858 | |
| 1859 | /** |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1860 | * hdd_update_dp_vdev_flags() - update datapath vdev flags |
| 1861 | * @cbk_data: callback data |
| 1862 | * @sta_id: station id |
| 1863 | * @vdev_param: vdev parameter |
| 1864 | * @is_link_up: link state up or down |
| 1865 | * |
| 1866 | * Return: QDF status |
| 1867 | */ |
| 1868 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
| 1869 | uint8_t sta_id, |
| 1870 | uint32_t vdev_param, |
| 1871 | bool is_link_up) |
| 1872 | { |
| 1873 | struct cdp_vdev *data_vdev; |
| 1874 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1875 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1876 | hdd_context_t *hdd_ctx; |
| 1877 | struct wlan_objmgr_psoc **psoc; |
| 1878 | |
| 1879 | if (!cbk_data) |
| 1880 | return status; |
| 1881 | |
| 1882 | psoc = cbk_data; |
| 1883 | hdd_ctx = container_of(psoc, hdd_context_t, hdd_psoc); |
| 1884 | |
| 1885 | if (!hdd_ctx->tdls_nap_active) |
| 1886 | return status; |
| 1887 | |
| 1888 | data_vdev = cdp_peer_get_vdev_by_sta_id(soc, sta_id); |
| 1889 | if (NULL == data_vdev) { |
| 1890 | status = QDF_STATUS_E_FAILURE; |
| 1891 | return status; |
| 1892 | } |
| 1893 | |
| 1894 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 1895 | |
| 1896 | return status; |
| 1897 | } |
| 1898 | |
| 1899 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1900 | * hdd_roam_register_sta() - register station |
| 1901 | * @pAdapter: pointer to adapter |
| 1902 | * @pRoamInfo: pointer to roam info |
| 1903 | * @staId: station identifier |
| 1904 | * @pPeerMacAddress: peer MAC address |
| 1905 | * @pBssDesc: pointer to BSS description |
| 1906 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1907 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1908 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 1909 | QDF_STATUS hdd_roam_register_sta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1910 | tCsrRoamInfo *pRoamInfo, |
| 1911 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1912 | struct qdf_mac_addr *pPeerMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1913 | tSirBssDescription *pBssDesc) |
| 1914 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1915 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1916 | struct ol_txrx_desc_type staDesc = { 0 }; |
| 1917 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 1918 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1919 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1920 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1921 | |
| 1922 | if (NULL == pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1923 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1924 | |
| 1925 | /* Get the Station ID from the one saved during the association */ |
| 1926 | staDesc.sta_id = staId; |
| 1927 | |
| 1928 | /* set the QoS field appropriately */ |
| 1929 | if (hdd_wmm_is_active(pAdapter)) |
| 1930 | staDesc.is_qos_enabled = 1; |
| 1931 | else |
| 1932 | staDesc.is_qos_enabled = 0; |
| 1933 | |
| 1934 | #ifdef FEATURE_WLAN_WAPI |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1935 | hdd_notice("WAPI STA Registered: %d", |
| 1936 | pAdapter->wapi_info.fIsWapiSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1937 | if (pAdapter->wapi_info.fIsWapiSta) |
| 1938 | staDesc.is_wapi_supported = 1; |
| 1939 | else |
| 1940 | staDesc.is_wapi_supported = 0; |
| 1941 | #endif /* FEATURE_WLAN_WAPI */ |
| 1942 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1943 | /* Register the vdev transmit and receive functions */ |
| 1944 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 1945 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1946 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1947 | pAdapter->txrx_vdev = (void *)cdp_get_vdev_from_vdev_id(soc, |
| 1948 | (struct cdp_pdev *)pdev, |
| 1949 | pAdapter->sessionId); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1950 | if (!pAdapter->txrx_vdev) { |
| 1951 | hdd_err("%s find vdev fail", __func__); |
| 1952 | return QDF_STATUS_E_FAILURE; |
| 1953 | } |
| 1954 | |
| 1955 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1956 | cdp_vdev_register(soc, |
| 1957 | (struct cdp_vdev *)pAdapter->txrx_vdev, pAdapter, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1958 | if (!txrx_ops.tx.tx) { |
| 1959 | hdd_err("%s vdev register fail", __func__); |
| 1960 | return QDF_STATUS_E_FAILURE; |
| 1961 | } |
| 1962 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1963 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1964 | qdf_status = cdp_peer_register(soc, |
| 1965 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1966 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1967 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1968 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1969 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1970 | } |
| 1971 | |
| 1972 | if (!pRoamInfo->fAuthRequired) { |
| 1973 | /* |
| 1974 | * Connections that do not need Upper layer auth, transition |
| 1975 | * TLSHIM directly to 'Authenticated' state |
| 1976 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1977 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1978 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1979 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1980 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1981 | pRoamInfo->roamSynchInProgress |
| 1982 | #else |
| 1983 | false |
| 1984 | #endif |
| 1985 | ); |
| 1986 | |
| 1987 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 1988 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1989 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1990 | 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] | 1991 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1992 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1993 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1994 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1996 | pRoamInfo->roamSynchInProgress |
| 1997 | #else |
| 1998 | false |
| 1999 | #endif |
| 2000 | ); |
| 2001 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2002 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2003 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2004 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2005 | } |
| 2006 | |
| 2007 | /** |
| 2008 | * hdd_send_re_assoc_event() - send reassoc event |
| 2009 | * @dev: pointer to net device |
| 2010 | * @pAdapter: pointer to adapter |
| 2011 | * @pCsrRoamInfo: pointer to roam info |
| 2012 | * @reqRsnIe: pointer to RSN Information element |
| 2013 | * @reqRsnLength: length of RSN IE |
| 2014 | * |
| 2015 | * Return: none |
| 2016 | */ |
| 2017 | static void hdd_send_re_assoc_event(struct net_device *dev, |
| 2018 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo, |
| 2019 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2020 | { |
| 2021 | unsigned int len = 0; |
| 2022 | u8 *pFTAssocRsp = NULL; |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2023 | uint8_t *rspRsnIe = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
| 2024 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2025 | uint32_t rspRsnLength = 0; |
| 2026 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2027 | uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes-EID and len */ |
| 2028 | uint8_t *buf_ptr, ssid_ie_len; |
| 2029 | struct cfg80211_bss *bss = NULL; |
| 2030 | uint8_t *final_req_ie = NULL; |
| 2031 | tCsrRoamConnectedProfile roam_profile; |
| 2032 | tHalHandle hal_handle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2033 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2034 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2035 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2036 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2037 | if (!rspRsnIe) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2038 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2039 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2040 | } |
| 2041 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2042 | if (!assoc_req_ies) { |
| 2043 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2044 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2045 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2046 | if (pCsrRoamInfo == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2047 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2048 | goto done; |
| 2049 | } |
| 2050 | |
| 2051 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2052 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2053 | goto done; |
| 2054 | } |
| 2055 | |
| 2056 | pFTAssocRsp = |
| 2057 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2058 | pCsrRoamInfo->nAssocReqLength); |
| 2059 | if (pFTAssocRsp == NULL) |
| 2060 | goto done; |
| 2061 | |
| 2062 | /* pFTAssocRsp needs to point to the IEs */ |
| 2063 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2064 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2065 | (unsigned int)pFTAssocRsp[0], (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2066 | |
| 2067 | /* |
| 2068 | * Active session count is decremented upon disconnection, but during |
| 2069 | * roaming, there is no disconnect indication and hence active session |
| 2070 | * count is not decremented. |
| 2071 | * After roaming is completed, active session count is incremented |
| 2072 | * as a part of connect indication but effectively after roaming the |
| 2073 | * active session count should still be the same and hence upon |
| 2074 | * successful reassoc decrement the active session count here. |
| 2075 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2076 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2077 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
| 2078 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2079 | |
| 2080 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
| 2081 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2082 | rspRsnLength = len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2083 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2084 | qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2085 | |
| 2086 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2087 | (int)pCsrRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2088 | sme_roam_get_connect_profile(hal_handle, pAdapter->sessionId, |
| 2089 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2090 | |
| 2091 | bss = hdd_cfg80211_get_bss(pAdapter->wdev.wiphy, |
| 2092 | chan, pCsrRoamInfo->bssid.bytes, |
| 2093 | &roam_profile.SSID.ssId[0], |
| 2094 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2095 | |
| 2096 | if (bss == NULL) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2097 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2098 | buf_ptr = buf_ssid_ie; |
| 2099 | *buf_ptr = SIR_MAC_SSID_EID; |
| 2100 | buf_ptr++; |
| 2101 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2102 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2103 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2104 | roam_profile.SSID.length); |
| 2105 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2106 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2107 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2108 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2109 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2110 | if (final_req_ie == NULL) |
| 2111 | goto done; |
| 2112 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2113 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2114 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2115 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2116 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2117 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2118 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2119 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2120 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2121 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Varun Reddy Yeturu | c13305e | 2017-03-10 14:05:02 -0800 | [diff] [blame] | 2122 | cfg80211_roamed_bss(dev, bss, |
| 2123 | final_req_ie, (ssid_ie_len + reqRsnLength), |
| 2124 | rspRsnIe, rspRsnLength, GFP_KERNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2125 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2126 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2127 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2128 | pCsrRoamInfo->nAssocReqLength); |
| 2129 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2130 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2131 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2132 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2133 | |
Prakash Dhavali | 989127d | 2016-11-29 14:56:44 +0530 | [diff] [blame] | 2134 | wlan_hdd_send_roam_auth_event(pAdapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2135 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2136 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2137 | pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2138 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2139 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2140 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2141 | qdf_mem_free(final_req_ie); |
| 2142 | qdf_mem_free(rspRsnIe); |
| 2143 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2144 | } |
| 2145 | |
| 2146 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2147 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2148 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2149 | * |
| 2150 | * Return: roam sync status if roaming offloaded else false |
| 2151 | */ |
| 2152 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2153 | bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2154 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2155 | if (roaminfo) |
| 2156 | return roaminfo->roamSynchInProgress; |
| 2157 | else |
| 2158 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2159 | } |
| 2160 | #endif |
| 2161 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2162 | /** |
| 2163 | * hdd_get_ibss_peer_staid() - get sta id for IBSS peer |
| 2164 | * @hddstactx: pointer to HDD sta context |
| 2165 | * @roaminfo: pointer to roaminfo structure |
| 2166 | * |
| 2167 | * This function returns staid for IBSS peer. If peer is broadcast |
| 2168 | * MAC address return self staid(0) else find the peer sta id of |
| 2169 | * the peer. |
| 2170 | * |
| 2171 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2172 | */ |
| 2173 | static uint8_t hdd_get_ibss_peer_staid(hdd_station_ctx_t *hddstactx, |
| 2174 | tCsrRoamInfo *roaminfo) |
| 2175 | { |
| 2176 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
| 2177 | QDF_STATUS status; |
| 2178 | |
| 2179 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
| 2180 | staid = 0; |
| 2181 | } else { |
| 2182 | status = hdd_get_peer_sta_id(hddstactx, |
| 2183 | &roaminfo->peerMac, &staid); |
| 2184 | if (status != QDF_STATUS_SUCCESS) { |
| 2185 | hdd_err("Unable to find staid for " MAC_ADDRESS_STR, |
| 2186 | MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
| 2187 | } |
| 2188 | } |
| 2189 | |
| 2190 | return staid; |
| 2191 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2192 | |
| 2193 | /** |
| 2194 | * hdd_change_sta_state_authenticated()- |
| 2195 | * This function changes STA state to authenticated |
| 2196 | * @adapter: pointer to the adapter structure. |
| 2197 | * @roaminfo: pointer to the RoamInfo structure. |
| 2198 | * |
| 2199 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2200 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2201 | * |
| 2202 | * Return: 0 on success and errno on failure |
| 2203 | */ |
| 2204 | static int hdd_change_sta_state_authenticated(hdd_adapter_t *adapter, |
| 2205 | tCsrRoamInfo *roaminfo) |
| 2206 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2207 | QDF_STATUS status; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2208 | uint32_t timeout; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2209 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2210 | 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] | 2211 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2212 | |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2213 | timeout = hddstactx->hdd_ReassocScenario ? |
| 2214 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2215 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2216 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2217 | if (QDF_IBSS_MODE == adapter->device_mode) |
| 2218 | staid = hdd_get_ibss_peer_staid(hddstactx, roaminfo); |
| 2219 | else |
| 2220 | staid = hddstactx->conn_info.staId[0]; |
| 2221 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2222 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", staid); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2223 | |
| 2224 | /* Connections that do not need Upper layer authentication, |
| 2225 | * transition TL to 'Authenticated' state after the keys are set |
| 2226 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2227 | status = hdd_change_peer_state(adapter, staid, OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2228 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2229 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2230 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
| 2231 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2232 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 2233 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2234 | sme_ps_enable_auto_ps_timer( |
| 2235 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 2236 | adapter->sessionId, |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2237 | timeout, false); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2238 | } |
| 2239 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2240 | return qdf_status_to_os_return(status); |
| 2241 | } |
| 2242 | |
| 2243 | /** |
| 2244 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2245 | * if key installation is required |
| 2246 | * @encr_type: encryption type |
| 2247 | * |
| 2248 | * Return: true if key installation is required and false otherwise. |
| 2249 | */ |
| 2250 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2251 | eCsrEncryptionType encr_type) |
| 2252 | { |
| 2253 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2254 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2255 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
| 2256 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2257 | return true; |
| 2258 | else |
| 2259 | return false; |
| 2260 | } |
| 2261 | |
| 2262 | /** |
| 2263 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2264 | * complete |
| 2265 | * @adapter: pointer to HDD adapter |
| 2266 | * @roaminfo: pointer to roam info |
| 2267 | * @roam_result: roam result |
| 2268 | * |
| 2269 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2270 | * This function checks for the successful set key completion and update |
| 2271 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2272 | * |
| 2273 | * Return: None |
| 2274 | */ |
| 2275 | static void hdd_change_peer_state_after_set_key(hdd_adapter_t *adapter, |
| 2276 | tCsrRoamInfo *roaminfo, eCsrRoamResult roam_result) |
| 2277 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2278 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 2279 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.ucEncryptionType; |
| 2280 | |
| 2281 | /* |
| 2282 | * If the security mode is one of the following, IBSS peer will be |
| 2283 | * waiting in CONN state and we will move the peer state to AUTH |
| 2284 | * here. For non-secure connection, no need to wait for set-key complete |
| 2285 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2286 | */ |
| 2287 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2288 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2289 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2290 | |
| 2291 | return; |
| 2292 | } |
| 2293 | |
| 2294 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2295 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2296 | /* |
| 2297 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2298 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2299 | * after roaming. STA TL state moves to authenticated only if |
| 2300 | * ptk_installed is true. So, make ptk_installed to true in |
| 2301 | * case of 11R roaming. |
| 2302 | */ |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2303 | if (sme_neighbor_roam_is11r_assoc(WLAN_HDD_GET_HAL_CTX(adapter), |
| 2304 | adapter->sessionId)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2305 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2306 | } else { |
| 2307 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2308 | } |
| 2309 | |
| 2310 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2311 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2312 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2313 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2314 | * set the unicast and broadcast key. |
| 2315 | */ |
| 2316 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2317 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2318 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2319 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2320 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2321 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2322 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2323 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2324 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2325 | } |
| 2326 | |
| 2327 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2328 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2329 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2330 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2331 | } |
| 2332 | |
| 2333 | hdd_sta_ctx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2334 | |
| 2335 | return; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2336 | } |
| 2337 | |
| 2338 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2339 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
| 2340 | * @pAdapter: pointer to adapter |
| 2341 | * @pRoamInfo: pointer to roam info |
| 2342 | * @roamId: roam id |
| 2343 | * @roamStatus: roam status |
| 2344 | * @roamResult: roam result |
| 2345 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2346 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2347 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2348 | 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] | 2349 | tCsrRoamInfo *pRoamInfo, |
| 2350 | uint32_t roamId, |
| 2351 | eRoamCmdStatus roamStatus, |
| 2352 | eCsrRoamResult roamResult) |
| 2353 | { |
| 2354 | eCsrEncryptionType connectedCipherAlgo; |
| 2355 | bool fConnected = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2356 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2357 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2358 | ENTER(); |
| 2359 | |
| 2360 | if (NULL == pRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2361 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2362 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2363 | } |
| 2364 | /* |
| 2365 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2366 | * then go to 'authenticated'. For all other authentication types |
| 2367 | * (those that do not require upper layer authentication) we can put TL |
| 2368 | * directly into 'authenticated' state. |
| 2369 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2370 | hdd_info("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2371 | MAC_ADDRESS_STR, roamStatus, roamResult, |
| 2372 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 2373 | |
| 2374 | fConnected = hdd_conn_get_connected_cipher_algo(pHddStaCtx, |
| 2375 | &connectedCipherAlgo); |
| 2376 | if (fConnected) { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2377 | hdd_change_peer_state_after_set_key(pAdapter, pRoamInfo, |
| 2378 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2379 | } else { |
| 2380 | /* |
| 2381 | * possible disassoc after issuing set key and waiting |
| 2382 | * set key complete. |
| 2383 | */ |
| 2384 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2385 | } |
| 2386 | |
| 2387 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2388 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2389 | } |
| 2390 | |
| 2391 | /** |
| 2392 | * hdd_perform_roam_set_key_complete() - perform set key complete |
| 2393 | * @pAdapter: pointer to adapter |
| 2394 | * |
| 2395 | * Return: none |
| 2396 | */ |
| 2397 | void hdd_perform_roam_set_key_complete(hdd_adapter_t *pAdapter) |
| 2398 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2399 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2400 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2401 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2402 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2403 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2404 | qdf_mem_copy(roamInfo.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2405 | pHddStaCtx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2406 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2407 | pHddStaCtx->roam_info.peerMac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2408 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2409 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2410 | hdd_roam_set_key_complete_handler(pAdapter, |
| 2411 | &roamInfo, |
| 2412 | pHddStaCtx->roam_info.roamId, |
| 2413 | pHddStaCtx->roam_info.roamStatus, |
| 2414 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2415 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2416 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2417 | |
| 2418 | pHddStaCtx->roam_info.deferKeyComplete = false; |
| 2419 | } |
| 2420 | |
| 2421 | /** |
| 2422 | * hdd_association_completion_handler() - association completion handler |
| 2423 | * @pAdapter: pointer to adapter |
| 2424 | * @pRoamInfo: pointer to roam info |
| 2425 | * @roamId: roam id |
| 2426 | * @roamStatus: roam status |
| 2427 | * @roamResult: roam result |
| 2428 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2429 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2430 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2431 | static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2432 | tCsrRoamInfo *pRoamInfo, |
| 2433 | uint32_t roamId, |
| 2434 | eRoamCmdStatus roamStatus, |
| 2435 | eCsrRoamResult roamResult) |
| 2436 | { |
| 2437 | struct net_device *dev = pAdapter->dev; |
| 2438 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2439 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2440 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2441 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2442 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2443 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2444 | bool hddDisconInProgress = false; |
| 2445 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2446 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2447 | bool ok; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2448 | |
| 2449 | if (!pHddCtx) { |
| 2450 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2451 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2452 | } |
| 2453 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2454 | /* validate config */ |
| 2455 | if (!pHddCtx->config) { |
| 2456 | hdd_err("config is NULL"); |
| 2457 | return QDF_STATUS_E_NULL_VALUE; |
| 2458 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2459 | /* HDD has initiated disconnect, do not send connect result indication |
| 2460 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2461 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2462 | if (((eConnectionState_Disconnecting == |
| 2463 | pHddStaCtx->conn_info.connState) || |
| 2464 | (eConnectionState_NotConnected == |
| 2465 | pHddStaCtx->conn_info.connState)) && |
| 2466 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2467 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2468 | hdd_info("Disconnect from HDD in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2469 | hddDisconInProgress = true; |
| 2470 | } |
| 2471 | |
| 2472 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
| 2473 | if (NULL == pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2474 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2475 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2476 | } |
| 2477 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2478 | hdd_conn_set_connection_state(pAdapter, |
| 2479 | eConnectionState_Associated); |
| 2480 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2481 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2482 | /* Save the connection info from CSR... */ |
| 2483 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, |
| 2484 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2485 | |
| 2486 | if (hdd_add_beacon_filter(pAdapter) != 0) |
| 2487 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2488 | #ifdef FEATURE_WLAN_WAPI |
| 2489 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2490 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
| 2491 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2492 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
| 2493 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2494 | } else { |
| 2495 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2496 | } |
| 2497 | #endif /* FEATURE_WLAN_WAPI */ |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2498 | hdd_debug("bss_descr[%d] devicemode[%d]", !!pRoamInfo->pBssDesc, |
| 2499 | pAdapter->device_mode); |
| 2500 | if ((QDF_STA_MODE == pAdapter->device_mode) && |
| 2501 | pRoamInfo->pBssDesc) { |
| 2502 | ie_len = GET_IE_LEN_IN_BSS(pRoamInfo->pBssDesc->length); |
| 2503 | pHddStaCtx->ap_supports_immediate_power_save = |
| 2504 | wlan_hdd_is_ap_supports_immediate_power_save( |
| 2505 | (uint8_t *) pRoamInfo->pBssDesc->ieFields, |
| 2506 | ie_len); |
| 2507 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
| 2508 | pHddStaCtx->ap_supports_immediate_power_save); |
| 2509 | } |
| 2510 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2511 | /* Indicate 'connect' status to user space */ |
| 2512 | hdd_send_association_event(dev, pRoamInfo); |
| 2513 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2514 | if (policy_mgr_is_mcc_in_24G(pHddCtx->hdd_psoc)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2515 | if (pHddCtx->miracast_value) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2516 | wlan_hdd_set_mas(pAdapter, |
| 2517 | pHddCtx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2518 | } |
| 2519 | |
| 2520 | /* Initialize the Linkup event completion variable */ |
| 2521 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2522 | |
| 2523 | /* |
| 2524 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2525 | * the device properly. Before allowing any packet to go up to |
| 2526 | * the application, device activation has to be ensured for |
| 2527 | * proper queue mapping by the kernel. we have registered net |
| 2528 | * device notifier for device change notification. With this we |
| 2529 | * will come to know that the device is getting |
| 2530 | * activated properly. |
| 2531 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2532 | if (pHddStaCtx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2533 | /* |
| 2534 | * Enable Linkup Event Servicing which allows the net |
| 2535 | * device notifier to set the linkup event variable. |
| 2536 | */ |
| 2537 | pAdapter->isLinkUpSvcNeeded = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2538 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2539 | /* Switch on the Carrier to activate the device */ |
| 2540 | wlan_hdd_netif_queue_control(pAdapter, |
| 2541 | WLAN_NETIF_CARRIER_ON, |
| 2542 | WLAN_CONTROL_PATH); |
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 | /* |
| 2545 | * Wait for the Link to up to ensure all the queues |
| 2546 | * are set properly by the kernel. |
| 2547 | */ |
| 2548 | rc = wait_for_completion_timeout( |
| 2549 | &pAdapter->linkup_event_var, |
| 2550 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2551 | ); |
| 2552 | if (!rc) |
| 2553 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2554 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2555 | /* |
| 2556 | * Disable Linkup Event Servicing - no more service |
| 2557 | * required from the net device notifier call. |
| 2558 | */ |
| 2559 | pAdapter->isLinkUpSvcNeeded = false; |
| 2560 | } else { |
| 2561 | pHddStaCtx->ft_carrier_on = false; |
| 2562 | ft_carrier_on = true; |
| 2563 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2564 | if ((WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId) |
| 2565 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2566 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2567 | hdd_err("Wrong Staid: %d", pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2568 | |
| 2569 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2570 | |
| 2571 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 2572 | hdd_ipa_wlan_evt(pAdapter, pRoamInfo->staId, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 2573 | HDD_IPA_STA_CONNECT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2574 | pRoamInfo->bssid.bytes); |
| 2575 | |
| 2576 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2577 | wlan_hdd_auto_shutdown_enable(pHddCtx, false); |
| 2578 | #endif |
| 2579 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2580 | hdd_debug("check if STA chan ok for DNBS"); |
| 2581 | if (policy_mgr_is_chan_ok_for_dnbs(pHddCtx->hdd_psoc, |
| 2582 | pHddStaCtx->conn_info.operationChannel, |
| 2583 | &ok)) { |
| 2584 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
| 2585 | pHddStaCtx->conn_info.operationChannel); |
| 2586 | return QDF_STATUS_E_FAILURE; |
| 2587 | } |
| 2588 | |
| 2589 | if (!ok) { |
| 2590 | hdd_err("Chan:%d not suitable for DNBS", |
| 2591 | pHddStaCtx->conn_info.operationChannel); |
| 2592 | wlan_hdd_netif_queue_control(pAdapter, |
| 2593 | WLAN_NETIF_CARRIER_OFF, |
| 2594 | WLAN_CONTROL_PATH); |
| 2595 | if (!hddDisconInProgress) { |
| 2596 | hdd_err("Disconnecting..."); |
| 2597 | sme_roam_disconnect( |
| 2598 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2599 | pAdapter->sessionId, |
| 2600 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2601 | } |
| 2602 | return QDF_STATUS_E_FAILURE; |
| 2603 | } |
| 2604 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2605 | hdd_debug("check for SAP restart"); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2606 | policy_mgr_check_concurrent_intf_and_restart_sap( |
| 2607 | pHddCtx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2608 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2609 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 2610 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2611 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2612 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2613 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2614 | /* |
| 2615 | * For reassoc, the station is already registered, all we need |
| 2616 | * is to change the state of the STA in TL. |
| 2617 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2618 | * CONNECTED instead of AUTHENTICATED. |
| 2619 | */ |
| 2620 | if (!pRoamInfo->fReassocReq) { |
| 2621 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2622 | u8 *pFTAssocRsp = NULL; |
| 2623 | unsigned int assocRsplen = 0; |
| 2624 | u8 *pFTAssocReq = NULL; |
| 2625 | unsigned int assocReqlen = 0; |
| 2626 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2627 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2628 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2629 | |
| 2630 | /* add bss_id to cfg80211 data base */ |
| 2631 | bss = |
| 2632 | wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 2633 | pRoamInfo); |
| 2634 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2635 | hdd_err("wlan: Not able to create BSS entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2636 | wlan_hdd_netif_queue_control(pAdapter, |
| 2637 | WLAN_NETIF_CARRIER_OFF, |
| 2638 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2639 | if (!hddDisconInProgress) { |
| 2640 | /* |
| 2641 | * Here driver was not able to add bss |
| 2642 | * in cfg80211 database this can happen |
| 2643 | * if connected channel is not valid, |
| 2644 | * i.e reg domain was changed during |
| 2645 | * connection. Queue disconnect for the |
| 2646 | * session if disconnect is not in |
| 2647 | * progress. |
| 2648 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2649 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2650 | sme_roam_disconnect( |
| 2651 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2652 | pAdapter->sessionId, |
| 2653 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2654 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2655 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2656 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2657 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2658 | eCSR_AUTH_TYPE_FT_RSN |
| 2659 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2660 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
| 2661 | |
| 2662 | /* Association Response */ |
| 2663 | pFTAssocRsp = |
| 2664 | (u8 *) (pRoamInfo->pbFrames + |
| 2665 | pRoamInfo->nBeaconLength + |
| 2666 | pRoamInfo->nAssocReqLength); |
| 2667 | if (pFTAssocRsp != NULL) { |
| 2668 | /* |
| 2669 | * pFTAssocRsp needs to point to the IEs |
| 2670 | */ |
| 2671 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2672 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2673 | (unsigned int)pFTAssocRsp[0], |
| 2674 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2675 | assocRsplen = |
| 2676 | pRoamInfo->nAssocRspLength - |
| 2677 | FT_ASSOC_RSP_IES_OFFSET; |
| 2678 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2679 | hdd_debug("AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2680 | assocRsplen = 0; |
| 2681 | } |
| 2682 | |
| 2683 | /* Association Request */ |
| 2684 | pFTAssocReq = (u8 *) (pRoamInfo->pbFrames + |
| 2685 | pRoamInfo->nBeaconLength); |
| 2686 | if (pFTAssocReq != NULL) { |
| 2687 | if (!ft_carrier_on) { |
| 2688 | /* |
| 2689 | * pFTAssocReq needs to point to |
| 2690 | * the IEs |
| 2691 | */ |
| 2692 | pFTAssocReq += |
| 2693 | FT_ASSOC_REQ_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2694 | hdd_debug("pFTAssocReq is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2695 | (unsigned int) |
| 2696 | pFTAssocReq[0], |
| 2697 | (unsigned int) |
| 2698 | pFTAssocReq[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2699 | assocReqlen = |
| 2700 | pRoamInfo->nAssocReqLength - |
| 2701 | FT_ASSOC_REQ_IES_OFFSET; |
| 2702 | } else { |
| 2703 | /* |
| 2704 | * This should contain only the |
| 2705 | * FTIEs |
| 2706 | */ |
| 2707 | assocReqlen = |
| 2708 | pRoamInfo->nAssocReqLength; |
| 2709 | } |
| 2710 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2711 | hdd_debug("AssocReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2712 | assocReqlen = 0; |
| 2713 | } |
| 2714 | |
| 2715 | if (ft_carrier_on) { |
| 2716 | if (!hddDisconInProgress) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2717 | struct cfg80211_bss *roam_bss; |
| 2718 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2719 | /* |
| 2720 | * After roaming is completed, |
| 2721 | * active session count is |
| 2722 | * incremented as a part of |
| 2723 | * connect indication but |
| 2724 | * effectively the active |
| 2725 | * session count should still |
| 2726 | * be the same and hence upon |
| 2727 | * successful reassoc |
| 2728 | * decrement the active session |
| 2729 | * count here. |
| 2730 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2731 | if (!hdd_is_roam_sync_in_progress |
| 2732 | (pRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2733 | policy_mgr_decr_session_set_pcl( |
| 2734 | pHddCtx->hdd_psoc, |
| 2735 | pAdapter->device_mode, |
| 2736 | pAdapter->sessionId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2737 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2738 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2739 | chan = |
| 2740 | ieee80211_get_channel |
| 2741 | (pAdapter->wdev.wiphy, |
| 2742 | (int)pRoamInfo->pBssDesc-> |
| 2743 | channelId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2744 | hdd_debug( |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2745 | "assocReqlen %d assocRsplen %d", |
| 2746 | assocReqlen, |
| 2747 | assocRsplen); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2748 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2749 | hdd_debug( |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2750 | "Reassoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2751 | QDF_TRACE_HEX_DUMP( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2752 | QDF_MODULE_ID_HDD, |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2753 | QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2754 | pFTAssocReq, |
| 2755 | assocReqlen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2756 | roam_bss = |
| 2757 | hdd_cfg80211_get_bss( |
| 2758 | pAdapter->wdev.wiphy, |
| 2759 | chan, |
| 2760 | pRoamInfo->bssid.bytes, |
| 2761 | pRoamInfo->u. |
| 2762 | pConnectedProfile->SSID.ssId, |
| 2763 | pRoamInfo->u. |
| 2764 | pConnectedProfile->SSID.length); |
| 2765 | cfg80211_roamed_bss(dev, |
| 2766 | roam_bss, |
| 2767 | pFTAssocReq, |
| 2768 | assocReqlen, |
| 2769 | pFTAssocRsp, |
| 2770 | assocRsplen, |
| 2771 | GFP_KERNEL); |
| 2772 | wlan_hdd_send_roam_auth_event( |
| 2773 | pAdapter, |
| 2774 | pRoamInfo->bssid.bytes, |
| 2775 | pFTAssocReq, |
| 2776 | assocReqlen, |
| 2777 | pFTAssocRsp, |
| 2778 | assocRsplen, |
| 2779 | pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2780 | } |
| 2781 | if (sme_get_ftptk_state |
| 2782 | (WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2783 | pAdapter->sessionId)) { |
| 2784 | sme_set_ftptk_state |
| 2785 | (WLAN_HDD_GET_HAL_CTX |
| 2786 | (pAdapter), |
| 2787 | pAdapter->sessionId, |
| 2788 | false); |
| 2789 | pRoamInfo->fAuthRequired = |
| 2790 | false; |
| 2791 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2792 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2793 | roam_info.bssid, |
| 2794 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2795 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2796 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2797 | roam_info.peerMac, |
| 2798 | pRoamInfo->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2799 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2800 | pHddStaCtx->roam_info.roamId = |
| 2801 | roamId; |
| 2802 | pHddStaCtx->roam_info. |
| 2803 | roamStatus = roamStatus; |
| 2804 | pHddStaCtx->roam_info. |
| 2805 | deferKeyComplete = true; |
| 2806 | } |
| 2807 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2808 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2809 | ft_carrier_on); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2810 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2811 | pRoamInfo-> |
| 2812 | bssid.bytes, |
| 2813 | pRoamInfo, |
| 2814 | pFTAssocReq, |
| 2815 | assocReqlen, |
| 2816 | pFTAssocRsp, |
| 2817 | assocRsplen, |
| 2818 | WLAN_STATUS_SUCCESS, |
| 2819 | GFP_KERNEL, |
| 2820 | false, |
| 2821 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2822 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 2823 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2824 | /* |
| 2825 | * wpa supplicant expecting WPA/RSN IE in |
| 2826 | * connect result. |
| 2827 | */ |
| 2828 | csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX |
| 2829 | (pAdapter), |
| 2830 | pAdapter->sessionId, |
| 2831 | &reqRsnLength, |
| 2832 | reqRsnIe); |
| 2833 | |
| 2834 | csr_roam_get_wpa_rsn_rsp_ie(WLAN_HDD_GET_HAL_CTX |
| 2835 | (pAdapter), |
| 2836 | pAdapter->sessionId, |
| 2837 | &rspRsnLength, |
| 2838 | rspRsnIe); |
| 2839 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2840 | if (ft_carrier_on) |
| 2841 | hdd_send_re_assoc_event(dev, |
| 2842 | pAdapter, |
| 2843 | pRoamInfo, |
| 2844 | reqRsnIe, |
| 2845 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2846 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2847 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2848 | MAC_ADDRESS_STR |
| 2849 | " result:%d and Status:%d", |
| 2850 | MAC_ADDR_ARRAY |
| 2851 | (pRoamInfo->bssid.bytes), |
| 2852 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2853 | |
| 2854 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2855 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2856 | pRoamInfo-> |
| 2857 | bssid.bytes, |
| 2858 | pRoamInfo, |
| 2859 | reqRsnIe, |
| 2860 | reqRsnLength, |
| 2861 | rspRsnIe, |
| 2862 | rspRsnLength, |
| 2863 | WLAN_STATUS_SUCCESS, |
| 2864 | GFP_KERNEL, |
| 2865 | false, |
| 2866 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2867 | } |
| 2868 | } |
| 2869 | } |
| 2870 | if (!hddDisconInProgress) { |
| 2871 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2872 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2873 | bss); |
| 2874 | |
| 2875 | /* |
| 2876 | * Perform any WMM-related association |
| 2877 | * processing. |
| 2878 | */ |
| 2879 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2880 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2881 | |
| 2882 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2883 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2884 | */ |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2885 | qdf_status = hdd_roam_register_sta(pAdapter, |
| 2886 | pRoamInfo, |
| 2887 | pHddStaCtx->conn_info.staId[0], |
| 2888 | NULL, pRoamInfo->pBssDesc); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2889 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2890 | wlan_hdd_netif_queue_control(pAdapter, |
| 2891 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2892 | WLAN_CONTROL_PATH); |
| 2893 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2894 | } |
| 2895 | } else { |
| 2896 | /* |
| 2897 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 2898 | * in case of reassociation also need to indicate it to |
| 2899 | * supplicant. |
| 2900 | */ |
| 2901 | csr_roam_get_wpa_rsn_req_ie( |
| 2902 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2903 | pAdapter->sessionId, |
| 2904 | &reqRsnLength, reqRsnIe); |
| 2905 | |
| 2906 | hdd_send_re_assoc_event(dev, pAdapter, pRoamInfo, |
| 2907 | reqRsnIe, reqRsnLength); |
| 2908 | /* Reassoc successfully */ |
| 2909 | if (pRoamInfo->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2910 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2911 | hdd_change_peer_state(pAdapter, |
| 2912 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2913 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2914 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2915 | pRoamInfo->roamSynchInProgress |
| 2916 | #else |
| 2917 | false |
| 2918 | #endif |
| 2919 | ); |
| 2920 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2921 | hdd_objmgr_set_peer_mlme_auth_state( |
| 2922 | pAdapter->hdd_vdev, |
| 2923 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2924 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2925 | hdd_debug("staId: %d Changing TL state to AUTHENTICATED", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2926 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2927 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2928 | hdd_change_peer_state(pAdapter, |
| 2929 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2930 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2931 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2932 | pRoamInfo->roamSynchInProgress |
| 2933 | #else |
| 2934 | false |
| 2935 | #endif |
| 2936 | ); |
| 2937 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2938 | hdd_objmgr_set_peer_mlme_auth_state( |
| 2939 | pAdapter->hdd_vdev, |
| 2940 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2941 | } |
| 2942 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2943 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2944 | /* |
| 2945 | * Perform any WMM-related association |
| 2946 | * processing |
| 2947 | */ |
| 2948 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2949 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2950 | } |
| 2951 | |
| 2952 | /* Start the tx queues */ |
| 2953 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2954 | if (pRoamInfo->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2955 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2956 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2957 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2958 | wlan_hdd_netif_queue_control(pAdapter, |
| 2959 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2960 | WLAN_CONTROL_PATH); |
| 2961 | } |
| 2962 | |
Padma, Santhosh Kumar | 724f63d | 2016-08-09 16:04:31 +0530 | [diff] [blame] | 2963 | #ifdef FEATURE_WLAN_TDLS |
| 2964 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 2965 | #endif |
| 2966 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2967 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2968 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2969 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2970 | } |
| 2971 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2972 | qdf_mem_zero(&pAdapter->hdd_stats.hddPmfStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2973 | sizeof(pAdapter->hdd_stats.hddPmfStats)); |
| 2974 | #endif |
| 2975 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2976 | bool connect_timeout = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2977 | hdd_wext_state_t *pWextState = |
| 2978 | WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2979 | if (pRoamInfo) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2980 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2981 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2982 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 2983 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2984 | else |
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(pWextState->req_bssId.bytes), |
| 2988 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 2989 | |
| 2990 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 2991 | (pRoamInfo && |
| 2992 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
| 2993 | pRoamInfo->statusCode) || |
| 2994 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
| 2995 | pRoamInfo->statusCode) || |
| 2996 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
| 2997 | pRoamInfo->statusCode)))) { |
| 2998 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 2999 | pRoamInfo ? |
| 3000 | pRoamInfo->bssid.bytes : |
| 3001 | pWextState->req_bssId.bytes); |
| 3002 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 3003 | pRoamInfo ? |
| 3004 | pRoamInfo->bssid.bytes : |
| 3005 | pWextState->req_bssId.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3006 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3007 | } |
| 3008 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3009 | /* |
| 3010 | * CR465478: Only send up a connection failure result when CSR |
| 3011 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3012 | */ |
| 3013 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 3014 | && !hddDisconInProgress) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3015 | if (pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3016 | hdd_err("send connect failure to nl80211: for bssid " |
| 3017 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3018 | " result: %d and Status: %d reasoncode: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3019 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3020 | roamResult, roamStatus, |
| 3021 | pRoamInfo->reasonCode); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3022 | pHddStaCtx->conn_info.assoc_status_code = |
| 3023 | pRoamInfo->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3024 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3025 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3026 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3027 | " result: %d and status: %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3028 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3029 | roamResult, roamStatus); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3030 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3031 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3032 | wlan_deregister_txrx_packetdump(); |
| 3033 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3034 | /* inform association failure event to nl80211 */ |
| 3035 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 3036 | roamResult) { |
| 3037 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3038 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3039 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3040 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3041 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3042 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3043 | connect_timeout, |
| 3044 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3045 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3046 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3047 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3048 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3049 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3050 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3051 | connect_timeout, |
| 3052 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3053 | } else { |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3054 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3055 | hdd_connect_result(dev, |
| 3056 | pRoamInfo->bssid.bytes, |
| 3057 | NULL, NULL, 0, NULL, 0, |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3058 | pRoamInfo->reasonCode ? |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3059 | pRoamInfo->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3060 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3061 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3062 | connect_timeout, |
| 3063 | pRoamInfo->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3064 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3065 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3066 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3067 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3068 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3069 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3070 | connect_timeout, |
| 3071 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3072 | } |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3073 | hdd_clear_roam_profile_ie(pAdapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3074 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 3075 | && !hddDisconInProgress)) { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3076 | hdd_connect_result(dev, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3077 | pWextState->req_bssId.bytes, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3078 | NULL, NULL, 0, NULL, 0, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3079 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3080 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3081 | connect_timeout, |
| 3082 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3083 | } |
| 3084 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3085 | /* |
| 3086 | * Set connection state to eConnectionState_NotConnected only |
| 3087 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3088 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3089 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3090 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 3091 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3092 | && !hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3093 | hdd_conn_set_connection_state(pAdapter, |
| 3094 | eConnectionState_NotConnected); |
| 3095 | } |
| 3096 | hdd_wmm_init(pAdapter); |
| 3097 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3098 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3099 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3100 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3101 | WLAN_CONTROL_PATH); |
| 3102 | } |
| 3103 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3104 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3105 | } |
| 3106 | |
| 3107 | /** |
| 3108 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
| 3109 | * @pAdapter: pointer to adapter |
| 3110 | * @pRoamInfo: pointer to roam info |
| 3111 | * @roamId: roam id |
| 3112 | * @roamStatus: roam status |
| 3113 | * @roamResult: roam result |
| 3114 | * |
| 3115 | * Here we update the status of the Ibss when we receive information that we |
| 3116 | * have started/joined an ibss session. |
| 3117 | * |
| 3118 | * Return: none |
| 3119 | */ |
| 3120 | static void hdd_roam_ibss_indication_handler(hdd_adapter_t *pAdapter, |
| 3121 | tCsrRoamInfo *pRoamInfo, |
| 3122 | uint32_t roamId, |
| 3123 | eRoamCmdStatus roamStatus, |
| 3124 | eCsrRoamResult roamResult) |
| 3125 | { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3126 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3127 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3128 | hdd_debug("%s: id %d, status %d, result %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3129 | pAdapter->dev->name, roamId, |
| 3130 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3131 | |
| 3132 | switch (roamResult) { |
| 3133 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3134 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3135 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3136 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3137 | { |
| 3138 | hdd_context_t *pHddCtx = |
| 3139 | (hdd_context_t *) pAdapter->pHddCtx; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3140 | hdd_station_ctx_t *hdd_sta_ctx = |
| 3141 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3142 | struct qdf_mac_addr broadcastMacAddr = |
| 3143 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3144 | |
| 3145 | if (NULL == pRoamInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3146 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | return; |
| 3148 | } |
| 3149 | |
| 3150 | /* When IBSS Started comes from CSR, we need to move |
| 3151 | * connection state to IBSS Disconnected (meaning no peers |
| 3152 | * are in the IBSS). |
| 3153 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3154 | hdd_conn_set_connection_state(pAdapter, |
| 3155 | eConnectionState_IbssDisconnected); |
| 3156 | /* notify wmm */ |
| 3157 | hdd_wmm_connect(pAdapter, pRoamInfo, |
| 3158 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3159 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 3160 | hdd_sta_ctx->broadcast_staid = pRoamInfo->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3161 | |
| 3162 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3163 | pAdapter; |
| 3164 | hdd_roam_register_sta(pAdapter, pRoamInfo, |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3165 | pRoamInfo->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3166 | &broadcastMacAddr, |
| 3167 | pRoamInfo->pBssDesc); |
| 3168 | |
| 3169 | if (pRoamInfo->pBssDesc) { |
| 3170 | struct cfg80211_bss *bss; |
| 3171 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3172 | struct ieee80211_channel *chan; |
| 3173 | int chan_no; |
| 3174 | unsigned int freq; |
| 3175 | #endif |
| 3176 | /* we created the IBSS, notify supplicant */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3177 | hdd_info("%s: created ibss " MAC_ADDRESS_STR, |
| 3178 | pAdapter->dev->name, |
| 3179 | MAC_ADDR_ARRAY( |
| 3180 | pRoamInfo->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3181 | |
| 3182 | /* we must first give cfg80211 the BSS information */ |
| 3183 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 3184 | pRoamInfo); |
| 3185 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3186 | hdd_err("%s: unable to create IBSS entry", |
| 3187 | pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3188 | return; |
| 3189 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3190 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3191 | wlan_hdd_netif_queue_control(pAdapter, |
| 3192 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3193 | WLAN_CONTROL_PATH); |
| 3194 | |
| 3195 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3196 | chan_no = pRoamInfo->pBssDesc->channelId; |
| 3197 | |
| 3198 | if (chan_no <= 14) |
| 3199 | freq = ieee80211_channel_to_frequency(chan_no, |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 3200 | NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3201 | else |
| 3202 | freq = ieee80211_channel_to_frequency(chan_no, |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 3203 | NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3204 | |
| 3205 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3206 | |
| 3207 | if (chan) |
| 3208 | cfg80211_ibss_joined(pAdapter->dev, |
| 3209 | bss->bssid, chan, |
| 3210 | GFP_KERNEL); |
| 3211 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3212 | hdd_warn("%s: chanId: %d, can't find channel", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3213 | pAdapter->dev->name, |
| 3214 | (int)pRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3215 | #else |
| 3216 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3217 | GFP_KERNEL); |
| 3218 | #endif |
| 3219 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3220 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | bss); |
| 3222 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3223 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3224 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
| 3225 | pAdapter->device_mode, pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3226 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3227 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3228 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
| 3229 | pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3230 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | break; |
| 3232 | } |
| 3233 | |
| 3234 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3235 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3236 | hdd_err("%s: unable to create IBSS", pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3237 | break; |
| 3238 | } |
| 3239 | |
| 3240 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3241 | hdd_err("%s: unexpected result %d", |
| 3242 | pAdapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3243 | break; |
| 3244 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3245 | } |
| 3246 | |
| 3247 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3248 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3249 | * @sta_ctx: pointer to hdd station context |
| 3250 | * @sta_id: station ID |
| 3251 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3252 | * |
| 3253 | * This information is passed to iwconfig later. The peer that joined |
| 3254 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3255 | |
| 3256 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3257 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3258 | bool hdd_save_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id, |
| 3259 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3260 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3261 | int idx; |
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 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
| 3264 | if (0 == sta_ctx->conn_info.staId[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3265 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3266 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3267 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3268 | qdf_copy_macaddr( |
| 3269 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3270 | peer_mac_addr); |
| 3271 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3272 | } |
| 3273 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3274 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3275 | } |
| 3276 | |
| 3277 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3278 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3279 | * @sta_ctx: pointer to hdd station context |
| 3280 | * @sta_id: station ID |
| 3281 | * |
| 3282 | * Return: None |
| 3283 | */ |
| 3284 | void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id) |
| 3285 | { |
| 3286 | int i; |
| 3287 | |
| 3288 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3289 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
| 3290 | sta_ctx->conn_info.staId[i] = 0; |
| 3291 | return; |
| 3292 | } |
| 3293 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3294 | } |
| 3295 | |
| 3296 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3297 | * roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter |
| 3298 | * @pAdapter: pointer to adapter |
| 3299 | * @staId: station id |
| 3300 | * |
| 3301 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3302 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3303 | * false otherwise. |
| 3304 | */ |
| 3305 | static bool roam_remove_ibss_station(hdd_adapter_t *pAdapter, uint8_t staId) |
| 3306 | { |
| 3307 | bool fSuccess = false; |
| 3308 | int idx = 0; |
| 3309 | uint8_t valid_idx = 0; |
| 3310 | uint8_t del_idx = 0; |
| 3311 | uint8_t empty_slots = 0; |
| 3312 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3313 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3314 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3315 | if (staId == pHddStaCtx->conn_info.staId[idx]) { |
| 3316 | pHddStaCtx->conn_info.staId[idx] = 0; |
| 3317 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3318 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3319 | peerMacAddress[idx]); |
| 3320 | |
| 3321 | fSuccess = true; |
| 3322 | |
| 3323 | /* |
| 3324 | * Note the deleted Index, if its 0 we need special |
| 3325 | * handling. |
| 3326 | */ |
| 3327 | del_idx = idx; |
| 3328 | |
| 3329 | empty_slots++; |
| 3330 | } else { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3331 | if (pHddStaCtx->conn_info.staId[idx] != |
| 3332 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3333 | valid_idx = idx; |
| 3334 | } else { |
| 3335 | /* Found an empty slot */ |
| 3336 | empty_slots++; |
| 3337 | } |
| 3338 | } |
| 3339 | } |
| 3340 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3341 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3342 | /* Last peer departed, set the IBSS state appropriately */ |
| 3343 | pHddStaCtx->conn_info.connState = |
| 3344 | eConnectionState_IbssDisconnected; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3345 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3346 | } |
| 3347 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3348 | if (fSuccess == true) { |
| 3349 | if (del_idx == 0) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3350 | if (pHddStaCtx->conn_info.staId[valid_idx] != |
| 3351 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3352 | pHddStaCtx->conn_info.staId[0] = |
| 3353 | pHddStaCtx->conn_info.staId[valid_idx]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3354 | qdf_copy_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3355 | peerMacAddress[0], |
| 3356 | &pHddStaCtx->conn_info. |
| 3357 | peerMacAddress[valid_idx]); |
| 3358 | |
| 3359 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3360 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3361 | peerMacAddress[valid_idx]); |
| 3362 | } |
| 3363 | } |
| 3364 | } |
| 3365 | return fSuccess; |
| 3366 | } |
| 3367 | |
| 3368 | /** |
| 3369 | * roam_ibss_connect_handler() - IBSS connection handler |
| 3370 | * @pAdapter: pointer to adapter |
| 3371 | * @pRoamInfo: pointer to roam info |
| 3372 | * |
| 3373 | * We update the status of the IBSS to connected in this function. |
| 3374 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3375 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3376 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3377 | static QDF_STATUS roam_ibss_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3378 | tCsrRoamInfo *pRoamInfo) |
| 3379 | { |
| 3380 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3381 | /* |
| 3382 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3383 | * a partner stations). |
| 3384 | */ |
| 3385 | hdd_conn_set_connection_state(pAdapter, eConnectionState_IbssConnected); |
| 3386 | |
| 3387 | /* Save the connection info from CSR... */ |
| 3388 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
| 3389 | |
| 3390 | /* Send the bssid address to the wext. */ |
| 3391 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3392 | /* add bss_id to cfg80211 data base */ |
| 3393 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3394 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3395 | hdd_err("%s: unable to create IBSS entry", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3396 | pAdapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3397 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3398 | } |
| 3399 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3400 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3401 | bss); |
| 3402 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3403 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3404 | } |
| 3405 | |
| 3406 | /** |
| 3407 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
| 3408 | * @pAdapter: pointer to adapter |
| 3409 | * @pRoamInfo: pointer to roam info |
| 3410 | * @roamId: roam id |
| 3411 | * @roamStatus: roam status |
| 3412 | * @roamResult: roam result |
| 3413 | * |
| 3414 | * This function indicates the Mic failure to the supplicant |
| 3415 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3416 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3417 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3418 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3419 | hdd_roam_mic_error_indication_handler(hdd_adapter_t *pAdapter, |
| 3420 | tCsrRoamInfo *pRoamInfo, |
| 3421 | uint32_t roamId, |
| 3422 | eRoamCmdStatus roamStatus, |
| 3423 | eCsrRoamResult roamResult) |
| 3424 | { |
| 3425 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3426 | |
| 3427 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3428 | TKIP_COUNTER_MEASURE_STOPED == |
| 3429 | pHddStaCtx->WextState.mTKIPCounterMeasures) { |
| 3430 | struct iw_michaelmicfailure msg; |
| 3431 | union iwreq_data wreq; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3432 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3433 | memset(&msg, '\0', sizeof(msg)); |
| 3434 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3435 | memcpy(msg.src_addr.sa_data, |
| 3436 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3437 | sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3438 | hdd_debug("MIC MAC " MAC_ADDRESS_STR, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3439 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3440 | |
| 3441 | if (pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 3442 | msg.flags = IW_MICFAILURE_GROUP; |
| 3443 | else |
| 3444 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3445 | memset(&wreq, 0, sizeof(wreq)); |
| 3446 | wreq.data.length = sizeof(msg); |
| 3447 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, |
| 3448 | (char *)&msg); |
| 3449 | /* inform mic failure to nl80211 */ |
| 3450 | cfg80211_michael_mic_failure(pAdapter->dev, |
| 3451 | pRoamInfo->u.pMICFailureInfo-> |
| 3452 | taMacAddr, |
| 3453 | ((pRoamInfo->u.pMICFailureInfo-> |
| 3454 | multicast == |
| 3455 | eSIR_TRUE) ? |
| 3456 | NL80211_KEYTYPE_GROUP : |
| 3457 | NL80211_KEYTYPE_PAIRWISE), |
| 3458 | pRoamInfo->u.pMICFailureInfo-> |
| 3459 | keyId, |
| 3460 | pRoamInfo->u.pMICFailureInfo->TSC, |
| 3461 | GFP_KERNEL); |
| 3462 | |
| 3463 | } |
| 3464 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3465 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3466 | } |
| 3467 | |
| 3468 | /** |
| 3469 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
| 3470 | * @pAdapter: pointer to adapter |
| 3471 | * @pRoamInfo: pointer to roam info |
| 3472 | * @roamId: roam id |
| 3473 | * @roamStatus: roam status |
| 3474 | * @roamResult: roam result |
| 3475 | * |
| 3476 | * The Ibss connection status is updated regularly here in this function. |
| 3477 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3478 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3479 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3480 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3481 | roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter, |
| 3482 | tCsrRoamInfo *pRoamInfo, |
| 3483 | uint32_t roamId, |
| 3484 | eRoamCmdStatus roamStatus, |
| 3485 | eCsrRoamResult roamResult) |
| 3486 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3487 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3488 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3489 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3490 | switch (roamResult) { |
| 3491 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3492 | { |
| 3493 | hdd_station_ctx_t *pHddStaCtx = |
| 3494 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3495 | struct station_info *stainfo; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3496 | eCsrEncryptionType encr_type = pHddStaCtx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3497 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3498 | hdd_info("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3499 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3500 | MAC_ADDRESS_STR " and stationID= %d", |
| 3501 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3502 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3503 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3504 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3505 | if (!hdd_save_peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3506 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 3507 | pRoamInfo->staId, |
| 3508 | &pRoamInfo->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3509 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3510 | break; |
| 3511 | } |
| 3512 | |
| 3513 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3514 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3515 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 3516 | pRoamInfo->fAuthRequired = true; |
| 3517 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3518 | /* Register the Station with TL for the new peer. */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3519 | qdf_status = hdd_roam_register_sta(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3520 | pRoamInfo, |
| 3521 | pRoamInfo->staId, |
| 3522 | &pRoamInfo->peerMac, |
| 3523 | pRoamInfo->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3524 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3525 | 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] | 3526 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3527 | } |
| 3528 | pHddStaCtx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3529 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3530 | if (stainfo == NULL) { |
| 3531 | hdd_err("memory allocation for station_info failed"); |
| 3532 | return QDF_STATUS_E_NOMEM; |
| 3533 | } |
| 3534 | stainfo->filled = 0; |
| 3535 | stainfo->generation = pHddStaCtx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3536 | |
| 3537 | cfg80211_new_sta(pAdapter->dev, |
| 3538 | (const u8 *)pRoamInfo->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3539 | stainfo, GFP_KERNEL); |
| 3540 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3542 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3543 | pHddStaCtx->ibss_enc_key.keyDirection = |
| 3544 | eSIR_TX_RX; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3545 | qdf_copy_macaddr(&pHddStaCtx->ibss_enc_key.peerMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3546 | &pRoamInfo->peerMac); |
| 3547 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3548 | hdd_info("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3549 | encr_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3550 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3551 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3552 | sme_roam_set_key(WLAN_HDD_GET_HAL_CTX |
| 3553 | (pAdapter), |
| 3554 | pAdapter->sessionId, |
| 3555 | &pHddStaCtx->ibss_enc_key, |
| 3556 | &roamId); |
| 3557 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3558 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3559 | hdd_err("sme_roam_set_key failed, status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3560 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3561 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3562 | } |
| 3563 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3564 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3565 | wlan_hdd_netif_queue_control(pAdapter, |
| 3566 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3567 | WLAN_CONTROL_PATH); |
| 3568 | break; |
| 3569 | } |
| 3570 | |
| 3571 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3572 | { |
| 3573 | |
| 3574 | roam_ibss_connect_handler(pAdapter, pRoamInfo); |
| 3575 | |
| 3576 | break; |
| 3577 | } |
| 3578 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3579 | { |
| 3580 | hdd_station_ctx_t *pHddStaCtx = |
| 3581 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3582 | |
| 3583 | if (!roam_remove_ibss_station(pAdapter, pRoamInfo->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3584 | 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] | 3585 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3586 | hdd_info("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3587 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3588 | MAC_ADDRESS_STR " and stationID= %d", |
| 3589 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3590 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3591 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3592 | |
| 3593 | hdd_roam_deregister_sta(pAdapter, pRoamInfo->staId); |
| 3594 | |
| 3595 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 3596 | pHddStaCtx->ibss_sta_generation++; |
| 3597 | |
| 3598 | cfg80211_del_sta(pAdapter->dev, |
| 3599 | (const u8 *)&pRoamInfo->peerMac.bytes, |
| 3600 | GFP_KERNEL); |
| 3601 | break; |
| 3602 | } |
| 3603 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3604 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3605 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3606 | /* Stop only when we are inactive */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3607 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3608 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3609 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3610 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3611 | hdd_conn_set_connection_state(pAdapter, |
| 3612 | eConnectionState_NotConnected); |
| 3613 | |
| 3614 | /* Send the bssid address to the wext. */ |
| 3615 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3616 | break; |
| 3617 | } |
| 3618 | default: |
| 3619 | break; |
| 3620 | |
| 3621 | } |
| 3622 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3623 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3624 | } |
| 3625 | |
| 3626 | #ifdef FEATURE_WLAN_TDLS |
| 3627 | /** |
| 3628 | * hdd_roam_register_tdlssta() - register new TDLS station |
| 3629 | * @pAdapter: pointer to adapter |
| 3630 | * @peerMac: pointer to peer MAC address |
| 3631 | * @staId: station identifier |
| 3632 | * @ucastSig: unicast signature |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3633 | * @qos: QOS capability of TDLS station/link |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3634 | * |
| 3635 | * Construct the staDesc and register with TL the new STA. |
| 3636 | * This is called as part of ADD_STA in the TDLS setup. |
| 3637 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3638 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3639 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3640 | QDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3641 | const uint8_t *peerMac, uint16_t staId, |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3642 | uint8_t ucastSig, uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3643 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3644 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3645 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3646 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3647 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3648 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3649 | |
| 3650 | /* |
| 3651 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3652 | * be peer MAC, here we are working on direct Link |
| 3653 | */ |
| 3654 | staDesc.sta_id = staId; |
| 3655 | |
| 3656 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3657 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3658 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3659 | /* Register the vdev transmit and receive functions */ |
| 3660 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3661 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3662 | cdp_vdev_register(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3663 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
| 3664 | (struct cdp_pdev *)pdev, pAdapter->sessionId), |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3665 | pAdapter, &txrx_ops); |
| 3666 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3667 | |
| 3668 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3669 | qdf_status = cdp_peer_register(soc, |
| 3670 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3671 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3672 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3673 | qdf_status, qdf_status); |
| 3674 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3675 | } |
| 3676 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3677 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3678 | } |
| 3679 | |
| 3680 | /** |
| 3681 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
| 3682 | * @pAdapter: pointer to adapter |
| 3683 | * @staId: station identifier |
| 3684 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3685 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3686 | */ |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3687 | 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] | 3688 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3689 | QDF_STATUS qdf_status; |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 3690 | 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] | 3691 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 3692 | staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3693 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3694 | 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] | 3695 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3696 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3697 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3698 | } |
| 3699 | |
| 3700 | /** |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3701 | * hdd_tdls_connection_tracker_update() - update connection tracker state |
| 3702 | * @adapter: pointer to adapter |
| 3703 | * @roam_info: pointer to roam info |
| 3704 | * @hdd_tdls_ctx: tdls context |
| 3705 | * |
| 3706 | * Return: QDF_STATUS enumeration |
| 3707 | */ |
| 3708 | static QDF_STATUS hdd_tdls_connection_tracker_update(hdd_adapter_t *adapter, |
| 3709 | tCsrRoamInfo *roam_info, |
| 3710 | tdlsCtx_t *hdd_tdls_ctx) |
| 3711 | { |
| 3712 | hddTdlsPeer_t *curr_peer; |
| 3713 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3714 | |
| 3715 | curr_peer = wlan_hdd_tdls_find_peer(adapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3716 | roam_info->peerMac.bytes); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3717 | |
| 3718 | if (!curr_peer) { |
| 3719 | hdd_err("curr_peer is null"); |
| 3720 | return QDF_STATUS_E_FAILURE; |
| 3721 | } |
| 3722 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3723 | if (eTDLS_LINK_CONNECTED == |
| 3724 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3725 | hdd_debug("Received CONNECTION_TRACKER_NOTIFICATION " |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3726 | MAC_ADDRESS_STR |
| 3727 | " staId: %d, reason: %d", |
| 3728 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3729 | roam_info->staId, |
| 3730 | roam_info->reasonCode); |
| 3731 | |
| 3732 | if (roam_info->reasonCode == |
| 3733 | eWNI_TDLS_PEER_ENTER_BUF_STA || |
| 3734 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3735 | eWNI_TDLS_ENTER_BT_BUSY_MODE || |
| 3736 | roam_info->reasonCode == |
| 3737 | eWMI_TDLS_SCAN_STARTED_EVENT) |
| 3738 | hdd_ctx->enable_tdls_connection_tracker = false; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3739 | else if (roam_info->reasonCode == |
| 3740 | eWNI_TDLS_PEER_EXIT_BUF_STA || |
| 3741 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3742 | eWNI_TDLS_EXIT_BT_BUSY_MODE || |
| 3743 | roam_info->reasonCode == |
| 3744 | eWMI_TDLS_SCAN_COMPLETED_EVENT) |
| 3745 | hdd_ctx->enable_tdls_connection_tracker = true; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3746 | hdd_debug("hdd_ctx->enable_tdls_connection_tracker %d", |
Nitesh Shah | c549dd5 | 2017-02-23 16:45:44 +0530 | [diff] [blame] | 3747 | hdd_ctx->enable_tdls_connection_tracker); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3748 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3749 | hdd_debug("TDLS not connected, ignore notification, reason: %d", |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3750 | roam_info->reasonCode); |
| 3751 | } |
| 3752 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3753 | return QDF_STATUS_SUCCESS; |
| 3754 | } |
| 3755 | |
| 3756 | |
| 3757 | |
| 3758 | |
| 3759 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3760 | * hdd_roam_tdls_status_update_handler() - TDLS status update handler |
| 3761 | * @pAdapter: pointer to adapter |
| 3762 | * @pRoamInfo: pointer to roam info |
| 3763 | * @roamId: roam id |
| 3764 | * @roamStatus: roam status |
| 3765 | * @roamResult: roam result |
| 3766 | * |
| 3767 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3768 | * TL in case of new TDLS client is added and deregistration at the time |
| 3769 | * TDLS client is deleted. |
| 3770 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3771 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3772 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3773 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3774 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 3775 | tCsrRoamInfo *pRoamInfo, |
| 3776 | uint32_t roamId, |
| 3777 | eRoamCmdStatus roamStatus, |
| 3778 | eCsrRoamResult roamResult) |
| 3779 | { |
| 3780 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3781 | tdlsCtx_t *pHddTdlsCtx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3782 | tSmeTdlsPeerStateParams smeTdlsPeerStateParams; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3783 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3784 | uint8_t staIdx; |
| 3785 | hddTdlsPeer_t *curr_peer; |
| 3786 | uint32_t reason; |
| 3787 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3788 | hdd_debug("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3789 | roamResult == |
| 3790 | eCSR_ROAM_RESULT_ADD_TDLS_PEER ? "ADD_TDLS_PEER" : roamResult |
| 3791 | == |
| 3792 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? "DEL_TDLS_PEER" : |
| 3793 | roamResult == |
| 3794 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? "DEL_TDLS_PEER_IND" |
| 3795 | : roamResult == |
| 3796 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3797 | "DEL_ALL_TDLS_PEER_IND" : roamResult == |
| 3798 | eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? "UPDATE_TDLS_PEER" : |
| 3799 | roamResult == |
| 3800 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
| 3801 | "LINK_ESTABLISH_REQ_RSP" : roamResult == |
| 3802 | eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER ? "TDLS_SHOULD_DISCOVER" |
| 3803 | : roamResult == |
| 3804 | eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN ? "TDLS_SHOULD_TEARDOWN" |
| 3805 | : roamResult == |
| 3806 | eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED ? |
| 3807 | "TDLS_SHOULD_PEER_DISCONNECTED" : "UNKNOWN", pRoamInfo->staId, |
| 3808 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 3809 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3810 | switch (roamResult) { |
| 3811 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3812 | { |
| 3813 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3814 | hdd_err("Add Sta failed. status code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3815 | pRoamInfo->statusCode); |
Selvaraj, Sridhar | 5d95e63 | 2016-09-14 17:00:38 +0530 | [diff] [blame] | 3816 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3817 | } else { |
| 3818 | /* |
| 3819 | * Check if there is available index for this new TDLS |
| 3820 | * STA. |
| 3821 | */ |
| 3822 | for (staIdx = 0; |
| 3823 | staIdx < pHddCtx->max_num_tdls_sta; |
| 3824 | staIdx++) { |
| 3825 | if (0 == |
| 3826 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3827 | staId) { |
| 3828 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3829 | sessionId = |
| 3830 | pRoamInfo->sessionId; |
| 3831 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3832 | staId = pRoamInfo->staId; |
| 3833 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3834 | hdd_debug("TDLS: STA IDX at %d is %d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3835 | "of mac " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3836 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3837 | staIdx, |
| 3838 | pHddCtx-> |
| 3839 | tdlsConnInfo[staIdx]. |
| 3840 | staId, |
| 3841 | MAC_ADDR_ARRAY |
| 3842 | (pRoamInfo->peerMac.bytes)); |
| 3843 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3844 | qdf_copy_macaddr(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3845 | tdlsConnInfo |
| 3846 | [staIdx]. |
| 3847 | peerMac, |
| 3848 | &pRoamInfo-> |
| 3849 | peerMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3850 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3851 | break; |
| 3852 | } |
| 3853 | } |
| 3854 | if (staIdx < pHddCtx->max_num_tdls_sta) { |
| 3855 | if (-1 == |
| 3856 | wlan_hdd_tdls_set_sta_id(pAdapter, |
| 3857 | pRoamInfo-> |
| 3858 | peerMac.bytes, |
| 3859 | pRoamInfo-> |
| 3860 | staId)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3861 | hdd_err("wlan_hdd_tdls_set_sta_id() failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3862 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3863 | } |
| 3864 | |
| 3865 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 3866 | sta_to_adapter[pRoamInfo->staId] = |
| 3867 | pAdapter; |
| 3868 | /* |
| 3869 | * store the ucast signature, |
| 3870 | * if required for further reference. |
| 3871 | */ |
| 3872 | |
| 3873 | wlan_hdd_tdls_set_signature(pAdapter, |
| 3874 | pRoamInfo-> |
| 3875 | peerMac.bytes, |
| 3876 | pRoamInfo-> |
| 3877 | ucastSig); |
| 3878 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3879 | status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3880 | 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] | 3881 | pRoamInfo->staId); |
| 3882 | } |
| 3883 | pAdapter->tdlsAddStaStatus = status; |
| 3884 | } |
| 3885 | complete(&pAdapter->tdls_add_station_comp); |
| 3886 | break; |
| 3887 | } |
| 3888 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3889 | { |
| 3890 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3891 | hdd_err("Add Sta failed. status code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3892 | pRoamInfo->statusCode); |
| 3893 | } |
| 3894 | /* store the ucast signature which will be used later when |
| 3895 | * registering to TL |
| 3896 | */ |
| 3897 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 3898 | complete(&pAdapter->tdls_add_station_comp); |
| 3899 | break; |
| 3900 | } |
| 3901 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3902 | { |
| 3903 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3904 | hdd_err("Link Establish Request failed. status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3905 | pRoamInfo->statusCode); |
| 3906 | } |
| 3907 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3908 | break; |
| 3909 | } |
| 3910 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
| 3911 | { |
| 3912 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 3913 | staIdx++) { |
| 3914 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 3915 | pRoamInfo->sessionId) |
| 3916 | && pRoamInfo->staId == |
| 3917 | pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3918 | hdd_debug("HDD: del STA IDX = %x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3919 | pRoamInfo->staId); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3920 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3921 | curr_peer = |
| 3922 | wlan_hdd_tdls_find_peer(pAdapter, |
| 3923 | pRoamInfo-> |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3924 | peerMac.bytes); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3925 | if (NULL != curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3926 | hdd_debug("Current status for peer " MAC_ADDRESS_STR " is %d", |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3927 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3928 | curr_peer->link_status); |
| 3929 | if (TDLS_IS_CONNECTED(curr_peer)) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3930 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3931 | hdd_roam_deregister_tdlssta |
| 3932 | (pAdapter, |
| 3933 | pRoamInfo->staId); |
| 3934 | wlan_hdd_tdls_decrement_peer_count |
| 3935 | (pAdapter); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3936 | } else if (eTDLS_LINK_CONNECTING == |
| 3937 | curr_peer->link_status) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3938 | mutex_unlock(&pHddCtx->tdls_lock); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3939 | hdd_roam_deregister_tdlssta |
| 3940 | (pAdapter, |
| 3941 | pRoamInfo->staId); |
Nitesh Shah | 0bf768f | 2017-03-31 15:01:37 +0530 | [diff] [blame] | 3942 | } else |
| 3943 | mutex_unlock(&pHddCtx->tdls_lock); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3944 | } else |
| 3945 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3946 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3947 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3948 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 3949 | pRoamInfo-> |
| 3950 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3951 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3952 | |
| 3953 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 3954 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3955 | sessionId = 255; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3956 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3957 | tdlsConnInfo[staIdx]. |
| 3958 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3959 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3960 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3961 | break; |
| 3962 | } |
| 3963 | } |
| 3964 | complete(&pAdapter->tdls_del_station_comp); |
| 3965 | } |
| 3966 | break; |
| 3967 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 3968 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3969 | hdd_debug("Sending teardown to supplicant with reason code %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3970 | pRoamInfo->reasonCode); |
| 3971 | |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3972 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3973 | curr_peer = |
| 3974 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3975 | pRoamInfo->peerMac.bytes); |
Ganesh Kondabattini | 9c8dc46 | 2017-04-19 10:52:54 +0530 | [diff] [blame] | 3976 | |
| 3977 | if (!curr_peer) { |
| 3978 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3979 | hdd_debug("peer doesn't exists"); |
| 3980 | status = QDF_STATUS_SUCCESS; |
| 3981 | break; |
| 3982 | } |
| 3983 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3984 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 3985 | pRoamInfo->reasonCode); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 3986 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3987 | curr_peer->peerMac); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3988 | mutex_unlock(&pHddCtx->tdls_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3989 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3990 | break; |
| 3991 | } |
| 3992 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 3993 | { |
| 3994 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
| 3995 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 3996 | staIdx++) { |
| 3997 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 3998 | pRoamInfo->sessionId) |
| 3999 | && pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4000 | hdd_debug("hdd_tdlsStatusUpdate: staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4001 | MAC_ADDRESS_STR, |
| 4002 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4003 | staId, |
| 4004 | MAC_ADDR_ARRAY(pHddCtx-> |
| 4005 | tdlsConnInfo |
| 4006 | [staIdx]. |
| 4007 | peerMac. |
| 4008 | bytes)); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4009 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4010 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4011 | pHddCtx-> |
| 4012 | tdlsConnInfo |
| 4013 | [staIdx]. |
| 4014 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4015 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4016 | hdd_roam_deregister_tdlssta(pAdapter, |
| 4017 | pHddCtx-> |
| 4018 | tdlsConnInfo |
| 4019 | [staIdx]. |
| 4020 | staId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4021 | qdf_mem_zero(&smeTdlsPeerStateParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4022 | sizeof |
| 4023 | (smeTdlsPeerStateParams)); |
| 4024 | smeTdlsPeerStateParams.vdevId = |
| 4025 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4026 | sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4027 | qdf_mem_copy(&smeTdlsPeerStateParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4028 | peerMacAddr, |
| 4029 | &pHddCtx-> |
| 4030 | tdlsConnInfo[staIdx]. |
| 4031 | peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4032 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4033 | smeTdlsPeerStateParams.peerState = |
| 4034 | eSME_TDLS_PEER_STATE_TEARDOWN; |
| 4035 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4036 | hdd_debug("calling sme_update_tdls_peer_state for staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4037 | MAC_ADDRESS_STR, |
| 4038 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4039 | staId, |
| 4040 | MAC_ADDR_ARRAY(pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4041 | tdlsConnInfo |
| 4042 | [staIdx]. |
| 4043 | peerMac. |
| 4044 | bytes)); |
| 4045 | status = |
| 4046 | sme_update_tdls_peer_state( |
| 4047 | pHddCtx->hHal, |
| 4048 | &smeTdlsPeerStateParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4049 | if (QDF_STATUS_SUCCESS != status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4050 | hdd_err("sme_update_tdls_peer_state failed for " |
| 4051 | MAC_ADDRESS_STR, |
| 4052 | MAC_ADDR_ARRAY |
| 4053 | (pHddCtx-> |
| 4054 | tdlsConnInfo[staIdx]. |
| 4055 | peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4056 | } |
| 4057 | wlan_hdd_tdls_decrement_peer_count |
| 4058 | (pAdapter); |
| 4059 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4060 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4061 | tdlsConnInfo[staIdx]. |
| 4062 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4063 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4064 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4065 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4066 | sessionId = 255; |
| 4067 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4068 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4069 | } |
| 4070 | } |
| 4071 | break; |
| 4072 | } |
| 4073 | case eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER: |
| 4074 | { |
| 4075 | /* ignore TDLS_SHOULD_DISCOVER if any concurrency detected */ |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 4076 | if (!cds_check_is_tdls_allowed(pAdapter->device_mode)) { |
| 4077 | hdd_err("TDLS not allowed, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4078 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4079 | break; |
| 4080 | } |
| 4081 | |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4082 | if (pHddCtx->tdls_nss_switch_in_progress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4083 | hdd_debug("TDLS antenna switch is in progress, ignore SHOULD_DISCOVER"); |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4084 | status = QDF_STATUS_SUCCESS; |
| 4085 | break; |
| 4086 | } |
| 4087 | |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4088 | mutex_lock(&pHddCtx->tdls_lock); |
| 4089 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4090 | if (!pHddTdlsCtx) { |
| 4091 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4092 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4093 | roamResult); |
| 4094 | status = QDF_STATUS_E_FAILURE; |
| 4095 | break; |
| 4096 | } |
| 4097 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4098 | curr_peer = |
| 4099 | wlan_hdd_tdls_get_peer(pAdapter, |
Nitesh Shah | 379449e | 2017-01-31 19:11:29 +0530 | [diff] [blame] | 4100 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4101 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4102 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4103 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4104 | } else { |
| 4105 | if (eTDLS_LINK_CONNECTED == |
| 4106 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4107 | hdd_debug("TDLS link status is connected, ignore SHOULD_DISCOVER"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4108 | } else { |
| 4109 | /* |
| 4110 | * If external control is enabled then initiate |
| 4111 | * TDLS only if forced peer is set otherwise |
| 4112 | * ignore should Discover trigger from fw. |
| 4113 | */ |
| 4114 | if (pHddCtx->config-> |
| 4115 | fTDLSExternalControl |
| 4116 | && (false == |
| 4117 | curr_peer->isForcedPeer)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4118 | 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] | 4119 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4120 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4121 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4122 | 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] | 4123 | pHddCtx->config-> |
| 4124 | fTDLSExternalControl, |
| 4125 | curr_peer->isForcedPeer, |
| 4126 | pRoamInfo->reasonCode); |
Nitesh Shah | 983e8f5 | 2016-11-25 12:36:29 +0530 | [diff] [blame] | 4127 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 4128 | wlan_hdd_tdls_implicit_send_discovery_request( |
| 4129 | pHddTdlsCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4130 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4131 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4132 | } |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4133 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4134 | break; |
| 4135 | } |
| 4136 | |
| 4137 | case eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN: |
| 4138 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4139 | mutex_lock(&pHddCtx->tdls_lock); |
| 4140 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4141 | if (!pHddTdlsCtx) { |
| 4142 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4143 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4144 | roamResult); |
| 4145 | status = QDF_STATUS_E_FAILURE; |
| 4146 | break; |
| 4147 | } |
| 4148 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4149 | curr_peer = |
| 4150 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4151 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4152 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4153 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4154 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4155 | } else { |
| 4156 | if (eTDLS_LINK_CONNECTED == |
| 4157 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4158 | hdd_debug("Received SHOULD_TEARDOWN for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4159 | MAC_ADDRESS_STR |
| 4160 | " staId: %d, reason: %d", |
| 4161 | MAC_ADDR_ARRAY(pRoamInfo-> |
| 4162 | peerMac.bytes), |
| 4163 | pRoamInfo->staId, |
| 4164 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4165 | |
| 4166 | if (pRoamInfo->reasonCode == |
| 4167 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4168 | pRoamInfo->reasonCode == |
| 4169 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4170 | pRoamInfo->reasonCode == |
| 4171 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4172 | pRoamInfo->reasonCode == |
| 4173 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4174 | reason = |
| 4175 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4176 | } else |
| 4177 | reason = |
| 4178 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4179 | |
| 4180 | wlan_hdd_tdls_indicate_teardown |
| 4181 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4182 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4183 | hdd_send_wlan_tdls_teardown_event( |
| 4184 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4185 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4186 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4187 | hdd_debug("TDLS link is not connected, ignore SHOULD_TEARDOWN, reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4188 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4189 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4190 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4191 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4192 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4193 | break; |
| 4194 | } |
| 4195 | |
| 4196 | case eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED: |
| 4197 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4198 | mutex_lock(&pHddCtx->tdls_lock); |
| 4199 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4200 | if (!pHddTdlsCtx) { |
| 4201 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4202 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4203 | roamResult); |
| 4204 | status = QDF_STATUS_E_FAILURE; |
| 4205 | break; |
| 4206 | } |
| 4207 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4208 | curr_peer = |
| 4209 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4210 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4211 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4212 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4213 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4214 | } else { |
| 4215 | if (eTDLS_LINK_CONNECTED == |
| 4216 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4217 | hdd_debug("Received SHOULD_PEER_DISCONNECTED for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4218 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4219 | " staId: %d reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4220 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4221 | pRoamInfo->staId, |
| 4222 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4223 | |
| 4224 | if (pRoamInfo->reasonCode == |
| 4225 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4226 | pRoamInfo->reasonCode == |
| 4227 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4228 | pRoamInfo->reasonCode == |
| 4229 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4230 | pRoamInfo->reasonCode == |
| 4231 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4232 | reason = |
| 4233 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4234 | } else |
| 4235 | reason = |
| 4236 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4237 | |
| 4238 | wlan_hdd_tdls_indicate_teardown |
| 4239 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4240 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4241 | hdd_send_wlan_tdls_teardown_event( |
| 4242 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4243 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4244 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4245 | 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] | 4246 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4247 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4248 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4249 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4250 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4251 | break; |
| 4252 | } |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4253 | |
| 4254 | case eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4255 | mutex_lock(&pHddCtx->tdls_lock); |
| 4256 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4257 | if (!pHddTdlsCtx) { |
| 4258 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4259 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4260 | roamResult); |
| 4261 | status = QDF_STATUS_E_FAILURE; |
| 4262 | break; |
| 4263 | } |
| 4264 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4265 | status = hdd_tdls_connection_tracker_update(pAdapter, |
| 4266 | pRoamInfo, |
| 4267 | pHddTdlsCtx); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4268 | mutex_unlock(&pHddCtx->tdls_lock); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4269 | break; |
| 4270 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4271 | default: |
| 4272 | { |
| 4273 | break; |
| 4274 | } |
| 4275 | } |
| 4276 | |
| 4277 | return status; |
| 4278 | } |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4279 | #else |
| 4280 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4281 | inline QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4282 | uint8_t staId) |
| 4283 | { |
| 4284 | return QDF_STATUS_SUCCESS; |
| 4285 | } |
| 4286 | |
| 4287 | static inline QDF_STATUS |
| 4288 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 4289 | tCsrRoamInfo *pRoamInfo, |
| 4290 | uint32_t roamId, |
| 4291 | eRoamCmdStatus roamStatus, |
| 4292 | eCsrRoamResult roamResult) |
| 4293 | { |
| 4294 | return QDF_STATUS_SUCCESS; |
| 4295 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4296 | #endif |
| 4297 | |
| 4298 | #ifdef WLAN_FEATURE_11W |
| 4299 | /** |
| 4300 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
| 4301 | * @pAdapter: pointer to the adapter |
| 4302 | * @nFrameLength: Length of the unprotected frame being passed |
| 4303 | * @pbFrames: Pointer to the frame buffer |
| 4304 | * @frameType: 802.11 frame type |
| 4305 | * |
| 4306 | * This function forwards the unprotected management frame to the supplicant. |
| 4307 | * |
| 4308 | * Return: nothing |
| 4309 | */ |
| 4310 | static void |
| 4311 | hdd_indicate_unprot_mgmt_frame(hdd_adapter_t *pAdapter, uint32_t nFrameLength, |
| 4312 | uint8_t *pbFrames, uint8_t frameType) |
| 4313 | { |
| 4314 | uint8_t type = 0; |
| 4315 | uint8_t subType = 0; |
| 4316 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4317 | hdd_debug("Frame Type = %d Frame Length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4318 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4319 | |
| 4320 | /* Sanity Checks */ |
| 4321 | if (NULL == pAdapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4322 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4323 | return; |
| 4324 | } |
| 4325 | |
| 4326 | if (NULL == pAdapter->dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4327 | hdd_err("pAdapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4328 | return; |
| 4329 | } |
| 4330 | |
| 4331 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4332 | hdd_err("pAdapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4333 | return; |
| 4334 | } |
| 4335 | |
| 4336 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4337 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4338 | return; |
| 4339 | } |
| 4340 | |
| 4341 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4342 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4343 | return; |
| 4344 | } |
| 4345 | |
| 4346 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4347 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4348 | |
| 4349 | /* Get pAdapter from Destination mac address of the frame */ |
| 4350 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 4351 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4352 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4353 | nFrameLength); |
| 4354 | #else |
| 4355 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, |
| 4356 | nFrameLength); |
| 4357 | #endif |
| 4358 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 4359 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 4360 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 4361 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4362 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4363 | nFrameLength); |
| 4364 | #else |
| 4365 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, |
| 4366 | nFrameLength); |
| 4367 | #endif |
| 4368 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 4369 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4370 | hdd_warn("Frame type %d and subtype %d are not valid", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4371 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4372 | return; |
| 4373 | } |
| 4374 | } |
| 4375 | #endif |
| 4376 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4377 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4378 | /** |
| 4379 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
| 4380 | * @pAdapter: pointer to adapter |
| 4381 | * @tid: traffic identifier |
| 4382 | * @state: state |
| 4383 | * @measInterval: measurement interval |
| 4384 | * |
| 4385 | * This function sends traffic stream metrics IE information to |
| 4386 | * the supplicant via wireless event. |
| 4387 | * |
| 4388 | * Return: none |
| 4389 | */ |
| 4390 | static void |
| 4391 | hdd_indicate_tsm_ie(hdd_adapter_t *pAdapter, uint8_t tid, |
| 4392 | uint8_t state, uint16_t measInterval) |
| 4393 | { |
| 4394 | union iwreq_data wrqu; |
| 4395 | char buf[IW_CUSTOM_MAX + 1]; |
| 4396 | int nBytes = 0; |
| 4397 | |
| 4398 | if (NULL == pAdapter) |
| 4399 | return; |
| 4400 | |
| 4401 | /* create the event */ |
| 4402 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4403 | memset(buf, '\0', sizeof(buf)); |
| 4404 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4405 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4406 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4407 | |
| 4408 | nBytes = |
| 4409 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4410 | measInterval); |
| 4411 | |
| 4412 | wrqu.data.pointer = buf; |
| 4413 | wrqu.data.length = nBytes; |
| 4414 | /* send the event */ |
| 4415 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4416 | } |
| 4417 | |
| 4418 | /** |
| 4419 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
| 4420 | * @pAdapter: pointer to adapter |
| 4421 | * @pRoamInfo: pointer to roam info |
| 4422 | * |
| 4423 | * This function sends cckm preauth indication to the supplicant |
| 4424 | * via wireless custom event. |
| 4425 | * |
| 4426 | * Return: none |
| 4427 | */ |
| 4428 | static void |
| 4429 | hdd_indicate_cckm_pre_auth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 4430 | { |
| 4431 | union iwreq_data wrqu; |
| 4432 | char buf[IW_CUSTOM_MAX + 1]; |
| 4433 | char *pos = buf; |
| 4434 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4435 | |
| 4436 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4437 | return; |
| 4438 | |
| 4439 | /* create the event */ |
| 4440 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4441 | memset(buf, '\0', sizeof(buf)); |
| 4442 | |
| 4443 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4444 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4445 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 4446 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4447 | |
| 4448 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4449 | pos += nBytes; |
| 4450 | freeBytes -= nBytes; |
| 4451 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4452 | qdf_mem_copy(pos, pRoamInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4453 | pos += QDF_MAC_ADDR_SIZE; |
| 4454 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4455 | |
| 4456 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
| 4457 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 4458 | freeBytes -= nBytes; |
| 4459 | |
| 4460 | wrqu.data.pointer = buf; |
| 4461 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4462 | |
| 4463 | /* send the event */ |
| 4464 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4465 | } |
| 4466 | |
| 4467 | /** |
| 4468 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
| 4469 | * @pAdapter: pointer to adapter |
| 4470 | * @pRoamInfo: pointer to roam info |
| 4471 | * |
| 4472 | * Return: none |
| 4473 | */ |
| 4474 | static void |
| 4475 | hdd_indicate_ese_adj_ap_rep_ind(hdd_adapter_t *pAdapter, |
| 4476 | tCsrRoamInfo *pRoamInfo) |
| 4477 | { |
| 4478 | union iwreq_data wrqu; |
| 4479 | char buf[IW_CUSTOM_MAX + 1]; |
| 4480 | int nBytes = 0; |
| 4481 | |
| 4482 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4483 | return; |
| 4484 | |
| 4485 | /* create the event */ |
| 4486 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4487 | memset(buf, '\0', sizeof(buf)); |
| 4488 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4489 | hdd_debug("CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4490 | |
| 4491 | nBytes = |
| 4492 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
| 4493 | pRoamInfo->tsmRoamDelay); |
| 4494 | |
| 4495 | wrqu.data.pointer = buf; |
| 4496 | wrqu.data.length = nBytes; |
| 4497 | |
| 4498 | /* send the event */ |
| 4499 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4500 | } |
| 4501 | |
| 4502 | /** |
| 4503 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
| 4504 | * @pAdapter: pointer to adapter |
| 4505 | * @measurementToken: measurement token |
| 4506 | * @flag: flag |
| 4507 | * @numBss: number of bss |
| 4508 | * |
| 4509 | * If the measurement is none and no scan results found, |
| 4510 | * indicate the supplicant about measurement done. |
| 4511 | * |
| 4512 | * Return: none |
| 4513 | */ |
| 4514 | void |
| 4515 | hdd_indicate_ese_bcn_report_no_results(const hdd_adapter_t *pAdapter, |
| 4516 | const uint16_t measurementToken, |
| 4517 | const bool flag, const uint8_t numBss) |
| 4518 | { |
| 4519 | union iwreq_data wrqu; |
| 4520 | char buf[IW_CUSTOM_MAX]; |
| 4521 | char *pos = buf; |
| 4522 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4523 | |
| 4524 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4525 | memset(buf, '\0', sizeof(buf)); |
| 4526 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4527 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4528 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4529 | |
| 4530 | nBytes = |
| 4531 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4532 | flag, numBss); |
| 4533 | |
| 4534 | wrqu.data.pointer = buf; |
| 4535 | wrqu.data.length = nBytes; |
| 4536 | /* send the event */ |
| 4537 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4538 | } |
| 4539 | |
| 4540 | /** |
| 4541 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
| 4542 | * @pAdapter: pointer to adapter |
| 4543 | * @pRoamInfo: pointer to roam info |
| 4544 | * |
| 4545 | * If the measurement is none and no scan results found, |
| 4546 | * indicate the supplicant about measurement done. |
| 4547 | * |
| 4548 | * Return: none |
| 4549 | */ |
| 4550 | static void |
| 4551 | hdd_indicate_ese_bcn_report_ind(const hdd_adapter_t *pAdapter, |
| 4552 | const tCsrRoamInfo *pRoamInfo) |
| 4553 | { |
| 4554 | union iwreq_data wrqu; |
| 4555 | char buf[IW_CUSTOM_MAX]; |
| 4556 | char *pos = buf; |
| 4557 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4558 | uint8_t i = 0, len = 0; |
| 4559 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4560 | uint8_t lastSent = 0, sendBss = 0; |
| 4561 | int bcnRepFieldSize = |
| 4562 | sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0]. |
| 4563 | bcnReportFields); |
| 4564 | uint8_t ieLenByte = 1; |
| 4565 | /* |
| 4566 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4567 | */ |
| 4568 | #define ESEBCNREPHEADER_LEN (18) |
| 4569 | |
| 4570 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4571 | return; |
| 4572 | |
| 4573 | /* |
| 4574 | * Custom event can pass maximum of 256 bytes of data, |
| 4575 | * based on the IE len we need to identify how many BSS info can |
| 4576 | * be filled in to custom event data. |
| 4577 | */ |
| 4578 | /* |
| 4579 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4580 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4581 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4582 | */ |
| 4583 | |
| 4584 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) |
| 4585 | && (!pRoamInfo->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4586 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4587 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4588 | * indicate the supplicant about measurement done |
| 4589 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4590 | hdd_indicate_ese_bcn_report_no_results( |
| 4591 | pAdapter, |
| 4592 | pRoamInfo->pEseBcnReportRsp-> |
| 4593 | measurementToken, |
| 4594 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4595 | pRoamInfo->pEseBcnReportRsp->numBss); |
| 4596 | } else { |
| 4597 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) { |
| 4598 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4599 | memset(buf, '\0', sizeof(buf)); |
| 4600 | tot_bcn_ieLen = 0; |
| 4601 | sendBss = 0; |
| 4602 | pos = buf; |
| 4603 | freeBytes = IW_CUSTOM_MAX; |
| 4604 | |
| 4605 | for (i = lastSent; |
| 4606 | i < pRoamInfo->pEseBcnReportRsp->numBss; i++) { |
| 4607 | len = |
| 4608 | bcnRepFieldSize + ieLenByte + |
| 4609 | pRoamInfo->pEseBcnReportRsp-> |
| 4610 | bcnRepBssInfo[i].ieLen; |
| 4611 | if ((len + tot_bcn_ieLen) > |
| 4612 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4613 | break; |
| 4614 | } |
| 4615 | tot_bcn_ieLen += len; |
| 4616 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4617 | 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] | 4618 | i, bcnRepFieldSize, 1, |
| 4619 | pRoamInfo->pEseBcnReportRsp-> |
| 4620 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4621 | } |
| 4622 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4623 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4624 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4625 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 4626 | pRoamInfo->pEseBcnReportRsp->flag, sendBss, |
| 4627 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4628 | |
| 4629 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
| 4630 | pRoamInfo->pEseBcnReportRsp-> |
| 4631 | measurementToken, |
| 4632 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4633 | sendBss); |
| 4634 | pos += nBytes; |
| 4635 | freeBytes -= nBytes; |
| 4636 | |
| 4637 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4638 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4639 | sizeof(tot_bcn_ieLen)); |
| 4640 | pos += sizeof(tot_bcn_ieLen); |
| 4641 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4642 | |
| 4643 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4644 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4645 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4646 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4647 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
| 4648 | pRoamInfo->pEseBcnReportRsp-> |
| 4649 | bcnRepBssInfo[i + |
| 4650 | lastSent].bcnReportFields. |
| 4651 | ChanNum, |
| 4652 | pRoamInfo->pEseBcnReportRsp-> |
| 4653 | bcnRepBssInfo[i + |
| 4654 | lastSent].bcnReportFields. |
| 4655 | Spare, |
| 4656 | pRoamInfo->pEseBcnReportRsp-> |
| 4657 | bcnRepBssInfo[i + |
| 4658 | lastSent].bcnReportFields. |
| 4659 | MeasDuration, |
| 4660 | pRoamInfo->pEseBcnReportRsp-> |
| 4661 | bcnRepBssInfo[i + |
| 4662 | lastSent].bcnReportFields. |
| 4663 | PhyType, |
| 4664 | pRoamInfo->pEseBcnReportRsp-> |
| 4665 | bcnRepBssInfo[i + |
| 4666 | lastSent].bcnReportFields. |
| 4667 | RecvSigPower, |
| 4668 | pRoamInfo->pEseBcnReportRsp-> |
| 4669 | bcnRepBssInfo[i + |
| 4670 | lastSent].bcnReportFields. |
| 4671 | ParentTsf, |
| 4672 | pRoamInfo->pEseBcnReportRsp-> |
| 4673 | bcnRepBssInfo[i + |
| 4674 | lastSent].bcnReportFields. |
| 4675 | TargetTsf[0], |
| 4676 | pRoamInfo->pEseBcnReportRsp-> |
| 4677 | bcnRepBssInfo[i + |
| 4678 | lastSent].bcnReportFields. |
| 4679 | TargetTsf[1], |
| 4680 | pRoamInfo->pEseBcnReportRsp-> |
| 4681 | bcnRepBssInfo[i + |
| 4682 | lastSent].bcnReportFields. |
| 4683 | BcnInterval, |
| 4684 | pRoamInfo->pEseBcnReportRsp-> |
| 4685 | bcnRepBssInfo[i + |
| 4686 | lastSent].bcnReportFields. |
| 4687 | CapabilityInfo, |
| 4688 | pRoamInfo->pEseBcnReportRsp-> |
| 4689 | bcnRepBssInfo[i + |
| 4690 | lastSent].bcnReportFields. |
| 4691 | Bssid[0], |
| 4692 | pRoamInfo->pEseBcnReportRsp-> |
| 4693 | bcnRepBssInfo[i + |
| 4694 | lastSent].bcnReportFields. |
| 4695 | Bssid[1], |
| 4696 | pRoamInfo->pEseBcnReportRsp-> |
| 4697 | bcnRepBssInfo[i + |
| 4698 | lastSent].bcnReportFields. |
| 4699 | Bssid[2], |
| 4700 | pRoamInfo->pEseBcnReportRsp-> |
| 4701 | bcnRepBssInfo[i + |
| 4702 | lastSent].bcnReportFields. |
| 4703 | Bssid[3], |
| 4704 | pRoamInfo->pEseBcnReportRsp-> |
| 4705 | bcnRepBssInfo[i + |
| 4706 | lastSent].bcnReportFields. |
| 4707 | Bssid[4], |
| 4708 | pRoamInfo->pEseBcnReportRsp-> |
| 4709 | bcnRepBssInfo[i + |
| 4710 | lastSent].bcnReportFields. |
| 4711 | Bssid[5]); |
| 4712 | |
| 4713 | /* bcn report fields are copied */ |
| 4714 | len = |
| 4715 | sizeof(pRoamInfo->pEseBcnReportRsp-> |
| 4716 | bcnRepBssInfo[i + |
| 4717 | lastSent]. |
| 4718 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4719 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4720 | (char *)&pRoamInfo-> |
| 4721 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4722 | lastSent]. |
| 4723 | bcnReportFields, len); |
| 4724 | pos += len; |
| 4725 | freeBytes -= len; |
| 4726 | |
| 4727 | /* Add 1 byte of ie len */ |
| 4728 | len = |
| 4729 | pRoamInfo->pEseBcnReportRsp-> |
| 4730 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4731 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4732 | pos += sizeof(len); |
| 4733 | freeBytes -= sizeof(len); |
| 4734 | |
| 4735 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4736 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4737 | (char *)pRoamInfo-> |
| 4738 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4739 | lastSent]. |
| 4740 | pBuf, len); |
| 4741 | pos += len; |
| 4742 | freeBytes -= len; |
| 4743 | } |
| 4744 | |
| 4745 | wrqu.data.pointer = buf; |
| 4746 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4747 | |
| 4748 | /* send the event */ |
| 4749 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, |
| 4750 | buf); |
| 4751 | lastSent += sendBss; |
| 4752 | } |
| 4753 | } |
| 4754 | } |
| 4755 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4756 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4757 | |
| 4758 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4759 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
| 4760 | * @pHddStaCtx: Station Context |
| 4761 | * |
| 4762 | * API to check if the connection authentication type is 8021x_sha256. |
| 4763 | * |
| 4764 | * Return: bool |
| 4765 | */ |
| 4766 | #ifdef WLAN_FEATURE_11W |
| 4767 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4768 | { |
| 4769 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
| 4770 | pHddStaCtx->conn_info.authType; |
| 4771 | } |
| 4772 | #else |
| 4773 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4774 | { |
| 4775 | return false; |
| 4776 | } |
| 4777 | #endif |
| 4778 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4779 | /* |
| 4780 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4781 | * @adapter: Pointer to adapter context |
| 4782 | * @roam_info: Pointer to roam info |
| 4783 | * |
| 4784 | * Return: None |
| 4785 | */ |
| 4786 | static void hdd_roam_channel_switch_handler(hdd_adapter_t *adapter, |
| 4787 | tCsrRoamInfo *roam_info) |
| 4788 | { |
| 4789 | struct hdd_chan_change_params chan_change; |
| 4790 | struct cfg80211_bss *bss; |
| 4791 | struct net_device *dev = adapter->dev; |
| 4792 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4793 | struct wiphy *wiphy = wdev->wiphy; |
| 4794 | QDF_STATUS status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4795 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4796 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4797 | hdd_debug("channel switch for session:%d to channel:%d", |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4798 | adapter->sessionId, roam_info->chan_info.chan_id); |
| 4799 | |
| 4800 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4801 | chan_change.chan_params.ch_width = |
| 4802 | roam_info->chan_info.ch_width; |
| 4803 | chan_change.chan_params.sec_ch_offset = |
| 4804 | roam_info->chan_info.sec_ch_offset; |
| 4805 | chan_change.chan_params.center_freq_seg0 = |
| 4806 | roam_info->chan_info.band_center_freq1; |
| 4807 | chan_change.chan_params.center_freq_seg1 = |
| 4808 | roam_info->chan_info.band_center_freq2; |
| 4809 | |
| 4810 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4811 | if (NULL == bss) |
| 4812 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4813 | else |
| 4814 | cfg80211_put_bss(wiphy, bss); |
| 4815 | |
| 4816 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change); |
| 4817 | if (QDF_IS_STATUS_ERROR(status)) |
| 4818 | hdd_err("channel change notification failed"); |
| 4819 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4820 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->hdd_psoc, |
| 4821 | adapter->sessionId); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4822 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4823 | hdd_debug("set hw mode change not done"); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4824 | } |
| 4825 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4826 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4827 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4828 | * @pContext: pointer to adapter context |
| 4829 | * @pRoamInfo: pointer to roam info |
| 4830 | * @roamId: roam id |
| 4831 | * @roamStatus: roam status |
| 4832 | * @roamResult: roam result |
| 4833 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4834 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4835 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4836 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4837 | hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, |
| 4838 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4839 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4840 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4841 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 4842 | hdd_wext_state_t *pWextState = NULL; |
| 4843 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4844 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4845 | struct cfg80211_bss *bss_status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4846 | hdd_context_t *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4847 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4848 | hdd_debug("CSR Callback: status= %d result= %d roamID=%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4849 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4850 | |
| 4851 | /* Sanity check */ |
| 4852 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4853 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4854 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4855 | } |
| 4856 | |
| 4857 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4858 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4859 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4860 | |
Sreelakshmi Konamki | 075431a | 2017-03-16 15:23:30 +0530 | [diff] [blame] | 4861 | /* Omitting eCSR_ROAM_UPDATE_SCAN_RESULT as this is too frequent */ |
| 4862 | if (eCSR_ROAM_UPDATE_SCAN_RESULT != roamStatus) |
| 4863 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4864 | pAdapter->sessionId, roamStatus)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4865 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4866 | switch (roamStatus) { |
| 4867 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 6f3a865 | 2015-09-25 10:58:15 +0530 | [diff] [blame] | 4868 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4869 | complete(&pAdapter->session_open_comp_var); |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 4870 | hdd_debug("session %d opened", pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4871 | break; |
| 4872 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4873 | /* |
| 4874 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4875 | * reassoc failed due to failure, timeout, reject from ap |
| 4876 | * in any case tell the OS, our carrier is off and mark |
| 4877 | * interface down. |
| 4878 | */ |
| 4879 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4880 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
| 4881 | roamStatus, roamResult, pAdapter->sessionId); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4882 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4883 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4884 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4885 | pHddStaCtx->ft_carrier_on = false; |
| 4886 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4887 | hdd_debug("hdd_ReassocScenario set to: %d, ReAssoc Failed, session: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4888 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4889 | break; |
| 4890 | |
| 4891 | case eCSR_ROAM_FT_START: |
| 4892 | /* |
| 4893 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4894 | * informed that the link is down. So mark the link ready for |
| 4895 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4896 | * be received. Where in we will not mark the link down |
| 4897 | * Also we want to stop tx at this point when we will be |
| 4898 | * doing disassoc at this time. This saves 30-60 msec |
| 4899 | * after reassoc. |
| 4900 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4901 | hdd_info("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4902 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4903 | hdd_napi_serialize(1); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4904 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4905 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4906 | WLAN_CONTROL_PATH); |
| 4907 | status = hdd_roam_deregister_sta(pAdapter, |
| 4908 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4909 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4910 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4911 | pHddStaCtx->ft_carrier_on = true; |
| 4912 | pHddStaCtx->hdd_ReassocScenario = true; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4913 | hdd_info("hdd_ReassocScenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
| 4914 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4915 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4916 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4917 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4918 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4919 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4920 | if (roamResult == eCSR_ROAM_RESULT_FAILURE) |
| 4921 | pAdapter->roam_ho_fail = true; |
| 4922 | else |
| 4923 | pAdapter->roam_ho_fail = false; |
| 4924 | complete(&pAdapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4925 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4926 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4927 | /* notify apps that we can't pass traffic anymore */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4928 | hdd_debug("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4929 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4930 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4931 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4932 | if (pHddStaCtx->ft_carrier_on == false) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4933 | wlan_hdd_netif_queue_control(pAdapter, |
| 4934 | WLAN_NETIF_CARRIER_OFF, |
| 4935 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4936 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4937 | break; |
| 4938 | case eCSR_ROAM_LOSTLINK: |
| 4939 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4940 | hdd_debug("Roaming started due to connection lost"); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4941 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4942 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4943 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4944 | WLAN_CONTROL_PATH); |
| 4945 | break; |
| 4946 | } |
| 4947 | case eCSR_ROAM_DISASSOCIATED: |
| 4948 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4949 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4950 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 4951 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4952 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4953 | pAdapter->roam_ho_fail = false; |
| 4954 | complete(&pAdapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4955 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4956 | /* Call to clear any MC Addr List filter applied after |
| 4957 | * successful connection. |
| 4958 | */ |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4959 | hdd_disable_and_flush_mc_addr_list(pAdapter, |
| 4960 | pmo_peer_disconnect); |
| 4961 | qdf_ret_status = |
| 4962 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4963 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4964 | } |
| 4965 | break; |
| 4966 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4967 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4968 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4969 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4970 | roamStatus, roamResult); |
| 4971 | break; |
| 4972 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4973 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4974 | /* |
| 4975 | * To Do - address probable memory leak with WEP encryption upon |
| 4976 | * successful association. |
| 4977 | */ |
| 4978 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 4979 | /* Clear saved connection information in HDD */ |
| 4980 | hdd_conn_remove_connect_info( |
| 4981 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 4982 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4983 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4984 | hdd_association_completion_handler(pAdapter, pRoamInfo, |
| 4985 | roamId, roamStatus, |
| 4986 | roamResult); |
| 4987 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4988 | if (pRoamInfo) |
| 4989 | pRoamInfo->roamSynchInProgress = false; |
| 4990 | #endif |
| 4991 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 4992 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4993 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4994 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4995 | qdf_ret_status = hdd_association_completion_handler(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4996 | pRoamInfo, |
| 4997 | roamId, |
| 4998 | roamStatus, |
| 4999 | roamResult); |
| 5000 | break; |
| 5001 | case eCSR_ROAM_IBSS_IND: |
| 5002 | hdd_roam_ibss_indication_handler(pAdapter, pRoamInfo, roamId, |
| 5003 | roamStatus, roamResult); |
| 5004 | break; |
| 5005 | |
| 5006 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5007 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5008 | roam_roam_connect_status_update_handler(pAdapter, |
| 5009 | pRoamInfo, |
| 5010 | roamId, |
| 5011 | roamStatus, |
| 5012 | roamResult); |
| 5013 | break; |
| 5014 | |
| 5015 | case eCSR_ROAM_MIC_ERROR_IND: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5016 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5017 | hdd_roam_mic_error_indication_handler(pAdapter, |
| 5018 | pRoamInfo, |
| 5019 | roamId, |
| 5020 | roamStatus, |
| 5021 | roamResult); |
| 5022 | break; |
| 5023 | |
| 5024 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 5025 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5026 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5027 | hdd_roam_set_key_complete_handler(pAdapter, pRoamInfo, |
| 5028 | roamId, roamStatus, |
| 5029 | roamResult); |
| 5030 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
| 5031 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5032 | hdd_debug("hdd_ReassocScenario set to: %d, set key complete, session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5033 | pHddStaCtx->hdd_ReassocScenario, |
| 5034 | pAdapter->sessionId); |
| 5035 | } |
| 5036 | } |
| 5037 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5038 | if (pRoamInfo != NULL) |
| 5039 | pRoamInfo->roamSynchInProgress = false; |
| 5040 | #endif |
| 5041 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5042 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5043 | case eCSR_ROAM_FT_RESPONSE: |
| 5044 | hdd_send_ft_event(pAdapter); |
| 5045 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5046 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5047 | case eCSR_ROAM_PMK_NOTIFY: |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 5048 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType |
| 5049 | || hdd_is_8021x_sha256_auth_type(pHddStaCtx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5050 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5051 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5052 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
| 5053 | pAdapter, pRoamInfo, 1, false); |
| 5054 | } |
| 5055 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5056 | |
| 5057 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 5058 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 5059 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5060 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5061 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, |
| 5062 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5063 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5064 | } |
| 5065 | break; |
| 5066 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 5067 | /* |
| 5068 | * This event will notify pre-auth completion in case of success |
| 5069 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5070 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5071 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5072 | pRoamInfo, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5073 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5074 | } |
| 5075 | break; |
| 5076 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 5077 | /* |
| 5078 | * This event will notify pre-auth completion incase of failure. |
| 5079 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5080 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5081 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5082 | pRoamInfo, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5083 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5084 | } |
| 5085 | break; |
| 5086 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 5087 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 5088 | * It will be only invoked on success |
| 5089 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5090 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5091 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, |
| 5092 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5093 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5094 | } |
| 5095 | break; |
| 5096 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5097 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 5098 | hdd_remain_chan_ready_handler(pAdapter, pRoamInfo->roc_scan_id); |
| 5099 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5100 | #ifdef FEATURE_WLAN_TDLS |
| 5101 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5102 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5103 | hdd_roam_tdls_status_update_handler(pAdapter, pRoamInfo, |
| 5104 | roamId, |
| 5105 | roamStatus, |
| 5106 | roamResult); |
| 5107 | break; |
| 5108 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 5109 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, |
| 5110 | pRoamInfo->reasonCode); |
| 5111 | break; |
| 5112 | #endif |
| 5113 | #ifdef WLAN_FEATURE_11W |
| 5114 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 5115 | hdd_indicate_unprot_mgmt_frame(pAdapter, |
| 5116 | pRoamInfo->nFrameLength, |
| 5117 | pRoamInfo->pbFrames, |
| 5118 | pRoamInfo->frameType); |
| 5119 | break; |
| 5120 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5121 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5122 | case eCSR_ROAM_TSM_IE_IND: |
| 5123 | hdd_indicate_tsm_ie(pAdapter, pRoamInfo->tsmIe.tsid, |
| 5124 | pRoamInfo->tsmIe.state, |
| 5125 | pRoamInfo->tsmIe.msmt_interval); |
| 5126 | break; |
| 5127 | |
| 5128 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 5129 | { |
| 5130 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
| 5131 | pHddStaCtx->conn_info.authType |
| 5132 | || eCSR_AUTH_TYPE_CCKM_RSN == |
| 5133 | pHddStaCtx->conn_info.authType) { |
| 5134 | hdd_indicate_cckm_pre_auth(pAdapter, pRoamInfo); |
| 5135 | } |
| 5136 | break; |
| 5137 | } |
| 5138 | |
| 5139 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 5140 | { |
| 5141 | hdd_indicate_ese_adj_ap_rep_ind(pAdapter, pRoamInfo); |
| 5142 | break; |
| 5143 | } |
| 5144 | |
| 5145 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 5146 | { |
| 5147 | hdd_indicate_ese_bcn_report_ind(pAdapter, pRoamInfo); |
| 5148 | break; |
| 5149 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5150 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5151 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5152 | hdd_roam_channel_switch_handler(pAdapter, pRoamInfo); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5153 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5154 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5155 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 5156 | if ((NULL != pRoamInfo) && (NULL != pRoamInfo->pBssDesc)) { |
| 5157 | bss_status = wlan_hdd_cfg80211_inform_bss_frame( |
| 5158 | pAdapter, pRoamInfo->pBssDesc); |
| 5159 | if (NULL == bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5160 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5161 | else |
| 5162 | cfg80211_put_bss( |
| 5163 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 5164 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 5165 | #endif |
| 5166 | bss_status); |
| 5167 | } |
| 5168 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 5169 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
| 5170 | hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, |
| 5171 | roamResult); |
| 5172 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5173 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5174 | hdd_debug("Process ROAM_START from firmware"); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5175 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5176 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5177 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5178 | hdd_napi_serialize(1); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5179 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5180 | hdd_set_roaming_in_progress(true); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 5181 | policy_mgr_restart_opportunistic_timer(hdd_ctx->hdd_psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5182 | break; |
| 5183 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5184 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5185 | hdd_napi_serialize(0); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5186 | wlan_hdd_netif_queue_control(pAdapter, |
| 5187 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 5188 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5189 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5190 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5191 | pAdapter->roam_ho_fail = false; |
| 5192 | complete(&pAdapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5193 | break; |
| 5194 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5195 | default: |
| 5196 | break; |
| 5197 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5198 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5199 | } |
| 5200 | |
| 5201 | /** |
| 5202 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 5203 | * @auth_suite: auth suite |
| 5204 | * |
| 5205 | * Return: eCsrAuthType enumeration |
| 5206 | */ |
| 5207 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5208 | { |
| 5209 | eCsrAuthType auth_type; |
| 5210 | /* is the auth type supported? */ |
| 5211 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 5212 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 5213 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 5214 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5215 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5216 | /* Check for 11r FT Authentication with PSK */ |
| 5217 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5218 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5219 | /* Check for 11R FT Authentication with 802.1X */ |
| 5220 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5221 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5222 | #ifdef FEATURE_WLAN_ESE |
| 5223 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5224 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5225 | } else |
| 5226 | #endif /* FEATURE_WLAN_ESE */ |
| 5227 | #ifdef WLAN_FEATURE_11W |
| 5228 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5229 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5230 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5231 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5232 | } else |
| 5233 | #endif |
| 5234 | { |
| 5235 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5236 | } |
| 5237 | return auth_type; |
| 5238 | } |
| 5239 | |
| 5240 | /** |
| 5241 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5242 | * @auth_suite: auth suite |
| 5243 | * |
| 5244 | * Return: eCsrAuthType enumeration |
| 5245 | */ |
| 5246 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5247 | { |
| 5248 | eCsrAuthType auth_type; |
| 5249 | /* is the auth type supported? */ |
| 5250 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5251 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5252 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5253 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5254 | } else |
| 5255 | #ifdef FEATURE_WLAN_ESE |
| 5256 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5257 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5258 | } else |
| 5259 | #endif /* FEATURE_WLAN_ESE */ |
| 5260 | { |
| 5261 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5262 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5263 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5264 | return auth_type; |
| 5265 | } |
| 5266 | |
| 5267 | /** |
| 5268 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5269 | * Translate RSN to CSR encryption type |
| 5270 | * @cipher_suite: cipher suite |
| 5271 | * |
| 5272 | * Return: eCsrEncryptionType enumeration |
| 5273 | */ |
| 5274 | eCsrEncryptionType |
| 5275 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5276 | { |
| 5277 | eCsrEncryptionType cipher_type; |
| 5278 | |
| 5279 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5280 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5281 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5282 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5283 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5284 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5285 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5286 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5287 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5288 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5289 | else |
| 5290 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5291 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5292 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5293 | return cipher_type; |
| 5294 | } |
| 5295 | |
| 5296 | /** |
| 5297 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5298 | * Translate WPA to CSR encryption type |
| 5299 | * @cipher_suite: cipher suite |
| 5300 | * |
| 5301 | * Return: eCsrEncryptionType enumeration |
| 5302 | */ |
| 5303 | eCsrEncryptionType |
| 5304 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5305 | { |
| 5306 | eCsrEncryptionType cipher_type; |
| 5307 | |
| 5308 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5309 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5310 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5311 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5312 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5313 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5314 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5315 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5316 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5317 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5318 | else |
| 5319 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5320 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5321 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5322 | return cipher_type; |
| 5323 | } |
| 5324 | |
| 5325 | /** |
| 5326 | * hdd_process_genie() - process gen ie |
| 5327 | * @pAdapter: pointer to adapter |
| 5328 | * @bssid: pointer to mac address |
| 5329 | * @pEncryptType: pointer to encryption type |
| 5330 | * @mcEncryptType: pointer to multicast encryption type |
| 5331 | * @pAuthType: pointer to auth type |
| 5332 | * |
| 5333 | * Return: 0 on success, error number otherwise |
| 5334 | */ |
| 5335 | static int32_t hdd_process_genie(hdd_adapter_t *pAdapter, |
| 5336 | u8 *bssid, |
| 5337 | eCsrEncryptionType *pEncryptType, |
| 5338 | eCsrEncryptionType *mcEncryptType, |
| 5339 | eCsrAuthType *pAuthType, |
| 5340 | #ifdef WLAN_FEATURE_11W |
| 5341 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5342 | #endif |
| 5343 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5344 | { |
| 5345 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5346 | QDF_STATUS result; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5347 | tDot11fIERSN dot11RSNIE; |
| 5348 | tDot11fIEWPA dot11WPAIE; |
| 5349 | uint32_t i; |
| 5350 | uint8_t *pRsnIe; |
| 5351 | uint16_t RSNIeLen; |
| 5352 | tPmkidCacheInfo PMKIDCache[4]; /* Local transfer memory */ |
| 5353 | bool updatePMKCache = false; |
| 5354 | |
| 5355 | /* |
| 5356 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5357 | * setting present flag to 0. |
| 5358 | */ |
| 5359 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5360 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5361 | |
| 5362 | /* Type check */ |
| 5363 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5364 | /* Validity checks */ |
| 5365 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5366 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5367 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5368 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5369 | return -EINVAL; |
| 5370 | } |
| 5371 | /* Skip past the EID byte and length byte */ |
| 5372 | pRsnIe = gen_ie + 2; |
| 5373 | RSNIeLen = gen_ie_len - 2; |
| 5374 | /* Unpack the RSN IE */ |
| 5375 | dot11f_unpack_ie_rsn((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5376 | pRsnIe, RSNIeLen, &dot11RSNIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5377 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5378 | hdd_debug("pairwise cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5379 | dot11RSNIE.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5380 | hdd_debug("authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5381 | dot11RSNIE.akm_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5382 | /* dot11RSNIE.akm_suite_count */ |
| 5383 | /* Just translate the FIRST one */ |
| 5384 | *pAuthType = |
| 5385 | hdd_translate_rsn_to_csr_auth_type( |
| 5386 | dot11RSNIE.akm_suites[0]); |
| 5387 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5388 | *pEncryptType = |
| 5389 | hdd_translate_rsn_to_csr_encryption_type( |
| 5390 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5391 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5392 | *mcEncryptType = |
| 5393 | hdd_translate_rsn_to_csr_encryption_type( |
| 5394 | dot11RSNIE.gp_cipher_suite); |
| 5395 | #ifdef WLAN_FEATURE_11W |
| 5396 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
| 5397 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1; |
| 5398 | #endif |
| 5399 | /* Set the PMKSA ID Cache for this interface */ |
| 5400 | for (i = 0; i < dot11RSNIE.pmkid_count; i++) { |
| 5401 | if (is_zero_ether_addr(bssid)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5402 | hdd_warn("MAC address is all zeroes"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5403 | break; |
| 5404 | } |
| 5405 | updatePMKCache = true; |
| 5406 | /* |
| 5407 | * For right now, I assume setASSOCIATE() has passed |
| 5408 | * in the bssid. |
| 5409 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5410 | qdf_mem_copy(PMKIDCache[i].BSSID.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5411 | bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5412 | qdf_mem_copy(PMKIDCache[i].PMKID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5413 | dot11RSNIE.pmkid[i], CSR_RSN_PMKID_SIZE); |
| 5414 | } |
| 5415 | |
| 5416 | if (updatePMKCache) { |
| 5417 | /* |
| 5418 | * Calling csr_roam_set_pmkid_cache to configure the |
| 5419 | * PMKIDs into the cache. |
| 5420 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5421 | hdd_debug("Calling sme_roam_set_pmkid_cache with cache entry %d.", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5422 | i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5423 | /* Finally set the PMKSA ID Cache in CSR */ |
| 5424 | result = |
| 5425 | sme_roam_set_pmkid_cache(halHandle, |
| 5426 | pAdapter->sessionId, |
| 5427 | PMKIDCache, |
| 5428 | dot11RSNIE.pmkid_count, |
| 5429 | false); |
| 5430 | } |
| 5431 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5432 | /* Validity checks */ |
| 5433 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5434 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5435 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5436 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5437 | return -EINVAL; |
| 5438 | } |
| 5439 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5440 | pRsnIe = gen_ie + 2 + 4; |
| 5441 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5442 | /* Unpack the WPA IE */ |
| 5443 | dot11f_unpack_ie_wpa((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5444 | pRsnIe, RSNIeLen, &dot11WPAIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5445 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5446 | hdd_debug("WPA unicast cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5447 | dot11WPAIE.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5448 | hdd_debug("WPA authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5449 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5450 | /* dot11WPAIE.auth_suite_count */ |
| 5451 | /* Just translate the FIRST one */ |
| 5452 | *pAuthType = |
| 5453 | hdd_translate_wpa_to_csr_auth_type( |
| 5454 | dot11WPAIE.auth_suites[0]); |
| 5455 | /* dot11WPAIE.unicast_cipher_count */ |
| 5456 | *pEncryptType = |
| 5457 | hdd_translate_wpa_to_csr_encryption_type( |
| 5458 | dot11WPAIE.unicast_ciphers[0]); |
| 5459 | /* dot11WPAIE.unicast_cipher_count */ |
| 5460 | *mcEncryptType = |
| 5461 | hdd_translate_wpa_to_csr_encryption_type( |
| 5462 | dot11WPAIE.multicast_cipher); |
| 5463 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5464 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5465 | return -EINVAL; |
| 5466 | } |
| 5467 | return 0; |
| 5468 | } |
| 5469 | |
| 5470 | /** |
| 5471 | * hdd_set_genie_to_csr() - set genie to csr |
| 5472 | * @pAdapter: pointer to adapter |
| 5473 | * @RSNAuthType: pointer to auth type |
| 5474 | * |
| 5475 | * Return: 0 on success, error number otherwise |
| 5476 | */ |
| 5477 | int hdd_set_genie_to_csr(hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 5478 | { |
| 5479 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5480 | uint32_t status = 0; |
| 5481 | eCsrEncryptionType RSNEncryptType; |
| 5482 | eCsrEncryptionType mcRSNEncryptType; |
| 5483 | #ifdef WLAN_FEATURE_11W |
| 5484 | uint8_t RSNMfpRequired = 0; |
| 5485 | uint8_t RSNMfpCapable = 0; |
| 5486 | #endif |
| 5487 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
| 5488 | /* MAC address of assoc peer */ |
| 5489 | /* But, this routine is only called when we are NOT associated. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5490 | qdf_mem_copy(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5491 | pWextState->roamProfile.BSSIDs.bssid, |
| 5492 | sizeof(bssid)); |
| 5493 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN |
| 5494 | || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) { |
| 5495 | /* continue */ |
| 5496 | } else { |
| 5497 | return 0; |
| 5498 | } |
| 5499 | /* The actual processing may eventually be more extensive than this. */ |
| 5500 | /* Right now, just consume any PMKIDs that are sent in by the app. */ |
| 5501 | status = hdd_process_genie(pAdapter, bssid, |
| 5502 | &RSNEncryptType, |
| 5503 | &mcRSNEncryptType, RSNAuthType, |
| 5504 | #ifdef WLAN_FEATURE_11W |
| 5505 | &RSNMfpRequired, &RSNMfpCapable, |
| 5506 | #endif |
| 5507 | pWextState->WPARSNIE[1] + 2, |
| 5508 | pWextState->WPARSNIE); |
| 5509 | if (status == 0) { |
| 5510 | /* |
| 5511 | * Now copy over all the security attributes |
| 5512 | * you have parsed out. |
| 5513 | */ |
| 5514 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5515 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5516 | |
| 5517 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; /* Use the cipher type in the RSN IE */ |
| 5518 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5519 | mcRSNEncryptType; |
| 5520 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5521 | if ((QDF_IBSS_MODE == pAdapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5522 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 5523 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5524 | /* |
| 5525 | * For wpa none supplicant sends the WPA IE with unicast |
| 5526 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5527 | * multicast cipher as either AES/TKIP based on group |
| 5528 | * cipher configuration mentioned in the |
| 5529 | * wpa_supplicant.conf. |
| 5530 | */ |
| 5531 | |
| 5532 | /* Set the unicast cipher same as multicast cipher */ |
| 5533 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 5534 | = mcRSNEncryptType; |
| 5535 | } |
| 5536 | #ifdef WLAN_FEATURE_11W |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5537 | hdd_debug("RSNMfpRequired = %d, RSNMfpCapable = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5538 | RSNMfpRequired, RSNMfpCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5539 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 5540 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 5541 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5542 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5543 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5544 | } |
| 5545 | return 0; |
| 5546 | } |
| 5547 | |
| 5548 | /** |
| 5549 | * hdd_set_csr_auth_type() - set csr auth type |
| 5550 | * @pAdapter: pointer to adapter |
| 5551 | * @RSNAuthType: auth type |
| 5552 | * |
| 5553 | * Return: 0 on success, error number otherwise |
| 5554 | */ |
| 5555 | int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 5556 | { |
| 5557 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5558 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 5559 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5560 | |
| 5561 | pRoamProfile->AuthType.numEntries = 1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5562 | hdd_debug("pHddStaCtx->conn_info.authType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5563 | pHddStaCtx->conn_info.authType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5564 | |
| 5565 | switch (pHddStaCtx->conn_info.authType) { |
| 5566 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5567 | #ifdef FEATURE_WLAN_ESE |
| 5568 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5569 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5570 | #endif |
| 5571 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 5572 | |
| 5573 | pRoamProfile->AuthType.authType[0] = |
| 5574 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5575 | } else if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
| 5576 | |
| 5577 | #ifdef FEATURE_WLAN_ESE |
| 5578 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 5579 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5580 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5581 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5582 | pRoamProfile->AuthType.authType[0] = |
| 5583 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5584 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5585 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5586 | pRoamProfile->AuthType.authType[0] = |
| 5587 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5588 | } else |
| 5589 | #endif |
| 5590 | if ((pWextState-> |
| 5591 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5592 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5593 | pRoamProfile->AuthType.authType[0] = |
| 5594 | eCSR_AUTH_TYPE_WPA; |
| 5595 | } else |
| 5596 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5597 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5598 | pRoamProfile->AuthType.authType[0] = |
| 5599 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5600 | } else { |
| 5601 | pRoamProfile->AuthType.authType[0] = |
| 5602 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5603 | } |
| 5604 | } |
| 5605 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
| 5606 | #ifdef FEATURE_WLAN_ESE |
| 5607 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 5608 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5609 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5610 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5611 | pRoamProfile->AuthType.authType[0] = |
| 5612 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5613 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5614 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5615 | pRoamProfile->AuthType.authType[0] = |
| 5616 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5617 | } else |
| 5618 | #endif |
| 5619 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5620 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 5621 | ((pWextState-> |
| 5622 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5623 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5624 | pRoamProfile->AuthType.authType[0] = |
| 5625 | eCSR_AUTH_TYPE_FT_RSN; |
| 5626 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5627 | && |
| 5628 | ((pWextState-> |
| 5629 | authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5630 | == IW_AUTH_KEY_MGMT_PSK)) { |
| 5631 | pRoamProfile->AuthType.authType[0] = |
| 5632 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5633 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5634 | |
| 5635 | #ifdef WLAN_FEATURE_11W |
| 5636 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5637 | pRoamProfile->AuthType.authType[0] = |
| 5638 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5639 | } else if (RSNAuthType == |
| 5640 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5641 | pRoamProfile->AuthType.authType[0] = |
| 5642 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5643 | } else |
| 5644 | #endif |
| 5645 | |
| 5646 | if ((pWextState-> |
| 5647 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5648 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5649 | pRoamProfile->AuthType.authType[0] = |
| 5650 | eCSR_AUTH_TYPE_RSN; |
| 5651 | } else |
| 5652 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5653 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5654 | pRoamProfile->AuthType.authType[0] = |
| 5655 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5656 | } else { |
| 5657 | pRoamProfile->AuthType.authType[0] = |
| 5658 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5659 | } |
| 5660 | } |
| 5661 | break; |
| 5662 | |
| 5663 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5664 | |
| 5665 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5666 | break; |
| 5667 | default: |
| 5668 | |
| 5669 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5670 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5671 | #endif /* FEATURE_WLAN_ESE */ |
| 5672 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5673 | break; |
| 5674 | } |
| 5675 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5676 | hdd_debug("Set roam Authtype to %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5677 | pWextState->roamProfile.AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5678 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5679 | return 0; |
| 5680 | } |
| 5681 | |
| 5682 | /** |
| 5683 | * __iw_set_essid() - This function sets the ssid received from wpa_supplicant |
| 5684 | * to the CSR roam profile. |
| 5685 | * |
| 5686 | * @dev: Pointer to the net device. |
| 5687 | * @info: Pointer to the iw_request_info. |
| 5688 | * @wrqu: Pointer to the iwreq_data. |
| 5689 | * @extra: Pointer to the data. |
| 5690 | * |
| 5691 | * Return: 0 for success, error number on failure |
| 5692 | */ |
| 5693 | static int __iw_set_essid(struct net_device *dev, |
| 5694 | struct iw_request_info *info, |
| 5695 | union iwreq_data *wrqu, char *extra) |
| 5696 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5697 | uint32_t status = 0; |
| 5698 | hdd_wext_state_t *pWextState; |
| 5699 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5700 | hdd_context_t *hdd_ctx; |
| 5701 | uint32_t roamId; |
| 5702 | tCsrRoamProfile *pRoamProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5703 | eCsrAuthType RSNAuthType; |
| 5704 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5705 | int ret; |
| 5706 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5707 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5708 | |
| 5709 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5710 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5711 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5712 | return ret; |
| 5713 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5714 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5715 | if (0 != ret) |
| 5716 | return ret; |
| 5717 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5718 | if (pAdapter->device_mode != QDF_STA_MODE && |
Jeff Johnson | d6e4b63 | 2016-10-03 13:49:27 -0700 | [diff] [blame] | 5719 | pAdapter->device_mode != QDF_IBSS_MODE && |
| 5720 | pAdapter->device_mode != QDF_P2P_CLIENT_MODE) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5721 | hdd_warn("device mode %s(%d) is not allowed", |
| 5722 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 5723 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5724 | return -EINVAL; |
| 5725 | } |
| 5726 | |
| 5727 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5728 | |
| 5729 | if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5730 | hdd_warn("Counter measure is in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5731 | return -EBUSY; |
| 5732 | } |
| 5733 | if (SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length) |
| 5734 | return -EINVAL; |
| 5735 | |
| 5736 | pRoamProfile = &pWextState->roamProfile; |
Agrawal Ashish | 3d000b4 | 2017-02-07 13:44:50 +0530 | [diff] [blame] | 5737 | /*Try disconnecting if already in connected state*/ |
| 5738 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5739 | if (0 > status) { |
| 5740 | hdd_err("Failed to disconnect the existing connection"); |
| 5741 | return -EALREADY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5742 | } |
| 5743 | |
| 5744 | /* |
| 5745 | * when cfg80211 defined, wpa_supplicant wext driver uses |
| 5746 | * zero-length, null-string ssid for force disconnection. |
| 5747 | * after disconnection (if previously connected) and cleaning ssid, |
| 5748 | * driver MUST return success. |
| 5749 | */ |
| 5750 | if (0 == wrqu->essid.length) |
| 5751 | return 0; |
| 5752 | |
| 5753 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5754 | &pWextState->roamProfile.uapsd_mask); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5755 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5756 | pWextState->roamProfile.uapsd_mask = 0; |
| 5757 | |
| 5758 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
| 5759 | |
| 5760 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = |
| 5761 | wrqu->essid.length; |
| 5762 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5763 | qdf_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5764 | sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5765 | qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5766 | ssId), extra, wrqu->essid.length); |
| 5767 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion |
| 5768 | || IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion) { |
| 5769 | |
| 5770 | /* set gen ie */ |
| 5771 | hdd_set_genie_to_csr(pAdapter, &RSNAuthType); |
| 5772 | |
| 5773 | /* set auth */ |
| 5774 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5775 | } |
| 5776 | #ifdef FEATURE_WLAN_WAPI |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5777 | hdd_debug("Setting WAPI AUTH Type and Encryption Mode values"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5778 | if (pAdapter->wapi_info.nWapiMode) { |
| 5779 | switch (pAdapter->wapi_info.wapiAuthMode) { |
| 5780 | case WAPI_AUTH_MODE_PSK: |
| 5781 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5782 | hdd_debug("WAPI AUTH TYPE: PSK: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5783 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5784 | pRoamProfile->AuthType.numEntries = 1; |
| 5785 | pRoamProfile->AuthType.authType[0] = |
| 5786 | eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5787 | break; |
| 5788 | } |
| 5789 | case WAPI_AUTH_MODE_CERT: |
| 5790 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5791 | hdd_debug("WAPI AUTH TYPE: CERT: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5792 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5793 | pRoamProfile->AuthType.numEntries = 1; |
| 5794 | pRoamProfile->AuthType.authType[0] = |
| 5795 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5796 | break; |
| 5797 | } |
| 5798 | } /* End of switch */ |
| 5799 | if (pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5800 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5801 | hdd_debug("WAPI PAIRWISE/GROUP ENCRYPTION: WPI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5802 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5803 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 5804 | eCSR_ENCRYPT_TYPE_WPI; |
| 5805 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5806 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 5807 | eCSR_ENCRYPT_TYPE_WPI; |
| 5808 | } |
| 5809 | } |
| 5810 | #endif /* FEATURE_WLAN_WAPI */ |
| 5811 | /* if previous genIE is not NULL, update AssocIE */ |
| 5812 | if (0 != pWextState->genIE.length) { |
| 5813 | memset(&pWextState->assocAddIE, 0, |
| 5814 | sizeof(pWextState->assocAddIE)); |
| 5815 | memcpy(pWextState->assocAddIE.addIEdata, |
| 5816 | pWextState->genIE.addIEdata, pWextState->genIE.length); |
| 5817 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5818 | pWextState->roamProfile.pAddIEAssoc = |
| 5819 | pWextState->assocAddIE.addIEdata; |
| 5820 | pWextState->roamProfile.nAddIEAssocLength = |
| 5821 | pWextState->assocAddIE.length; |
| 5822 | |
| 5823 | /* clear previous genIE after use it */ |
| 5824 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 5825 | } |
| 5826 | |
| 5827 | /* |
| 5828 | * Assumes it is not WPS Association by default, except when |
| 5829 | * pAddIEAssoc has WPS IE. |
| 5830 | */ |
| 5831 | pWextState->roamProfile.bWPSAssociation = false; |
| 5832 | |
| 5833 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5834 | pWextState->roamProfile. |
| 5835 | nAddIEAssocLength)) |
| 5836 | pWextState->roamProfile.bWPSAssociation = true; |
| 5837 | |
| 5838 | /* Disable auto BMPS entry by PMC until DHCP is done */ |
| 5839 | sme_set_dhcp_till_power_active_flag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5840 | true); |
| 5841 | |
| 5842 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 5843 | |
| 5844 | if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType) { |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5845 | pRoamProfile->ch_params.ch_width = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5846 | hdd_select_cbmode(pAdapter, |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5847 | (WLAN_HDD_GET_CTX(pAdapter))->config->AdHocChannel5G, |
| 5848 | &pRoamProfile->ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5849 | } |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5850 | |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5851 | /* |
| 5852 | * Change conn_state to connecting before sme_roam_connect(), |
| 5853 | * because sme_roam_connect() has a direct path to call |
| 5854 | * hdd_sme_roam_callback(), which will change the conn_state |
| 5855 | * If direct path, conn_state will be accordingly changed to |
| 5856 | * NotConnected or Associated by either |
| 5857 | * hdd_association_completion_handler() or hdd_dis_connect_handler() |
| 5858 | * in sme_RoamCallback()if sme_RomConnect is to be queued, |
| 5859 | * Connecting state will remain until it is completed. |
| 5860 | * |
| 5861 | * If connection state is not changed, |
| 5862 | * connection state will remain in eConnectionState_NotConnected state. |
| 5863 | * In hdd_association_completion_handler, "hddDisconInProgress" is |
| 5864 | * set to true if conn state is eConnectionState_NotConnected. |
| 5865 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5866 | * informed of connect result indication which is an issue. |
| 5867 | */ |
| 5868 | if (QDF_STA_MODE == pAdapter->device_mode || |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5869 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode) |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5870 | hdd_conn_set_connection_state(pAdapter, |
| 5871 | eConnectionState_Connecting); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5872 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5873 | status = sme_roam_connect(hHal, pAdapter->sessionId, |
| 5874 | &(pWextState->roamProfile), &roamId); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5875 | if ((QDF_STATUS_SUCCESS != status) && |
| 5876 | (QDF_STA_MODE == pAdapter->device_mode || |
| 5877 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5878 | hdd_err("sme_roam_connect failed session_id: %d status %d -> NotConnected", |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5879 | pAdapter->sessionId, status); |
| 5880 | /* change back to NotAssociated */ |
| 5881 | hdd_conn_set_connection_state(pAdapter, |
| 5882 | eConnectionState_NotConnected); |
| 5883 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5884 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5885 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5886 | |
| 5887 | EXIT(); |
| 5888 | return status; |
| 5889 | } |
| 5890 | |
| 5891 | /** |
| 5892 | * iw_set_essid() - set essid handler function |
| 5893 | * @dev: Pointer to the net device. |
| 5894 | * @info: Pointer to the iw_request_info. |
| 5895 | * @wrqu: Pointer to the iwreq_data. |
| 5896 | * @extra: Pointer to the data. |
| 5897 | * |
| 5898 | * Return: 0 for success, error number on failure |
| 5899 | */ |
| 5900 | int iw_set_essid(struct net_device *dev, |
| 5901 | struct iw_request_info *info, |
| 5902 | union iwreq_data *wrqu, char *extra) |
| 5903 | { |
| 5904 | int ret; |
| 5905 | |
| 5906 | cds_ssr_protect(__func__); |
| 5907 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5908 | cds_ssr_unprotect(__func__); |
| 5909 | |
| 5910 | return ret; |
| 5911 | } |
| 5912 | |
| 5913 | /** |
| 5914 | * __iw_get_essid() - This function returns the essid to the wpa_supplicant |
| 5915 | * @dev: pointer to the net device |
| 5916 | * @info: pointer to the iw request info |
| 5917 | * @dwrq: pointer to iw_point |
| 5918 | * @extra: pointer to the data |
| 5919 | * |
| 5920 | * Return: 0 on success, error number otherwise |
| 5921 | */ |
| 5922 | static int __iw_get_essid(struct net_device *dev, |
| 5923 | struct iw_request_info *info, |
| 5924 | struct iw_point *dwrq, char *extra) |
| 5925 | { |
| 5926 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5927 | hdd_context_t *hdd_ctx; |
| 5928 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5929 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5930 | int ret; |
| 5931 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5932 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5933 | |
| 5934 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5935 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5936 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5937 | return ret; |
| 5938 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5939 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5940 | if (0 != ret) |
| 5941 | return ret; |
| 5942 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5943 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 5944 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 5945 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected |
| 5946 | || pHddStaCtx->conn_info.connState == |
| 5947 | eConnectionState_IbssDisconnected) |
| 5948 | && wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) { |
| 5949 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 5950 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 5951 | dwrq->length); |
| 5952 | dwrq->flags = 1; |
| 5953 | } else { |
| 5954 | memset(extra, 0, dwrq->length); |
| 5955 | dwrq->length = 0; |
| 5956 | dwrq->flags = 0; |
| 5957 | } |
| 5958 | EXIT(); |
| 5959 | return 0; |
| 5960 | } |
| 5961 | |
| 5962 | /** |
| 5963 | * iw_get_essid() - get essid handler function |
| 5964 | * @dev: Pointer to the net device. |
| 5965 | * @info: Pointer to the iw_request_info. |
| 5966 | * @wrqu: Pointer to the iwreq_data. |
| 5967 | * @extra: Pointer to the data. |
| 5968 | * |
| 5969 | * Return: 0 for success, error number on failure |
| 5970 | */ |
| 5971 | int iw_get_essid(struct net_device *dev, |
| 5972 | struct iw_request_info *info, |
| 5973 | struct iw_point *wrqu, char *extra) |
| 5974 | { |
| 5975 | int ret; |
| 5976 | |
| 5977 | cds_ssr_protect(__func__); |
| 5978 | ret = __iw_get_essid(dev, info, wrqu, extra); |
| 5979 | cds_ssr_unprotect(__func__); |
| 5980 | |
| 5981 | return ret; |
| 5982 | } |
| 5983 | |
| 5984 | /** |
| 5985 | * __iw_set_auth() - |
| 5986 | * This function sets the auth type received from the wpa_supplicant |
| 5987 | * @dev: pointer to the net device |
| 5988 | * @info: pointer to the iw request info |
| 5989 | * @wrqu: pointer to iwreq_data |
| 5990 | * @extra: pointer to the data |
| 5991 | * |
| 5992 | * Return: 0 on success, error number otherwise |
| 5993 | */ |
| 5994 | static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 5995 | union iwreq_data *wrqu, char *extra) |
| 5996 | { |
| 5997 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5998 | hdd_context_t *hdd_ctx; |
| 5999 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6000 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6001 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6002 | eCsrEncryptionType mcEncryptionType; |
| 6003 | eCsrEncryptionType ucEncryptionType; |
| 6004 | int ret; |
| 6005 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6006 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6007 | |
| 6008 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6009 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6010 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6011 | return ret; |
| 6012 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6013 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6014 | if (0 != ret) |
| 6015 | return ret; |
| 6016 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6017 | switch (wrqu->param.flags & IW_AUTH_INDEX) { |
| 6018 | case IW_AUTH_WPA_VERSION: |
| 6019 | pWextState->wpaVersion = wrqu->param.value; |
| 6020 | break; |
| 6021 | |
| 6022 | case IW_AUTH_CIPHER_PAIRWISE: |
| 6023 | { |
| 6024 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6025 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6026 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6027 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6028 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6029 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6030 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6031 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6032 | == |
| 6033 | (pWextState-> |
| 6034 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6035 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6036 | pHddStaCtx->conn_info.authType)) |
| 6037 | /*Dynamic WEP key */ |
| 6038 | ucEncryptionType = |
| 6039 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6040 | else |
| 6041 | /*Static WEP key */ |
| 6042 | ucEncryptionType = |
| 6043 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6044 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6045 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6046 | == |
| 6047 | (pWextState-> |
| 6048 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6049 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6050 | pHddStaCtx->conn_info.authType)) |
| 6051 | /*Dynamic WEP key */ |
| 6052 | ucEncryptionType = |
| 6053 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6054 | else |
| 6055 | /*Static WEP key */ |
| 6056 | ucEncryptionType = |
| 6057 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6058 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6059 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
| 6060 | wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6061 | return -EINVAL; |
| 6062 | } |
| 6063 | |
| 6064 | pRoamProfile->EncryptionType.numEntries = 1; |
| 6065 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 6066 | ucEncryptionType; |
| 6067 | } |
| 6068 | break; |
| 6069 | case IW_AUTH_CIPHER_GROUP: |
| 6070 | { |
| 6071 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6072 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6073 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6074 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6075 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6076 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6077 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6078 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6079 | == |
| 6080 | (pWextState-> |
| 6081 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6082 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6083 | pHddStaCtx->conn_info.authType)) |
| 6084 | mcEncryptionType = |
| 6085 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6086 | else |
| 6087 | mcEncryptionType = |
| 6088 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6089 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6090 | /* Dynamic WEP keys won't work with shared keys */ |
| 6091 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6092 | == |
| 6093 | (pWextState-> |
| 6094 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6095 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6096 | pHddStaCtx->conn_info.authType)) { |
| 6097 | mcEncryptionType = |
| 6098 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6099 | } else { |
| 6100 | mcEncryptionType = |
| 6101 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6102 | } |
| 6103 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6104 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6105 | wrqu->param.value); |
| 6106 | return -EINVAL; |
| 6107 | } |
| 6108 | |
| 6109 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 6110 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 6111 | mcEncryptionType; |
| 6112 | } |
| 6113 | break; |
| 6114 | |
| 6115 | case IW_AUTH_80211_AUTH_ALG: |
| 6116 | { |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 6117 | /* Save the auth algo here and set auth type to SME |
| 6118 | * Roam profile in the iw_set_ap_address |
| 6119 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6120 | if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
| 6121 | pHddStaCtx->conn_info.authType = |
| 6122 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6123 | |
| 6124 | else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 6125 | pHddStaCtx->conn_info.authType = |
| 6126 | eCSR_AUTH_TYPE_SHARED_KEY; |
| 6127 | |
| 6128 | else if (wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 6129 | /*Not supported */ |
| 6130 | pHddStaCtx->conn_info.authType = |
| 6131 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6132 | pWextState->roamProfile.AuthType.authType[0] = |
| 6133 | pHddStaCtx->conn_info.authType; |
| 6134 | } |
| 6135 | break; |
| 6136 | |
| 6137 | case IW_AUTH_KEY_MGMT: |
| 6138 | { |
| 6139 | #ifdef FEATURE_WLAN_ESE |
| 6140 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 6141 | /*Check for CCKM AKM type */ |
| 6142 | if (wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6143 | hdd_debug("CCKM AKM Set %d", wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6144 | /* Set the CCKM bit in authKeyMgmt */ |
| 6145 | /* |
| 6146 | * Right now, this breaks all ref to authKeyMgmt because |
| 6147 | * our code doesn't realize it is a "bitfield" |
| 6148 | */ |
| 6149 | pWextState->authKeyMgmt |= |
| 6150 | IW_AUTH_KEY_MGMT_CCKM; |
| 6151 | /* Set the key management to 802.1X */ |
| 6152 | /* pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; */ |
| 6153 | pWextState->isESEConnection = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6154 | } else if (wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 6155 | /* Save the key management */ |
| 6156 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
Jeff Johnson | 3474602 | 2017-02-07 16:32:57 -0800 | [diff] [blame] | 6157 | } else if (!(wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6158 | /* Save the key management anyway */ |
| 6159 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6160 | } else { /* It must be IW_AUTH_KEY_MGMT_802_1X */ |
| 6161 | /* Save the key management */ |
| 6162 | pWextState->authKeyMgmt |= |
| 6163 | IW_AUTH_KEY_MGMT_802_1X; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6164 | } |
| 6165 | #else |
| 6166 | /* Save the key management */ |
| 6167 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6168 | #endif /* FEATURE_WLAN_ESE */ |
| 6169 | } |
| 6170 | break; |
| 6171 | |
| 6172 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 6173 | { |
| 6174 | if (wrqu->param.value) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6175 | hdd_debug("Counter Measure started %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6176 | wrqu->param.value); |
| 6177 | pWextState->mTKIPCounterMeasures = |
| 6178 | TKIP_COUNTER_MEASURE_STARTED; |
| 6179 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6180 | hdd_debug("Counter Measure stopped=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6181 | wrqu->param.value); |
| 6182 | pWextState->mTKIPCounterMeasures = |
| 6183 | TKIP_COUNTER_MEASURE_STOPED; |
| 6184 | } |
| 6185 | } |
| 6186 | break; |
| 6187 | case IW_AUTH_DROP_UNENCRYPTED: |
| 6188 | case IW_AUTH_WPA_ENABLED: |
| 6189 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 6190 | case IW_AUTH_ROAMING_CONTROL: |
| 6191 | case IW_AUTH_PRIVACY_INVOKED: |
| 6192 | |
| 6193 | default: |
| 6194 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6195 | hdd_warn("called with unsupported auth type %d", |
| 6196 | wrqu->param.flags & IW_AUTH_INDEX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6197 | break; |
| 6198 | } |
| 6199 | |
| 6200 | EXIT(); |
| 6201 | return 0; |
| 6202 | } |
| 6203 | |
| 6204 | /** |
| 6205 | * iw_set_auth() - set auth callback function |
| 6206 | * @dev: Pointer to the net device. |
| 6207 | * @info: Pointer to the iw_request_info. |
| 6208 | * @wrqu: Pointer to the iwreq_data. |
| 6209 | * @extra: Pointer to the data. |
| 6210 | * |
| 6211 | * Return: 0 for success, error number on failure. |
| 6212 | */ |
| 6213 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6214 | union iwreq_data *wrqu, char *extra) |
| 6215 | { |
| 6216 | int ret; |
| 6217 | |
| 6218 | cds_ssr_protect(__func__); |
| 6219 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 6220 | cds_ssr_unprotect(__func__); |
| 6221 | |
| 6222 | return ret; |
| 6223 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6224 | /** |
| 6225 | * __iw_get_auth() - |
| 6226 | * This function returns the auth type to the wpa_supplicant |
| 6227 | * @dev: pointer to the net device |
| 6228 | * @info: pointer to the iw request info |
| 6229 | * @wrqu: pointer to iwreq_data |
| 6230 | * @extra: pointer to the data |
| 6231 | * |
| 6232 | * Return: 0 on success, error number otherwise |
| 6233 | */ |
| 6234 | static int __iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6235 | union iwreq_data *wrqu, char *extra) |
| 6236 | { |
| 6237 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6238 | hdd_context_t *hdd_ctx; |
| 6239 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6240 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6241 | int ret; |
| 6242 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6243 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6244 | |
| 6245 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6246 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6247 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6248 | return ret; |
| 6249 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6250 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6251 | if (0 != ret) |
| 6252 | return ret; |
| 6253 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6254 | switch (pRoamProfile->negotiatedAuthType) { |
| 6255 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 6256 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6257 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 6258 | break; |
| 6259 | case eCSR_AUTH_TYPE_WPA: |
| 6260 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6261 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 6262 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6263 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6264 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6265 | case eCSR_AUTH_TYPE_RSN: |
| 6266 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6267 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 6268 | break; |
| 6269 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 6270 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6271 | break; |
| 6272 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 6273 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 6274 | break; |
| 6275 | case eCSR_AUTH_TYPE_UNKNOWN: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6276 | hdd_debug("called with unknown auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6277 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6278 | break; |
| 6279 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 6280 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6281 | break; |
| 6282 | case eCSR_AUTH_TYPE_WPA_PSK: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6283 | hdd_debug("called with WPA PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6284 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6285 | return -EIO; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6286 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6287 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6288 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 6289 | #ifdef WLAN_FEATURE_11W |
| 6290 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 6291 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 6292 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6293 | hdd_debug("called with RSN PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6294 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6295 | return -EIO; |
| 6296 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6297 | hdd_warn("Unknown auth type: %d", |
| 6298 | pRoamProfile->negotiatedAuthType); |
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 | } |
| 6302 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) { |
| 6303 | switch (pRoamProfile->negotiatedUCEncryptionType) { |
| 6304 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6305 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6306 | break; |
| 6307 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6308 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6309 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6310 | break; |
| 6311 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6312 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6313 | break; |
| 6314 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6315 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6316 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6317 | break; |
| 6318 | case eCSR_ENCRYPT_TYPE_AES: |
| 6319 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6320 | break; |
| 6321 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6322 | hdd_warn("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6323 | pRoamProfile->negotiatedUCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6324 | return -EIO; |
| 6325 | } |
| 6326 | } |
| 6327 | |
| 6328 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) { |
| 6329 | switch (pRoamProfile->negotiatedMCEncryptionType) { |
| 6330 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6331 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6332 | break; |
| 6333 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6334 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6335 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6336 | break; |
| 6337 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6338 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6339 | break; |
| 6340 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6341 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6342 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6343 | break; |
| 6344 | case eCSR_ENCRYPT_TYPE_AES: |
| 6345 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6346 | break; |
| 6347 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6348 | hdd_err("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6349 | pRoamProfile->negotiatedMCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6350 | return -EIO; |
| 6351 | } |
| 6352 | } |
| 6353 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6354 | hdd_debug("called with auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6355 | pRoamProfile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6356 | EXIT(); |
| 6357 | return 0; |
| 6358 | } |
| 6359 | |
| 6360 | /** |
| 6361 | * iw_get_auth() - get auth callback function |
| 6362 | * @dev: Pointer to the net device. |
| 6363 | * @info: Pointer to the iw_request_info. |
| 6364 | * @wrqu: Pointer to the iwreq_data. |
| 6365 | * @extra: Pointer to the data. |
| 6366 | * |
| 6367 | * Return: 0 for success, error number on failure. |
| 6368 | */ |
| 6369 | int iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6370 | union iwreq_data *wrqu, char *extra) |
| 6371 | { |
| 6372 | int ret; |
| 6373 | |
| 6374 | cds_ssr_protect(__func__); |
| 6375 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 6376 | cds_ssr_unprotect(__func__); |
| 6377 | |
| 6378 | return ret; |
| 6379 | } |
| 6380 | |
| 6381 | /** |
| 6382 | * __iw_set_ap_address() - set ap address |
| 6383 | * @dev: pointer to the net device |
| 6384 | * @info: pointer to the iw request info |
| 6385 | * @wrqu: pointer to iwreq_data |
| 6386 | * @extra: pointer to the data |
| 6387 | * |
| 6388 | * This function updates the HDD global station context connection info |
| 6389 | * BSSID with the MAC address received from the wpa_supplicant. |
| 6390 | * |
| 6391 | * Return: 0 on success, error number otherwise |
| 6392 | */ |
| 6393 | static int __iw_set_ap_address(struct net_device *dev, |
| 6394 | struct iw_request_info *info, |
| 6395 | union iwreq_data *wrqu, char *extra) |
| 6396 | { |
| 6397 | |
| 6398 | hdd_adapter_t *adapter; |
| 6399 | hdd_context_t *hdd_ctx; |
| 6400 | hdd_station_ctx_t *pHddStaCtx = |
| 6401 | WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 6402 | uint8_t *pMacAddress = NULL; |
| 6403 | int ret; |
| 6404 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6405 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6406 | |
| 6407 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6408 | |
| 6409 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6410 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6411 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6412 | return ret; |
| 6413 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6414 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6415 | if (0 != ret) |
| 6416 | return ret; |
| 6417 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6418 | pMacAddress = (uint8_t *) wrqu->ap_addr.sa_data; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6419 | hdd_debug(" " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMacAddress)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6420 | qdf_mem_copy(pHddStaCtx->conn_info.bssId.bytes, pMacAddress, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6421 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6422 | EXIT(); |
| 6423 | |
| 6424 | return 0; |
| 6425 | } |
| 6426 | |
| 6427 | /** |
| 6428 | * iw_set_ap_address() - set ap addresses callback function |
| 6429 | * @dev: Pointer to the net device. |
| 6430 | * @info: Pointer to the iw_request_info. |
| 6431 | * @wrqu: Pointer to the iwreq_data. |
| 6432 | * @extra: Pointer to the data. |
| 6433 | * |
| 6434 | * Return: 0 for success, error number on failure. |
| 6435 | */ |
| 6436 | int iw_set_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6437 | union iwreq_data *wrqu, char *extra) |
| 6438 | { |
| 6439 | int ret; |
| 6440 | |
| 6441 | cds_ssr_protect(__func__); |
| 6442 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 6443 | cds_ssr_unprotect(__func__); |
| 6444 | |
| 6445 | return ret; |
| 6446 | } |
| 6447 | |
| 6448 | /** |
| 6449 | * __iw_get_ap_address() - get ap address |
| 6450 | * @dev: pointer to the net device |
| 6451 | * @info: pointer to the iw request info |
| 6452 | * @wrqu: pointer to iwreq_data |
| 6453 | * @extra: pointer to the data |
| 6454 | * |
| 6455 | * This function returns currently associated BSSID. |
| 6456 | * |
| 6457 | * Return: 0 on success, error number otherwise |
| 6458 | */ |
| 6459 | static int __iw_get_ap_address(struct net_device *dev, |
| 6460 | struct iw_request_info *info, |
| 6461 | union iwreq_data *wrqu, char *extra) |
| 6462 | { |
| 6463 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6464 | hdd_context_t *hdd_ctx; |
| 6465 | hdd_station_ctx_t *pHddStaCtx = |
| 6466 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6467 | int ret; |
| 6468 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6469 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6470 | |
| 6471 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6472 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6473 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6474 | return ret; |
| 6475 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6476 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6477 | if (0 != ret) |
| 6478 | return ret; |
| 6479 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6480 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated || |
| 6481 | eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6482 | qdf_mem_copy(wrqu->ap_addr.sa_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6483 | pHddStaCtx->conn_info.bssId.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6484 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6485 | } else { |
| 6486 | memset(wrqu->ap_addr.sa_data, 0, sizeof(wrqu->ap_addr.sa_data)); |
| 6487 | } |
| 6488 | EXIT(); |
| 6489 | return 0; |
| 6490 | } |
| 6491 | |
| 6492 | /** |
| 6493 | * iw_get_ap_address() - get ap addresses callback function |
| 6494 | * @dev: Pointer to the net device. |
| 6495 | * @info: Pointer to the iw_request_info. |
| 6496 | * @wrqu: Pointer to the iwreq_data. |
| 6497 | * @extra: Pointer to the data. |
| 6498 | * |
| 6499 | * Return: 0 for success, error number on failure. |
| 6500 | */ |
| 6501 | int iw_get_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6502 | union iwreq_data *wrqu, char *extra) |
| 6503 | { |
| 6504 | int ret; |
| 6505 | |
| 6506 | cds_ssr_protect(__func__); |
| 6507 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 6508 | cds_ssr_unprotect(__func__); |
| 6509 | |
| 6510 | return ret; |
| 6511 | } |