diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 1bc03e75936e..e7ec3a87528c 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -169,7 +169,8 @@ #define g_mode_rates_size (12) #define a_mode_rates_size (8) - +#define DRIVER_DISCONNECT_REASON_INDEX \ + QCA_NL80211_VENDOR_SUBCMD_DRIVER_DISCONNECT_REASON_INDEX /** * rtt_is_initiator - Macro to check if the bitmap has any RTT roles set * @bitmap: The bitmap to be checked @@ -1700,6 +1701,10 @@ static const struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = .vendor_id = QCA_NL80211_VENDOR_ID, .subcmd = QCA_NL80211_VENDOR_SUBCMD_UPDATE_STA_INFO, }, + [QCA_NL80211_VENDOR_SUBCMD_DRIVER_DISCONNECT_REASON_INDEX] = { + .vendor_id = QCA_NL80211_VENDOR_ID, + .subcmd = QCA_NL80211_VENDOR_SUBCMD_DRIVER_DISCONNECT_REASON, + }, #ifdef WLAN_SUPPORT_TWT FEATURE_TWT_VENDOR_EVENTS #endif @@ -22146,6 +22151,9 @@ wlan_hdd_cfg80211_indicate_disconnect(struct hdd_adapter *adapter, uint16_t disconnect_ies_len) { enum ieee80211_reasoncode ieee80211_reason; + struct sk_buff *vendor_event; + int flags; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); ieee80211_reason = wlan_hdd_get_cfg80211_disconnect_reason(adapter, reason); @@ -22155,6 +22163,26 @@ wlan_hdd_cfg80211_indicate_disconnect(struct hdd_adapter *adapter, adapter->last_disconnect_reason, hdd_qca_reason_to_str(adapter->last_disconnect_reason), locally_generated); + + flags = cds_get_gfp_flags(); + vendor_event = + cfg80211_vendor_event_alloc( + hdd_ctx->wiphy, &(adapter->wdev), NLMSG_HDRLEN + + sizeof(adapter->last_disconnect_reason) + + NLMSG_HDRLEN, DRIVER_DISCONNECT_REASON_INDEX, flags); + if (!vendor_event) { + hdd_err("cfg80211_vendor_event_alloc failed"); + return; + } + + if (nla_put_u32(vendor_event, DISCONNECT_REASON, + adapter->last_disconnect_reason)) { + hdd_err("DISCONNECT_REASON put fail"); + kfree_skb(vendor_event); + goto send_disconnect; + } + cfg80211_vendor_event(vendor_event, flags); +send_disconnect: cfg80211_disconnected(adapter->dev, ieee80211_reason, disconnect_ies, disconnect_ies_len, locally_generated, GFP_KERNEL); diff --git a/core/hdd/src/wlan_hdd_sta_info.h b/core/hdd/src/wlan_hdd_sta_info.h index 20d0152e89b0..1412688a5b73 100644 --- a/core/hdd/src/wlan_hdd_sta_info.h +++ b/core/hdd/src/wlan_hdd_sta_info.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -38,6 +39,9 @@ /* Opaque handle for abstraction */ #define hdd_sta_info_entry qdf_list_node_t +#define DISCONNECT_REASON \ + QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_DRIVER_DISCONNECT_REASON + /** * struct dhcp_phase - Per Peer DHCP Phases * @DHCP_PHASE_ACK: upon receiving DHCP_ACK/NAK message in REQUEST phase or diff --git a/core/hdd/src/wlan_hdd_station_info.c b/core/hdd/src/wlan_hdd_station_info.c index b948e7ad2b45..ca95b647404b 100644 --- a/core/hdd/src/wlan_hdd_station_info.c +++ b/core/hdd/src/wlan_hdd_station_info.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -135,8 +135,6 @@ QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_REMOTE_RX_RETRY_COUNT #define REMOTE_RX_BC_MC_COUNT \ QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_REMOTE_RX_BC_MC_COUNT -#define DISCONNECT_REASON \ - QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_DRIVER_DISCONNECT_REASON #define BEACON_IES \ QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_BEACON_IES #define ASSOC_REQ_IES \