From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A308BA04C9; Mon, 14 Sep 2020 00:10:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A4FB51C0D2; Mon, 14 Sep 2020 00:10:20 +0200 (CEST) Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by dpdk.org (Postfix) with ESMTP id 307F22C52 for ; Mon, 14 Sep 2020 00:10:17 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 89DD6580098; Sun, 13 Sep 2020 18:07:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 13 Sep 2020 18:07:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=MwyZYbCdZPJsw U0O5uoprU2kDhkkThWu0J8FfBxD7BI=; b=Lk6KE5tnsCZtmFY4OQKOazL6clKP/ lo3d8QksZ8h2O45Zedu1sQA7l30s7jr+tMZ99J4IUfxQZjoj8dE6QUZ3p7Vv1kGd OrE1SqQny/R4Ppt9R2vcBbMY23Ny4rtnfQQywcwossWFBPqw0cd1Q4KAYmoEj63L sKn9mDZLqLFVYSMU+7erbBNJw9dj+D3Hk8nR74RHCB/ajSD11J+YACFug0/q448e Ys/Xt969LdS6bsXbEDmM3U8kWmUDpzkHl/4O9B/lAK/uzAUQr7vFrU2t6mci7DmX hpQ3StZOoF/i0pW4YHbETDVl65ffQmap/Rh9JRzwXsh+dNLpeHBxSTs/w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=MwyZYbCdZPJswU0O5uoprU2kDhkkThWu0J8FfBxD7BI=; b=pdwKsua0 PXe8wpxg+b14LpPOLm/mmi6qi+g5JvMlUjcFKnn/e3WwMmxe32OonNMw7I/URbGW B8Zgjd0mOxYba7a5QB7ekewfdxYCK8CBiuR5BKwkQ7s6Mw5a6Ly7Jo3JFoO75XqZ IVsVk7sATR/re1KoTkYUVovkx4U/2XlBSusqLwPcPrEP3H+FvKKN06ZI58PPIByA IqNXcimHY5ZfiJXiPScaoE6A1PaWr8z1nBMQR6yLGhs7wUPNVJVB7lNiwkLRCC0t +b/KeJ3QXZL1049D4SVMYjC0j94bXbLz7DMCf8sfTlu8/AuwJwFuI8L2HFXXWm0E gK7caH61M6EIlQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeihedgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 56E6A3064674; Sun, 13 Sep 2020 18:07:36 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, "John W. Linville" , Ciara Loftus , Qi Zhang , Shepard Siegel , Ed Czeck , John Miller , Igor Russkikh , Pavel Belous , Steven Webster , Matt Peters , Somalapuram Amaranath , Rasesh Mody , Shahed Shaikh , Ajit Khaparde , Somnath Kotur , Chas Williams , "Wei Hu (Xavier)" , Rahul Lakkireddy , Hemant Agrawal , Sachin Saxena , Wei Zhao , Jeff Guo , Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin , Igor Chauskin , Gagandeep Singh , John Daley , Hyong Youb Kim , Gaetan Rivet , Xiao Wang , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , "Min Hu (Connor)" , Yisen Zhuang , Beilei Xing , Jingjing Wu , Qiming Yang , Alfredo Cardigliano , Rosen Xu , Shijith Thotton , Srisivasubramanian Srinivasan , Jakub Grajciar , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , Zyta Szpak , Liron Himi , Stephen Hemminger , "K. Y. Srinivasan" , Haiyang Zhang , Long Li , Martin Spinler , Heinrich Kuhn , Harman Kalra , Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K , Akhil Goyal , Jasvinder Singh , Cristian Dumitrescu , Keith Wiles , Maciej Czekaj , Maxime Coquelin , Chenbo Xia , Zhihong Wang , Yong Wang Date: Mon, 14 Sep 2020 00:06:53 +0200 Message-Id: <20200913220711.3768597-3-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200913220711.3768597-1-thomas@monjalon.net> References: <20200913220711.3768597-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 02/20] ethdev: allow drivers to return error on close 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" The device operation .dev_close was returning void. This driver interface is changed to return an int. Note that the API rte_eth_dev_close() is still returning void, although a deprecation notice is pending to change it as well. Signed-off-by: Thomas Monjalon --- app/test/virtual_pmd.c | 6 ++++-- drivers/net/af_packet/rte_eth_af_packet.c | 3 ++- drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +++- drivers/net/ark/ark_ethdev.c | 6 ++++-- drivers/net/atlantic/atl_ethdev.c | 6 ++++-- drivers/net/avp/avp_ethdev.c | 5 +++-- drivers/net/axgbe/axgbe_ethdev.c | 5 +++-- drivers/net/bnx2x/bnx2x_ethdev.c | 4 +++- drivers/net/bnxt/bnxt_ethdev.c | 4 +++- drivers/net/bnxt/bnxt_reps.c | 3 ++- drivers/net/bnxt/bnxt_reps.h | 2 +- drivers/net/bonding/eth_bond_private.h | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++- drivers/net/cxgbe/cxgbe_ethdev.c | 6 ++++-- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +++- drivers/net/dpaa2/dpaa2_ethdev.c | 6 ++++-- drivers/net/e1000/em_ethdev.c | 6 ++++-- drivers/net/e1000/igb_ethdev.c | 12 ++++++++---- drivers/net/ena/ena_ethdev.c | 6 ++++-- drivers/net/enetc/enetc_ethdev.c | 4 +++- drivers/net/enic/enic_ethdev.c | 4 +++- drivers/net/failsafe/failsafe_ops.c | 3 ++- drivers/net/fm10k/fm10k_ethdev.c | 4 +++- drivers/net/hinic/hinic_pmd_ethdev.c | 6 ++++-- drivers/net/hns3/hns3_ethdev.c | 6 ++++-- drivers/net/hns3/hns3_ethdev_vf.c | 6 ++++-- drivers/net/i40e/i40e_ethdev.c | 5 +++-- drivers/net/i40e/i40e_ethdev_vf.c | 5 +++-- drivers/net/iavf/iavf_ethdev.c | 5 +++-- drivers/net/ice/ice_dcf_ethdev.c | 6 ++++-- drivers/net/ice/ice_ethdev.c | 6 ++++-- drivers/net/igc/igc_ethdev.c | 6 ++++-- drivers/net/ionic/ionic_ethdev.c | 10 ++++++---- drivers/net/ipn3ke/ipn3ke_representor.c | 4 +++- drivers/net/ixgbe/ixgbe_ethdev.c | 11 +++++++---- drivers/net/kni/rte_eth_kni.c | 4 +++- drivers/net/liquidio/lio_ethdev.c | 4 +++- drivers/net/memif/rte_eth_memif.c | 4 +++- drivers/net/mlx4/mlx4.c | 3 ++- drivers/net/mlx5/mlx5.c | 9 +++++---- drivers/net/mlx5/mlx5.h | 2 +- drivers/net/mvneta/mvneta_ethdev.c | 4 +++- drivers/net/mvpp2/mrvl_ethdev.c | 4 +++- drivers/net/netvsc/hn_ethdev.c | 4 +++- drivers/net/nfb/nfb_ethdev.c | 4 +++- drivers/net/nfp/nfp_net.c | 6 ++++-- drivers/net/octeontx/octeontx_ethdev.c | 4 +++- drivers/net/octeontx2/otx2_ethdev.c | 5 +++-- drivers/net/pcap/rte_eth_pcap.c | 3 ++- drivers/net/pfe/pfe_ethdev.c | 8 +++++--- drivers/net/qede/qede_ethdev.c | 4 +++- drivers/net/sfc/sfc_ethdev.c | 4 +++- drivers/net/softnic/rte_eth_softnic.c | 4 ++-- drivers/net/szedata2/rte_eth_szedata2.c | 4 +++- drivers/net/tap/rte_eth_tap.c | 4 +++- drivers/net/thunderx/nicvf_ethdev.c | 4 +++- drivers/net/vhost/rte_eth_vhost.c | 6 ++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 6 ++++-- lib/librte_ethdev/rte_ethdev_core.h | 2 +- 61 files changed, 200 insertions(+), 99 deletions(-) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 79156cb85a..596b608f4c 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -62,9 +62,11 @@ static void virtual_ethdev_stop(struct rte_eth_dev *eth_dev __rte_unused) rte_pktmbuf_free(pkt); } -static void +static int virtual_ethdev_close(struct rte_eth_dev *dev __rte_unused) -{} +{ + return 0; +} static int virtual_ethdev_configure_success(struct rte_eth_dev *dev __rte_unused) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index b9723e9619..7d0ff1cbb3 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -376,9 +376,10 @@ eth_stats_reset(struct rte_eth_dev *dev) return 0; } -static void +static int eth_dev_close(struct rte_eth_dev *dev __rte_unused) { + return 0; } static void diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 936d4a7d5f..bac9729bf8 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -701,7 +701,7 @@ xdp_umem_destroy(struct xsk_umem_info *umem) umem = NULL; } -static void +static int eth_dev_close(struct rte_eth_dev *dev) { struct pmd_internals *internals = dev->data->dev_private; @@ -731,6 +731,8 @@ eth_dev_close(struct rte_eth_dev *dev) dev->data->mac_addrs = NULL; remove_xdp_program(internals); + + return 0; } static void diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 0321ec1264..9e1f8218a8 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -30,7 +30,7 @@ static int eth_ark_dev_uninit(struct rte_eth_dev *eth_dev); static int eth_ark_dev_configure(struct rte_eth_dev *dev); static int eth_ark_dev_start(struct rte_eth_dev *dev); static void eth_ark_dev_stop(struct rte_eth_dev *dev); -static void eth_ark_dev_close(struct rte_eth_dev *dev); +static int eth_ark_dev_close(struct rte_eth_dev *dev); static int eth_ark_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int eth_ark_dev_link_update(struct rte_eth_dev *dev, @@ -681,7 +681,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev) } } -static void +static int eth_ark_dev_close(struct rte_eth_dev *dev) { struct ark_adapter *ark = dev->data->dev_private; @@ -711,6 +711,8 @@ eth_ark_dev_close(struct rte_eth_dev *dev) rte_free(dev->data->mac_addrs); dev->data->mac_addrs = 0; + + return 0; } static int diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index d3b00ab295..1d76883c52 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -22,7 +22,7 @@ static int atl_dev_start(struct rte_eth_dev *dev); static void atl_dev_stop(struct rte_eth_dev *dev); static int atl_dev_set_link_up(struct rte_eth_dev *dev); static int atl_dev_set_link_down(struct rte_eth_dev *dev); -static void atl_dev_close(struct rte_eth_dev *dev); +static int atl_dev_close(struct rte_eth_dev *dev); static int atl_dev_reset(struct rte_eth_dev *dev); static int atl_dev_promiscuous_enable(struct rte_eth_dev *dev); static int atl_dev_promiscuous_disable(struct rte_eth_dev *dev); @@ -718,7 +718,7 @@ atl_dev_set_link_down(struct rte_eth_dev *dev) /* * Reset and stop device. */ -static void +static int atl_dev_close(struct rte_eth_dev *dev) { PMD_INIT_FUNC_TRACE(); @@ -726,6 +726,8 @@ atl_dev_close(struct rte_eth_dev *dev) atl_dev_stop(dev); atl_free_queues(dev); + + return 0; } static int diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 5b47f0924a..2eed6acc3f 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -38,7 +38,7 @@ static int avp_dev_create(struct rte_pci_device *pci_dev, static int avp_dev_configure(struct rte_eth_dev *dev); static int avp_dev_start(struct rte_eth_dev *dev); static void avp_dev_stop(struct rte_eth_dev *dev); -static void avp_dev_close(struct rte_eth_dev *dev); +static int avp_dev_close(struct rte_eth_dev *dev); static int avp_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int avp_vlan_offload_set(struct rte_eth_dev *dev, int mask); @@ -2103,7 +2103,7 @@ avp_dev_stop(struct rte_eth_dev *eth_dev) rte_spinlock_unlock(&avp->lock); } -static void +static int avp_dev_close(struct rte_eth_dev *eth_dev) { struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); @@ -2139,6 +2139,7 @@ avp_dev_close(struct rte_eth_dev *eth_dev) unlock: rte_spinlock_unlock(&avp->lock); + return 0; } static int diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 0c25739f82..be6f7cbda6 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -15,7 +15,7 @@ static int axgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(struct rte_eth_dev *dev); static void axgbe_dev_stop(struct rte_eth_dev *dev); static void axgbe_dev_interrupt_handler(void *param); -static void axgbe_dev_close(struct rte_eth_dev *dev); +static int axgbe_dev_close(struct rte_eth_dev *dev); static int axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev); static int axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev); static int axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev); @@ -379,10 +379,11 @@ axgbe_dev_stop(struct rte_eth_dev *dev) } /* Clear all resources like TX/RX queues. */ -static void +static int axgbe_dev_close(struct rte_eth_dev *dev) { axgbe_dev_clear_queues(dev); + return 0; } static int diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index b2ea5fafa7..73217c2138 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -280,7 +280,7 @@ bnx2x_dev_stop(struct rte_eth_dev *dev) return; } -static void +static int bnx2x_dev_close(struct rte_eth_dev *dev) { struct bnx2x_softc *sc = dev->data->dev_private; @@ -295,6 +295,8 @@ bnx2x_dev_close(struct rte_eth_dev *dev) /* free ilt */ bnx2x_free_ilt_mem(sc); + + return 0; } static int diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 510a0d9e0a..02e53bf04d 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1329,7 +1329,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) bp->flow_stat->flow_count = 0; } -static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) +static int bnxt_dev_close_op(struct rte_eth_dev *eth_dev) { struct bnxt *bp = eth_dev->data->dev_private; @@ -1365,6 +1365,8 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) rte_free(bp->grp_info); bp->grp_info = NULL; + + return 0; } static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 6fa9a30d27..fa014125e3 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -449,9 +449,10 @@ void bnxt_vf_rep_dev_stop_op(struct rte_eth_dev *eth_dev) bnxt_vf_rep_free_rx_mbufs(vfr_bp); } -void bnxt_vf_rep_dev_close_op(struct rte_eth_dev *eth_dev) +int bnxt_vf_rep_dev_close_op(struct rte_eth_dev *eth_dev) { bnxt_vf_representor_uninit(eth_dev); + return 0; } int bnxt_vf_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, diff --git a/drivers/net/bnxt/bnxt_reps.h b/drivers/net/bnxt/bnxt_reps.h index 418b95afcd..0a0501f888 100644 --- a/drivers/net/bnxt/bnxt_reps.h +++ b/drivers/net/bnxt/bnxt_reps.h @@ -38,7 +38,7 @@ int bnxt_vf_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev, void bnxt_vf_rep_rx_queue_release_op(void *rx_queue); void bnxt_vf_rep_tx_queue_release_op(void *tx_queue); void bnxt_vf_rep_dev_stop_op(struct rte_eth_dev *eth_dev); -void bnxt_vf_rep_dev_close_op(struct rte_eth_dev *eth_dev); +int bnxt_vf_rep_dev_close_op(struct rte_eth_dev *eth_dev); int bnxt_vf_rep_stats_get_op(struct rte_eth_dev *eth_dev, struct rte_eth_stats *stats); int bnxt_vf_rep_stats_reset_op(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h index c9b2d0fe46..0a0034705d 100644 --- a/drivers/net/bonding/eth_bond_private.h +++ b/drivers/net/bonding/eth_bond_private.h @@ -318,7 +318,7 @@ bond_tlb_activate_slave(struct bond_dev_private *internals); void bond_ethdev_stop(struct rte_eth_dev *eth_dev); -void +int bond_ethdev_close(struct rte_eth_dev *dev); #endif diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index cdbd8151ed..e1123deb83 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2095,7 +2095,7 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) } } -void +int bond_ethdev_close(struct rte_eth_dev *dev) { struct bond_dev_private *internals = dev->data->dev_private; @@ -2119,6 +2119,8 @@ bond_ethdev_close(struct rte_eth_dev *dev) bond_flow_ops.flush(dev, &ferror); bond_ethdev_free_queues(dev); rte_bitmap_reset(internals->vlan_filter_bmp); + + return 0; } /* forward declaration */ diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 7c6016d5cf..d575a9b389 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -315,7 +315,7 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) /* * Stop device. */ -void cxgbe_dev_close(struct rte_eth_dev *eth_dev) +int cxgbe_dev_close(struct rte_eth_dev *eth_dev) { struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; @@ -323,7 +323,7 @@ void cxgbe_dev_close(struct rte_eth_dev *eth_dev) CXGBE_FUNC_TRACE(); if (!(adapter->flags & FULL_INIT_DONE)) - return; + return 0; cxgbe_down(pi); @@ -332,6 +332,8 @@ void cxgbe_dev_close(struct rte_eth_dev *eth_dev) * have been disabled */ t4_sge_eth_clear_queues(pi); + + return 0; } /* Start the device. diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 0b7c52aecf..69d91639e9 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -19,7 +19,7 @@ void cxgbe_dev_rx_queue_release(void *q); void cxgbe_dev_tx_queue_release(void *q); void cxgbe_dev_stop(struct rte_eth_dev *eth_dev); -void cxgbe_dev_close(struct rte_eth_dev *eth_dev); +int cxgbe_dev_close(struct rte_eth_dev *eth_dev); int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *device_info); int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index c15e2b5462..da8d36b06f 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -353,7 +353,7 @@ static void dpaa_eth_dev_stop(struct rte_eth_dev *dev) dev->tx_pkt_burst = dpaa_eth_tx_drop_all; } -static void dpaa_eth_dev_close(struct rte_eth_dev *dev) +static int dpaa_eth_dev_close(struct rte_eth_dev *dev) { struct fman_if *fif = dev->process_private; struct __fman_if *__fif; @@ -376,6 +376,8 @@ static void dpaa_eth_dev_close(struct rte_eth_dev *dev) dpaa_interrupt_handler, (void *)dev); } + + return 0; } static int diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 02c254846c..037ee0d2c6 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1239,7 +1239,7 @@ dpaa2_dev_stop(struct rte_eth_dev *dev) rte_eth_linkstatus_set(dev, &link); } -static void +static int dpaa2_dev_close(struct rte_eth_dev *dev) { struct dpaa2_dev_priv *priv = dev->data->dev_private; @@ -1255,11 +1255,13 @@ dpaa2_dev_close(struct rte_eth_dev *dev) ret = dpni_reset(dpni, CMD_PRI_LOW, priv->token); if (ret) { DPAA2_PMD_ERR("Failure cleaning dpni device: err=%d", ret); - return; + return -1; } memset(&link, 0, sizeof(link)); rte_eth_linkstatus_set(dev, &link); + + return 0; } static int diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 902b1cdca0..45d3949ff7 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -34,7 +34,7 @@ static int eth_em_configure(struct rte_eth_dev *dev); static int eth_em_start(struct rte_eth_dev *dev); static void eth_em_stop(struct rte_eth_dev *dev); -static void eth_em_close(struct rte_eth_dev *dev); +static int eth_em_close(struct rte_eth_dev *dev); static int eth_em_promiscuous_enable(struct rte_eth_dev *dev); static int eth_em_promiscuous_disable(struct rte_eth_dev *dev); static int eth_em_allmulticast_enable(struct rte_eth_dev *dev); @@ -758,7 +758,7 @@ eth_em_stop(struct rte_eth_dev *dev) } } -static void +static int eth_em_close(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -782,6 +782,8 @@ eth_em_close(struct rte_eth_dev *dev) rte_intr_disable(intr_handle); rte_intr_callback_unregister(intr_handle, eth_em_interrupt_handler, dev); + + return 0; } static int diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index a5551e8175..564216b0a4 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -77,7 +77,7 @@ static int eth_igb_start(struct rte_eth_dev *dev); static void eth_igb_stop(struct rte_eth_dev *dev); static int eth_igb_dev_set_link_up(struct rte_eth_dev *dev); static int eth_igb_dev_set_link_down(struct rte_eth_dev *dev); -static void eth_igb_close(struct rte_eth_dev *dev); +static int eth_igb_close(struct rte_eth_dev *dev); static int eth_igb_reset(struct rte_eth_dev *dev); static int eth_igb_promiscuous_enable(struct rte_eth_dev *dev); static int eth_igb_promiscuous_disable(struct rte_eth_dev *dev); @@ -155,7 +155,7 @@ static void igbvf_intr_disable(struct e1000_hw *hw); static int igbvf_dev_configure(struct rte_eth_dev *dev); static int igbvf_dev_start(struct rte_eth_dev *dev); static void igbvf_dev_stop(struct rte_eth_dev *dev); -static void igbvf_dev_close(struct rte_eth_dev *dev); +static int igbvf_dev_close(struct rte_eth_dev *dev); static int igbvf_promiscuous_enable(struct rte_eth_dev *dev); static int igbvf_promiscuous_disable(struct rte_eth_dev *dev); static int igbvf_allmulticast_enable(struct rte_eth_dev *dev); @@ -1535,7 +1535,7 @@ eth_igb_dev_set_link_down(struct rte_eth_dev *dev) return 0; } -static void +static int eth_igb_close(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1604,6 +1604,8 @@ eth_igb_close(struct rte_eth_dev *dev) /* clear all the filters list */ igb_filterlist_flush(dev); + + return 0; } /* @@ -3382,7 +3384,7 @@ igbvf_dev_stop(struct rte_eth_dev *dev) adapter->stopped = true; } -static void +static int igbvf_dev_close(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -3413,6 +3415,8 @@ igbvf_dev_close(struct rte_eth_dev *dev) rte_intr_callback_unregister(&pci_dev->intr_handle, eth_igbvf_interrupt_handler, (void *)dev); + + return 0; } static int diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index da8c8ad922..ea979fddd1 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -187,7 +187,7 @@ static void ena_init_rings(struct ena_adapter *adapter, static int ena_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int ena_start(struct rte_eth_dev *dev); static void ena_stop(struct rte_eth_dev *dev); -static void ena_close(struct rte_eth_dev *dev); +static int ena_close(struct rte_eth_dev *dev); static int ena_dev_reset(struct rte_eth_dev *dev); static int ena_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); static void ena_rx_queue_release_all(struct rte_eth_dev *dev); @@ -487,7 +487,7 @@ static void ena_config_debug_area(struct ena_adapter *adapter) ena_com_delete_debug_area(&adapter->ena_dev); } -static void ena_close(struct rte_eth_dev *dev) +static int ena_close(struct rte_eth_dev *dev) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; @@ -513,6 +513,8 @@ static void ena_close(struct rte_eth_dev *dev) * release of the resource in the rte_eth_dev_release_port(). */ dev->data->mac_addrs = NULL; + + return 0; } static int diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index c6fb42740d..bdb32762ce 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -545,7 +545,7 @@ enetc_stats_reset(struct rte_eth_dev *dev) return 0; } -static void +static int enetc_dev_close(struct rte_eth_dev *dev) { uint16_t i; @@ -564,6 +564,8 @@ enetc_dev_close(struct rte_eth_dev *dev) dev->data->tx_queues[i] = NULL; } dev->data->nb_tx_queues = 0; + + return 0; } static int diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index ca75919ee2..b14ed00085 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -445,12 +445,14 @@ static void enicpmd_dev_stop(struct rte_eth_dev *eth_dev) /* * Stop device. */ -static void enicpmd_dev_close(struct rte_eth_dev *eth_dev) +static int enicpmd_dev_close(struct rte_eth_dev *eth_dev) { struct enic *enic = pmd_priv(eth_dev); ENICPMD_FUNC_TRACE(); enic_remove(enic); + + return 0; } static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev, diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 96f7e456f9..93ebd09114 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -240,7 +240,7 @@ fs_dev_set_link_down(struct rte_eth_dev *dev) } static void fs_dev_free_queues(struct rte_eth_dev *dev); -static void +static int fs_dev_close(struct rte_eth_dev *dev) { struct sub_device *sdev; @@ -259,6 +259,7 @@ fs_dev_close(struct rte_eth_dev *dev) } fs_dev_free_queues(dev); fs_unlock(dev, 0); + return 0; } static int diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index b574693bca..82f46cebf5 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -2779,7 +2779,7 @@ fm10k_close_mbx_service(struct fm10k_hw *hw) hw->mbx.ops.disconnect(hw, &hw->mbx); } -static void +static int fm10k_dev_close(struct rte_eth_dev *dev) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2824,6 +2824,8 @@ fm10k_dev_close(struct rte_eth_dev *dev) rte_intr_callback_unregister(intr_handle, fm10k_dev_interrupt_handler_vf, (void *)dev); } + + return 0; } static const struct eth_dev_ops fm10k_eth_dev_ops = { diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 67e6afcf7a..5f2e97d3bd 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -2936,7 +2936,7 @@ static void hinic_nic_dev_destroy(struct rte_eth_dev *eth_dev) * @param dev * Pointer to Ethernet device structure. */ -static void hinic_dev_close(struct rte_eth_dev *dev) +static int hinic_dev_close(struct rte_eth_dev *dev) { struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); @@ -2944,7 +2944,7 @@ static void hinic_dev_close(struct rte_eth_dev *dev) &nic_dev->dev_status)) { PMD_DRV_LOG(WARNING, "Device %s already closed", dev->data->name); - return; + return 0; } /* stop device first */ @@ -2971,6 +2971,8 @@ static void hinic_dev_close(struct rte_eth_dev *dev) /* deinit nic hardware device */ hinic_nic_dev_destroy(dev); + + return 0; } static const struct eth_dev_ops hinic_pmd_ops = { diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 81e773046e..96806afd87 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4747,7 +4747,7 @@ hns3_dev_stop(struct rte_eth_dev *dev) rte_spinlock_unlock(&hw->lock); } -static void +static int hns3_dev_close(struct rte_eth_dev *eth_dev) { struct hns3_adapter *hns = eth_dev->data->dev_private; @@ -4756,7 +4756,7 @@ hns3_dev_close(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) { rte_free(eth_dev->process_private); eth_dev->process_private = NULL; - return; + return 0; } if (hw->adapter_state == HNS3_NIC_STARTED) @@ -4776,6 +4776,8 @@ hns3_dev_close(struct rte_eth_dev *eth_dev) eth_dev->process_private = NULL; hns3_mp_uninit_primary(); hns3_warn(hw, "Close port %d finished", hw->data->port_id); + + return 0; } static int diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 1d2941f0e3..b732bbc732 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1821,14 +1821,14 @@ hns3vf_dev_stop(struct rte_eth_dev *dev) rte_spinlock_unlock(&hw->lock); } -static void +static int hns3vf_dev_close(struct rte_eth_dev *eth_dev) { struct hns3_adapter *hns = eth_dev->data->dev_private; struct hns3_hw *hw = &hns->hw; if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return; + return 0; if (hw->adapter_state == HNS3_NIC_STARTED) hns3vf_dev_stop(eth_dev); @@ -1846,6 +1846,8 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) eth_dev->process_private = NULL; hns3_mp_uninit_primary(); hns3_warn(hw, "Close port %d finished", hw->data->port_id); + + return 0; } static int diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 11c02b1888..8dccb513d4 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -225,7 +225,7 @@ static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev); static int i40e_dev_configure(struct rte_eth_dev *dev); static int i40e_dev_start(struct rte_eth_dev *dev); static void i40e_dev_stop(struct rte_eth_dev *dev); -static void i40e_dev_close(struct rte_eth_dev *dev); +static int i40e_dev_close(struct rte_eth_dev *dev); static int i40e_dev_reset(struct rte_eth_dev *dev); static int i40e_dev_promiscuous_enable(struct rte_eth_dev *dev); static int i40e_dev_promiscuous_disable(struct rte_eth_dev *dev); @@ -2608,7 +2608,7 @@ i40e_dev_stop(struct rte_eth_dev *dev) pf->adapter->rss_reta_updated = 0; } -static void +static int i40e_dev_close(struct rte_eth_dev *dev) { struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -2748,6 +2748,7 @@ i40e_dev_close(struct rte_eth_dev *dev) i40e_tm_conf_uninit(dev); hw->adapter_closed = 1; + return 0; } /* diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 69cab8e739..104eef639d 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -90,7 +90,7 @@ static int i40evf_dev_xstats_reset(struct rte_eth_dev *dev); static int i40evf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask); -static void i40evf_dev_close(struct rte_eth_dev *dev); +static int i40evf_dev_close(struct rte_eth_dev *dev); static int i40evf_dev_reset(struct rte_eth_dev *dev); static int i40evf_check_vf_reset_done(struct rte_eth_dev *dev); static int i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev); @@ -2355,7 +2355,7 @@ i40evf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) return ret; } -static void +static int i40evf_dev_close(struct rte_eth_dev *dev) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2387,6 +2387,7 @@ i40evf_dev_close(struct rte_eth_dev *dev) vf->aq_resp = NULL; hw->adapter_closed = 1; + return 0; } /* diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index c3aa4cd725..4860a94d4c 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -32,7 +32,7 @@ static int iavf_dev_configure(struct rte_eth_dev *dev); static int iavf_dev_start(struct rte_eth_dev *dev); static void iavf_dev_stop(struct rte_eth_dev *dev); -static void iavf_dev_close(struct rte_eth_dev *dev); +static int iavf_dev_close(struct rte_eth_dev *dev); static int iavf_dev_reset(struct rte_eth_dev *dev); static int iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); @@ -1408,7 +1408,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) return 0; } -static void +static int iavf_dev_close(struct rte_eth_dev *dev) { struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1428,6 +1428,7 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_intr_callback_unregister(intr_handle, iavf_dev_interrupt_handler, dev); iavf_disable_irq0(hw); + return 0; } static int diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 2faed3cc7a..5b626cb641 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -847,13 +847,13 @@ ice_dcf_stats_reset(struct rte_eth_dev *dev) return 0; } -static void +static int ice_dcf_dev_close(struct rte_eth_dev *dev) { struct ice_dcf_adapter *adapter = dev->data->dev_private; if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return; + return 0; dev->dev_ops = NULL; dev->rx_pkt_burst = NULL; @@ -861,6 +861,8 @@ ice_dcf_dev_close(struct rte_eth_dev *dev) ice_dcf_uninit_parent_adapter(dev); ice_dcf_uninit_hw(dev, &adapter->real_hw); + + return 0; } static int diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 8d435e8892..042ee6def0 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -74,7 +74,7 @@ static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { static int ice_dev_configure(struct rte_eth_dev *dev); static int ice_dev_start(struct rte_eth_dev *dev); static void ice_dev_stop(struct rte_eth_dev *dev); -static void ice_dev_close(struct rte_eth_dev *dev); +static int ice_dev_close(struct rte_eth_dev *dev); static int ice_dev_reset(struct rte_eth_dev *dev); static int ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); @@ -2389,7 +2389,7 @@ ice_dev_stop(struct rte_eth_dev *dev) pf->adapter_stopped = true; } -static void +static int ice_dev_close(struct rte_eth_dev *dev) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -2437,6 +2437,8 @@ ice_dev_close(struct rte_eth_dev *dev) /* unregister callback func from eal lib */ rte_intr_callback_unregister(intr_handle, ice_interrupt_handler, dev); + + return 0; } static int diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c index 6ab3ee909d..99014a369c 100644 --- a/drivers/net/igc/igc_ethdev.c +++ b/drivers/net/igc/igc_ethdev.c @@ -183,7 +183,7 @@ static void eth_igc_stop(struct rte_eth_dev *dev); static int eth_igc_start(struct rte_eth_dev *dev); static int eth_igc_set_link_up(struct rte_eth_dev *dev); static int eth_igc_set_link_down(struct rte_eth_dev *dev); -static void eth_igc_close(struct rte_eth_dev *dev); +static int eth_igc_close(struct rte_eth_dev *dev); static int eth_igc_reset(struct rte_eth_dev *dev); static int eth_igc_promiscuous_enable(struct rte_eth_dev *dev); static int eth_igc_promiscuous_disable(struct rte_eth_dev *dev); @@ -1170,7 +1170,7 @@ igc_dev_free_queues(struct rte_eth_dev *dev) dev->data->nb_tx_queues = 0; } -static void +static int eth_igc_close(struct rte_eth_dev *dev) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -1204,6 +1204,8 @@ eth_igc_close(struct rte_eth_dev *dev) /* Reset any pending lock */ igc_reset_swfw_lock(hw); + + return 0; } static void diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 800f6e5d64..1775fd29b7 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -25,7 +25,7 @@ static int ionic_dev_configure(struct rte_eth_dev *dev); static int ionic_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int ionic_dev_start(struct rte_eth_dev *dev); static void ionic_dev_stop(struct rte_eth_dev *dev); -static void ionic_dev_close(struct rte_eth_dev *dev); +static int ionic_dev_close(struct rte_eth_dev *dev); static int ionic_dev_set_link_up(struct rte_eth_dev *dev); static int ionic_dev_set_link_down(struct rte_eth_dev *dev); static int ionic_dev_link_update(struct rte_eth_dev *eth_dev, @@ -956,7 +956,7 @@ ionic_dev_stop(struct rte_eth_dev *eth_dev) /* * Reset and stop device. */ -static void +static int ionic_dev_close(struct rte_eth_dev *eth_dev) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); @@ -967,14 +967,16 @@ ionic_dev_close(struct rte_eth_dev *eth_dev) err = ionic_lif_stop(lif); if (err) { IONIC_PRINT(ERR, "Cannot stop LIF: %d", err); - return; + return -1; } err = eth_ionic_dev_uninit(eth_dev); if (err) { IONIC_PRINT(ERR, "Cannot destroy LIF: %d", err); - return; + return -1; } + + return 0; } static int diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index b673c49149..d49abbf758 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -208,7 +208,7 @@ ipn3ke_rpst_dev_stop(struct rte_eth_dev *dev) } } -static void +static int ipn3ke_rpst_dev_close(struct rte_eth_dev *dev) { struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev); @@ -221,6 +221,8 @@ ipn3ke_rpst_dev_close(struct rte_eth_dev *dev) /* Disable the RX path */ ipn3ke_xmac_rx_disable(hw, rpst->port_id, 0); } + + return 0; } /* diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index fd0cb9b0e2..5c12a575c2 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -147,7 +147,7 @@ static int ixgbe_dev_start(struct rte_eth_dev *dev); static void ixgbe_dev_stop(struct rte_eth_dev *dev); static int ixgbe_dev_set_link_up(struct rte_eth_dev *dev); static int ixgbe_dev_set_link_down(struct rte_eth_dev *dev); -static void ixgbe_dev_close(struct rte_eth_dev *dev); +static int ixgbe_dev_close(struct rte_eth_dev *dev); static int ixgbe_dev_reset(struct rte_eth_dev *dev); static int ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev); static int ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev); @@ -251,7 +251,7 @@ static int ixgbevf_dev_start(struct rte_eth_dev *dev); static int ixgbevf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); static void ixgbevf_dev_stop(struct rte_eth_dev *dev); -static void ixgbevf_dev_close(struct rte_eth_dev *dev); +static int ixgbevf_dev_close(struct rte_eth_dev *dev); static int ixgbevf_dev_reset(struct rte_eth_dev *dev); static void ixgbevf_intr_disable(struct rte_eth_dev *dev); static void ixgbevf_intr_enable(struct rte_eth_dev *dev); @@ -2994,7 +2994,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) /* * Reset and stop device. */ -static void +static int ixgbe_dev_close(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = @@ -3065,6 +3065,7 @@ ixgbe_dev_close(struct rte_eth_dev *dev) rte_free(dev->security_ctx); #endif + return 0; } /* @@ -5449,7 +5450,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) adapter->rss_reta_updated = 0; } -static void +static int ixgbevf_dev_close(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -5478,6 +5479,8 @@ ixgbevf_dev_close(struct rte_eth_dev *dev) rte_intr_disable(intr_handle); rte_intr_callback_unregister(intr_handle, ixgbevf_dev_interrupt_handler, dev); + + return 0; } /* diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 831fe96c96..aa365a57de 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -198,7 +198,7 @@ eth_kni_dev_stop(struct rte_eth_dev *dev) dev->data->dev_link.link_status = 0; } -static void +static int eth_kni_close(struct rte_eth_dev *eth_dev) { struct pmd_internals *internals; @@ -214,6 +214,8 @@ eth_kni_close(struct rte_eth_dev *eth_dev) if (ret) PMD_LOG(WARNING, "Not able to release kni for %s", eth_dev->data->name); + + return 0; } static int diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 2258838c4c..d7df0c7853 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1550,7 +1550,7 @@ lio_dev_set_link_down(struct rte_eth_dev *eth_dev) * @return * - nothing */ -static void +static int lio_dev_close(struct rte_eth_dev *eth_dev) { struct lio_device *lio_dev = LIO_DEV(eth_dev); @@ -1581,6 +1581,8 @@ lio_dev_close(struct rte_eth_dev *eth_dev) /* Delete all queues */ lio_dev_clear_queues(eth_dev); + + return 0; } /** diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index c1c7e9f8d8..c00b9702a9 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -1203,7 +1203,7 @@ memif_dev_start(struct rte_eth_dev *dev) return ret; } -static void +static int memif_dev_close(struct rte_eth_dev *dev) { struct pmd_internals *pmd = dev->data->dev_private; @@ -1224,6 +1224,8 @@ memif_dev_close(struct rte_eth_dev *dev) } rte_free(dev->process_private); + + return 0; } static int diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 71061a720f..df59314b66 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -370,7 +370,7 @@ mlx4_dev_stop(struct rte_eth_dev *dev) * @param dev * Pointer to Ethernet device structure. */ -static void +static int mlx4_dev_close(struct rte_eth_dev *dev) { struct mlx4_priv *priv = dev->data->dev_private; @@ -400,6 +400,7 @@ mlx4_dev_close(struct rte_eth_dev *dev) MLX4_ASSERT(priv->ctx == NULL); mlx4_intr_uninstall(priv); memset(priv, 0, sizeof(*priv)); + return 0; } static const struct eth_dev_ops mlx4_dev_ops = { diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 1e4c695f84..e8685b216f 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1338,7 +1338,7 @@ mlx5_proc_priv_uninit(struct rte_eth_dev *dev) * @param dev * Pointer to Ethernet device structure. */ -void +int mlx5_dev_close(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -1348,14 +1348,14 @@ mlx5_dev_close(struct rte_eth_dev *dev) if (rte_eal_process_type() == RTE_PROC_SECONDARY) { /* Check if process_private released. */ if (!dev->process_private) - return; + return 0; mlx5_tx_uar_uninit_secondary(dev); mlx5_proc_priv_uninit(dev); rte_eth_dev_release_port(dev); - return; + return 0; } if (!priv->sh) - return; + return 0; DRV_LOG(DEBUG, "port %u closing device \"%s\"", dev->data->port_id, ((priv->sh->ctx != NULL) ? @@ -1478,6 +1478,7 @@ mlx5_dev_close(struct rte_eth_dev *dev) * it is freed when dev_private is freed. */ dev->data->mac_addrs = NULL; + return 0; } /** diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 78d6eb7281..b1308ba594 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -767,7 +767,7 @@ int mlx5_proc_priv_init(struct rte_eth_dev *dev); int mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel); uint16_t mlx5_eth_find_next(uint16_t port_id, struct rte_pci_device *pci_dev); -void mlx5_dev_close(struct rte_eth_dev *dev); +int mlx5_dev_close(struct rte_eth_dev *dev); /* Macro to iterate over all valid ports for mlx5 driver. */ #define MLX5_ETH_FOREACH_DEV(port_id, pci_dev) \ diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 673a8e2b3a..b13e2c52f3 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -429,7 +429,7 @@ mvneta_dev_stop(struct rte_eth_dev *dev) * @param dev * Pointer to Ethernet device structure. */ -static void +static int mvneta_dev_close(struct rte_eth_dev *dev) { struct mvneta_priv *priv = dev->data->dev_private; @@ -455,6 +455,8 @@ mvneta_dev_close(struct rte_eth_dev *dev) mvneta_neta_deinit(); rte_mvep_deinit(MVEP_MOD_T_NETA); } + + return 0; } /** diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 96b27dfd30..b40169daba 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -855,7 +855,7 @@ mrvl_dev_stop(struct rte_eth_dev *dev) * @param dev * Pointer to Ethernet device structure. */ -static void +static int mrvl_dev_close(struct rte_eth_dev *dev) { struct mrvl_priv *priv = dev->data->dev_private; @@ -915,6 +915,8 @@ mrvl_dev_close(struct rte_eth_dev *dev) mrvl_deinit_pp2(); rte_mvep_deinit(MVEP_MOD_T_PP2); } + + return 0; } /** diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index fd91c0e491..f02f546882 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -841,13 +841,15 @@ hn_dev_stop(struct rte_eth_dev *dev) hn_vf_stop(dev); } -static void +static int hn_dev_close(struct rte_eth_dev *dev) { PMD_INIT_FUNC_TRACE(); hn_vf_close(dev); hn_dev_free_queues(dev); + + return 0; } static const struct eth_dev_ops hn_eth_dev_ops = { diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c index b039ab6fc2..c3c3d003f1 100644 --- a/drivers/net/nfb/nfb_ethdev.c +++ b/drivers/net/nfb/nfb_ethdev.c @@ -209,7 +209,7 @@ nfb_eth_dev_info(struct rte_eth_dev *dev, * @param dev * Pointer to Ethernet device structure. */ -static void +static int nfb_eth_dev_close(struct rte_eth_dev *dev) { struct pmd_internals *internals = dev->data->dev_private; @@ -235,6 +235,8 @@ nfb_eth_dev_close(struct rte_eth_dev *dev) rte_free(dev->data->mac_addrs); dev->data->mac_addrs = NULL; + + return 0; } /** diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 99946279db..c20d71cdc3 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -50,7 +50,7 @@ #include /* Prototypes */ -static void nfp_net_close(struct rte_eth_dev *dev); +static int nfp_net_close(struct rte_eth_dev *dev); static int nfp_net_configure(struct rte_eth_dev *dev); static void nfp_net_dev_interrupt_handler(void *param); static void nfp_net_dev_interrupt_delayed_handler(void *param); @@ -864,7 +864,7 @@ nfp_net_set_link_down(struct rte_eth_dev *dev) } /* Reset and stop device. The device can not be restarted. */ -static void +static int nfp_net_close(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; @@ -906,6 +906,8 @@ nfp_net_close(struct rte_eth_dev *dev) * The ixgbe PMD driver disables the pcie master on the * device. The i40e does not... */ + + return 0; } static int diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 76c69294d0..946844ca0b 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -478,7 +478,7 @@ octeontx_dev_configure(struct rte_eth_dev *dev) return 0; } -static void +static int octeontx_dev_close(struct rte_eth_dev *dev) { struct octeontx_txq *txq = NULL; @@ -517,6 +517,8 @@ octeontx_dev_close(struct rte_eth_dev *dev) dev->tx_pkt_burst = NULL; dev->rx_pkt_burst = NULL; + + return 0; } static int diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index 7425ee55be..d9bcf004c6 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -2222,7 +2222,7 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev) } static int otx2_nix_dev_reset(struct rte_eth_dev *eth_dev); -static void otx2_nix_dev_close(struct rte_eth_dev *eth_dev); +static int otx2_nix_dev_close(struct rte_eth_dev *eth_dev); /* Initialize and register driver with DPDK Application */ static const struct eth_dev_ops otx2_eth_dev_ops = { @@ -2635,10 +2635,11 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) return 0; } -static void +static int otx2_nix_dev_close(struct rte_eth_dev *eth_dev) { otx2_eth_dev_uninit(eth_dev, true); + return 0; } static int diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 668cbd1fc7..76e704a65a 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -728,7 +728,7 @@ eth_stats_reset(struct rte_eth_dev *dev) return 0; } -static void +static int eth_dev_close(struct rte_eth_dev *dev) { unsigned int i; @@ -748,6 +748,7 @@ eth_dev_close(struct rte_eth_dev *dev) } } + return 0; } static void diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c index 368acfa554..8867b61a9d 100644 --- a/drivers/net/pfe/pfe_ethdev.c +++ b/drivers/net/pfe/pfe_ethdev.c @@ -398,14 +398,14 @@ pfe_eth_exit(struct rte_eth_dev *dev, struct pfe *pfe) pfe->nb_devs--; } -static void +static int pfe_eth_close(struct rte_eth_dev *dev) { if (!dev) - return; + return -1; if (!g_pfe) - return; + return -1; pfe_eth_exit(dev, g_pfe); @@ -415,6 +415,8 @@ pfe_eth_close(struct rte_eth_dev *dev) rte_free(g_pfe); g_pfe = NULL; } + + return 0; } static int diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 70d48e48ef..7dc5fd1565 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1542,7 +1542,7 @@ static void qede_poll_sp_sb_cb(void *param) } } -static void qede_dev_close(struct rte_eth_dev *eth_dev) +static int qede_dev_close(struct rte_eth_dev *eth_dev) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); @@ -1586,6 +1586,8 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev) if (ECORE_IS_CMT(edev)) rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev); + + return 0; } static int diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index acee3e48e4..f1b857358c 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -318,7 +318,7 @@ sfc_dev_set_link_down(struct rte_eth_dev *dev) return 0; } -static void +static int sfc_dev_close(struct rte_eth_dev *dev) { struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); @@ -364,6 +364,8 @@ sfc_dev_close(struct rte_eth_dev *dev) dev->process_private = NULL; free(sa); + + return 0; } static int diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 866d17a93c..491a308c11 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -201,10 +201,10 @@ pmd_dev_stop(struct rte_eth_dev *dev) softnic_mtr_free(p); } -static void +static int pmd_dev_close(struct rte_eth_dev *dev __rte_unused) { - return; + return 0; } static int diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index a17c53577c..daa40cfd6c 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1155,7 +1155,7 @@ eth_tx_queue_release(void *q) } } -static void +static int eth_dev_close(struct rte_eth_dev *dev) { struct pmd_internals *internals = dev->data->dev_private; @@ -1180,6 +1180,8 @@ eth_dev_close(struct rte_eth_dev *dev) rte_free(dev->data->mac_addrs); dev->data->mac_addrs = NULL; + + return 0; } static int diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 339f24bf82..6bce90c531 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1032,7 +1032,7 @@ tap_stats_reset(struct rte_eth_dev *dev) return 0; } -static void +static int tap_dev_close(struct rte_eth_dev *dev) { int i; @@ -1078,6 +1078,8 @@ tap_dev_close(struct rte_eth_dev *dev) * Since TUN device has no more opened file descriptors * it will be removed from kernel */ + + return 0; } static void diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index d955a7ee23..649fe5c6e6 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -1852,7 +1852,7 @@ nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic, bool cleanup) } } -static void +static int nicvf_dev_close(struct rte_eth_dev *dev) { size_t i; @@ -1869,6 +1869,8 @@ nicvf_dev_close(struct rte_eth_dev *dev) nicvf_periodic_alarm_stop(nicvf_vf_interrupt, nic->snicvf[i]); } + + return 0; } static int diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index e55278af69..fb3b9ce043 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1164,7 +1164,7 @@ eth_dev_stop(struct rte_eth_dev *dev) update_queuing_status(dev); } -static void +static int eth_dev_close(struct rte_eth_dev *dev) { struct pmd_internal *internal; @@ -1173,7 +1173,7 @@ eth_dev_close(struct rte_eth_dev *dev) internal = dev->data->dev_private; if (!internal) - return; + return 0; eth_dev_stop(dev); @@ -1201,6 +1201,8 @@ eth_dev_close(struct rte_eth_dev *dev) rte_free(vring_states[dev->data->port_id]); vring_states[dev->data->port_id] = NULL; + + return 0; } static int diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index dc0093bdf0..1731fc6750 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -704,7 +704,7 @@ virtio_alloc_queues(struct rte_eth_dev *dev) static void virtio_queues_unbind_intr(struct rte_eth_dev *dev); -static void +static int virtio_dev_close(struct rte_eth_dev *dev) { struct virtio_hw *hw = dev->data->dev_private; @@ -713,7 +713,7 @@ virtio_dev_close(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "virtio_dev_close"); if (!hw->opened) - return; + return 0; hw->opened = false; /* reset the NIC */ @@ -743,6 +743,8 @@ virtio_dev_close(struct rte_eth_dev *dev) if (!hw->modern) rte_pci_ioport_unmap(VTPCI_IO(hw)); } + + return 0; } static int diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 815fba2f55..4efb48350c 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -64,7 +64,7 @@ static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev); static int vmxnet3_dev_configure(struct rte_eth_dev *dev); static int vmxnet3_dev_start(struct rte_eth_dev *dev); static void vmxnet3_dev_stop(struct rte_eth_dev *dev); -static void vmxnet3_dev_close(struct rte_eth_dev *dev); +static int vmxnet3_dev_close(struct rte_eth_dev *dev); static void vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set); static int vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev); static int vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev); @@ -888,13 +888,15 @@ vmxnet3_free_queues(struct rte_eth_dev *dev) /* * Reset and stop device. */ -static void +static int vmxnet3_dev_close(struct rte_eth_dev *dev) { PMD_INIT_FUNC_TRACE(); vmxnet3_dev_stop(dev); vmxnet3_free_queues(dev); + + return 0; } static void diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 32407dd418..76308106bd 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -43,7 +43,7 @@ typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev); typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev); /**< @internal Function used to link down a configured Ethernet device. */ -typedef void (*eth_dev_close_t)(struct rte_eth_dev *dev); +typedef int (*eth_dev_close_t)(struct rte_eth_dev *dev); /**< @internal Function used to close a configured Ethernet device. */ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev); -- 2.28.0