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 <thomas@monjalon.net>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Thomas Monjalon 2020-09-29 01:14:10 +02:00 committed by Ferruh Yigit
parent 2c65898b48
commit b142387b07
62 changed files with 206 additions and 103 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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);

View File

@ -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

View File

@ -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 */

View File

@ -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.

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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

View File

@ -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

View File

@ -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;
}
/*

View File

@ -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;
}
/*

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}
/*

View File

@ -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;
}
/*

View File

@ -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

View File

@ -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;
}
/**

View File

@ -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

View File

@ -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 = {

View File

@ -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;
}
/**

View File

@ -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) \

View File

@ -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;
}
/**

View File

@ -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;
}
/**

View File

@ -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 = {

View File

@ -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;
}
/**

View File

@ -50,7 +50,7 @@
#include <errno.h>
/* 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);