From patchwork Tue Aug 31 08:40:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiming Chen X-Patchwork-Id: 97597 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 B201EA0C46; Tue, 31 Aug 2021 10:41:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3936040141; Tue, 31 Aug 2021 10:41:39 +0200 (CEST) Received: from mail-m974.mail.163.com (mail-m974.mail.163.com [123.126.97.4]) by mails.dpdk.org (Postfix) with ESMTP id 312E540041; Tue, 31 Aug 2021 10:41:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=90wj4 T1icP1AesoL8f0SQI74qnBsiAK8rg+yd/Tqdrw=; b=e6U9ZSJs8uzL9qPAE+Zb8 Ri3i4DHYng8KqkiVFPkSGRj3fqWYLqfGNMEAPbrw54PPtwLEJgN48TVlUlMNkmoF Fk3qpFiKRo5OClgv64yTkIEY1+c1I43819FOa4Boq6C199Z4VBjBF80MKPEfavzO JRyrdYiXOw8hdhyTDqUflU= Received: from localhost.localdomain (unknown [124.160.214.152]) by smtp4 (Coremail) with SMTP id HNxpCgCnzNQ76y1hZxebAQ--.40276S2; Tue, 31 Aug 2021 16:41:33 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: haiyue.wang@intel.com, Qiming Chen , stable@dpdk.org Date: Tue, 31 Aug 2021 16:40:51 +0800 Message-Id: <20210831084051.6300-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 MIME-Version: 1.0 X-CM-TRANSID: HNxpCgCnzNQ76y1hZxebAQ--.40276S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kr43AF1UAFyxKFW3CFW3Jrb_yoW8WrW7pr 48XrZrAa48XF4I9392v34ruF9Ika97WrW5GryfC3s5AryDKrZ8KrZxXFy0vr18Jr47AF42 vr18AF4kGw1fArUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jmYL9UUUUU= X-Originating-IP: [124.160.214.152] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/xtbBzwcAoFaEAC+D6gABs9 Subject: [dpdk-dev] [PATCH] net/ixgbe: fix probability of obtaining mailbox lock failure 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" Ifconfig pf port up/down, after several times, the dpdk vf driver may fail to obtain the mailbox lock, resulting in configuration failure and functional failure. In order to increase the reliability of mailbox communication, the patch uses a trial strategy. Fixes: abf7275bbaa2 ("ixgbe: move to drivers/net/") Cc: stable@dpdk.org Signed-off-by: Qiming Chen --- drivers/net/ixgbe/base/ixgbe_mbx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.c b/drivers/net/ixgbe/base/ixgbe_mbx.c index 4dddff2c58..5a14fcc7b4 100644 --- a/drivers/net/ixgbe/base/ixgbe_mbx.c +++ b/drivers/net/ixgbe/base/ixgbe_mbx.c @@ -370,15 +370,23 @@ STATIC s32 ixgbe_check_for_rst_vf(struct ixgbe_hw *hw, u16 mbx_id) STATIC s32 ixgbe_obtain_mbx_lock_vf(struct ixgbe_hw *hw) { s32 ret_val = IXGBE_ERR_MBX; + s32 timeout = hw->mbx.timeout; + s32 usec = hw->mbx.usec_delay; DEBUGFUNC("ixgbe_obtain_mbx_lock_vf"); - /* Take ownership of the buffer */ - IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_VFU); + do { + /* Take ownership of the buffer */ + IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_VFU); - /* reserve mailbox for vf use */ - if (ixgbe_read_v2p_mailbox(hw) & IXGBE_VFMAILBOX_VFU) - ret_val = IXGBE_SUCCESS; + /* reserve mailbox for vf use */ + if (ixgbe_read_v2p_mailbox(hw) & IXGBE_VFMAILBOX_VFU) { + ret_val = IXGBE_SUCCESS; + break; + } + + usec_delay(usec); + } while (timeout--); return ret_val; }