DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [PATCH 2/2] net/iavf: add reset VF command to testpmd
Date: Mon, 29 Sep 2025 14:30:39 +0000	[thread overview]
Message-ID: <20250929143039.547207-2-ciara.loftus@intel.com> (raw)
In-Reply-To: <20250929143039.547207-1-ciara.loftus@intel.com>

This patch adds an IAVF testpmd command "port reset_vf <port_id>" which
will send a request to the PF to reset the given VF.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
 drivers/net/intel/iavf/iavf_testpmd.c | 52 +++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/drivers/net/intel/iavf/iavf_testpmd.c b/drivers/net/intel/iavf/iavf_testpmd.c
index 775179fc01..588f9bbeb3 100644
--- a/drivers/net/intel/iavf/iavf_testpmd.c
+++ b/drivers/net/intel/iavf/iavf_testpmd.c
@@ -69,6 +69,52 @@ static cmdline_parse_inst_t cmd_enable_tx_lldp = {
 	},
 };
 
+struct cmd_reset_vf_result {
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t reset_vf;
+	portid_t port_id;
+};
+
+static cmdline_parse_token_string_t cmd_reset_vf_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_reset_vf_result,
+		port, "port");
+static cmdline_parse_token_string_t cmd_reset_vf_reset_vf =
+	TOKEN_STRING_INITIALIZER(struct cmd_reset_vf_result,
+		reset_vf, "reset_vf");
+static cmdline_parse_token_num_t cmd_reset_vf_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_reset_vf_result,
+		port_id, RTE_UINT16);
+
+static void
+cmd_reset_vf_parsed(void *parsed_result,
+	__rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+	struct cmd_reset_vf_result *res = parsed_result;
+	int ret;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	ret = rte_pmd_iavf_reset(res->port_id);
+	if (ret < 0)
+		fprintf(stderr, "Request to reset VF failed for port %u: %s\n",
+			res->port_id, rte_strerror(-ret));
+	else
+		printf("VF reset requested for port %u\n", res->port_id);
+}
+
+static cmdline_parse_inst_t cmd_reset_vf = {
+	.f = cmd_reset_vf_parsed,
+	.data = NULL,
+	.help_str = "port reset_vf <port_id>",
+	.tokens = {
+		(void *)&cmd_reset_vf_port,
+		(void *)&cmd_reset_vf_reset_vf,
+		(void *)&cmd_reset_vf_port_id,
+		NULL,
+	},
+};
+
 static struct testpmd_driver_commands iavf_cmds = {
 	.commands = {
 	{
@@ -76,7 +122,13 @@ static struct testpmd_driver_commands iavf_cmds = {
 		"set tx lldp (on|off)\n"
 		"    Set iavf Tx lldp packet(currently only supported on)\n\n",
 	},
+	{
+		&cmd_reset_vf,
+		"port reset_vf (port_id)\n"
+		"    Send a request to the PF to reset the VF\n\n",
+	},
 	{ NULL, NULL },
 	},
 };
+
 TESTPMD_ADD_DRIVER_COMMANDS(iavf_cmds)
-- 
2.34.1


  reply	other threads:[~2025-09-29 14:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 14:30 [PATCH 1/2] net/iavf: support VF initiated resets Ciara Loftus
2025-09-29 14:30 ` Ciara Loftus [this message]
2025-09-30  9:07 ` Bruce Richardson
2025-09-30 12:30   ` Stephen Hemminger

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=20250929143039.547207-2-ciara.loftus@intel.com \
    --to=ciara.loftus@intel.com \
    --cc=dev@dpdk.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).