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 DF9A7A00C4; Mon, 27 Jun 2022 09:22:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8483E400D7; Mon, 27 Jun 2022 09:22:28 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 64D42400D5; Mon, 27 Jun 2022 09:22:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656314546; x=1687850546; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=gF7Y4iB9/nE7qmU0dfauJVcElHPDSfBO08k43kVqd/k=; b=OlTtostOk272NLxJhR73DWzU6Rcyr9m9mL2UU+6Basa6mW2KbeW/BvfF gnlQ0iUuKo4lPRXoXHZgX9tf8Lg/zmmC46s9jKGZCHnO2wGhy2PAme8sP 4T3ue0J8PtNCbzWZYDXaakP5zIpNu57G44T0x6YbnwaRAk4s9Ye1tpvfS VNCuUxcHe+f5hRKZKMEKU9qTYOv0bCEqjqyyhsUvcsCmLYelzUncfAh45 Q36y099Ifz/ap4xbf+U0NoOSI+Y0qTdE+gmrAGSNmz5pBBYNmegyqMe7y dBmnfqYm4OUhUuW9hse6jgqMX1iNsFBwbmFoe0x0V7QHk+0XiVaAIyiwh Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10390"; a="261795960" X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="261795960" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 00:22:25 -0700 X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="594186416" Received: from unknown (HELO dpdkserver..) ([10.239.252.174]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 00:22:23 -0700 From: Yiding Zhou To: dev@dpdk.org Cc: stable@dpdk.org, Yiding Zhou , Jingjing Wu , Beilei Xing , Qi Zhang Subject: [PATCH] net/iavf: fix issue of VF resetting Date: Mon, 27 Jun 2022 15:22:32 +0800 Message-Id: <20220627072232.243946-1-yidingx.zhou@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 When the VF is in closed state, the vf_reset flag can not be reverted if the VF is reset asynchronously. This prevents all virtchnl commands from executing, causing subsequent calls to iavf_dev_reset() to fail. So the vf_reset flag needs to be reverted even when VF is in closed state. Fixes: 676d986b4b86 ("net/iavf: fix crash after VF reset failure") Cc: stable@dpdk.org Signed-off-by: Yiding Zhou --- drivers/net/iavf/iavf_ethdev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 7df0bf8118..506fcff6e3 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2702,8 +2702,10 @@ iavf_dev_close(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - if (adapter->closed) - return 0; + if (adapter->closed) { + ret = 0; + goto out; + } ret = iavf_dev_stop(dev); adapter->closed = true; @@ -2763,6 +2765,7 @@ iavf_dev_close(struct rte_eth_dev *dev) * the bus master bit will not be disabled, and this call will have no * effect. */ +out: if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) vf->vf_reset = false; -- 2.34.1