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