From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [PATCH] net/iavf: ensure no polling during VF initiated reset
Date: Thu, 16 Oct 2025 11:32:24 +0000 [thread overview]
Message-ID: <20251016113224.1652880-1-ciara.loftus@intel.com> (raw)
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
next reply other threads:[~2025-10-16 11:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 11:32 Ciara Loftus [this message]
2025-10-16 14:32 ` Bruce Richardson
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=20251016113224.1652880-1-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).