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