DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrey Chilikin <andrey.chilikin@intel.com>
To: dev@dpdk.org
Cc: beilei.xing@intel.com, jingjing.wu@intel.com,
	Andrey Chilikin <andrey.chilikin@intel.com>
Subject: [dpdk-dev] [PATCH v3 2/2] app/testpmd: enable ddp remove profile feature
Date: Tue, 27 Jun 2017 14:35:13 +0100	[thread overview]
Message-ID: <1498570513-8592-3-git-send-email-andrey.chilikin@intel.com> (raw)
In-Reply-To: <1498570513-8592-1-git-send-email-andrey.chilikin@intel.com>
In-Reply-To: <1495901077-11845-1-git-send-email-andrey.chilikin@intel.com>

New command 'ddp del (port) (profile_path)' removes previously
loaded profile and deletes it from the list of the loaded profiles.

Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
 app/test-pmd/cmdline.c                      | 74 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 +++
 2 files changed, 81 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 632d6f03f..425ffccb9 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -606,6 +606,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"ddp add (port_id) (profile_path)\n"
 			"    Load a profile package on a port\n\n"
 
+			"ddp del (port_id) (profile_path)\n"
+			"    Delete a profile package from a port\n\n"
+
 			"ptype mapping get (port_id) (valid_only)\n"
 			"    Get ptype mapping on a port\n\n"
 
@@ -12999,6 +13002,76 @@ cmdline_parse_inst_t cmd_ddp_add = {
 	},
 };
 
+/* Delete dynamic device personalization*/
+struct cmd_ddp_del_result {
+	cmdline_fixed_string_t ddp;
+	cmdline_fixed_string_t del;
+	uint8_t port_id;
+	char filepath[];
+};
+
+cmdline_parse_token_string_t cmd_ddp_del_ddp =
+	TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, ddp, "ddp");
+cmdline_parse_token_string_t cmd_ddp_del_del =
+	TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, del, "del");
+cmdline_parse_token_num_t cmd_ddp_del_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_ddp_del_result, port_id, UINT8);
+cmdline_parse_token_string_t cmd_ddp_del_filepath =
+	TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, filepath, NULL);
+
+static void
+cmd_ddp_del_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_ddp_del_result *res = parsed_result;
+	uint8_t *buff;
+	uint32_t size;
+	int ret = -ENOTSUP;
+
+	if (res->port_id > nb_ports) {
+		printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
+		return;
+	}
+
+	if (!all_ports_stopped()) {
+		printf("Please stop all ports first\n");
+		return;
+	}
+
+	buff = open_ddp_package_file(res->filepath, &size);
+	if (!buff)
+		return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_i40e_process_ddp_package(res->port_id,
+					       buff, size,
+					       RTE_PMD_I40E_PKG_OP_WR_DEL);
+#endif
+
+	if (ret == -EACCES)
+		printf("Profile does not exist.\n");
+	else if (ret < 0)
+		printf("Failed to delete profile.\n");
+
+	close_ddp_package_file(buff);
+}
+
+cmdline_parse_inst_t cmd_ddp_del = {
+	.f = cmd_ddp_del_parsed,
+	.data = NULL,
+	.help_str = "ddp del <port_id> <profile_path>",
+	.tokens = {
+		(void *)&cmd_ddp_del_ddp,
+		(void *)&cmd_ddp_del_del,
+		(void *)&cmd_ddp_del_port_id,
+		(void *)&cmd_ddp_del_filepath,
+		NULL,
+	},
+};
+
 /* Get dynamic device personalization profile info */
 struct cmd_ddp_info_result {
 	cmdline_fixed_string_t ddp;
@@ -13978,6 +14051,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_strict_link_prio,
 	(cmdline_parse_inst_t *)&cmd_tc_min_bw,
 	(cmdline_parse_inst_t *)&cmd_ddp_add,
+	(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_show_vf_stats,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 18ee8a3fe..76809b859 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1232,6 +1232,13 @@ Load a dynamic device personalization (DDP) package::
 
    testpmd> ddp add (port_id) (package_path)
 
+ddp del
+~~~~~~~
+
+Delete a dynamic device personalization package::
+
+   testpmd> ddp del (port_id) (package_path)
+
 ptype mapping
 ~~~~~~~~~~~~~
 
-- 
2.13.0

  parent reply	other threads:[~2017-06-27 13:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-27 16:04 [dpdk-dev] [PATCH] net/i40e: extended list of operations for ddp processing Andrey Chilikin
2017-06-27  8:18 ` [dpdk-dev] [PATCH v2 0/2] " Andrey Chilikin
2017-06-27  8:18 ` [dpdk-dev] [PATCH v2 1/2] " Andrey Chilikin
2017-06-27  8:18 ` [dpdk-dev] [PATCH v2 2/2] app/testpmd: enable ddp remove profile feature Andrey Chilikin
2017-06-27  9:55   ` Ferruh Yigit
2017-06-27 13:35 ` [dpdk-dev] [PATCH v3 0/2] net/i40e: extended list of operations for ddp processing Andrey Chilikin
2017-06-27 13:35 ` [dpdk-dev] [PATCH v3 1/2] " Andrey Chilikin
2017-06-28  6:57   ` Xing, Beilei
2017-06-28  7:40     ` Chilikin, Andrey
2017-06-28  8:03       ` Xing, Beilei
2017-06-27 13:35 ` Andrey Chilikin [this message]
2017-06-28  6:40   ` [dpdk-dev] [PATCH v3 2/2] app/testpmd: enable ddp remove profile feature Xing, Beilei
2017-06-28  8:15 ` [dpdk-dev] [PATCH v4 0/2] net/i40e: extended list of operations for ddp processing Andrey Chilikin
2017-06-28  9:47   ` Ferruh Yigit
2017-06-28  8:15 ` [dpdk-dev] [PATCH v4 1/2] " Andrey Chilikin
2017-06-28  8:25   ` Xing, Beilei
2017-06-28  8:15 ` [dpdk-dev] [PATCH v4 2/2] app/testpmd: enable ddp remove profile feature Andrey Chilikin

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=1498570513-8592-3-git-send-email-andrey.chilikin@intel.com \
    --to=andrey.chilikin@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@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).