qcacld-3.0: Send driver disconnect internal reason code to user space

Send the driver disconnect internal reason code as an event to user space
using QCA_NL80211_VENDOR_SUBCMD_DRIVER_DISCONNECT_REASON vendor command.

Change-Id: I19959e097c5709d63fbd941583b934e291c3af1c
CRs-Fixed: 3371396
This commit is contained in:
Krupali Dhanvijay 2022-12-27 22:49:59 +05:30 • committed by Madan Koyyalamudi
commit db7294ed01
3 changed files with 34 additions and 4 deletions

View file

@ -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);

View file

@ -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

View file

@ -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 \