From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0060BA0566; Mon, 8 Mar 2021 18:06:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 788CD22A422; Mon, 8 Mar 2021 18:06:39 +0100 (CET) Received: from m12-11.163.com (m12-11.163.com [220.181.12.11]) by mails.dpdk.org (Postfix) with ESMTP id 84AD622A3FF for ; Mon, 8 Mar 2021 18:06:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=JVhwn HJUJlHauL7Ojok1vRlati9tS1nczVbtyB+sIF8=; b=VdBW+9mCE06Oka8PZ/MWC RZJjKG3h2tkJFqpvgLhYZtjggFs+LZlMNMaR2UBaka71qBS3m++ijOHt9SHMS9a7 PyyLBSKB4wI3PLNzxd7zm9pfhPy3/Xuiqt+zKG9bBWP0NY7mYJU6n1AnKXalT11K RszZsAks/zB7ps99y8bkQc= Received: from localhost.localdomain (unknown [115.231.16.114]) by smtp7 (Coremail) with SMTP id C8CowAC3v3+ZWUZgbhPyRA--.21031S2; Tue, 09 Mar 2021 01:06:35 +0800 (CST) From: chenqiming2018@163.com To: dev@dpdk.org Cc: chenqiming2018@163.com, beilei.xing@intel.com, qi.z.zhang@intel.com Date: Tue, 9 Mar 2021 01:05:58 +0800 Message-Id: <20210308170558.2833-1-chenqiming2018@163.com> X-Mailer: git-send-email 2.30.1.windows.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID: C8CowAC3v3+ZWUZgbhPyRA--.21031S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Cr18KFW7JF4kJw45WFy5XFb_yoW5JFyfpr W3Ga45CF1kJr47W3ySya18uFW5X3yrG3y7GFW3GwnY9ayrKa10vryUKa15Wr1qyrWkuF4a vFs8WFy3CFn0qaUanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jrEfOUUUUU= X-Originating-IP: [115.231.16.114] X-CM-SenderInfo: xfkh01xlpl0wasqrmqqrwthudrp/xtbBrRtPPV75aHmhdQAAsm Subject: [dpdk-dev] [fix probabilistic failure of i40evf initialization] net/i40e: fix probabilistic failure of i40evf initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Qiming Chen 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 --- 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