diff mbox series

[v2,13/47] iwlwifi: enable sending/setting debug host event

Message ID iwlwifi.20201209231352.a9dba2daca59.I2b18bccf0d409f1517c3e2841b667014f9dafc24@changeid (mailing list archive)
State Accepted
Commit 87f1283b6ae4c3e71ac6e8fe109904f8b888ffa7
Delegated to: Luca Coelho
Headers show
Series iwlwifi: final patches for v5.11 2020-12-09 | expand

Commit Message

Luca Coelho Dec. 9, 2020, 9:16 p.m. UTC
From: Mordechay Goodstein <mordechay.goodstein@intel.com>

This is used for BT node and for any user that wants to
control what events would be send from FW to the driver.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 .../net/wireless/intel/iwlwifi/fw/api/debug.h | 14 +++++++++
 .../net/wireless/intel/iwlwifi/fw/debugfs.c   | 29 +++++++++++++++++++
 2 files changed, 43 insertions(+)

Comments

Luca Coelho Dec. 9, 2020, 10:15 p.m. UTC | #1
Luca Coelho <luca@coelho.fi> wrote:

> From: Mordechay Goodstein <mordechay.goodstein@intel.com>
> 
> This is used for BT node and for any user that wants to
> control what events would be send from FW to the driver.
> 
> Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

21 patches applied to iwlwifi-next.git, thanks.

87f1283b6ae4 iwlwifi: enable sending/setting debug host event
861bae42e1f1 iwlwifi: avoid endless HW errors at assert time
52b155214be8 iwlwifi: mvm: remove the read_nvm from iwl_run_unified_mvm_ucode
cdaba917268d iwlwifi: follow the new inclusive terminology
d295a898c2f5 iwlwifi: fix typo in comment
7b2829f315d0 iwlwifi: sort out the NVM offsets
c6bae2169071 iwlwifi: mvm: iterate active stations when updating statistics
efc0ec5afb6e iwlwifi: validate MPDU length against notification length
df72138de4bc iwlwifi: pcie: validate RX descriptor length
59fa61f3fd4e iwlwifi: remove sw_csum_tx
e20a5c9f768b iwlwifi: mvm: clear up iwl_mvm_notify_rx_queue() argument type
cf5b46276847 iwlwifi: mvm: move iwl_mvm_stop_device() out of line
3fa965c2dd4e iwlwifi: pcie: change 12k A-MSDU config to use 16k buffers
9e8338ad17eb iwlwifi: mvm: fix 22000 series driver NMI
2f7a04c7b03b iwlwifi: mvm: do more useful queue sync accounting
94631b56422d iwlwifi: mvm: clean up scan state on failure
aa7fd94687b2 iwlwifi: pcie: remove MSIX_HW_INT_CAUSES_REG_IML handling
97b4f859543d iwlwifi: fw: file: fix documentation for SAR flag
69d6cfc491f0 iwlwifi: pcie: remove unnecessary setting of inta_mask
152fdc0f6988 iwlwifi: trans: consider firmware dead after errors
58a1c9f9a9b6 iwlwifi: dbg-tlv: fix old length in is_trig_data_contained()
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/debug.h b/drivers/net/wireless/intel/iwlwifi/fw/api/debug.h
index 94b1a1268476..48d7c8485e3f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/debug.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/debug.h
@@ -78,6 +78,12 @@  enum iwl_debug_cmds {
 	 * &struct iwl_dbg_mem_access_rsp
 	 */
 	UMAC_RD_WR = 0x1,
+	/**
+	 * @HOST_EVENT_CFG:
+	 * updates the enabled event severities
+	 * &struct iwl_dbg_host_event_cfg_cmd
+	 */
+	HOST_EVENT_CFG = 0x3,
 	/**
 	 * @DBGC_SUSPEND_RESUME:
 	 * DBGC suspend/resume commad. Uses a single dword as data:
@@ -395,4 +401,12 @@  struct iwl_buf_alloc_cmd {
 	struct iwl_buf_alloc_frag frags[BUF_ALLOC_MAX_NUM_FRAGS];
 } __packed; /* BUFFER_ALLOCATION_CMD_API_S_VER_2 */
 
+/**
+ * struct iwl_dbg_host_event_cfg_cmd
+ * @enabled_severities: enabled severities
+ */
+struct iwl_dbg_host_event_cfg_cmd {
+	__le32 enabled_severities;
+} __packed; /* DEBUG_HOST_EVENT_CFG_CMD_API_S_VER_1 */
+
 #endif /* __iwl_fw_api_debug_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
index 267ad4eddb5c..ce1186068f2d 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
@@ -200,6 +200,34 @@  static int iwl_fw_send_timestamp_marker_cmd(struct iwl_fw_runtime *fwrt)
 	return iwl_trans_send_cmd(fwrt->trans, &hcmd);
 }
 
+static int iwl_dbgfs_enabled_severities_write(struct iwl_fw_runtime *fwrt,
+					      char *buf, size_t count)
+{
+	struct iwl_dbg_host_event_cfg_cmd event_cfg;
+	struct iwl_host_cmd hcmd = {
+		.id = iwl_cmd_id(HOST_EVENT_CFG, DEBUG_GROUP, 0),
+		.flags = CMD_ASYNC,
+		.data[0] = &event_cfg,
+		.len[0] = sizeof(event_cfg),
+	};
+	u32 enabled_severities;
+	int ret = kstrtou32(buf, 10, &enabled_severities);
+
+	if (ret < 0)
+		return ret;
+
+	event_cfg.enabled_severities = cpu_to_le32(enabled_severities);
+
+	ret = iwl_trans_send_cmd(fwrt->trans, &hcmd);
+	IWL_INFO(fwrt,
+		 "sent host event cfg with enabled_severities: %u, ret: %d\n",
+		 enabled_severities, ret);
+
+	return ret ?: count;
+}
+
+FWRT_DEBUGFS_WRITE_FILE_OPS(enabled_severities, 16);
+
 static void iwl_fw_timestamp_marker_wk(struct work_struct *work)
 {
 	int ret;
@@ -431,5 +459,6 @@  void iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt,
 	FWRT_DEBUGFS_ADD_FILE(timestamp_marker, dbgfs_dir, 0200);
 	FWRT_DEBUGFS_ADD_FILE(fw_info, dbgfs_dir, 0200);
 	FWRT_DEBUGFS_ADD_FILE(send_hcmd, dbgfs_dir, 0200);
+	FWRT_DEBUGFS_ADD_FILE(enabled_severities, dbgfs_dir, 0200);
 	FWRT_DEBUGFS_ADD_FILE(fw_dbg_domain, dbgfs_dir, 0400);
 }