From: Catherine Sullivan <catherine.sullivan@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [net-next S3 08/13] i40e: enable user dump of internal hardware state
Date: Tue, 7 Apr 2015 19:45:37 -0400 [thread overview]
Message-ID: <1428450342-48517-8-git-send-email-catherine.sullivan@intel.com> (raw)
In-Reply-To: <1428450342-48517-1-git-send-email-catherine.sullivan@intel.com>
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
This is a feature to enable better debugging of user reported issues by
allowing a bash script to acquire information about the internal hardware
state. The data output to the kernel log is collected by the script and can
then be sent to Intel. This is a critical debugging feature for helping us
interpret and reproduce complex customer setups.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Change-ID: Ie8b3ab09086d6870a709015f51ada05af10b41bb
---
drivers/net/ethernet/intel/i40e/i40e_common.c | 57 ++++++++++++++++++++++++
drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 45 +++++++++++++++++++
drivers/net/ethernet/intel/i40e/i40e_prototype.h | 5 +++
3 files changed, 107 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index 44dc4b1..ce522d7 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -3506,6 +3506,63 @@ void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status)
}
/**
+ * i40e_aq_debug_dump
+ * @hw: pointer to the hardware structure
+ * @cluster_id: specific cluster to dump
+ * @table_id: table id within cluster
+ * @start_index: index of line in the block to read
+ * @buff_size: dump buffer size
+ * @buff: dump buffer
+ * @ret_buff_size: actual buffer size returned
+ * @ret_next_table: next block to read
+ * @ret_next_index: next index to read
+ *
+ * Dump internal FW/HW data for debug purposes.
+ *
+ **/
+i40e_status i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
+ u8 table_id, u32 start_index, u16 buff_size,
+ void *buff, u16 *ret_buff_size,
+ u8 *ret_next_table, u32 *ret_next_index,
+ struct i40e_asq_cmd_details *cmd_details)
+{
+ struct i40e_aq_desc desc;
+ struct i40e_aqc_debug_dump_internals *cmd =
+ (struct i40e_aqc_debug_dump_internals *)&desc.params.raw;
+ struct i40e_aqc_debug_dump_internals *resp =
+ (struct i40e_aqc_debug_dump_internals *)&desc.params.raw;
+ i40e_status status;
+
+ if (buff_size == 0 || !buff)
+ return I40E_ERR_PARAM;
+
+ i40e_fill_default_direct_cmd_desc(&desc,
+ i40e_aqc_opc_debug_dump_internals);
+ /* Indirect Command */
+ desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_BUF);
+ if (buff_size > I40E_AQ_LARGE_BUF)
+ desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
+
+ cmd->cluster_id = cluster_id;
+ cmd->table_id = table_id;
+ cmd->idx = cpu_to_le32(start_index);
+
+ desc.datalen = cpu_to_le16(buff_size);
+
+ status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
+ if (!status) {
+ if (ret_buff_size)
+ *ret_buff_size = le16_to_cpu(desc.datalen);
+ if (ret_next_table)
+ *ret_next_table = resp->table_id;
+ if (ret_next_index)
+ *ret_next_index = le32_to_cpu(resp->idx);
+ }
+
+ return status;
+}
+
+/**
* i40e_read_bw_from_alt_ram
* @hw: pointer to the hardware structure
* @max_bw: pointer for max_bw read
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index daa8826..34170ea 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -1388,6 +1388,50 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
r_cfg->app[i].selector,
r_cfg->app[i].protocolid);
}
+ } else if (strncmp(&cmd_buf[5], "debug fwdata", 12) == 0) {
+ int cluster_id, table_id;
+ int index, ret;
+ u16 buff_len = 4096;
+ u32 next_index;
+ u8 next_table;
+ u8 *buff;
+ u16 rlen;
+
+ cnt = sscanf(&cmd_buf[18], "%i %i %i",
+ &cluster_id, &table_id, &index);
+ if (cnt != 3) {
+ dev_info(&pf->pdev->dev,
+ "dump debug fwdata <cluster_id> <table_id> <index>\n");
+ goto command_write_done;
+ }
+
+ dev_info(&pf->pdev->dev,
+ "AQ debug dump fwdata params %x %x %x %x\n",
+ cluster_id, table_id, index, buff_len);
+ buff = kzalloc(buff_len, GFP_KERNEL);
+ if (!buff)
+ goto command_write_done;
+
+ ret = i40e_aq_debug_dump(&pf->hw, cluster_id, table_id,
+ index, buff_len, buff, &rlen,
+ &next_table, &next_index,
+ NULL);
+ if (ret) {
+ dev_info(&pf->pdev->dev,
+ "debug dump fwdata AQ Failed %d 0x%x\n",
+ ret, pf->hw.aq.asq_last_status);
+ kfree(buff);
+ buff = NULL;
+ goto command_write_done;
+ }
+ dev_info(&pf->pdev->dev,
+ "AQ debug dump fwdata rlen=0x%x next_table=0x%x next_index=0x%x\n",
+ rlen, next_table, next_index);
+ print_hex_dump(KERN_INFO, "AQ buffer WB: ",
+ DUMP_PREFIX_OFFSET, 16, 1,
+ buff, rlen, true);
+ kfree(buff);
+ buff = NULL;
} else {
dev_info(&pf->pdev->dev,
"dump desc tx <vsi_seid> <ring_id> [<desc_n>], dump desc rx <vsi_seid> <ring_id> [<desc_n>],\n");
@@ -1903,6 +1947,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
dev_info(&pf->pdev->dev, " dump desc rx <vsi_seid> <ring_id> [<desc_n>]\n");
dev_info(&pf->pdev->dev, " dump desc aq\n");
dev_info(&pf->pdev->dev, " dump reset stats\n");
+ dev_info(&pf->pdev->dev, " dump debug fwdata <cluster_id> <table_id> <index>\n");
dev_info(&pf->pdev->dev, " msg_enable [level]\n");
dev_info(&pf->pdev->dev, " read <reg>\n");
dev_info(&pf->pdev->dev, " write <reg> <value>\n");
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
index fea0d37..7b34f1e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
@@ -303,4 +303,9 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw,
u16 vsi_seid, u16 queue, bool is_add,
struct i40e_control_filter_stats *stats,
struct i40e_asq_cmd_details *cmd_details);
+i40e_status i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
+ u8 table_id, u32 start_index, u16 buff_size,
+ void *buff, u16 *ret_buff_size,
+ u8 *ret_next_table, u32 *ret_next_index,
+ struct i40e_asq_cmd_details *cmd_details);
#endif /* _I40E_PROTOTYPE_H_ */
--
1.9.3
next prev parent reply other threads:[~2015-04-07 23:45 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 23:45 [Intel-wired-lan] [net-next S3 01/13] i40evf: fix bad indentation Catherine Sullivan
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 02/13] i40e: Add support to program FDir SB rules for VF from PF through ethtool Catherine Sullivan
2015-04-07 23:53 ` Jeff Kirsher
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 03/13] i40evf: remove aq_pending Catherine Sullivan
2015-04-07 23:53 ` Jeff Kirsher
2015-04-14 15:31 ` Young, James M
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 04/13] i40e: notify VFs of link state Catherine Sullivan
2015-04-07 23:53 ` Jeff Kirsher
2015-04-14 15:35 ` Young, James M
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 05/13] i40e: move VF notification routines up Catherine Sullivan
2015-04-07 23:54 ` Jeff Kirsher
2015-04-14 15:32 ` Young, James M
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 06/13] i40e: For VF reset (VFR and VFLR) add some more delay Catherine Sullivan
2015-04-07 23:54 ` Jeff Kirsher
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 07/13] i40e: print FCoE capability reported by the device function Catherine Sullivan
2015-04-07 23:54 ` Jeff Kirsher
2015-04-14 16:40 ` Young, James M
2015-04-07 23:45 ` Catherine Sullivan [this message]
2015-04-07 23:58 ` [Intel-wired-lan] [net-next S3 08/13] i40e: enable user dump of internal hardware state Jeff Kirsher
2015-04-14 15:33 ` Young, James M
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 09/13] i40e/i40evf: Save WR_CSR_PROT field from DEV/FUNC capabilities Catherine Sullivan
2015-04-07 23:58 ` Jeff Kirsher
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 10/13] i40e: handle possible memory allocation failure Catherine Sullivan
2015-04-07 23:58 ` Jeff Kirsher
2015-04-14 15:36 ` Young, James M
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 11/13] i40e: get rid of unused locals Catherine Sullivan
2015-04-07 23:59 ` Jeff Kirsher
2015-04-14 15:34 ` Young, James M
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 12/13] i40e: Use new 40G speeds Catherine Sullivan
2015-04-08 0:02 ` Jeff Kirsher
2015-04-14 15:34 ` Young, James M
2015-04-07 23:45 ` [Intel-wired-lan] [net-next S3 13/13] i40e: Bump version to 1.3.2 Catherine Sullivan
2015-04-07 23:59 ` Jeff Kirsher
2015-04-14 15:34 ` Young, James M
2015-04-07 23:52 ` [Intel-wired-lan] [net-next S3 01/13] i40evf: fix bad indentation Jeff Kirsher
2015-04-08 1:37 ` Alexander Duyck
2015-04-08 1:45 ` Jeff Kirsher
2015-04-13 21:10 ` Young, James M
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428450342-48517-8-git-send-email-catherine.sullivan@intel.com \
--to=catherine.sullivan@intel.com \
--cc=intel-wired-lan@osuosl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).