public inbox for dev@dpdk.org
 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 3/4] net/iavf: enable post-reset restoration of VF settings
Date: Tue, 31 Mar 2026 13:01:19 +0000	[thread overview]
Message-ID: <20260331130120.2471971-4-ciara.loftus@intel.com> (raw)
In-Reply-To: <20260331130120.2471971-1-ciara.loftus@intel.com>

When a VF is reset its settings are not restored. These settings include
unicast and multicast promiscuous states. Enable the ability to restore
these settings by introducing a new devarg "auto_reconfig" which accepts
values of zero to disable or one to enable. It is enabled by default.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
 doc/guides/nics/intel_vf.rst         |  4 +++
 drivers/net/intel/iavf/iavf.h        |  1 +
 drivers/net/intel/iavf/iavf_ethdev.c | 51 ++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)

diff --git a/doc/guides/nics/intel_vf.rst b/doc/guides/nics/intel_vf.rst
index aec7f11b84..5fa2ddc9ea 100644
--- a/doc/guides/nics/intel_vf.rst
+++ b/doc/guides/nics/intel_vf.rst
@@ -104,6 +104,10 @@ IAVF PMD parameters
     transparently after a reset event, rather than relying on the application to do so. To disable
     this functionality, set the ``auto_reset`` devarg to zero: ``-a 18:01.0,auto_reset=0``
 
+``auto_reconfig``
+    Restore settings (unicast and multicast promiscuous states) on the VF after a reset event.
+    Enabled by default. To disable it: ``-a 18:01.0,auto_reconfig=0``
+
 ``no-poll-on-link-down``
     Stop polling Rx/Tx hardware queue when link is down. This is enabled by default because it is
     required when ``auto_reset`` is enabled which it is by default. To disable it, you must disable
diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index 403c61e2e8..02fa780e86 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -319,6 +319,7 @@ struct iavf_devargs {
 	uint16_t quanta_size;
 	uint32_t watchdog_period;
 	int auto_reset;
+	int auto_reconfig;
 	int no_poll_on_link_down;
 	uint64_t mbuf_check;
 };
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index b5abfb1316..111bfa1934 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -41,6 +41,7 @@
 #define IAVF_QUANTA_SIZE_ARG       "quanta_size"
 #define IAVF_RESET_WATCHDOG_ARG    "watchdog_period"
 #define IAVF_ENABLE_AUTO_RESET_ARG "auto_reset"
+#define IAVF_ENABLE_AUTO_RECONFIG_ARG "auto_reconfig"
 #define IAVF_NO_POLL_ON_LINK_DOWN_ARG "no-poll-on-link-down"
 #define IAVF_MBUF_CHECK_ARG       "mbuf_check"
 uint64_t iavf_timestamp_dynflag;
@@ -52,6 +53,7 @@ static const char * const iavf_valid_args[] = {
 	IAVF_QUANTA_SIZE_ARG,
 	IAVF_RESET_WATCHDOG_ARG,
 	IAVF_ENABLE_AUTO_RESET_ARG,
+	IAVF_ENABLE_AUTO_RECONFIG_ARG,
 	IAVF_NO_POLL_ON_LINK_DOWN_ARG,
 	IAVF_MBUF_CHECK_ARG,
 	NULL
@@ -2375,6 +2377,7 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev)
 
 	ad->devargs.auto_reset = 1;
 	ad->devargs.no_poll_on_link_down = 1;
+	ad->devargs.auto_reconfig = 1;
 
 	if (!devargs)
 		return 0;
@@ -2437,6 +2440,11 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev)
 		ad->devargs.no_poll_on_link_down = 1;
 	}
 
+	ret = rte_kvargs_process(kvlist, IAVF_ENABLE_AUTO_RECONFIG_ARG,
+				 &parse_bool, &ad->devargs.auto_reconfig);
+	if (ret)
+		goto bail;
+
 bail:
 	rte_kvargs_free(kvlist);
 	return ret;
@@ -3101,6 +3109,34 @@ iavf_is_reset_detected(struct iavf_adapter *adapter)
 	return false;
 }
 
+static int
+iavf_post_reset_reconfig(struct rte_eth_dev *dev)
+{
+	int ret, status = 0;
+	bool allmulti = false, allunicast = false;
+	struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+
+	/* Restore pre-reset unicast promiscuous and multicast promiscuous states */
+	if (dev->data->promiscuous)
+		allunicast = true;
+	if (dev->data->all_multicast)
+		allmulti = true;
+	if (allmulti || allunicast) {
+		ret = iavf_config_promisc(adapter, allunicast, allmulti);
+		if (ret)
+			PMD_DRV_LOG(ERR, "Failed to restore unicast promiscuous mode (%s) "
+						"and multicast promiscuous mode (%s)",
+						allunicast ? "on" : "off", allmulti ? "on" : "off");
+		else
+			PMD_DRV_LOG(DEBUG, "Restored unicast promiscuous mode (%s) "
+						"and multicast promiscuous mode (%s)",
+						allunicast ? "on" : "off", allmulti ? "on" : "off");
+		status |= ret;
+	}
+
+	return status;
+}
+
 /*
  * Handle hardware reset
  */
@@ -3150,6 +3186,21 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev, bool vf_initiated_reset)
 
 		dev->data->dev_started = 1;
 	}
+
+	/* Restore settings after the reset */
+	if (adapter->devargs.auto_reconfig) {
+		ret = iavf_post_reset_reconfig(dev);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to restore VF settings after reset");
+			goto error;
+		}
+	} else {
+		dev->data->promiscuous = 0;
+		dev->data->all_multicast = 0;
+		vf->promisc_unicast_enabled = false;
+		vf->promisc_multicast_enabled = false;
+	}
+
 	goto exit;
 
 error:
-- 
2.43.0


  parent reply	other threads:[~2026-03-31 13:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 13:01 [PATCH 0/4] net/iavf: improve VF reset resilience Ciara Loftus
2026-03-31 13:01 ` [PATCH 1/4] net/iavf: fix disabling of promiscuous modes on device close Ciara Loftus
2026-03-31 13:01 ` [PATCH 2/4] net/iavf: enable auto reset by default Ciara Loftus
2026-03-31 13:01 ` Ciara Loftus [this message]
2026-03-31 13:01 ` [PATCH 4/4] net/iavf: fix reset handling error log Ciara Loftus
2026-03-31 13:23   ` David Marchand
2026-04-03 16:08 ` [PATCH 0/4] net/iavf: improve VF reset resilience Bruce Richardson
2026-04-03 16:40   ` 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=20260331130120.2471971-4-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