From patchwork Fri Jun 2 02:37:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 127943 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 1963042C0A; Fri, 2 Jun 2023 04:31:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 97C09406B8; Fri, 2 Jun 2023 04:31:36 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id D2DC640693 for ; Fri, 2 Jun 2023 04:31:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685673095; x=1717209095; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=LFzoKrx9vKZudj6kDVb99gvVw/DSFvNQ8qQVdjsQeRk=; b=J6uxesPlo6NrIP8JASqyVsWJFWTcCpr9I5XAF6KqyWZMhGCBPBEJEXy6 pmw3Al34jCj8C0xfLIvbYgAg/vodPHjKKOmyEh+d9s9xyHbRqepAZvaLm XkXjFUaCsAcgxBn0tjt2VyVFTxPZ+EZGrrV+3b9AAiIxJSxOgrRrZBtlg ANo6yjfJAN7uhcjXkX+qNwux274zhF5t28C8f4A1Dn7f0KI31zeMjY/Sc MlATMesUZN7+u6iX2P+qvklNPx9ImuYl1FB2AmOGcAk/a86DS5a8to+fQ kJagT7BRXt3U4kWEzEDnEZlCawwzDR3jbSYNjpvu22DeHs9rxaF8FeItU A==; X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="354597469" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="354597469" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 19:31:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="740604603" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="740604603" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 19:31:31 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Zhichao Zeng , Liang-Min Larry Wang , Jingjing Wu , Beilei Xing Subject: [PATCH v2] net/iavf: add VF reset check Date: Fri, 2 Jun 2023 10:37:15 +0800 Message-Id: <20230602023715.2370468-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 In the current implementation, after application calls rte_eth_dev_reset, it has no way to know if reset has been completed, and if the virtual channel command is called before it is completed, it may cause the dev to be abnormal. To avoid this issue, an uncertain delay need to be added. This commit adds a VF reset check before the dev_reset to inform the application not to invoke any virtual channel commands, to avoid making the device to be abnormal. Suggested-by: Liang-Min Larry Wang Signed-off-by: Zhichao Zeng --- drivers/net/iavf/iavf_ethdev.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index e6cf897293..96004220a1 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2855,7 +2855,20 @@ static int iavf_dev_reset(struct rte_eth_dev *dev) { int ret; + struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + /* + * Check whether the VF reset has been done and inform application, + * to avoid calling the virtual channel command, which may cause + * the device to be abnormal. + */ + ret = iavf_check_vf_reset_done(hw); + if (ret) { + PMD_DRV_LOG(ERR, "Wait too long for reset done!\n"); + return ret; + } + PMD_DRV_LOG(DEBUG, "Start dev_reset ...\n"); ret = iavf_dev_uninit(dev); if (ret) return ret;