DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anurag Mandal <anurag.mandal@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, vladimir.medvedkin@intel.com,
	ciara.loftus@intel.com, Anurag Mandal <anurag.mandal@intel.com>,
	stable@dpdk.org
Subject: [PATCH v4 5/7] net/iavf: improve VF reset detection on fast ARQ flip
Date: Tue, 18 Aug 2026 04:57:30 +0000	[thread overview]
Message-ID: <88850d22e9dfaff94930fb65557117ee1bccfbcd.1787028683.git.anurag.mandal@intel.com> (raw)
In-Reply-To: <cover.1787028683.git.anurag.mandal@intel.com>

During PF-initiated reset or a remote/ToR switch link-flap,
the PF toggles the admin receive queue enable bit (ARQLEN1)
so quickly around a VF reset that the VF's sampling window
misses it, leaving the PF and the VF states out of sync
and the data path stalled.

Complement the ARQLEN1 check with VFGEN_RSTAT
(VIRTCHNL_VFR_INPROGRESS) and shorten the poll interval to
5 ms (with a proportionally larger count, keeping the ~10 s
budget), matching the Linux kernel iavf driver.
When the VFR is still not observed, proceed with recovery
instead of bailing out so the PF and the VF states converge.

Fixes: 80fb3c920458 ("net/iavf: fix crash on VF start")
Cc: stable@dpdk.org

Signed-off-by: Anurag Mandal <anurag.mandal@intel.com>
Acked-by: Ciara Loftus <ciara.loftus@intel.com>
---
 drivers/net/intel/iavf/iavf.h        |  1 +
 drivers/net/intel/iavf/iavf_ethdev.c | 37 +++++++++++++++++++++-------
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index 605e9dd3aa..d57040e630 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -21,6 +21,7 @@
 #define IAVF_AQ_BUF_SZ            4096
 #define IAVF_RESET_WAIT_CNT       2000
 #define IAVF_RESET_DETECTED_CNT   500
+#define IAVF_RESET_POLL_SCALE     4  /* Poll-interval scale for reset detection */
 #define IAVF_BUF_SIZE_MIN         1024
 #define IAVF_FRAME_SIZE_MAX       9728
 #define IAVF_QUEUE_BASE_ADDR_UNIT 128
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 0f5eb57bbe..322b59d68c 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -3358,8 +3358,26 @@ iavf_dev_reset(struct rte_eth_dev *dev)
 static inline bool
 iavf_is_reset(struct iavf_hw *hw)
 {
-	return !(IAVF_READ_REG(hw, IAVF_VF_ARQLEN1) &
-		IAVF_VF_ARQLEN1_ARQENABLE_MASK);
+	uint32_t rstat;
+
+	/* ARQ has been disabled by the PF as part of the VFR. */
+	if (!(IAVF_READ_REG(hw, IAVF_VF_ARQLEN1) &
+		IAVF_VF_ARQLEN1_ARQENABLE_MASK))
+		return true;
+
+	/*
+	 * VFGEN_RSTAT reports VIRTCHNL_VFR_INPROGRESS.
+	 * At times, the PF flips ARQENABLE so quickly
+	 * around a VFR that the ARQLEN1 sample window
+	 * misses it. Using VFGEN_RSTAT, as a
+	 * complementary indicator, prevents from
+	 * missing a reset that really did happen.
+	 */
+	rstat = (IAVF_READ_REG(hw, IAVF_VFGEN_RSTAT) &
+		 IAVF_VFGEN_RSTAT_VFR_STATE_MASK) >>
+		IAVF_VFGEN_RSTAT_VFR_STATE_SHIFT;
+
+	return rstat == VIRTCHNL_VFR_INPROGRESS;
 }
 
 static bool
@@ -3368,11 +3386,14 @@ iavf_is_reset_detected(struct iavf_adapter *adapter)
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
 	int i;
 
-	/* poll until we see the reset actually happen */
-	for (i = 0; i < IAVF_RESET_DETECTED_CNT; i++) {
+	/*
+	 * Poll until the reset actually happen.
+	 * Poll every 5 ms to catch the fast ARQ flips.
+	 */
+	for (i = 0; i < IAVF_RESET_DETECTED_CNT * IAVF_RESET_POLL_SCALE; i++) {
 		if (iavf_is_reset(hw))
 			return true;
-		rte_delay_ms(20);
+		rte_delay_us(5000);
 	}
 
 	return false;
@@ -3423,10 +3444,8 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev, bool vf_initiated_reset)
 		if (!dev->data->dev_started)
 			return;
 
-		if (!iavf_is_reset_detected(adapter)) {
-			PMD_DRV_LOG(DEBUG, "reset not start");
-			return;
-		}
+		if (!iavf_is_reset_detected(adapter))
+			PMD_DRV_LOG(WARNING, "VFR not observed; recovering anyway");
 	}
 
 	vf->in_reset_recovery = true;
