From patchwork Fri Sep 24 08:08:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yu, DapengX" X-Patchwork-Id: 99544 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 41ADFA0C45; Fri, 24 Sep 2021 10:08:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3DF14122D; Fri, 24 Sep 2021 10:08:49 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 5EAF040142; Fri, 24 Sep 2021 10:08:47 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10116"; a="222137587" X-IronPort-AV: E=Sophos;i="5.85,319,1624345200"; d="scan'208";a="222137587" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2021 01:08:33 -0700 X-IronPort-AV: E=Sophos;i="5.85,319,1624345200"; d="scan'208";a="551489973" Received: from unknown (HELO localhost.localdomain) ([10.240.183.93]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2021 01:08:31 -0700 From: dapengx.yu@intel.com To: Qiming Yang , Qi Zhang Cc: dev@dpdk.org, haiyue.wang@intel.com, Dapeng Yu , stable@dpdk.org Date: Fri, 24 Sep 2021 16:08:20 +0800 Message-Id: <20210924080820.1110722-1-dapengx.yu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210914030858.202578-1-dapengx.yu@intel.com> References: <20210914030858.202578-1-dapengx.yu@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2] net/ice: retry getting VF VSI map after it fails 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: Dapeng Yu The request of getting VF VSI map request may fail when DCF is busy, this patch adds retry mechanism to make it able to succeed. Fixes: b09d34ac8584 ("net/ice: fix flow redirector") Cc: stable@dpdk.org Signed-off-by: Dapeng Yu Acked-by: Haiyue Wang --- V2: * Remove goto --- drivers/net/ice/ice_dcf.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 38e9a84698..c9c01a14e3 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -534,15 +534,26 @@ int ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(hw->eth_dev); - int err = 0; + int i = 0; + int err = -1; rte_spinlock_lock(&hw->vc_cmd_send_lock); rte_intr_disable(&pci_dev->intr_handle); ice_dcf_disable_irq0(hw); - if (ice_dcf_get_vf_resource(hw) || ice_dcf_get_vf_vsi_map(hw) < 0) - err = -1; + for (;;) { + if (ice_dcf_get_vf_resource(hw) == 0 && + ice_dcf_get_vf_vsi_map(hw) >= 0) { + err = 0; + break; + } + + if (++i >= ICE_DCF_ARQ_MAX_RETRIES) + break; + + rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME); + } rte_intr_enable(&pci_dev->intr_handle); ice_dcf_enable_irq0(hw);