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 6B8B2A0C47; Mon, 25 Oct 2021 08:41:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22D56410DB; Mon, 25 Oct 2021 08:41:32 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id B45A2407FF; Mon, 25 Oct 2021 08:41:30 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10147"; a="227030447" X-IronPort-AV: E=Sophos;i="5.87,179,1631602800"; d="scan'208";a="227030447" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2021 23:41:29 -0700 X-IronPort-AV: E=Sophos;i="5.87,179,1631602800"; d="scan'208";a="496646438" Received: from unknown (HELO localhost.localdomain) ([10.240.183.93]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2021 23:41:27 -0700 From: dapengx.yu@intel.com To: Qiming Yang , Qi Zhang Cc: dev@dpdk.org, Dapeng Yu , stable@dpdk.org Date: Mon, 25 Oct 2021 14:41:18 +0800 Message-Id: <20211025064118.1215220-1-dapengx.yu@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/ice: simplify the use of DCF device reset 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 After DCF is reset by PF, the DCF device un-initialization cannot function normally since the resource is already invalidated. So reset DCF twice is necessary, the first reset re-initializes the DCF, only then second reset can clean the filters successfully. This patch detects the reset flag, which is set by PF on DCF reset, if the flag is true, do DCF reset twice automatically. Fixes: 1a86f4dbdf42 ("net/ice: support DCF device reset") Cc: stable@dpdk.org Signed-off-by: Dapeng Yu --- drivers/net/ice/ice_dcf_ethdev.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 7cb8066416..e8057f5588 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1031,8 +1031,29 @@ ice_dcf_tm_ops_get(struct rte_eth_dev *dev __rte_unused, static int ice_dcf_dev_reset(struct rte_eth_dev *dev) { + struct ice_dcf_adapter *ad = dev->data->dev_private; + struct iavf_hw *hw = &ad->real_hw.avf; int ret; + if (!(IAVF_READ_REG(hw, IAVF_VF_ARQLEN1) & + IAVF_VF_ARQLEN1_ARQENABLE_MASK)) { + if (!ad->real_hw.resetting) + ad->real_hw.resetting = true; + PMD_DRV_LOG(ERR, "The DCF has been reset by PF"); + + /* + * Do the extra dev uninit/init to make DCF get resource. + * Then the next uninit/init can clean filters successfully. + */ + ret = ice_dcf_dev_uninit(dev); + if (ret) + return ret; + + ret = ice_dcf_dev_init(dev); + if (ret) + return ret; + } + ret = ice_dcf_dev_uninit(dev); if (ret) return ret; -- 2.27.0