wlan: Support to enhance debug framework
Propagation from qcacld-2.0 to prima.
Add interface to provide information on supported logger
features when requested by the user space application.
Change-Id: If70001d431ffc63d54398107bbc685a55cae5011
CRs-Fixed: 2191452
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 9f32185..8f8de37 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -8519,6 +8519,93 @@
return ret;
}
#endif /* WLAN_FEATURE_APFIND */
+
+/**
+ * __wlan_hdd_cfg80211_get_logger_supp_feature() - Get the wifi logger features
+ * @wiphy: pointer to wireless wiphy structure.
+ * @wdev: pointer to wireless_dev structure.
+ * @data: Pointer to the data to be passed via vendor interface
+ * @data_len:Length of the data to be passed
+ *
+ * This is called by userspace to know the supported logger features
+ *
+ * Return: Return the Success or Failure code.
+ */
+static int
+__wlan_hdd_cfg80211_get_logger_supp_feature(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data, int data_len)
+{
+ hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
+ int status;
+ uint32_t features;
+ struct sk_buff *reply_skb = NULL;
+
+ if (VOS_FTM_MODE == hdd_get_conparam()) {
+ hddLog(LOGE, FL("Command not allowed in FTM mode"));
+ return -EINVAL;
+ }
+
+ status = wlan_hdd_validate_context(hdd_ctx);
+ if (0 != status)
+ return -EINVAL;
+
+ features = 0;
+
+ if (hdd_is_memdump_supported())
+ features |= WIFI_LOGGER_MEMORY_DUMP_SUPPORTED;
+
+ if (hdd_ctx->cfg_ini->wlanLoggingEnable &&
+ hdd_ctx->cfg_ini->enableFatalEvent &&
+ hdd_ctx->is_fatal_event_log_sup) {
+ features |= WIFI_LOGGER_PER_PACKET_TX_RX_STATUS_SUPPORTED;
+ features |= WIFI_LOGGER_CONNECT_EVENT_SUPPORTED;
+ }
+
+ reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+ sizeof(uint32_t) + NLA_HDRLEN + NLMSG_HDRLEN);
+ if (!reply_skb) {
+ hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
+ return -ENOMEM;
+ }
+
+ hddLog(LOG1, FL("Supported logger features: 0x%0x"), features);
+ if (nla_put_u32(reply_skb, QCA_WLAN_VENDOR_ATTR_LOGGER_SUPPORTED,
+ features)) {
+ hddLog(LOGE, FL("nla put fail"));
+ kfree_skb(reply_skb);
+ return -EINVAL;
+ }
+
+ return cfg80211_vendor_cmd_reply(reply_skb);
+}
+
+/**
+ * wlan_hdd_cfg80211_get_logger_supp_feature() - Get the wifi logger features
+ * @wiphy: pointer to wireless wiphy structure.
+ * @wdev: pointer to wireless_dev structure.
+ * @data: Pointer to the data to be passed via vendor interface
+ * @data_len:Length of the data to be passed
+ *
+ * This is called by userspace to know the supported logger features
+ *
+ * Return: Return the Success or Failure code.
+ */
+static int
+wlan_hdd_cfg80211_get_logger_supp_feature(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data, int data_len)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __wlan_hdd_cfg80211_get_logger_supp_feature(wiphy, wdev,
+ data, data_len);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] =
{
{
@@ -8782,6 +8869,14 @@
WIPHY_VENDOR_CMD_NEED_RUNNING,
.doit = hdd_cfg80211_get_station_cmd
},
+ {
+ .info.vendor_id = QCA_NL80211_VENDOR_ID,
+ .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_LOGGER_FEATURE_SET,
+ .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
+ WIPHY_VENDOR_CMD_NEED_NETDEV |
+ WIPHY_VENDOR_CMD_NEED_RUNNING,
+ .doit = wlan_hdd_cfg80211_get_logger_supp_feature
+ },
};
/* vendor specific events */