DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
	Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>
Cc: <dev@dpdk.org>
Subject: [PATCH] app/testpmd: support dump ethdev private cmd
Date: Tue, 14 Mar 2023 11:50:35 +0000	[thread overview]
Message-ID: <20230314115035.33356-1-fengchengwen@huawei.com> (raw)

This patch adds 'dump_eth_priv [port_id]' which could used to dump
the specific ethdev port private info.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 app/test-pmd/cmdline.c                      | 43 +++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 ++++
 2 files changed, 50 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 6fa870dc32..3ac7e78aff 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -8439,6 +8439,48 @@ static cmdline_parse_inst_t cmd_dump_one = {
 	},
 };
 
+/* ******************************************************************************** */
+
+struct cmd_dump_eth_priv_result {
+	cmdline_fixed_string_t dump;
+	portid_t port_id;
+};
+
+static cmdline_parse_token_string_t cmd_dump_eth_priv_dump =
+	TOKEN_STRING_INITIALIZER(struct cmd_dump_one_result, dump,
+				 "dump_eth_priv");
+static cmdline_parse_token_num_t cmd_dump_eth_priv_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_dump_eth_priv_result,
+			      port_id, RTE_UINT16);
+
+static void cmd_dump_eth_priv_parsed(void *parsed_result, struct cmdline *cl,
+				     __rte_unused void *data)
+{
+	struct cmd_dump_eth_priv_result *res = parsed_result;
+	int ret;
+
+	if (!rte_eth_dev_is_valid_port(res->port_id)) {
+		cmdline_printf(cl, "Invalid port id %u\n", res->port_id);
+		return;
+	}
+
+	ret = rte_eth_dev_priv_dump(res->port_id, stdout);
+	if (ret < 0)
+		cmdline_printf(cl, "Failed to dump port id %u private info with error (%d): %s\n",
+			       res->port_id, ret, strerror(-ret));
+}
+
+static cmdline_parse_inst_t cmd_dump_eth_priv = {
+	.f = cmd_dump_eth_priv_parsed,  /* function to call */
+	.data = NULL,      /* 2nd arg of func */
+	.help_str = "dump_eth_priv <port_id>: Dump one ethdev port private info",
+	.tokens = {        /* token list, NULL terminated */
+		(void *)&cmd_dump_eth_priv_dump,
+		(void *)&cmd_dump_eth_priv_port_id,
+		NULL,
+	},
+};
+
 /* *** Filters Control *** */
 
 #define IPV4_ADDR_TO_UINT(ip_addr, ip) \
@@ -12854,6 +12896,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs,
 	(cmdline_parse_inst_t *)&cmd_dump,
 	(cmdline_parse_inst_t *)&cmd_dump_one,
+	(cmdline_parse_inst_t *)&cmd_dump_eth_priv,
 	(cmdline_parse_inst_t *)&cmd_flow,
 	(cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 8f23847859..211f41f86d 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -605,6 +605,13 @@ Dumps the log level for all the dpdk modules::
 
    testpmd> dump_log_types
 
+dump ethdev private
+~~~~~~~~~~~~~~~~~~~
+
+Dumps the specific ethdev port private info::
+
+   testpmd> dump_eth_priv [port_id]
+
 show (raw_encap|raw_decap)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.17.1


             reply	other threads:[~2023-03-14 11:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 11:50 Chengwen Feng [this message]
2023-03-14 13:45 ` Ferruh Yigit
2023-03-15  2:02   ` fengchengwen
2023-03-15  2:33 ` [PATCH] app/testpmd: dump private info in 'show port info' Chengwen Feng
2023-03-15  8:28   ` Singh, Aman Deep
2023-03-15 10:12   ` Ferruh Yigit
2023-03-16  1:10     ` fengchengwen
2023-03-16  7:55       ` Thomas Monjalon
2023-03-16  9:39         ` fengchengwen
2023-03-16  9:19       ` Dmitry Kozlyuk
2023-03-16  9:43         ` fengchengwen
2023-03-16 10:46         ` Ferruh Yigit
2023-03-16 15:16           ` Thomas Monjalon
2023-03-16  9:32 ` [PATCH v2] " Chengwen Feng
2023-03-16 11:42   ` Ferruh Yigit

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=20230314115035.33356-1-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=thomas@monjalon.net \
    --cc=yuying.zhang@intel.com \
    /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).