From patchwork Tue Mar 9 15:41:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: chenqiming2018@163.com X-Patchwork-Id: 88750 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2A269A0567; Tue, 9 Mar 2021 16:41:59 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A09F84069D; Tue, 9 Mar 2021 16:41:58 +0100 (CET) Received: from m12-11.163.com (m12-11.163.com [220.181.12.11]) by mails.dpdk.org (Postfix) with ESMTP id D45824068A for ; Tue, 9 Mar 2021 16:41:56 +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=aBQ3T19QfdUvv0sCF8X1i mgHtXi0mG1bRQCvpjistqCn2KfluYqcURKV+YX84ZpB9usURyyuFvR4a4GcMTUHR XaOpzxsqwQuf6xE+BapVnmhKVspw/C70vlg3Ej3Pqly+qcP7XJ4RmJFYWVcuEolF V2/R1mzCiXBXppIDYq6ugw= Received: from localhost.localdomain (unknown [115.231.16.114]) by smtp7 (Coremail) with SMTP id C8CowACnkIg9l0dghJCcRQ--.36920S2; Tue, 09 Mar 2021 23:41:51 +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 23:41:13 +0800 Message-Id: <20210309154113.2896-1-chenqiming2018@163.com> X-Mailer: git-send-email 2.30.1.windows.1 MIME-Version: 1.0 X-CM-TRANSID: C8CowACnkIg9l0dghJCcRQ--.36920S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Cr18KFW7JF4kJw45WFy5XFb_yoW5JFyfpr W3Ga45CF1kJr47W3ySya18uFW5X3yrG3y7GFW3GwnY9ayrKa10vryUKa15Wr1qyrWkuF4a vFs8WFy3CFn0qaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j50edUUUUU= X-Originating-IP: [115.231.16.114] X-CM-SenderInfo: xfkh01xlpl0wasqrmqqrwthudrp/xtbBrQBQPV75aIiLXQAAsR 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);