* [PATCH] net/iavf: ensure no polling during VF initiated reset
@ 2025-10-16 11:32 Ciara Loftus
2025-10-16 14:32 ` Bruce Richardson
0 siblings, 1 reply; 2+ messages in thread
From: Ciara Loftus @ 2025-10-16 11:32 UTC (permalink / raw)
To: dev; +Cc: Ciara Loftus
Ensure that the datapath functions will not poll during a vf initiated
reset. Otherwise the datapath could access freed resources and cause a
core dump. Achieve this by ensuring that the no-poll-on-link-down devarg
is set when trying to reinit a started device. If it's not set, suggest
stopping the port before the reinit.
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
drivers/net/intel/iavf/iavf_ethdev.c | 40 +++++++++++++++++++++-------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 95e5832f03..72d79447e1 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -3102,13 +3102,18 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev, bool vf_initiated_reset)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_adapter *adapter = dev->data->dev_private;
int ret;
+ bool restart_device = false;
- if (!dev->data->dev_started)
- return;
+ if (vf_initiated_reset) {
+ restart_device = dev->data->dev_started;
+ } else {
+ if (!dev->data->dev_started)
+ return;
- if (!vf_initiated_reset && !iavf_is_reset_detected(adapter)) {
- PMD_DRV_LOG(DEBUG, "reset not start");
- return;
+ if (!iavf_is_reset_detected(adapter)) {
+ PMD_DRV_LOG(DEBUG, "reset not start");
+ return;
+ }
}
vf->in_reset_recovery = true;
@@ -3125,12 +3130,14 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev, bool vf_initiated_reset)
iavf_dev_xstats_reset(dev);
- /* start the device */
- ret = iavf_dev_start(dev);
- if (ret)
- goto error;
+ if (!vf_initiated_reset || restart_device) {
+ /* start the device */
+ ret = iavf_dev_start(dev);
+ if (ret)
+ goto error;
- dev->data->dev_started = 1;
+ dev->data->dev_started = 1;
+ }
goto exit;
error:
@@ -3147,6 +3154,7 @@ int
rte_pmd_iavf_reinit(uint16_t port)
{
struct rte_eth_dev *dev;
+ struct iavf_adapter *adapter;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
@@ -3157,6 +3165,18 @@ rte_pmd_iavf_reinit(uint16_t port)
return -ENOTSUP;
}
+ if (!dev->data->dev_configured) {
+ PMD_DRV_LOG(ERR, "Cannot reinit unconfigured port %u.", port);
+ return -EINVAL;
+ }
+
+ adapter = dev->data->dev_private;
+ if (dev->data->dev_started && !adapter->devargs.no_poll_on_link_down) {
+ PMD_DRV_LOG(ERR, "Cannot reinit started port %u. Either stop the port or enable "
+ "no-poll-on-link-down in devargs.", port);
+ return -EINVAL;
+ }
+
iavf_handle_hw_reset(dev, true);
return 0;
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net/iavf: ensure no polling during VF initiated reset
2025-10-16 11:32 [PATCH] net/iavf: ensure no polling during VF initiated reset Ciara Loftus
@ 2025-10-16 14:32 ` Bruce Richardson
0 siblings, 0 replies; 2+ messages in thread
From: Bruce Richardson @ 2025-10-16 14:32 UTC (permalink / raw)
To: Ciara Loftus; +Cc: dev
On Thu, Oct 16, 2025 at 11:32:24AM +0000, Ciara Loftus wrote:
> Ensure that the datapath functions will not poll during a vf initiated
> reset. Otherwise the datapath could access freed resources and cause a
> core dump. Achieve this by ensuring that the no-poll-on-link-down devarg
> is set when trying to reinit a started device. If it's not set, suggest
> stopping the port before the reinit.
>
> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
> drivers/net/intel/iavf/iavf_ethdev.c | 40 +++++++++++++++++++++-------
> 1 file changed, 30 insertions(+), 10 deletions(-)
>
After discussing offline with Ciara, this patch is mostly a fix to the
previous iavf reset patch, which is not yet pulled to main. Therefore patch
squashed to original commit on next-net-intel tree.
Thanks,
/Bruce
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-16 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-16 11:32 [PATCH] net/iavf: ensure no polling during VF initiated reset Ciara Loftus
2025-10-16 14:32 ` Bruce Richardson
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).