* [PATCH 1/2] net/iavf: support VF initiated resets
@ 2025-09-29 14:30 Ciara Loftus
2025-09-29 14:30 ` [PATCH 2/2] net/iavf: add reset VF command to testpmd Ciara Loftus
2025-09-30 9:07 ` [PATCH 1/2] net/iavf: support VF initiated resets Bruce Richardson
0 siblings, 2 replies; 4+ messages in thread
From: Ciara Loftus @ 2025-09-29 14:30 UTC (permalink / raw)
To: dev; +Cc: Ciara Loftus, Timothy Miskell
Introduce a function that allows a VF to request the PF to reset itself.
This is useful for example when the application detects that one of the
queues have hung or any event where a reset is required and the PF is
unlikely to trigger it.
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Timothy Miskell <timothy.miskell@intel.com>
---
drivers/net/intel/iavf/iavf.h | 2 ++
drivers/net/intel/iavf/iavf_ethdev.c | 5 ++++
drivers/net/intel/iavf/iavf_vchnl.c | 29 +++++++++++++++++++++++
drivers/net/intel/iavf/meson.build | 1 +
drivers/net/intel/iavf/rte_pmd_iavf.c | 33 +++++++++++++++++++++++++++
drivers/net/intel/iavf/rte_pmd_iavf.h | 11 +++++++++
6 files changed, 81 insertions(+)
create mode 100644 drivers/net/intel/iavf/rte_pmd_iavf.c
diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index 435902fbc2..6e7aec1bb1 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -565,4 +565,6 @@ void iavf_dev_watchdog_enable(struct iavf_adapter *adapter);
void iavf_dev_watchdog_disable(struct iavf_adapter *adapter);
void iavf_handle_hw_reset(struct rte_eth_dev *dev);
void iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change);
+bool is_iavf_supported(struct rte_eth_dev *dev);
+int iavf_request_reset(struct rte_eth_dev *dev);
#endif /* _IAVF_ETHDEV_H_ */
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 08c814725d..996c7274ce 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -3212,6 +3212,11 @@ static struct rte_pci_driver rte_iavf_pmd = {
.remove = eth_iavf_pci_remove,
};
+bool is_iavf_supported(struct rte_eth_dev *dev)
+{
+ return !strcmp(dev->device->driver->name, rte_iavf_pmd.driver.name);
+}
+
RTE_PMD_REGISTER_PCI(net_iavf, rte_iavf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_iavf, pci_id_iavf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_iavf, "* igb_uio | vfio-pci");
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index b1b7a5bf94..65afd2c2d5 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -2271,3 +2271,32 @@ iavf_get_phc_time(struct ci_rx_queue *rxq)
rte_spinlock_unlock(&vf->phc_time_aq_lock);
return err;
}
+
+int
+iavf_request_reset(struct rte_eth_dev *dev)
+{
+ struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+ struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ struct iavf_cmd_info args;
+ int err = 0;
+
+ args.ops = VIRTCHNL_OP_RESET_VF;
+ args.in_args = NULL;
+ args.in_args_size = 0;
+ args.out_buffer = vf->aq_resp;
+ args.out_size = IAVF_AQ_BUF_SZ;
+
+ err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Failed to execute command of VIRTCHNL_OP_RESET_VF");
+ return err;
+ }
+
+ PMD_DRV_LOG(DEBUG, "VF reset request sent to PF successfully");
+
+ vf->vf_reset = true;
+ iavf_set_no_poll(dev->data->dev_private, false);
+ iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_RESET, NULL, 0);
+
+ return 0;
+}
diff --git a/drivers/net/intel/iavf/meson.build b/drivers/net/intel/iavf/meson.build
index 0db94d6fe6..b39337733f 100644
--- a/drivers/net/intel/iavf/meson.build
+++ b/drivers/net/intel/iavf/meson.build
@@ -24,6 +24,7 @@ sources = files(
'iavf_tm.c',
'iavf_ipsec_crypto.c',
'iavf_fsub.c',
+ 'rte_pmd_iavf.c',
)
if arch_subdir == 'x86'
diff --git a/drivers/net/intel/iavf/rte_pmd_iavf.c b/drivers/net/intel/iavf/rte_pmd_iavf.c
new file mode 100644
index 0000000000..4cb7fe11b8
--- /dev/null
+++ b/drivers/net/intel/iavf/rte_pmd_iavf.c
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2025 Intel Corporation
+ */
+
+#include <eal_export.h>
+
+#include "iavf.h"
+#include "rte_pmd_iavf.h"
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_iavf_reset, 25.11)
+int
+rte_pmd_iavf_reset(uint16_t port)
+{
+ struct rte_eth_dev *dev;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (!is_iavf_supported(dev)) {
+ PMD_DRV_LOG(ERR, "Cannot reset VF, port %u is not an IAVF device.", port);
+ return -ENOTSUP;
+ }
+
+ ret = iavf_request_reset(dev);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "Request to reset VF failed for port %u", port);
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/drivers/net/intel/iavf/rte_pmd_iavf.h b/drivers/net/intel/iavf/rte_pmd_iavf.h
index 56d453fc4c..1de490a977 100644
--- a/drivers/net/intel/iavf/rte_pmd_iavf.h
+++ b/drivers/net/intel/iavf/rte_pmd_iavf.h
@@ -95,6 +95,17 @@ extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_tcp_mask;
extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ip_offset_mask;
extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipsec_crypto_said_mask;
+/**
+ * Request PF driver to initiate a PF-to-VF RESET
+ *
+ * @param port
+ * The port identifier of the Ethernet device.
+ * @return
+ * 0 if successful, otherwise if a failure occurs
+ */
+__rte_experimental
+int rte_pmd_iavf_reset(uint16_t port);
+
/**
* The mbuf dynamic field pointer for flexible descriptor's extraction metadata.
*/
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] net/iavf: add reset VF command to testpmd
2025-09-29 14:30 [PATCH 1/2] net/iavf: support VF initiated resets Ciara Loftus
@ 2025-09-29 14:30 ` Ciara Loftus
2025-09-30 9:07 ` [PATCH 1/2] net/iavf: support VF initiated resets Bruce Richardson
1 sibling, 0 replies; 4+ messages in thread
From: Ciara Loftus @ 2025-09-29 14:30 UTC (permalink / raw)
To: dev; +Cc: Ciara Loftus
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] net/iavf: support VF initiated resets
2025-09-29 14:30 [PATCH 1/2] net/iavf: support VF initiated resets Ciara Loftus
2025-09-29 14:30 ` [PATCH 2/2] net/iavf: add reset VF command to testpmd Ciara Loftus
@ 2025-09-30 9:07 ` Bruce Richardson
2025-09-30 12:30 ` Stephen Hemminger
1 sibling, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2025-09-30 9:07 UTC (permalink / raw)
To: Ciara Loftus; +Cc: dev, Timothy Miskell, techboard
On Mon, Sep 29, 2025 at 02:30:38PM +0000, Ciara Loftus wrote:
> Introduce a function that allows a VF to request the PF to reset itself.
> This is useful for example when the application detects that one of the
> queues have hung or any event where a reset is required and the PF is
> unlikely to trigger it.
>
> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> Signed-off-by: Timothy Miskell <timothy.miskell@intel.com>
> ---
> drivers/net/intel/iavf/iavf.h | 2 ++
> drivers/net/intel/iavf/iavf_ethdev.c | 5 ++++
> drivers/net/intel/iavf/iavf_vchnl.c | 29 +++++++++++++++++++++++
> drivers/net/intel/iavf/meson.build | 1 +
> drivers/net/intel/iavf/rte_pmd_iavf.c | 33 +++++++++++++++++++++++++++
> drivers/net/intel/iavf/rte_pmd_iavf.h | 11 +++++++++
> 6 files changed, 81 insertions(+)
> create mode 100644 drivers/net/intel/iavf/rte_pmd_iavf.c
>
> diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
> index 435902fbc2..6e7aec1bb1 100644
> --- a/drivers/net/intel/iavf/iavf.h
> +++ b/drivers/net/intel/iavf/iavf.h
> @@ -565,4 +565,6 @@ void iavf_dev_watchdog_enable(struct iavf_adapter *adapter);
> void iavf_dev_watchdog_disable(struct iavf_adapter *adapter);
> void iavf_handle_hw_reset(struct rte_eth_dev *dev);
> void iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change);
> +bool is_iavf_supported(struct rte_eth_dev *dev);
> +int iavf_request_reset(struct rte_eth_dev *dev);
> #endif /* _IAVF_ETHDEV_H_ */
In general, I'm not a huge fan of adding driver-specific functions and I
feel like this should fit under the existing reset APIs in some way. That
should avoid the need to update (or such a big update) to testpmd, for example.
Some thoughts here:
1. we could add a devarg to the driver to adjust whether reset does a
"softer" reset of the VF just resetting itself, or a "hard" reset where the
PF does a fuller reset of the VF.
2. rather than a devarg, would do use a driver-specific function to adjust
this behaviour. The difference here would be that the driver-specific
function would be an init-time one rather than runtime, so the runtime of
the app, like testpmd, would be generic.
3. the most generic solution would be to add an additional parameter to the
reset() function itself to specify a hard or soft reset. This would mean
updating all drivers to handle the new parameter (shouldn't be hard, since
it would be __rte_unused in all cases by default). This also opens up
the possibility of other drivers - especially VFs - using it in the same
way. We could actually document that the "hard" option "may be used by VF
drivers to request a full reset of the VF by the PF".
CC'ing techboard to get some wider opinions here, especially thoughts on
option #3.
/Bruce
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] net/iavf: support VF initiated resets
2025-09-30 9:07 ` [PATCH 1/2] net/iavf: support VF initiated resets Bruce Richardson
@ 2025-09-30 12:30 ` Stephen Hemminger
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2025-09-30 12:30 UTC (permalink / raw)
To: Bruce Richardson; +Cc: Ciara Loftus, dev, Timothy Miskell, dpdk-techboard
[-- Attachment #1: Type: text/plain, Size: 3049 bytes --]
Like the idea of a flag argument to reset function.
On Tue, Sep 30, 2025, 02:07 Bruce Richardson <bruce.richardson@intel.com>
wrote:
> On Mon, Sep 29, 2025 at 02:30:38PM +0000, Ciara Loftus wrote:
> > Introduce a function that allows a VF to request the PF to reset itself.
> > This is useful for example when the application detects that one of the
> > queues have hung or any event where a reset is required and the PF is
> > unlikely to trigger it.
> >
> > Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> > Signed-off-by: Timothy Miskell <timothy.miskell@intel.com>
> > ---
> > drivers/net/intel/iavf/iavf.h | 2 ++
> > drivers/net/intel/iavf/iavf_ethdev.c | 5 ++++
> > drivers/net/intel/iavf/iavf_vchnl.c | 29 +++++++++++++++++++++++
> > drivers/net/intel/iavf/meson.build | 1 +
> > drivers/net/intel/iavf/rte_pmd_iavf.c | 33 +++++++++++++++++++++++++++
> > drivers/net/intel/iavf/rte_pmd_iavf.h | 11 +++++++++
> > 6 files changed, 81 insertions(+)
> > create mode 100644 drivers/net/intel/iavf/rte_pmd_iavf.c
> >
> > diff --git a/drivers/net/intel/iavf/iavf.h
> b/drivers/net/intel/iavf/iavf.h
> > index 435902fbc2..6e7aec1bb1 100644
> > --- a/drivers/net/intel/iavf/iavf.h
> > +++ b/drivers/net/intel/iavf/iavf.h
> > @@ -565,4 +565,6 @@ void iavf_dev_watchdog_enable(struct iavf_adapter
> *adapter);
> > void iavf_dev_watchdog_disable(struct iavf_adapter *adapter);
> > void iavf_handle_hw_reset(struct rte_eth_dev *dev);
> > void iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change);
> > +bool is_iavf_supported(struct rte_eth_dev *dev);
> > +int iavf_request_reset(struct rte_eth_dev *dev);
> > #endif /* _IAVF_ETHDEV_H_ */
>
> In general, I'm not a huge fan of adding driver-specific functions and I
> feel like this should fit under the existing reset APIs in some way. That
> should avoid the need to update (or such a big update) to testpmd, for
> example.
> Some thoughts here:
>
> 1. we could add a devarg to the driver to adjust whether reset does a
> "softer" reset of the VF just resetting itself, or a "hard" reset where
> the
> PF does a fuller reset of the VF.
> 2. rather than a devarg, would do use a driver-specific function to adjust
> this behaviour. The difference here would be that the driver-specific
> function would be an init-time one rather than runtime, so the runtime
> of
> the app, like testpmd, would be generic.
> 3. the most generic solution would be to add an additional parameter to the
> reset() function itself to specify a hard or soft reset. This would mean
> updating all drivers to handle the new parameter (shouldn't be hard,
> since
> it would be __rte_unused in all cases by default). This also opens up
> the possibility of other drivers - especially VFs - using it in the same
> way. We could actually document that the "hard" option "may be used by
> VF
> drivers to request a full reset of the VF by the PF".
>
> CC'ing techboard to get some wider opinions here, especially thoughts on
> option #3.
>
> /Bruce
>
[-- Attachment #2: Type: text/html, Size: 3843 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-30 12:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-29 14:30 [PATCH 1/2] net/iavf: support VF initiated resets Ciara Loftus
2025-09-29 14:30 ` [PATCH 2/2] net/iavf: add reset VF command to testpmd Ciara Loftus
2025-09-30 9:07 ` [PATCH 1/2] net/iavf: support VF initiated resets Bruce Richardson
2025-09-30 12:30 ` Stephen Hemminger
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).