From patchwork Tue Oct 27 06:24:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawen Wu X-Patchwork-Id: 82270 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E0156A04B5; Tue, 27 Oct 2020 07:22:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C1D002B9D; Tue, 27 Oct 2020 07:22:31 +0100 (CET) Received: from smtpbg501.qq.com (smtpbg501.qq.com [203.205.250.101]) by dpdk.org (Postfix) with ESMTP id 213E429C6 for ; Tue, 27 Oct 2020 07:22:27 +0100 (CET) X-QQ-mid: bizesmtp20t1603779741t0fg4bvs Received: from localhost.localdomain.com (unknown [183.129.236.74]) by esmtp6.qq.com (ESMTP) with id ; Tue, 27 Oct 2020 14:22:15 +0800 (CST) X-QQ-SSF: 01400000002000C0C000B00A0000000 X-QQ-FEAT: mJep2VbaKxYtwFUyKnHXijxaJ49rMICufyjuPMPVqWx89Zyxds3AH0INGFFKn VNcFs89pvtuCn5OnJKKI044vmFlPSgWlYFjBV4uHoZDsHBolxWW1uOKaiMZ03LSIl7doq6I VPCIFfZHlzZbgxG8LCQME683Ryg6HeXBlerVP3E/Dtu8Sm2bJtMv6VzvAqO0U+NWQA1OTIc j7lU+J5O2HlNFrnBf+Zkz427x6VDVIYFZHjui/BwDavc7QvTGUx2TXizl+Hn/1XWTMmeHPj GzIhxvDdZ3avEdy+gBz2/BIo1z8h+1TD7oSUUouiOGpB7+5A65byNjrShdf4WQUGOYyS+ue on1BTtr+S+5f80wWZWpSgCqBMrDRA== X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Date: Tue, 27 Oct 2020 14:24:05 +0800 Message-Id: <20201027062406.243081-1-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.18.4 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH 1/2] net/txgbe: fix driver exit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Replace the 'rte_panic()' with an error return. Also change the type of the calling function. Signed-off-by: Jiawen Wu --- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_pf.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h index b708e6d43..fb1368890 100644 --- a/drivers/net/txgbe/txgbe_ethdev.h +++ b/drivers/net/txgbe/txgbe_ethdev.h @@ -290,7 +290,7 @@ void txgbe_configure_dcb(struct rte_eth_dev *dev); int txgbe_dev_link_update_share(struct rte_eth_dev *dev, int wait_to_complete); -void txgbe_pf_host_init(struct rte_eth_dev *eth_dev); +int txgbe_pf_host_init(struct rte_eth_dev *eth_dev); void txgbe_pf_host_uninit(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c index 67045fb01..ee7fa83fa 100644 --- a/drivers/net/txgbe/txgbe_pf.c +++ b/drivers/net/txgbe/txgbe_pf.c @@ -64,7 +64,7 @@ txgbe_mb_intr_setup(struct rte_eth_dev *dev) return 0; } -void txgbe_pf_host_init(struct rte_eth_dev *eth_dev) +int txgbe_pf_host_init(struct rte_eth_dev *eth_dev) { struct txgbe_vf_info **vfinfo = TXGBE_DEV_VFDATA(eth_dev); struct txgbe_mirror_info *mirror_info = TXGBE_DEV_MR_INFO(eth_dev); @@ -78,12 +78,14 @@ void txgbe_pf_host_init(struct rte_eth_dev *eth_dev) RTE_ETH_DEV_SRIOV(eth_dev).active = 0; vf_num = dev_num_vf(eth_dev); if (vf_num == 0) - return; + return 0; *vfinfo = rte_zmalloc("vf_info", sizeof(struct txgbe_vf_info) * vf_num, 0); - if (*vfinfo == NULL) - rte_panic("Cannot allocate memory for private VF data\n"); + if (*vfinfo == NULL) { + DEBUGOUT("Cannot allocate memory for private VF data\n"); + return -ENOMEM; + } rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id); @@ -114,6 +116,8 @@ void txgbe_pf_host_init(struct rte_eth_dev *eth_dev) /* set mb interrupt mask */ txgbe_mb_intr_setup(eth_dev); + + return 0; } void txgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)