-- 
2.34.1


  parent reply	other threads:[~2026-08-18  4:59 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  8:26 [PATCH 0/5] net/iavf: harden reset recovery and data path on link flap Anurag Mandal
2026-08-06  8:26 ` [PATCH 1/5] net/iavf: discard empty AdminQ descriptors on reset Anurag Mandal
2026-08-07 10:10   ` Loftus, Ciara
2026-08-06  8:26 ` [PATCH 2/5] net/iavf: defer device start when PF VSI not ready Anurag Mandal
2026-08-07 10:46   ` Loftus, Ciara
2026-08-06  8:26 ` [PATCH 3/5] net/iavf: drain in-flight Tx before reset Anurag Mandal
2026-08-07 10:51   ` Loftus, Ciara
2026-08-06  8:26 ` [PATCH 4/5] net/iavf: change no_poll flag to atomic Anurag Mandal
2026-08-07 10:56   ` Loftus, Ciara
2026-08-06  8:26 ` [PATCH 5/5] net/iavf: improve VF reset detection on fast ARQ flip Anurag Mandal
2026-08-07 11:08   ` Loftus, Ciara
2026-08-13 10:45 ` [PATCH v2 0/7] net/iavf: harden reset recovery and data path on link flap Anurag Mandal
2026-08-13 10:45   ` [PATCH v2 1/7] net/iavf: discard empty AdminQ descriptors on reset Anurag Mandal
2026-08-13 13:01     ` Loftus, Ciara
2026-08-13 10:45   ` [PATCH v2 2/7] net/iavf: defer device start when PF VSI not ready Anurag Mandal
2026-08-13 13:12     ` Loftus, Ciara
2026-08-13 13:17       ` Bruce Richardson
2026-08-13 10:45   ` [PATCH v2 3/7] net/iavf: drain in-flight Tx before reset Anurag Mandal
2026-08-13 13:24     ` Loftus, Ciara
2026-08-13 10:45   ` [PATCH v2 4/7] net/iavf: change no_poll flag to atomic Anurag Mandal
2026-08-13 10:45   ` [PATCH v2 5/7] net/iavf: improve VF reset detection on fast ARQ flip Anurag Mandal
2026-08-13 13:48     ` Loftus, Ciara
2026-08-13 10:45   ` [PATCH v2 6/7] net/iavf: keep watchdog armed for the whole reset window Anurag Mandal
2026-08-13 13:54     ` Loftus, Ciara
2026-08-13 10:45   ` [PATCH v2 7/7] net/iavf: skip flow flush during PF-initiated reset Anurag Mandal
2026-08-13 13:56     ` Loftus, Ciara
2026-08-17  6:48 ` [PATCH v3 0/7] net/iavf: harden reset recovery and data path on link flap Anurag Mandal
2026-08-17  6:48   ` [PATCH v3 1/7] net/iavf: discard empty AdminQ descriptors on reset Anurag Mandal
2026-08-17  6:55     ` Mandal, Anurag
2026-08-17  6:48   ` [PATCH v3 2/7] net/iavf: defer device start when PF VSI not ready Anurag Mandal
2026-08-17  9:33     ` Loftus, Ciara
2026-08-17  6:48   ` [PATCH v3 3/7] net/iavf: drain in-flight Tx before reset Anurag Mandal
2026-08-17 10:46     ` Bruce Richardson
2026-08-17  6:48   ` [PATCH v3 4/7] net/iavf: change no_poll flag to atomic Anurag Mandal
2026-08-17  6:48   ` [PATCH v3 5/7] net/iavf: improve VF reset detection on fast ARQ flip Anurag Mandal
2026-08-17  6:48   ` [PATCH v3 6/7] net/iavf: keep watchdog armed for the whole reset window Anurag Mandal
2026-08-17  9:34     ` Loftus, Ciara
2026-08-17  6:48   ` [PATCH v3 7/7] net/iavf: skip flow flush during PF-initiated reset Anurag Mandal
2026-08-18  4:57 ` [PATCH v4 0/7] net/iavf: harden reset recovery and data path on link flap Anurag Mandal
2026-08-18  4:57   ` [PATCH v4 1/7] net/iavf: discard empty AdminQ descriptors on reset Anurag Mandal
2026-08-18  4:57   ` [PATCH v4 2/7] net/iavf: defer device start when PF VSI not ready Anurag Mandal
2026-08-18  4:57   ` [PATCH v4 3/7] net/iavf: drain in-flight Tx before reset Anurag Mandal
2026-08-18  4:57   ` [PATCH v4 4/7] net/iavf: change no_poll flag to atomic Anurag Mandal
2026-08-18  4:57   ` Anurag Mandal [this message]
2026-08-18  4:57   ` [PATCH v4 6/7] net/iavf: keep watchdog armed for the whole reset window Anurag Mandal
2026-08-18  4:57   ` [PATCH v4 7/7] net/iavf: skip flow flush during PF-initiated reset Anurag Mandal
2026-08-18 14:32   ` [PATCH v4 0/7] net/iavf: harden reset recovery and data path on link flap 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=88850d22e9dfaff94930fb65557117ee1bccfbcd.1787028683.git.anurag.mandal@intel.com \
    --to=anurag.mandal@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.com \
    /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