From b142387b07600c320683255d237b9109299883d5 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Tue, 29 Sep 2020 01:14:10 +0200 Subject: [PATCH] ethdev: allow drivers to return error on close 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 Reviewed-by: Rosen Xu Reviewed-by: Sachin Saxena Reviewed-by: Liron Himi Reviewed-by: Haiyue Wang Acked-by: Jeff Guo Reviewed-by: Andrew Rybchenko Reviewed-by: Ferruh Yigit Acked-by: Stephen Hemminger --- 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 | 10 ++++++---- 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/enic/enic_vf_representor.c | 5 +++-- 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 | 6 ++++-- 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_driver.h | 2 +- 62 files changed, 206 insertions(+), 103 deletions(-) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index b49089a33c..4bd4d1c9ad 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 01f462b465..4d0413c4f0 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -814,7 +814,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; @@ -861,6 +861,8 @@ eth_dev_close(struct rte_eth_dev *dev) rte_free(list); } } + + return 0; } static void diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index e13415e95b..5f2ed4b7b7 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, @@ -676,7 +676,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; @@ -706,6 +706,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 2fca9140d7..254758fd66 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); @@ -719,7 +719,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(); @@ -727,6 +727,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 4f5a014b54..458d64bcef 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -16,7 +16,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); @@ -410,10 +410,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 b99c712acb..0b90a499ab 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1404,7 +1404,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; @@ -1439,6 +1439,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 b76487f13b..cacb2176fb 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -495,10 +495,11 @@ void bnxt_rep_dev_stop_op(struct rte_eth_dev *eth_dev) bnxt_rep_free_rx_mbufs(vfr_bp); } -void bnxt_rep_dev_close_op(struct rte_eth_dev *eth_dev) +int bnxt_rep_dev_close_op(struct rte_eth_dev *eth_dev) { BNXT_TF_DBG(DEBUG, "BNXT Port:%d VFR close\n", eth_dev->data->port_id); bnxt_representor_uninit(eth_dev); + return 0; } int bnxt_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 3159f68de9..a019530094 100644 --- a/drivers/net/bnxt/bnxt_reps.h +++ b/drivers/net/bnxt/bnxt_reps.h @@ -45,7 +45,7 @@ int bnxt_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev, void bnxt_rep_rx_queue_release_op(void *rx_queue); void bnxt_rep_tx_queue_release_op(void *tx_queue); void bnxt_rep_dev_stop_op(struct rte_eth_dev *eth_dev); -void bnxt_rep_dev_close_op(struct rte_eth_dev *eth_dev); +int bnxt_rep_dev_close_op(struct rte_eth_dev *eth_dev); int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev, struct rte_eth_stats *stats); int bnxt_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 4ffd2ca4bb..dff835ef92 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 422e190daf..e4bbba5c32 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -318,7 +318,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 *temp_pi, *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; @@ -327,10 +327,10 @@ void cxgbe_dev_close(struct rte_eth_dev *eth_dev) CXGBE_FUNC_TRACE(); if (!(adapter->flags & FULL_INIT_DONE)) - return; + return 0; if (!pi->viid) - return; + return 0; cxgbe_down(pi); t4_sge_eth_release_queues(pi); @@ -343,11 +343,13 @@ void cxgbe_dev_close(struct rte_eth_dev *eth_dev) for_each_port(adapter, i) { temp_pi = adap2pinfo(adapter, i); if (temp_pi->viid) - return; + return 0; } cxgbe_close(adapter); rte_free(adapter); + + 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 8a6b19b5ce..7fe06e1830 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -369,7 +369,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; @@ -392,6 +392,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 02daa4d250..fb4165fa03 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1236,7 +1236,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; @@ -1252,11 +1252,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 1dc360713a..2d0e071448 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 5ab74840aa..9e4aefe00c 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; } /* @@ -3381,7 +3383,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); @@ -3412,6 +3414,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 0ef18fee2c..8c0dd30c02 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -199,7 +199,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); @@ -500,7 +500,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; @@ -526,6 +526,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 57e82845a4..ed03d53608 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -446,12 +446,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/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c index 5d34e1b460..c528be2b98 100644 --- a/drivers/net/enic/enic_vf_representor.c +++ b/drivers/net/enic/enic_vf_representor.c @@ -277,11 +277,12 @@ static void enic_vf_dev_stop(struct rte_eth_dev *eth_dev) * "close" is no-op for now and solely exists so that rte_eth_dev_close() * can finish its own cleanup without errors. */ -static void enic_vf_dev_close(struct rte_eth_dev *eth_dev __rte_unused) +static int enic_vf_dev_close(struct rte_eth_dev *eth_dev __rte_unused) { ENICPMD_FUNC_TRACE(); if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return; + return 0; + return 0; } static int 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 98e396b8e7..7eb4d67ae5 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -2777,7 +2777,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); @@ -2822,6 +2822,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 6fd16e6144..469fbba1b8 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -2965,7 +2965,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); @@ -2973,7 +2973,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 */ @@ -3000,6 +3000,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 99bcc7a9a4..d51adac484 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4876,7 +4876,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; @@ -4885,7 +4885,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) @@ -4905,6 +4905,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 4c73441116..2327d472bd 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1913,14 +1913,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); @@ -1938,6 +1938,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 6439baf2f8..f8c64c1a7c 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 8531cf6b12..61aad8c415 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); @@ -2401,7 +2401,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); @@ -2433,6 +2433,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 440da7d76a..8f46c4588f 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); @@ -1463,7 +1463,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); @@ -1506,6 +1506,8 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; + + 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 6513cc36b9..adf509bd76 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -77,7 +77,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); @@ -2383,7 +2383,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); @@ -2431,6 +2431,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 810568bc54..11397c5c1d 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); @@ -1165,7 +1165,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); @@ -1199,6 +1199,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 8da963a916..ce766e683d 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 2c2b27e62a..93e2ed5670 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 a19c0f3e6b..1a2411c838 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -1218,7 +1218,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; @@ -1239,6 +1239,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 4a807fb4fd..01ead6e6af 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1341,7 +1341,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; @@ -1351,14 +1351,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) ? @@ -1479,6 +1479,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 0907506755..43da9a1fb4 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -844,7 +844,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 5bf3ebc4bd..eebcdb840e 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 f5e77d07bf..27f7cfb056 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 229c1b9149..8968036ea3 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 f5e4cd339d..9509dc8bd6 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 ff2e22cd44..10eeeac642 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 2f4772f9ca..de291db53d 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -2252,7 +2252,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 = { @@ -2665,10 +2665,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 97356d2b0b..187a0019ff 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 150c70d940..14d417baed 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1544,7 +1544,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); @@ -1588,6 +1588,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 6c96118007..b6b0a1aded 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 e453fd1486..038abd98da 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 df16aa4ea7..2d1e4e365a 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1067,7 +1067,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; @@ -1116,6 +1116,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 83d9488360..3d7348771a 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 ce32be9ce3..f67f4db812 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 013a2904e6..0787337a01 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 fa80e75a5b..17fed0ed6e 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_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index 04ac8e923c..c3062c246c 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -42,7 +42,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);