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