DPDK patches and discussions
 help / color / mirror / Atom feed
From: Steve Yang <stevex.yang@intel.com>
To: dev@dpdk.org
Cc: yuying.zhang@intel.com, qi.z.zhang@intel.com,
	Steve Yang <stevex.yang@intel.com>
Subject: [PATCH v3] app/testpmd: support ddp dump command for ice
Date: Wed, 18 May 2022 06:58:06 +0000	[thread overview]
Message-ID: <20220518065806.1005694-1-stevex.yang@intel.com> (raw)
In-Reply-To: <20220512020618.474816-1-stevex.yang@intel.com>

Dump DDP runtime configure into a binary(package) file from ice PF port.

Add command line:
    ddp dump <port_id> <config_path>

Parameters:
    <port_id>       the PF Port ID
    <config_path>   dumped runtime configure file, if not a absolute path,
                    it will be dumped to testpmd running directory.

For example:
testpmd> ddp dump 0 current.pkg

If you want to dump ice VF DDP runtime configure, you need bind other
unused PF port of the NIC first, and then dump the PF's runtime configure
as target output.

Signed-off-by: Steve Yang <stevex.yang@intel.com>

---
v3: change git commit log
---
 app/test-pmd/cmdline.c   | 76 ++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/meson.build |  3 ++
 2 files changed, 79 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 6ffea8e21a..6282981ee9 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -60,6 +60,9 @@
 #ifdef RTE_NET_I40E
 #include <rte_pmd_i40e.h>
 #endif
+#ifdef RTE_NET_ICE
+#include <rte_pmd_ice.h>
+#endif
 #ifdef RTE_NET_BNXT
 #include <rte_pmd_bnxt.h>
 #endif
@@ -654,6 +657,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set link-down port (port_id)\n"
 			"	Set link down for a port.\n\n"
 
+			"ddp dump (port_id) (config_path)\n"
+			"    Dump a runtime configure on a port\n\n"
+
 			"ddp add (port_id) (profile_path[,backup_profile_path])\n"
 			"    Load a profile package on a port\n\n"
 
@@ -14471,6 +14477,75 @@ cmdline_parse_inst_t cmd_strict_link_prio = {
 	},
 };
 
+/* Dump device ddp package, only for ice PF */
+struct cmd_ddp_dump_result {
+	cmdline_fixed_string_t ddp;
+	cmdline_fixed_string_t add;
+	portid_t port_id;
+	char filepath[];
+};
+
+cmdline_parse_token_string_t cmd_ddp_dump_ddp =
+	TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, ddp, "ddp");
+cmdline_parse_token_string_t cmd_ddp_dump_dump =
+	TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, add, "dump");
+cmdline_parse_token_num_t cmd_ddp_dump_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_ddp_dump_result, port_id, RTE_UINT16);
+cmdline_parse_token_string_t cmd_ddp_dump_filepath =
+	TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, filepath, NULL);
+
+static void
+cmd_ddp_dump_parsed(
+	void *parsed_result,
+	__rte_unused struct cmdline *cl,
+	__rte_unused void *data)
+{
+	struct cmd_ddp_dump_result *res = parsed_result;
+	uint8_t *buff;
+	uint32_t size;
+	int ret = -ENOTSUP;
+
+#define ICE_BUFF_SIZE	0x000c9000
+	size = ICE_BUFF_SIZE;
+	buff = (uint8_t *)malloc(ICE_BUFF_SIZE);
+	if (buff) {
+#ifdef RTE_NET_ICE
+		ret = rte_pmd_ice_dump_package(res->port_id, &buff, &size);
+#endif
+		switch (ret) {
+		case 0:
+			save_file(res->filepath, buff, size);
+			break;
+		case -EINVAL:
+			fprintf(stderr, "Invalid buffer size\n");
+			break;
+		case -ENOTSUP:
+			fprintf(stderr,
+				"Device doesn't support "
+				"dump DDP runtime configure.\n");
+			break;
+		default:
+			fprintf(stderr,
+				"Failed to dump DDP runtime configure,"
+				" error: (%s)\n", strerror(-ret));
+		}
+	}
+	free(buff);
+}
+
+cmdline_parse_inst_t cmd_ddp_dump = {
+	.f = cmd_ddp_dump_parsed,
+	.data = NULL,
+	.help_str = "ddp dump <port_id> <config_path>",
+	.tokens = {
+		(void *)&cmd_ddp_dump_ddp,
+		(void *)&cmd_ddp_dump_dump,
+		(void *)&cmd_ddp_dump_port_id,
+		(void *)&cmd_ddp_dump_filepath,
+		NULL,
+	},
+};
+
 /* Load dynamic device personalization*/
 struct cmd_ddp_add_result {
 	cmdline_fixed_string_t ddp;
@@ -18025,6 +18100,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_ddp_del,
 	(cmdline_parse_inst_t *)&cmd_ddp_get_list,
 	(cmdline_parse_inst_t *)&cmd_ddp_get_info,
+	(cmdline_parse_inst_t *)&cmd_ddp_dump,
 	(cmdline_parse_inst_t *)&cmd_cfg_input_set,
 	(cmdline_parse_inst_t *)&cmd_clear_input_set,
 	(cmdline_parse_inst_t *)&cmd_show_vf_stats,
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 43130c8856..569e039bf7 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -67,6 +67,9 @@ endif
 if dpdk_conf.has('RTE_NET_I40E')
     deps += 'net_i40e'
 endif
+if dpdk_conf.has('RTE_NET_ICE')
+    deps += 'net_ice'
+endif
 if dpdk_conf.has('RTE_NET_IXGBE')
     deps += 'net_ixgbe'
 endif
-- 
2.27.0


  parent reply	other threads:[~2022-05-18  7:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11  8:02 [PATCH v1 0/2] ICE ddp download tool Steve Yang
2022-05-11  8:02 ` [PATCH v1 1/2] net/ice: support dump ice ddp package Steve Yang
2022-05-18  4:22   ` Zhang, Qi Z
2022-05-24  2:49     ` Zhang, Qi Z
2022-05-18 15:21   ` Stephen Hemminger
2022-05-11  8:02 ` [PATCH v1 2/2] app/testpmd: support dump_pkg command for ice Steve Yang
2022-05-18  4:32   ` Zhang, Qi Z
2022-05-12  2:06 ` [PATCH v2 0/2] ICE ddp download tool Steve Yang
2022-05-12  2:06   ` [PATCH v2 1/2] net/ice: support dump ice ddp package Steve Yang
2022-05-12  2:06   ` [PATCH v2 2/2] app/testpmd: support dump_pkg command for ice Steve Yang
2022-05-18  6:58   ` Steve Yang [this message]
2022-05-18 15:24     ` [PATCH v3] app/testpmd: support ddp dump " Stephen Hemminger
2022-05-19  8:14       ` Andrew Rybchenko
2022-05-19 12:12     ` David Marchand
2022-05-20  3:07       ` Zhang, Qi Z
2022-05-21  1:19         ` Zhang, Qi Z
2022-05-23  7:14           ` David Marchand
2022-06-09  7:39     ` [PATCH v4] net/ice: support dump DDP runtime configure Steve Yang
2022-06-09  8:40       ` Zhang, Qi Z
2022-06-10  1:16         ` Zhang, Qi Z
2022-06-10  1:14       ` [PATCH v5] " Steve Yang
2022-06-10  2:25         ` Zhang, Qi Z
2022-06-23 13:10           ` Thomas Monjalon
2022-06-23 13:13             ` Thomas Monjalon

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=20220518065806.1005694-1-stevex.yang@intel.com \
    --to=stevex.yang@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --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).