Skip to contentSkip to conversation

net/iavf: improve VF reset resilience

PATCH Applied Ciara Loftus 3 participants 8 messages Mar 31 – Apr 3 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/iavf: improve VF reset resilience

Previously, VF recovery from PF-initiated resets required explicit opt-in via auto_reset, leaving VFs non-functional by default after a reset unless the application handled it. This series makes transparent recovery including the restoration of settings the default, and implements some fixes related to the reset path as well.

Patch 1 fixes a regression which prevented promiscuous mode from being disabled before sending the RESET_VF message to the PF during device close.

Patch 2 enables the auto_reset and no-poll-on-link-down devargs by default so VFs recover from resets without the need to introduce any reset handling in the application.

Patch 3 introduces a new auto_reconfig devarg (on by default) which extends the recovery path to restore unicast and multicast promiscuous state after a reset. Restoration of additional settings such as VLAN filters could be added under the same mechanism in a follow-up series.

Patch 4 fixes a minor logging issue.

Ciara Loftus (4):
net/iavf: fix disabling of promiscuous modes on device close net/iavf: enable auto reset by default
net/iavf: enable post-reset restoration of VF settings net/iavf: fix reset handling error log

 doc/guides/nics/intel_vf.rst         | 15 ++++--
 drivers/net/intel/iavf/iavf.h        |  1 +
 drivers/net/intel/iavf/iavf_ethdev.c | 75 ++++++++++++++++++++++++----
 3 files changed, 77 insertions(+), 14 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/4 net/iavf: fix disabling of promiscuous modes on device close

Commit 41515403f184 ("net/iavf: disable promiscuous mode on close") introduced logic that disabled promiscuous mode when closing the device. However this logic was effectively disabled by commit 676d986b4b86 ("net/iavf: fix crash after VF reset failure") which prevented the configuration of promiscuous mode when the adapter was marked as "closed". Re-enable the disabling logic by moving it to earlier in the device close function, before the adapter is marked as "closed".

Fixes 676d986b4b86 ("net/iavf: fix crash after VF reset failure")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +6 -8
index 1eca20bc9a..2858cd4cb5 100644
@@ -2955,6 +2955,12 @@ iavf_dev_close(struct rte_eth_dev *dev)
 		vf->max_rss_qregion = IAVF_MAX_NUM_QUEUES_DFLT;
 	}
 
+	/* Disable promiscuous mode before resetting the VF. This is to avoid
+	 * potential issues when the PF is bound to the kernel driver.
+	 */
+	if (vf->promisc_unicast_enabled || vf->promisc_multicast_enabled)
+		iavf_config_promisc(adapter, false, false);
+
 	adapter->closed = true;
 
 	/* free iAVF security device context all related resources */
@@ -2966,14 +2972,6 @@ iavf_dev_close(struct rte_eth_dev *dev)
 	iavf_flow_flush(dev, NULL);
 	iavf_flow_uninit(adapter);
 
-	/*
-	 * disable promiscuous mode before reset vf
-	 * it is a workaround solution when work with kernel driver
-	 * and it is not the normal way
-	 */
-	if (vf->promisc_unicast_enabled || vf->promisc_multicast_enabled)
-		iavf_config_promisc(adapter, false, false);
-
 	iavf_vf_reset(hw);
 	iavf_shutdown_adminq(hw);
 	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/4 net/iavf: enable auto reset by default

In reply to Ciara Loftus

Previously, VF automatic recovery after a PF-initiated reset required the user to enable the auto_reset devarg. Without this, recovery was not attempted by the driver, leaving the VF not fully functional. Enable auto_reset by default so VFs transparently recover without requiring any user action.

Since auto_reset requires no-poll-on-link-down to function correctly, no-poll-on-link-down is also enabled by default. If the user tries to disable no-poll-on-link-down when auto_reset is enabled, a warning is emitted and no-poll-on-link-down will remain enabled.

---
 doc/guides/nics/intel_vf.rst         | 11 +++++++----
 drivers/net/intel/iavf/iavf_ethdev.c |  8 +++++++-
 2 files changed, 14 insertions(+), 5 deletions(-)
doc/guides/nics/intel_vf.rst +7 -4
index bc600e4b58..aec7f11b84 100644
@@ -100,12 +100,15 @@ IAVF PMD parameters
     for example, ``-a 18:01.0,watchdog_period=5000`` or ``-a 18:01.0,watchdog_period=0``.
 
 ``auto_reset``
-    Enable VF auto-reset by setting the devargs parameter,
-    for example ``-a 18:01.0,auto_reset=1``,
+    VF auto-reset is enabled by default, meaning the driver will attempt to bring the VF back up
+    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``
 
 ``no-poll-on-link-down``
-    Stop polling Rx/Tx hardware queue when link is down
-    by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``.
+    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
+    both ``auto_reset`` and ``no-poll-on-link-down``, for example,
+    ``-a 18:01.0,auto_reset=0,no-poll-on-link-down=0``.
 
 ``mbuf_check``
     Set the ``devargs`` parameter ``mbuf_check`` to enable Tx diagnostics.
