DPDK patches and discussions
 help / color / mirror / Atom feed
From: chenqiming2018@163.com
To: dev@dpdk.org
Cc: chenqiming2018@163.com, beilei.xing@intel.com, qi.z.zhang@intel.com
Subject: [dpdk-dev] [fix probabilistic failure of i40evf initialization] net/i40e: fix probabilistic failure of i40evf initialization
Date: Tue,  9 Mar 2021 23:41:13 +0800	[thread overview]
Message-ID: <20210309154113.2896-1-chenqiming2018@163.com> (raw)

From: Qiming Chen <chenqiming2018@163.com>

    The d2146nt chip integrates the x722 controller. The i40e.ko version is 2.9.21, and the firmware version is Intel’s customized version 4.3. It has been communicated with Intel Steven. The version is compatible. Each PF virtual place has 16 VFs, and there are 2 Each process takes over several VF ports, and there is no VF kernel driver on the host. In an embedded environment, repeated single board restarts may cause VF initialization failure.
    By checking the log, it can be confirmed that the i40evf_check_vf_reset_done function returns an error. Through a horizontal comparison with the iavf.ko code, it is found that the iavf kernel driver is implemented as a loop 20 times, and the vf status is checked for 5 seconds each time to increase the reliability of the vf initialization.
    Try to modify the align iavf.ko, repeat the test and reproduce, and find that the problem no longer exists. Although the probability is relatively small, the result is more serious, so it is recommended to modify it.

Signed-off-by: Qiming Chen <chenqiming2018@163.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 0c9bd8d2c..8bfbb1153 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -42,7 +42,8 @@
 /* busy wait delay in msec */
 #define I40EVF_BUSY_WAIT_DELAY 10
 #define I40EVF_BUSY_WAIT_COUNT 50
-#define MAX_RESET_WAIT_CNT     20
+#define I40EVF_AQ_MAX_ERR      20
+#define MAX_RESET_WAIT_CNT     500
 
 #define I40EVF_ALARM_INTERVAL 50000 /* us */
 
@@ -1217,7 +1218,7 @@ i40evf_check_vf_reset_done(struct rte_eth_dev *dev)
 		if (reset == VIRTCHNL_VFR_VFACTIVE ||
 		    reset == VIRTCHNL_VFR_COMPLETED)
 			break;
-		rte_delay_ms(50);
+		rte_delay_ms(10);
 	}
 
 	if (i >= MAX_RESET_WAIT_CNT)
@@ -1276,9 +1277,20 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 		goto err;
 	}
 
-	err = i40evf_check_vf_reset_done(dev);
-	if (err)
+	for (i = 0; i < I40EVF_AQ_MAX_ERR; i++) {
+		err = i40evf_check_vf_reset_done(dev);
+		if (err) {
+			PMD_INIT_LOG(WARNING, "Device is still reset: %d %d", err, i);
+			continue;
+		} else {
+			break;
+		}
+	}
+
+	if (i == I40EVF_AQ_MAX_ERR) {
+		PMD_INIT_LOG(ERR, "Device check vf reset status failed");
 		goto err;
+	}
 
 	i40e_init_adminq_parameter(hw);
 	err = i40e_init_adminq(hw);
-- 
2.30.1.windows.1


             reply	other threads:[~2021-03-09 15:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 15:41 chenqiming2018 [this message]
2021-03-24 12:38 ` Zhang, Qi Z
  -- strict thread matches above, loose matches on Subject: below --
2021-03-08 17:05 chenqiming2018

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=20210309154113.2896-1-chenqiming2018@163.com \
    --to=chenqiming2018@163.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@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;
as well as URLs for NNTP newsgroup(s).