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 4D6C9A0C4D; Mon, 6 Sep 2021 04:23:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD09E40E32; Mon, 6 Sep 2021 04:23:00 +0200 (CEST) Received: from mail-m972.mail.163.com (mail-m972.mail.163.com [123.126.97.2]) by mails.dpdk.org (Postfix) with ESMTP id C79E940C35; Mon, 6 Sep 2021 04:22:58 +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=I6Ncx UpLRSbIQAwSkfqtRU6lGzDq+ZFx3fdRdGaUVfw=; b=autkvCvxzaR2lOz7DdBPK DvBAL+DLd1lDeY8QaHKjL2uTs56HEqTFOWBssyJlRFJCd6UQ/VZ729X9DnOOckD2 d/uW80fQ0t/1snWe7nlPHNpEDEfagxxH7sPy++GxyCDDSrvk1aeT8Aq/NfrCgxRu fENtp3834Os2uYW1TsNBn4= Received: from localhost.localdomain (unknown [124.160.214.74]) by smtp2 (Coremail) with SMTP id GtxpCgC30XV6ezVhXY+dRg--.6S2; Mon, 06 Sep 2021 10:22:55 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: haiyue.wang@intel.com, Qiming Chen , stable@dpdk.org Date: Mon, 6 Sep 2021 10:22:08 +0800 Message-Id: <20210906022208.9530-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 In-Reply-To: <20210831084051.6300-1-chenqiming_huawei@163.com> References: <20210831084051.6300-1-chenqiming_huawei@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GtxpCgC30XV6ezVhXY+dRg--.6S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kr4xGw4DGw15ZF1xKFyfWFg_yoW8WF48pr 48XrZrAFy8XF4I9397Z34ruFyaka97WrW5Gr93C34rAryDKrZ8KrZxXFy0vr4xJr4xAF42 vr18AF4kGw1fArUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j9jjgUUUUU= X-Originating-IP: [124.160.214.74] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/1tbiQBMGoFSIj+5xEwAAsq Subject: [dpdk-dev] [PATCH v2] 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: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Qiming Chen --- v2: Modify fixes commit --- 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; } -- 2.30.1.windows.1