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 18F47A0032; Fri, 15 Jul 2022 11:11:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 726AA41140; Fri, 15 Jul 2022 11:11:48 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 403B140042; Fri, 15 Jul 2022 11:11:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657876306; x=1689412306; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LL51Nb4xEdLRDHUVzpVlEzcdC4ui/kTd+EejJWJ/By8=; b=KfoU+7wpjFkeuCGOXlZmV8b1IGq4t50Em0FBsUEJlZBa1y8N5ayUwGJK a+jus/nQTQWSge/PVe0yzXEYvkXBOH21uypcGjOHuRwUYGrEktz5VbKnu jgnaiQ6KCVU5n0KfT4lwmbD2I6np+qMpil/ERK3IkC55fqrvjURDDsLXI FErbjjNgKH0UMY7893nq8en9NG2yk6reqzE19mWfVQnjzRRnHHiyBySDE kswvSb9CkRVYfDbJLV1RUFE2FPzK6GrvjN6yoSTYecYCExsk81KOoiKkU jlTLbRlva4D41ABVo4jSgU7sJ5UDgrTAHuYH1HFnfIhtEVXPr+DZh72fO Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10408"; a="286882777" X-IronPort-AV: E=Sophos;i="5.92,273,1650956400"; d="scan'208";a="286882777" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 02:11:45 -0700 X-IronPort-AV: E=Sophos;i="5.92,273,1650956400"; d="scan'208";a="654259432" Received: from unknown (HELO localhost.localdomain) ([10.239.252.104]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 02:11:42 -0700 From: Ke Zhang To: thomas@monjalon.net, yuying.zhang@intel.com, beilei.xing@intel.com, ferruh.yigit@xilinx.com, yidingx.zhou@intel.com, dev@dpdk.org Cc: Ke Zhang , stable@dpdk.org Subject: [PATCH v4] net/i40e: fix the issue caused by PF and VF release order Date: Fri, 15 Jul 2022 17:03:59 +0800 Message-Id: <20220715090359.76538-1-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713071112.6182-1-ke1x.zhang@intel.com> References: <20220713071112.6182-1-ke1x.zhang@intel.com> 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 A segmentation fault occurs when testpmd exit. This is due to fetching the device name from PF, PF is freed firstly and then VF representor is called later. This commit fixes the bug by fetching the device name from VF representor not PF. Fixes: e391a7b7f815 ("net/i40e: fix multi-process shared data") Cc: stable@dpdk.org Signed-off-by: Ke Zhang --- v4: Update the commit log v3: Change the design and fix code in driver v2: Change the testpmd code to fix this issue --- --- drivers/net/i40e/i40e_vf_representor.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index 7f8e81858e..bcd445bcdd 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -29,8 +29,6 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, struct rte_eth_dev_info *dev_info) { struct i40e_vf_representor *representor = ethdev->data->dev_private; - struct rte_eth_dev_data *pf_dev_data = - representor->adapter->pf.dev_data; /* get dev info for the vdev */ dev_info->device = ethdev->device; @@ -104,7 +102,7 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, }; dev_info->switch_info.name = - rte_eth_devices[pf_dev_data->port_id].device->name; + rte_eth_devices[ethdev->data->port_id].device->name; dev_info->switch_info.domain_id = representor->switch_domain_id; dev_info->switch_info.port_id = representor->vf_id; -- 2.25.1