aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Williams <mitch.a.williams@intel.com>2017-04-12 07:16:52 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2017-04-19 19:38:23 -0400
commit3118025a070f3346a3f23cbb8e9039ff567a6c46 (patch)
treef55f17c465500d67d271186adbf89e1ef20c727f
parent0e626ff7ccbfc43c6cc4aeea611c40b899682382 (diff)
i40e: dump VF information in debugfs
Dump some internal state about VFs through debugfs. This provides information not available with 'ip link show'. To use, write "dump vf <id>" to the command file, or just "dump vf" to dump information on all of the VFs. Change-ID: Ibe32b7f4ae55d4358c0b903217475f708ada1ecd Signed-off-by: Mitch Williams <mitch.a.williams@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index c5f68cc1edcd..a3d7ec62b76c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -384,6 +384,8 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
384 " base_queue = %d, num_queue_pairs = %d, num_desc = %d\n", 384 " base_queue = %d, num_queue_pairs = %d, num_desc = %d\n",
385 vsi->base_queue, vsi->num_queue_pairs, vsi->num_desc); 385 vsi->base_queue, vsi->num_queue_pairs, vsi->num_desc);
386 dev_info(&pf->pdev->dev, " type = %i\n", vsi->type); 386 dev_info(&pf->pdev->dev, " type = %i\n", vsi->type);
387 if (vsi->type == I40E_VSI_SRIOV)
388 dev_info(&pf->pdev->dev, " VF ID = %i\n", vsi->vf_id);
387 dev_info(&pf->pdev->dev, 389 dev_info(&pf->pdev->dev,
388 " info: valid_sections = 0x%04x, switch_id = 0x%04x\n", 390 " info: valid_sections = 0x%04x, switch_id = 0x%04x\n",
389 vsi->info.valid_sections, vsi->info.switch_id); 391 vsi->info.valid_sections, vsi->info.switch_id);
@@ -694,6 +696,47 @@ static void i40e_dbg_dump_veb_all(struct i40e_pf *pf)
694 } 696 }
695} 697}
696 698
699/**
700 * i40e_dbg_dump_vf - dump VF info
701 * @pf: the i40e_pf created in command write
702 * @vf_id: the vf_id from the user
703 **/
704static void i40e_dbg_dump_vf(struct i40e_pf *pf, int vf_id)
705{
706 struct i40e_vf *vf;
707 struct i40e_vsi *vsi;
708
709 if (!pf->num_alloc_vfs) {
710 dev_info(&pf->pdev->dev, "no VFs allocated\n");
711 } else if ((vf_id >= 0) && (vf_id < pf->num_alloc_vfs)) {
712 vf = &pf->vf[vf_id];
713 vsi = pf->vsi[vf->lan_vsi_idx];
714 dev_info(&pf->pdev->dev, "vf %2d: VSI id=%d, seid=%d, qps=%d\n",
715 vf_id, vf->lan_vsi_id, vsi->seid, vf->num_queue_pairs);
716 dev_info(&pf->pdev->dev, " num MDD=%lld, invalid msg=%lld, valid msg=%lld\n",
717 vf->num_mdd_events,
718 vf->num_invalid_msgs,
719 vf->num_valid_msgs);
720 } else {
721 dev_info(&pf->pdev->dev, "invalid VF id %d\n", vf_id);
722 }
723}
724
725/**
726 * i40e_dbg_dump_vf_all - dump VF info for all VFs
727 * @pf: the i40e_pf created in command write
728 **/
729static void i40e_dbg_dump_vf_all(struct i40e_pf *pf)
730{
731 int i;
732
733 if (!pf->num_alloc_vfs)
734 dev_info(&pf->pdev->dev, "no VFs enabled!\n");
735 else
736 for (i = 0; i < pf->num_alloc_vfs; i++)
737 i40e_dbg_dump_vf(pf, i);
738}
739
697#define I40E_MAX_DEBUG_OUT_BUFFER (4096*4) 740#define I40E_MAX_DEBUG_OUT_BUFFER (4096*4)
698/** 741/**
699 * i40e_dbg_command_write - write into command datum 742 * i40e_dbg_command_write - write into command datum
@@ -712,6 +755,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
712 struct i40e_vsi *vsi; 755 struct i40e_vsi *vsi;
713 int vsi_seid; 756 int vsi_seid;
714 int veb_seid; 757 int veb_seid;
758 int vf_id;
715 int cnt; 759 int cnt;
716 760
717 /* don't allow partial writes */ 761 /* don't allow partial writes */
@@ -914,6 +958,12 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
914 i40e_dbg_dump_veb_seid(pf, vsi_seid); 958 i40e_dbg_dump_veb_seid(pf, vsi_seid);
915 else 959 else
916 i40e_dbg_dump_veb_all(pf); 960 i40e_dbg_dump_veb_all(pf);
961 } else if (strncmp(&cmd_buf[5], "vf", 2) == 0) {
962 cnt = sscanf(&cmd_buf[7], "%i", &vf_id);
963 if (cnt > 0)
964 i40e_dbg_dump_vf(pf, vf_id);
965 else
966 i40e_dbg_dump_vf_all(pf);
917 } else if (strncmp(&cmd_buf[5], "desc", 4) == 0) { 967 } else if (strncmp(&cmd_buf[5], "desc", 4) == 0) {
918 int ring_id, desc_n; 968 int ring_id, desc_n;
919 if (strncmp(&cmd_buf[10], "rx", 2) == 0) { 969 if (strncmp(&cmd_buf[10], "rx", 2) == 0) {
@@ -1109,6 +1159,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1109 dev_info(&pf->pdev->dev, "dump vsi [seid]\n"); 1159 dev_info(&pf->pdev->dev, "dump vsi [seid]\n");
1110 dev_info(&pf->pdev->dev, "dump reset stats\n"); 1160 dev_info(&pf->pdev->dev, "dump reset stats\n");
1111 dev_info(&pf->pdev->dev, "dump port\n"); 1161 dev_info(&pf->pdev->dev, "dump port\n");
1162 dev_info(&pf->pdev->dev, "dump vf [vf_id]\n");
1112 dev_info(&pf->pdev->dev, 1163 dev_info(&pf->pdev->dev,
1113 "dump debug fwdata <cluster_id> <table_id> <index>\n"); 1164 "dump debug fwdata <cluster_id> <table_id> <index>\n");
1114 } 1165 }