drivers/net/intel/iavf/iavf_ethdev.c +7 -1
index 2858cd4cb5..b5abfb1316 100644
@@ -2373,6 +2373,9 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev)
 	int ret;
 	int watchdog_period = -1;
 
+	ad->devargs.auto_reset = 1;
+	ad->devargs.no_poll_on_link_down = 1;
+
 	if (!devargs)
 		return 0;
 
@@ -2428,8 +2431,11 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev)
 	if (ret)
 		goto bail;
 
-	if (ad->devargs.auto_reset != 0)
+	if (ad->devargs.auto_reset != 0 && ad->devargs.no_poll_on_link_down == 0) {
+		PMD_INIT_LOG(WARNING,
+			"no-poll-on-link-down=0 is incompatible with auto_reset=1, ignoring");
 		ad->devargs.no_poll_on_link_down = 1;
+	}
 
 bail:
 	rte_kvargs_free(kvlist);
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/4 net/iavf: enable post-reset restoration of VF settings

In reply to Ciara Loftus

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.

---
 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(+)
doc/guides/nics/intel_vf.rst +4 -0
index aec7f11b84..5fa2ddc9ea 100644
@@ -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
drivers/net/intel/iavf/iavf.h +1 -0
index 403c61e2e8..02fa780e86 100644
@@ -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;
 };
drivers/net/intel/iavf/iavf_ethdev.c +51 -0

87 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/4 net/iavf: fix reset handling error log

In reply to Ciara Loftus

Commit f665790a5dba ("drivers: remove redundant newline from logs") intended to remove the newline from the log, however an unwanted character was left over. Remove it.

Fixes f665790a5dba ("drivers: remove redundant newline from logs")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/intel/iavf/iavf_ethdev.c +1 -1
index 111bfa1934..cf98d7e5e9 100644
@@ -3204,7 +3204,7 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev, bool vf_initiated_reset)
 	goto exit;
 
 error:
-	PMD_DRV_LOG(DEBUG, "RESET recover with error code=%dn", ret);
+	PMD_DRV_LOG(DEBUG, "RESET recover with error code=%d", ret);
 exit:
 	/* Call the post reset callback */
 	if (vf->post_reset_cb != NULL)
Signature · 1 line
2.43.0
Reviewed-by on v1 4/4
#5 lore raw

Re: [PATCH 4/4] net/iavf: fix reset handling error log

Quoted 9 lines · Ciara Loftus

Commit f665790a5dba ("drivers: remove redundant newline from logs") intended to remove the newline from the log, however an unwanted character was left over. Remove it.

Fixes f665790a5dba ("drivers: remove redundant newline from logs")

Oops.

Signature · 1 line
David Marchand
#6 lore raw
In reply to Ciara Loftus
Quoted 19 lines · Ciara Loftus

Previously, VF recovery from PF-initiated resets required explicit opt-in via auto_reset, leaving VFs non-functional by default after a reset unless the application handled it. This series makes transparent recovery including the restoration of settings the default, and implements some fixes related to the reset path as well.

Patch 1 fixes a regression which prevented promiscuous mode from being disabled before sending the RESET_VF message to the PF during device close.

Patch 2 enables the auto_reset and no-poll-on-link-down devargs by default so VFs recover from resets without the need to introduce any reset handling in the application.

Patch 3 introduces a new auto_reconfig devarg (on by default) which extends the recovery path to restore unicast and multicast promiscuous state after a reset. Restoration of additional settings such as VLAN filters could be added under the same mechanism in a follow-up series.

Quoted 8 lines

Patch 4 fixes a minor logging issue.

Ciara Loftus (4):
net/iavf: fix disabling of promiscuous modes on device close net/iavf: enable auto reset by default
net/iavf: enable post-reset restoration of VF settings net/iavf: fix reset handling error log

#7 lore raw
Quoted 22 lines · Bruce Richardson
Quoted 21 lines · Ciara Loftus

Previously, VF recovery from PF-initiated resets required explicit opt-in via auto_reset, leaving VFs non-functional by default after a reset unless the application handled it. This series makes transparent recovery including the restoration of settings the default, and implements some fixes related to the reset path as well.

Patch 1 fixes a regression which prevented promiscuous mode from being disabled before sending the RESET_VF message to the PF during device close.

Patch 2 enables the auto_reset and no-poll-on-link-down devargs by default so VFs recover from resets without the need to introduce any reset handling in the application.

Patch 3 introduces a new auto_reconfig devarg (on by default) which extends the recovery path to restore unicast and multicast promiscuous state after a reset. Restoration of additional settings such as VLAN filters could be added under the same mechanism in a follow-up series.

Patch 4 fixes a minor logging issue.

Quoted 8 lines
Quoted 6 lines

Ciara Loftus (4):
net/iavf: fix disabling of promiscuous modes on device close net/iavf: enable auto reset by default
net/iavf: enable post-reset restoration of VF settings net/iavf: fix reset handling error log

Applied to dpdk-next-net-intel.

Thanks,
/Bruce