Change eth_dev_stop_t return value from void to int.
Make eth_dev_stop_t implementations across all drivers to return
negative errno values if case of error conditions.
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
return -1;
}
-static void virtual_ethdev_stop(struct rte_eth_dev *eth_dev __rte_unused)
+static int virtual_ethdev_stop(struct rte_eth_dev *eth_dev __rte_unused)
{
void *pkt = NULL;
struct virtual_ethdev_private *prv = eth_dev->data->dev_private;
while (rte_ring_dequeue(prv->tx_queue, &pkt) != -ENOENT)
rte_pktmbuf_free(pkt);
+
+ return 0;
}
static int
/*
* This function gets called when the current port gets stopped.
*/
-static void
+static int
eth_dev_stop(struct rte_eth_dev *dev)
{
unsigned i;
}
dev->data->dev_link.link_status = ETH_LINK_DOWN;
+ return 0;
}
static int
}
/* This function gets called when the current port gets stopped. */
-static void
+static int
eth_dev_stop(struct rte_eth_dev *dev)
{
dev->data->dev_link.link_status = ETH_LINK_DOWN;
+ return 0;
}
/* Find ethdev in list */
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 int eth_ark_dev_stop(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);
return 0;
}
-static void
+static int
eth_ark_dev_stop(struct rte_eth_dev *dev)
{
uint16_t i;
struct ark_mpu_t *mpu;
if (ark->started == 0)
- return;
+ return 0;
ark->started = 0;
dev->data->dev_started = 0;
ark_pktchkr_dump_stats(ark->pc);
ark_pktchkr_stop(ark->pc);
}
+
+ return 0;
}
static int
static int eth_atl_dev_init(struct rte_eth_dev *eth_dev);
static int atl_dev_configure(struct rte_eth_dev *dev);
static int atl_dev_start(struct rte_eth_dev *dev);
-static void atl_dev_stop(struct rte_eth_dev *dev);
+static int 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 int atl_dev_close(struct rte_eth_dev *dev);
/*
* Stop device: disable rx and tx functions to allow for reconfiguring.
*/
-static void
+static int
atl_dev_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
rte_free(intr_handle->intr_vec);
intr_handle->intr_vec = NULL;
}
+
+ return 0;
}
/*
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct aq_hw_s *hw;
+ int ret;
PMD_INIT_FUNC_TRACE();
hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- atl_dev_stop(dev);
+ ret = atl_dev_stop(dev);
atl_free_queues(dev);
pthread_mutex_destroy(&hw->mbox_mutex);
- return 0;
+ return ret;
}
static int
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 int avp_dev_stop(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);
return ret;
}
-static void
+static int
avp_dev_stop(struct rte_eth_dev *eth_dev)
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
rte_spinlock_lock(&avp->lock);
if (avp->flags & AVP_F_DETACHED) {
PMD_DRV_LOG(ERR, "Operation not supported during VM live migration\n");
+ ret = -ENOTSUP;
goto unlock;
}
unlock:
rte_spinlock_unlock(&avp->lock);
+ return ret;
}
static int
static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev);
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 int axgbe_dev_stop(struct rte_eth_dev *dev);
static void axgbe_dev_interrupt_handler(void *param);
static int axgbe_dev_close(struct rte_eth_dev *dev);
static int axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
}
/* Stop device: disable rx and tx functions to allow for reconfiguring. */
-static void
+static int
axgbe_dev_stop(struct rte_eth_dev *dev)
{
struct axgbe_port *pdata = dev->data->dev_private;
rte_intr_disable(&pdata->pci_dev->intr_handle);
if (rte_bit_relaxed_get32(AXGBE_STOPPED, &pdata->dev_state))
- return;
+ return 0;
rte_bit_relaxed_set32(AXGBE_STOPPED, &pdata->dev_state);
axgbe_dev_disable_tx(dev);
pdata->hw_if.exit(pdata);
memset(&dev->data->dev_link, 0, sizeof(struct rte_eth_link));
rte_bit_relaxed_set32(AXGBE_DOWN, &pdata->dev_state);
+
+ return 0;
}
static int
return ret;
}
-static void
+static int
bnx2x_dev_stop(struct rte_eth_dev *dev)
{
struct bnx2x_softc *sc = dev->data->dev_private;
ret = bnx2x_nic_unload(sc, UNLOAD_NORMAL, FALSE);
if (ret) {
PMD_DRV_LOG(DEBUG, sc, "bnx2x_nic_unload failed (%d)", ret);
- return;
+ return ret;
}
- return;
+ return 0;
}
static int
}
/* Unload the driver, release resources */
-static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
+static int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct rte_eth_link link;
+ int ret;
eth_dev->data->dev_started = 0;
eth_dev->data->scattered_rx = 0;
rte_intr_disable(intr_handle);
/* Stop the child representors for this device */
- bnxt_rep_stop_all(bp);
+ ret = bnxt_rep_stop_all(bp);
+ if (ret != 0)
+ return ret;
/* delete the bnxt ULP port details */
bnxt_ulp_port_deinit(bp);
/* All filters are deleted on a port stop. */
if (BNXT_FLOW_XSTATS_EN(bp))
bp->flow_stat->flow_count = 0;
+
+ return 0;
}
static int bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
+ int ret = 0;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
bnxt_cancel_fc_thread(bp);
if (eth_dev->data->dev_started)
- bnxt_dev_stop_op(eth_dev);
+ ret = bnxt_dev_stop_op(eth_dev);
bnxt_free_switch_domain(bp);
rte_free(bp->grp_info);
bp->grp_info = NULL;
- return 0;
+ return ret;
}
static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,
return rc;
}
-void bnxt_rep_dev_stop_op(struct rte_eth_dev *eth_dev)
+int bnxt_rep_dev_stop_op(struct rte_eth_dev *eth_dev)
{
struct bnxt_representor *vfr_bp = eth_dev->data->dev_private;
eth_dev->data->dev_link.link_status = 0;
bnxt_rep_free_rx_mbufs(vfr_bp);
+
+ return 0;
}
int bnxt_rep_dev_close_op(struct rte_eth_dev *eth_dev)
return 0;
}
-void bnxt_rep_stop_all(struct bnxt *bp)
+int bnxt_rep_stop_all(struct bnxt *bp)
{
uint16_t vf_id;
struct rte_eth_dev *rep_eth_dev;
+ int ret;
/* No vfrep ports just exit */
if (!bp->rep_info)
- return;
+ return 0;
for (vf_id = 0; vf_id < BNXT_MAX_VF_REPS; vf_id++) {
rep_eth_dev = bp->rep_info[vf_id].vfr_eth_dev;
if (!rep_eth_dev)
continue;
- bnxt_rep_dev_stop_op(rep_eth_dev);
+ ret = bnxt_rep_dev_stop_op(rep_eth_dev);
+ if (ret != 0)
+ return ret;
}
+
+ return 0;
}
tx_conf);
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);
+int bnxt_rep_dev_stop_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);
-void bnxt_rep_stop_all(struct bnxt *bp);
+int bnxt_rep_stop_all(struct bnxt *bp);
#endif /* _BNXT_REPS_H_ */
void
bond_tlb_activate_slave(struct bond_dev_private *internals);
-void
+int
bond_ethdev_stop(struct rte_eth_dev *eth_dev);
int
}
}
-void
+int
bond_ethdev_stop(struct rte_eth_dev *eth_dev)
{
struct bond_dev_private *internals = eth_dev->data->dev_private;
uint16_t i;
+ int ret;
if (internals->mode == BONDING_MODE_8023AD) {
struct port *port;
internals->active_slave_count, slave_id) !=
internals->active_slave_count) {
internals->slaves[i].last_link_status = 0;
- rte_eth_dev_stop(slave_id);
+ ret = rte_eth_dev_stop(slave_id);
+ if (ret != 0) {
+ RTE_BOND_LOG(ERR, "Failed to stop device on port %u",
+ slave_id);
+ return ret;
+ }
deactivate_slave(eth_dev, slave_id);
}
}
+
+ return 0;
}
int
struct rte_eth_dev *eth_dev;
struct bond_dev_private *internals;
const char *name;
+ int ret = 0;
if (!dev)
return -EINVAL;
return -EBUSY;
if (eth_dev->data->dev_started == 1) {
- bond_ethdev_stop(eth_dev);
+ ret = bond_ethdev_stop(eth_dev);
bond_ethdev_close(eth_dev);
}
rte_eth_dev_release_port(eth_dev);
- return 0;
+ return ret;
}
/* this part will resolve the slave portids after all the other pdev and vdev
/*
* Stop device: disable rx and tx functions to allow for reconfiguring.
*/
-void cxgbe_dev_stop(struct rte_eth_dev *eth_dev)
+int cxgbe_dev_stop(struct rte_eth_dev *eth_dev)
{
struct port_info *pi = eth_dev->data->dev_private;
struct adapter *adapter = pi->adapter;
CXGBE_FUNC_TRACE();
if (!(adapter->flags & FULL_INIT_DONE))
- return;
+ return 0;
cxgbe_down(pi);
*/
t4_sge_eth_clear_queues(pi);
eth_dev->data->scattered_rx = 0;
+
+ return 0;
}
int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
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);
+int cxgbe_dev_stop(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);
return 0;
}
-static void dpaa_eth_dev_stop(struct rte_eth_dev *dev)
+static int dpaa_eth_dev_stop(struct rte_eth_dev *dev)
{
struct fman_if *fif = dev->process_private;
if (!fif->is_shared_mac)
fman_if_disable_rx(fif);
dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+ return 0;
}
static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
struct rte_eth_link *link = &dev->data->dev_link;
struct dpaa_if *dpaa_intf = dev->data->dev_private;
int loop;
+ int ret;
PMD_INIT_FUNC_TRACE();
intr_handle = &dpaa_dev->intr_handle;
__fif = container_of(fif, struct __fman_if, __if);
- dpaa_eth_dev_stop(dev);
+ ret = dpaa_eth_dev_stop(dev);
/* Reset link to autoneg */
if (link->link_status && !link->link_autoneg)
rte_free(dpaa_intf->tx_queues);
dpaa_intf->tx_queues = NULL;
- return 0;
+ return ret;
}
static int
if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
dpaa_update_link_status(__fif->node_name, ETH_LINK_DOWN);
else
- dpaa_eth_dev_stop(dev);
+ return dpaa_eth_dev_stop(dev);
return 0;
}
* This routine disables all traffic on the adapter by issuing a
* global reset on the MAC.
*/
-static void
+static int
dpaa2_dev_stop(struct rte_eth_dev *dev)
{
struct dpaa2_dev_priv *priv = dev->data->dev_private;
if (ret) {
DPAA2_PMD_ERR("Failure (ret %d) in disabling dpni %d dev",
ret, priv->hw_id);
- return;
+ return ret;
}
/* clear the recorded link status */
memset(&link, 0, sizeof(link));
rte_eth_linkstatus_set(dev, &link);
+
+ return 0;
}
static int
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 int eth_em_stop(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);
PMD_INIT_FUNC_TRACE();
- eth_em_stop(dev);
+ ret = eth_em_stop(dev);
+ if (ret != 0)
+ return ret;
e1000_power_up_phy(hw);
* global reset on the MAC.
*
**********************************************************************/
-static void
+static int
eth_em_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
rte_free(intr_handle->intr_vec);
intr_handle->intr_vec = NULL;
}
+
+ return 0;
}
static int
E1000_DEV_PRIVATE(dev->data->dev_private);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- eth_em_stop(dev);
+ ret = eth_em_stop(dev);
adapter->stopped = 1;
em_dev_free_queues(dev);
e1000_phy_hw_reset(hw);
rte_intr_callback_unregister(intr_handle,
eth_em_interrupt_handler, dev);
- return 0;
+ return ret;
}
static int
static int eth_igb_configure(struct rte_eth_dev *dev);
static int eth_igb_start(struct rte_eth_dev *dev);
-static void eth_igb_stop(struct rte_eth_dev *dev);
+static int 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 int eth_igb_close(struct rte_eth_dev *dev);
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 int igbvf_dev_stop(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);
* global reset on the MAC.
*
**********************************************************************/
-static void
+static int
eth_igb_stop(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
E1000_DEV_PRIVATE(dev->data->dev_private);
if (adapter->stopped)
- return;
+ return 0;
eth_igb_rxtx_control(dev, false);
adapter->stopped = true;
dev->data->dev_started = 0;
+
+ return 0;
}
static int
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct e1000_filter_info *filter_info =
E1000_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- eth_igb_stop(dev);
+ ret = eth_igb_stop(dev);
e1000_phy_hw_reset(hw);
igb_release_manageability(hw);
/* clear all the filters list */
igb_filterlist_flush(dev);
- return 0;
+ return ret;
}
/*
return 0;
}
-static void
+static int
igbvf_dev_stop(struct rte_eth_dev *dev)
{
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
E1000_DEV_PRIVATE(dev->data->dev_private);
if (adapter->stopped)
- return;
+ return 0;
PMD_INIT_FUNC_TRACE();
adapter->stopped = true;
dev->data->dev_started = 0;
+
+ return 0;
}
static int
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_ether_addr addr;
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ int ret;
PMD_INIT_FUNC_TRACE();
e1000_reset_hw(hw);
- igbvf_dev_stop(dev);
+ ret = igbvf_dev_stop(dev);
+ if (ret != 0)
+ return ret;
igb_dev_free_queues(dev);
bool disable_meta_caching);
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 int ena_stop(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);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct ena_adapter *adapter = dev->data->dev_private;
+ int ret = 0;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
if (adapter->state == ENA_ADAPTER_STATE_RUNNING)
- ena_stop(dev);
+ ret = ena_stop(dev);
adapter->state = ENA_ADAPTER_STATE_CLOSED;
ena_rx_queue_release_all(dev);
*/
dev->data->mac_addrs = NULL;
- return 0;
+ return ret;
}
static int
return rc;
}
-static void ena_stop(struct rte_eth_dev *dev)
+static int ena_stop(struct rte_eth_dev *dev)
{
struct ena_adapter *adapter = dev->data->dev_private;
struct ena_com_dev *ena_dev = &adapter->ena_dev;
++adapter->dev_stats.dev_stop;
adapter->state = ENA_ADAPTER_STATE_STOPPED;
dev->data->dev_started = 0;
+
+ return 0;
}
static int ena_create_io_queue(struct ena_ring *ring)
return 0;
}
-static void
+static int
enetc_dev_stop(struct rte_eth_dev *dev)
{
struct enetc_eth_hw *hw =
val = enetc_port_rd(enetc_hw, ENETC_PM0_CMD_CFG);
enetc_port_wr(enetc_hw, ENETC_PM0_CMD_CFG,
val & (~(ENETC_PM0_TX_EN | ENETC_PM0_RX_EN)));
+
+ return 0;
}
static const uint32_t *
enetc_dev_close(struct rte_eth_dev *dev)
{
uint16_t i;
+ int ret;
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- enetc_dev_stop(dev);
+ ret = enetc_dev_stop(dev);
for (i = 0; i < dev->data->nb_rx_queues; i++) {
enetc_rx_queue_release(dev->data->rx_queues[i]);
if (rte_eal_iova_mode() == RTE_IOVA_PA)
dpaax_iova_table_depopulate();
- return 0;
+ return ret;
}
static int
/*
* Stop device: disable rx and tx functions to allow for reconfiguring.
*/
-static void enicpmd_dev_stop(struct rte_eth_dev *eth_dev)
+static int enicpmd_dev_stop(struct rte_eth_dev *eth_dev)
{
struct rte_eth_link link;
struct enic *enic = pmd_priv(eth_dev);
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
- return;
+ return 0;
ENICPMD_FUNC_TRACE();
enic_disable(enic);
memset(&link, 0, sizeof(link));
rte_eth_linkstatus_set(eth_dev, &link);
+
+ return 0;
}
/*
return 0;
}
-static void enic_vf_dev_stop(struct rte_eth_dev *eth_dev)
+static int enic_vf_dev_stop(struct rte_eth_dev *eth_dev)
{
struct enic_vf_representor *vf;
struct vnic_rq *rq;
ENICPMD_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
- return;
+ return 0;
/* Undo dev_start. Disable/clean WQ */
vf = eth_dev->data->dev_private;
pf = vf->pf;
eth_dev->data->rx_queue_state[0] = RTE_ETH_QUEUE_STATE_STOPPED;
/* Clean up representor flowman */
enic_fm_destroy(&vf->enic);
+
+ return 0;
}
/*
RTE_ETH_QUEUE_STATE_STOPPED;
}
-static void
+static int
fs_dev_stop(struct rte_eth_dev *dev)
{
struct sub_device *sdev;
uint8_t i;
+ int ret;
fs_lock(dev, 0);
PRIV(dev)->state = DEV_STARTED - 1;
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_STARTED) {
- rte_eth_dev_stop(PORT_ID(sdev));
+ ret = rte_eth_dev_stop(PORT_ID(sdev));
+ if (fs_err(sdev, ret) < 0) {
+ ERROR("Failed to stop device %u",
+ PORT_ID(sdev));
+ PRIV(dev)->state = DEV_STARTED + 1;
+ fs_unlock(dev, 0);
+ return ret;
+ }
failsafe_rx_intr_uninstall_subdevice(sdev);
sdev->state = DEV_STARTED - 1;
}
failsafe_rx_intr_uninstall(dev);
fs_set_queues_state_stop(dev);
fs_unlock(dev, 0);
+
+ return 0;
}
static int
fs_lock(dev, 0);
failsafe_hotplug_alarm_cancel(dev);
- if (PRIV(dev)->state == DEV_STARTED)
- dev->dev_ops->dev_stop(dev);
+ if (PRIV(dev)->state == DEV_STARTED) {
+ ret = dev->dev_ops->dev_stop(dev);
+ if (ret != 0) {
+ fs_unlock(dev, 0);
+ return ret;
+ }
+ }
PRIV(dev)->state = DEV_ACTIVE - 1;
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
DEBUG("Closing sub_device %d", i);
return 0;
}
-static void
+static int
fm10k_dev_stop(struct rte_eth_dev *dev)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
rte_intr_efd_disable(intr_handle);
rte_free(intr_handle->intr_vec);
intr_handle->intr_vec = NULL;
+
+ return 0;
}
static void
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pdev->intr_handle;
+ int ret;
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
/* Stop mailbox service first */
fm10k_close_mbx_service(hw);
- fm10k_dev_stop(dev);
+
+ ret = fm10k_dev_stop(dev);
+
fm10k_dev_queue_release(dev);
fm10k_stop_hw(hw);
fm10k_dev_interrupt_handler_vf, (void *)dev);
}
- return 0;
+ return ret;
}
static const struct eth_dev_ops fm10k_eth_dev_ops = {
* @param dev
* Pointer to Ethernet device structure.
*/
-static void hinic_dev_stop(struct rte_eth_dev *dev)
+static int hinic_dev_stop(struct rte_eth_dev *dev)
{
int rc;
char *name;
if (!rte_bit_relaxed_test_and_clear32(HINIC_DEV_START,
&nic_dev->dev_status)) {
PMD_DRV_LOG(INFO, "Device %s already stopped", name);
- return;
+ return 0;
}
/* just stop phy port and vport */
/* free mbuf */
hinic_free_all_rx_mbuf(dev);
hinic_free_all_tx_mbuf(dev);
+
+ return 0;
}
static void hinic_disable_interrupt(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);
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
}
/* stop device first */
- hinic_dev_stop(dev);
+ ret = hinic_dev_stop(dev);
/* rx_cqe, rx_info */
hinic_free_all_rx_resources(dev);
/* deinit nic hardware device */
hinic_nic_dev_destroy(dev);
- return 0;
+ return ret;
}
static const struct eth_dev_ops hinic_pmd_ops = {
}
}
-static void
+static int
hns3_dev_stop(struct rte_eth_dev *dev)
{
struct hns3_adapter *hns = dev->data->dev_private;
hns3_rx_scattered_reset(dev);
rte_eal_alarm_cancel(hns3_service_handler, dev);
rte_spinlock_unlock(&hw->lock);
+
+ return 0;
}
static int
{
struct hns3_adapter *hns = eth_dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
+ int ret = 0;
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
rte_free(eth_dev->process_private);
}
if (hw->adapter_state == HNS3_NIC_STARTED)
- hns3_dev_stop(eth_dev);
+ ret = hns3_dev_stop(eth_dev);
hw->adapter_state = HNS3_NIC_CLOSING;
hns3_reset_abort(hns);
hns3_mp_uninit_primary();
hns3_warn(hw, "Close port %d finished", hw->data->port_id);
- return 0;
+ return ret;
}
static int
}
}
-static void
+static int
hns3vf_dev_stop(struct rte_eth_dev *dev)
{
struct hns3_adapter *hns = dev->data->dev_private;
hns3_rx_scattered_reset(dev);
rte_eal_alarm_cancel(hns3vf_service_handler, dev);
rte_spinlock_unlock(&hw->lock);
+
+ return 0;
}
static int
{
struct hns3_adapter *hns = eth_dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
+ int ret = 0;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
if (hw->adapter_state == HNS3_NIC_STARTED)
- hns3vf_dev_stop(eth_dev);
+ ret = hns3vf_dev_stop(eth_dev);
hw->adapter_state = HNS3_NIC_CLOSING;
hns3_reset_abort(hns);
hns3_mp_uninit_primary();
hns3_warn(hw, "Close port %d finished", hw->data->port_id);
- return 0;
+ return ret;
}
static int
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 int i40e_dev_stop(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);
return ret;
}
-static void
+static int
i40e_dev_stop(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
int i;
if (hw->adapter_stopped == 1)
- return;
+ return 0;
if (dev->data->dev_conf.intr_conf.rxq == 0) {
rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev);
dev->data->dev_started = 0;
pf->adapter->rss_reta_updated = 0;
+
+ return 0;
}
static int
PMD_INIT_LOG(WARNING, "failed to free switch domain: %d", ret);
- i40e_dev_stop(dev);
+ ret = i40e_dev_stop(dev);
/* Remove all mirror rules */
while ((p_mirror = TAILQ_FIRST(&pf->mirror_list))) {
i40e_tm_conf_uninit(dev);
hw->adapter_closed = 1;
- return 0;
+ return ret;
}
/*
static int i40evf_dev_configure(struct rte_eth_dev *dev);
static int i40evf_dev_start(struct rte_eth_dev *dev);
-static void i40evf_dev_stop(struct rte_eth_dev *dev);
+static int i40evf_dev_stop(struct rte_eth_dev *dev);
static int i40evf_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int i40evf_dev_link_update(struct rte_eth_dev *dev,
return -1;
}
-static void
+static int
i40evf_dev_stop(struct rte_eth_dev *dev)
{
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
rte_intr_disable(intr_handle);
if (hw->adapter_stopped == 1)
- return;
+ return 0;
i40evf_stop_queues(dev);
i40evf_disable_queues_intr(dev);
i40e_dev_clear_queues(dev);
FALSE);
hw->adapter_stopped = 1;
dev->data->dev_started = 0;
+
+ return 0;
}
static int
{
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- i40evf_dev_stop(dev);
+ ret = i40evf_dev_stop(dev);
+
i40e_dev_free_queues(dev);
/*
* disable promiscuous mode before reset vf
vf->aq_resp = NULL;
hw->adapter_closed = 1;
- return 0;
+ return ret;
}
/*
return 0;
}
-static void
+static int
i40e_vf_representor_dev_stop(__rte_unused struct rte_eth_dev *dev)
{
+ return 0;
}
static int
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 int iavf_dev_stop(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,
return -1;
}
-static void
+static int
iavf_dev_stop(struct rte_eth_dev *dev)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
PMD_INIT_FUNC_TRACE();
if (adapter->stopped == 1)
- return;
+ return 0;
iavf_stop_queues(dev);
adapter->stopped = 1;
dev->data->dev_started = 0;
+
+ return 0;
}
static int
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- iavf_dev_stop(dev);
+ ret = iavf_dev_stop(dev);
+
iavf_flow_flush(dev, NULL);
iavf_flow_uninit(adapter);
vf->vf_reset = false;
- return 0;
+ return ret;
}
static int
}
}
-static void
+static int
ice_dcf_dev_stop(struct rte_eth_dev *dev)
{
struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
if (ad->pf.adapter_stopped == 1) {
PMD_DRV_LOG(DEBUG, "Port is already stopped");
- return;
+ return 0;
}
ice_dcf_stop_queues(dev);
ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
dev->data->dev_link.link_status = ETH_LINK_DOWN;
ad->pf.adapter_stopped = 1;
+
+ return 0;
}
static int
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 int ice_dev_stop(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,
ICE_WRITE_REG(hw, GLINT_DYN_CTL(0), GLINT_DYN_CTL_WB_ON_ITR_M);
}
-static void
+static int
ice_dev_stop(struct rte_eth_dev *dev)
{
struct rte_eth_dev_data *data = dev->data;
/* avoid stopping again */
if (pf->adapter_stopped)
- return;
+ return 0;
/* stop and clear all Rx queues */
for (i = 0; i < data->nb_rx_queues; i++)
pf->adapter_stopped = true;
dev->data->dev_started = 0;
+
+ return 0;
}
static int
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct ice_adapter *ad =
ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
*/
ice_pf_disable_irq0(hw);
- ice_dev_stop(dev);
+ ret = ice_dev_stop(dev);
if (!ad->is_safe_mode)
ice_flow_uninit(ad);
rte_intr_callback_unregister(intr_handle,
ice_interrupt_handler, dev);
- return 0;
+ return ret;
}
static int
static int eth_igc_configure(struct rte_eth_dev *dev);
static int eth_igc_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static void eth_igc_stop(struct rte_eth_dev *dev);
+static int 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);
* This routine disables all traffic on the adapter by issuing a
* global reset on the MAC.
*/
-static void
+static int
eth_igc_stop(struct rte_eth_dev *dev)
{
struct igc_adapter *adapter = IGC_DEV_PRIVATE(dev);
rte_free(intr_handle->intr_vec);
intr_handle->intr_vec = NULL;
}
+
+ return 0;
}
/*
struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
struct igc_adapter *adapter = IGC_DEV_PRIVATE(dev);
int retry = 0;
+ int ret = 0;
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
if (!adapter->stopped)
- eth_igc_stop(dev);
+ ret = eth_igc_stop(dev);
igc_flow_flush(dev, NULL);
igc_clear_all_filter(dev);
/* Reset any pending lock */
igc_reset_swfw_lock(hw);
- return 0;
+ return ret;
}
static void
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 int ionic_dev_stop(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);
/*
* Stop device: disable rx and tx functions to allow for reconfiguring.
*/
-static void
+static int
ionic_dev_stop(struct rte_eth_dev *eth_dev)
{
struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
err = ionic_lif_stop(lif);
if (err)
IONIC_PRINT(ERR, "Cannot stop LIF: %d", err);
+
+ return err;
}
/*
return 0;
}
-static void
+static int
ipn3ke_rpst_dev_stop(struct rte_eth_dev *dev)
{
struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
/* Disable the RX path */
ipn3ke_xmac_rx_disable(hw, rpst->port_id, 0);
}
+
+ return 0;
}
static int
static int ixgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev);
static int ixgbe_l2_tn_filter_uninit(struct rte_eth_dev *eth_dev);
static int ixgbe_ntuple_filter_uninit(struct rte_eth_dev *eth_dev);
-static int ixgbe_dev_configure(struct rte_eth_dev *dev);
-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 int ixgbe_dev_close(struct rte_eth_dev *dev);
-static int ixgbe_dev_reset(struct rte_eth_dev *dev);
+static int ixgbe_dev_configure(struct rte_eth_dev *dev);
+static int ixgbe_dev_start(struct rte_eth_dev *dev);
+static int 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 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);
static int ixgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
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 int ixgbevf_dev_stop(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);
/*
* Stop device: disable rx and tx functions to allow for reconfiguring.
*/
-static void
+static int
ixgbe_dev_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);
if (hw->adapter_stopped)
- return;
+ return 0;
PMD_INIT_FUNC_TRACE();
hw->adapter_stopped = true;
dev->data->dev_started = 0;
+
+ return 0;
}
/*
ixgbe_pf_reset_hw(hw);
- ixgbe_dev_stop(dev);
+ ret = ixgbe_dev_stop(dev);
ixgbe_dev_free_queues(dev);
rte_free(dev->security_ctx);
#endif
- return 0;
+ return ret;
}
/*
return 0;
}
-static void
+static int
ixgbevf_dev_stop(struct rte_eth_dev *dev)
{
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
if (hw->adapter_stopped)
- return;
+ return 0;
PMD_INIT_FUNC_TRACE();
}
adapter->rss_reta_updated = 0;
+
+ return 0;
}
static int
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+ int ret;
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
ixgbe_reset_hw(hw);
- ixgbevf_dev_stop(dev);
+ ret = ixgbevf_dev_stop(dev);
ixgbe_dev_free_queues(dev);
rte_intr_callback_unregister(intr_handle,
ixgbevf_dev_interrupt_handler, dev);
- return 0;
+ return ret;
}
/*
return 0;
}
-static void ixgbe_vf_representor_dev_stop(__rte_unused struct rte_eth_dev *dev)
+static int ixgbe_vf_representor_dev_stop(__rte_unused struct rte_eth_dev *dev)
{
+ return 0;
}
static int
return 0;
}
-static void
+static int
eth_kni_dev_stop(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = dev->data->dev_private;
dev->data->dev_link.link_status = 0;
dev->data->dev_started = 0;
+
+ return 0;
}
static int
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- eth_kni_dev_stop(eth_dev);
+ ret = eth_kni_dev_stop(eth_dev);
/* mac_addrs must not be freed alone because part of dev_private */
eth_dev->data->mac_addrs = NULL;
PMD_LOG(WARNING, "Not able to release kni for %s",
eth_dev->data->name);
- return 0;
+ return ret;
}
static int
{
struct rte_eth_dev *eth_dev;
const char *name;
+ int ret;
name = rte_vdev_device_name(vdev);
PMD_LOG(INFO, "Un-Initializing eth_kni for %s", name);
eth_dev = rte_eth_dev_allocated(name);
if (eth_dev != NULL) {
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
- eth_kni_dev_stop(eth_dev);
+ ret = eth_kni_dev_stop(eth_dev);
+ if (ret != 0)
+ return ret;
return rte_eth_dev_release_port(eth_dev);
}
eth_kni_close(eth_dev);
}
/* Stop device and disable input/output functions */
-static void
+static int
lio_dev_stop(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
/* Clear recorded link status */
lio_dev->linfo.link.link_status64 = 0;
+
+ return 0;
}
static int
lio_dev_close(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
+ int ret = 0;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
lio_dev_info(lio_dev, "closing port %d\n", eth_dev->data->port_id);
if (lio_dev->intf_open)
- lio_dev_stop(eth_dev);
+ ret = lio_dev_stop(eth_dev);
/* Reset ioq regs */
lio_dev->fn_list.setup_device_regs(lio_dev);
/* Delete all queues */
lio_dev_clear_queues(eth_dev);
- return 0;
+ return ret;
}
/**
lio_reconf_queues(struct rte_eth_dev *eth_dev, int num_txq, int num_rxq)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
+ int ret;
if (lio_dev->nb_rx_queues != num_rxq ||
lio_dev->nb_tx_queues != num_txq) {
lio_dev->nb_tx_queues = num_txq;
}
- if (lio_dev->intf_open)
- lio_dev_stop(eth_dev);
+ if (lio_dev->intf_open) {
+ ret = lio_dev_stop(eth_dev);
+ if (ret != 0)
+ return ret;
+ }
/* Reset ioq registers */
if (lio_dev->fn_list.setup_device_regs(lio_dev)) {
NULL,
};
-static void mlx4_dev_stop(struct rte_eth_dev *dev);
+static int mlx4_dev_stop(struct rte_eth_dev *dev);
/**
* Initialize shared data between primary and secondary process.
* @param dev
* Pointer to Ethernet device structure.
*/
-static void
+static int
mlx4_dev_stop(struct rte_eth_dev *dev)
{
struct mlx4_priv *priv = dev->data->dev_private;
if (!priv->started)
- return;
+ return 0;
DEBUG("%p: detaching flows from all RX queues", (void *)dev);
priv->started = 0;
dev->tx_pkt_burst = mlx4_tx_burst_removed;
mlx4_flow_sync(priv, NULL);
mlx4_rxq_intr_disable(priv);
mlx4_rss_deinit(priv);
+
+ return 0;
}
/**
/* mlx5_trigger.c */
int mlx5_dev_start(struct rte_eth_dev *dev);
-void mlx5_dev_stop(struct rte_eth_dev *dev);
+int mlx5_dev_stop(struct rte_eth_dev *dev);
int mlx5_traffic_enable(struct rte_eth_dev *dev);
void mlx5_traffic_disable(struct rte_eth_dev *dev);
int mlx5_traffic_restart(struct rte_eth_dev *dev);
* @param dev
* Pointer to Ethernet device structure.
*/
-void
+int
mlx5_dev_stop(struct rte_eth_dev *dev)
{
struct mlx5_priv *priv = dev->data->dev_private;
mlx5_txq_stop(dev);
mlx5_rxq_stop(dev);
mlx5_txpp_stop(dev);
+
+ return 0;
}
/**
* @param dev
* Pointer to Ethernet device structure.
*/
-static void
+static int
mvneta_dev_stop(struct rte_eth_dev *dev)
{
struct mvneta_priv *priv = dev->data->dev_private;
dev->data->dev_started = 0;
if (!priv->ppio)
- return;
+ return 0;
mvneta_dev_set_link_down(dev);
mvneta_flush_queues(dev);
neta_ppio_deinit(priv->ppio);
priv->ppio = NULL;
+
+ return 0;
}
/**
mvneta_dev_close(struct rte_eth_dev *dev)
{
struct mvneta_priv *priv = dev->data->dev_private;
- int i;
+ int i, ret = 0;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
if (priv->ppio)
- mvneta_dev_stop(dev);
+ ret = mvneta_dev_stop(dev);
for (i = 0; i < dev->data->nb_rx_queues; i++) {
mvneta_rx_queue_release(dev->data->rx_queues[i]);
rte_mvep_deinit(MVEP_MOD_T_NETA);
}
- return 0;
+ return ret;
}
/**
* @param dev
* Pointer to Ethernet device structure.
*/
-static void
+static int
mrvl_dev_stop(struct rte_eth_dev *dev)
{
- mrvl_dev_set_link_down(dev);
+ return mrvl_dev_set_link_down(dev);
}
/**
return error;
}
-static void
+static int
hn_dev_stop(struct rte_eth_dev *dev)
{
struct hn_data *hv = dev->data->dev_private;
dev->data->dev_started = 0;
hn_rndis_set_rxfilter(hv, 0);
- hn_vf_stop(dev);
+ return hn_vf_stop(dev);
}
static int
eth_hn_dev_uninit(struct rte_eth_dev *eth_dev)
{
struct hn_data *hv = eth_dev->data->dev_private;
- int ret;
+ int ret, ret_stop;
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- hn_dev_stop(eth_dev);
+ ret_stop = hn_dev_stop(eth_dev);
hn_dev_close(eth_dev);
hn_detach(hv);
if (ret != 0)
return ret;
- return 0;
+ return ret_stop;
}
static int eth_hn_probe(struct rte_vmbus_driver *drv __rte_unused,
const uint32_t *hn_vf_supported_ptypes(struct rte_eth_dev *dev);
int hn_vf_start(struct rte_eth_dev *dev);
void hn_vf_reset(struct rte_eth_dev *dev);
-void hn_vf_stop(struct rte_eth_dev *dev);
int hn_vf_close(struct rte_eth_dev *dev);
+int hn_vf_stop(struct rte_eth_dev *dev);
int hn_vf_allmulticast_enable(struct rte_eth_dev *dev);
int hn_vf_allmulticast_disable(struct rte_eth_dev *dev);
return ret;
}
-void hn_vf_stop(struct rte_eth_dev *dev)
+int hn_vf_stop(struct rte_eth_dev *dev)
{
struct hn_data *hv = dev->data->dev_private;
struct rte_eth_dev *vf_dev;
+ int ret = 0;
rte_rwlock_read_lock(&hv->vf_lock);
vf_dev = hn_get_vf_dev(hv);
- if (vf_dev)
- rte_eth_dev_stop(vf_dev->data->port_id);
+ if (vf_dev) {
+ ret = rte_eth_dev_stop(vf_dev->data->port_id);
+ if (ret != 0)
+ PMD_DRV_LOG(ERR, "Failed to stop device on port %u",
+ vf_dev->data->port_id);
+ }
rte_rwlock_read_unlock(&hv->vf_lock);
+
+ return ret;
}
/* If VF is present, then cascade configuration down */
* @param dev
* Pointer to Ethernet device structure.
*/
-static void
+static int
nfb_eth_dev_stop(struct rte_eth_dev *dev)
{
uint16_t i;
for (i = 0; i < nb_rx; i++)
nfb_eth_rx_queue_stop(dev, i);
+
+ return 0;
}
/**
uint16_t i;
uint16_t nb_rx = dev->data->nb_rx_queues;
uint16_t nb_tx = dev->data->nb_tx_queues;
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- nfb_eth_dev_stop(dev);
+ ret = nfb_eth_dev_stop(dev);
nfb_nc_rxmac_deinit(internals->rxmac, internals->max_rxmac);
nfb_nc_txmac_deinit(internals->txmac, internals->max_txmac);
}
dev->data->nb_tx_queues = 0;
- return 0;
+ return ret;
}
/**
static int nfp_net_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int nfp_net_stats_reset(struct rte_eth_dev *dev);
-static void nfp_net_stop(struct rte_eth_dev *dev);
+static int nfp_net_stop(struct rte_eth_dev *dev);
static uint16_t nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
}
/* Stop device: disable rx and tx functions to allow for reconfiguring. */
-static void
+static int
nfp_net_stop(struct rte_eth_dev *dev)
{
int i;
nfp_eth_set_configured(dev->process_private,
hw->pf_port_idx, 0);
}
+
+ return 0;
}
/* Set the link up. */
return 0;
}
-static void
+static int
eth_dev_stop(struct rte_eth_dev *dev)
{
if (dev == NULL)
- return;
+ return 0;
dev->data->dev_link.link_status = ETH_LINK_DOWN;
+
+ return 0;
}
static int
return ret;
}
-static void
+static int
octeontx_dev_stop(struct rte_eth_dev *dev)
{
struct octeontx_nic *nic = octeontx_pmd_priv(dev);
if (ret < 0) {
octeontx_log_err("failed to req stop port %d res=%d",
nic->port_id, ret);
- return;
+ return ret;
}
ret = octeontx_pki_port_stop(nic->port_id);
if (ret < 0) {
octeontx_log_err("failed to stop pki port %d res=%d",
nic->port_id, ret);
- return;
+ return ret;
}
ret = octeontx_pko_channel_stop(nic->base_ochan);
octeontx_log_err("failed to stop channel %d VF%d %d %d",
nic->base_ochan, nic->port_id, nic->num_tx_queues,
ret);
- return;
+ return ret;
}
+
+ return 0;
}
static int
return rc;
}
-static void
+static int
otx2_nix_dev_stop(struct rte_eth_dev *eth_dev)
{
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
/* Stop tx queues */
for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
otx2_nix_tx_queue_stop(eth_dev, i);
+
+ return 0;
}
static int
* Is the only place for us to close all the tx streams dumpers.
* If not called the dumpers will be flushed within each tx burst.
*/
-static void
+static int
eth_dev_stop(struct rte_eth_dev *dev)
{
unsigned int i;
dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
dev->data->dev_link.link_status = ETH_LINK_DOWN;
+
+ return 0;
}
static int
}
}
-static void
+static int
pfe_eth_stop(struct rte_eth_dev *dev/*, int wake*/)
{
struct pfe_eth_priv_s *priv = dev->data->dev_private;
dev->rx_pkt_burst = &pfe_dummy_recv_pkts;
dev->tx_pkt_burst = &pfe_dummy_xmit_pkts;
+
+ return 0;
}
static int
pfe_eth_close(struct rte_eth_dev *dev)
{
+ int ret;
PMD_INIT_FUNC_TRACE();
if (!dev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- pfe_eth_stop(dev);
+ ret = pfe_eth_stop(dev);
/* Close the device file for link status */
pfe_eth_close_cdev(dev->data->dev_private);
g_pfe = NULL;
}
- return 0;
+ return ret;
}
static int
static int
pfe_link_down(struct rte_eth_dev *dev)
{
- pfe_eth_stop(dev);
- return 0;
+ return pfe_eth_stop(dev);
}
static int
eth_dev->data->mtu = 1500;
eth_dev->dev_ops = &ops;
- pfe_eth_stop(eth_dev);
+ err = pfe_eth_stop(eth_dev);
+ if (err != 0)
+ goto err0;
pfe_gemac_init(priv);
eth_dev->data->nb_rx_queues = 1;
return -1; /* common error code is < 0 */
}
-static void qede_dev_stop(struct rte_eth_dev *eth_dev)
+static int qede_dev_stop(struct rte_eth_dev *eth_dev)
{
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
/* Disable vport */
if (qede_activate_vport(eth_dev, false))
- return;
+ return 0;
if (qdev->enable_lro)
qede_enable_tpa(eth_dev, false);
ecore_hw_stop_fastpath(edev); /* TBD - loop */
DP_INFO(edev, "Device is stopped\n");
+
+ return 0;
}
static const char * const valid_args[] = {
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
+ int ret = 0;
PMD_INIT_FUNC_TRACE(edev);
* can release all the resources and device can be brought up newly
*/
if (eth_dev->data->dev_started)
- qede_dev_stop(eth_dev);
+ ret = qede_dev_stop(eth_dev);
if (qdev->vport_started)
qede_stop_vport(edev);
if (ECORE_IS_CMT(edev))
rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev);
- return 0;
+ return ret;
}
static int
}
if (dev->data->dev_started) {
dev->data->dev_started = 0;
- qede_dev_stop(dev);
+ rc = qede_dev_stop(dev);
+ if (rc != 0)
+ return rc;
restart = true;
}
rte_delay_ms(1000);
return 0;
}
-static void
+static int
eth_dev_stop(struct rte_eth_dev *dev)
{
dev->data->dev_started = 0;
dev->data->dev_link.link_status = ETH_LINK_DOWN;
+ return 0;
}
static int
struct pmd_internals *internals = NULL;
struct ring_queue *r = NULL;
uint16_t i;
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- eth_dev_stop(dev);
+ ret = eth_dev_stop(dev);
internals = dev->data->dev_private;
if (internals->action == DEV_CREATE) {
/* mac_addrs must not be freed alone because part of dev_private */
dev->data->mac_addrs = NULL;
- return 0;
+ return ret;
}
static const struct eth_dev_ops ops = {
return ret;
}
-static void
+static int
sfc_dev_stop(struct rte_eth_dev *dev)
{
struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
sfc_adapter_unlock(sa);
sfc_log_init(sa, "done");
+
+ return 0;
}
static int
return 0;
}
-static void
+static int
pmd_dev_stop(struct rte_eth_dev *dev)
{
struct pmd_internals *p = dev->data->dev_private;
tm_hierarchy_free(p);
softnic_mtr_free(p);
+
+ return 0;
}
static void
return ret;
}
-static void
+static int
eth_dev_stop(struct rte_eth_dev *dev)
{
uint16_t i;
uint16_t nb_rx = dev->data->nb_rx_queues;
uint16_t nb_tx = dev->data->nb_tx_queues;
+ int ret;
dev->data->dev_started = 0;
- for (i = 0; i < nb_tx; i++)
- eth_tx_queue_stop(dev, i);
+ for (i = 0; i < nb_tx; i++) {
+ ret = eth_tx_queue_stop(dev, i);
+ if (ret != 0)
+ return ret;
+ }
- for (i = 0; i < nb_rx; i++)
- eth_rx_queue_stop(dev, i);
+ for (i = 0; i < nb_rx; i++) {
+ ret = eth_rx_queue_stop(dev, i);
+ if (ret != 0)
+ return ret;
+ }
+
+ return 0;
}
static int
uint16_t i;
uint16_t nb_rx = dev->data->nb_rx_queues;
uint16_t nb_tx = dev->data->nb_tx_queues;
+ int ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- eth_dev_stop(dev);
+ ret = eth_dev_stop(dev);
free(internals->sze_dev_path);
}
dev->data->nb_tx_queues = 0;
- return 0;
+ return ret;
}
static int
/* This function gets called when the current port gets stopped.
*/
-static void
+static int
tap_dev_stop(struct rte_eth_dev *dev)
{
int i;
tap_intr_handle_set(dev, 0);
tap_link_set_down(dev);
+
+ return 0;
}
static int
#include "nicvf_svf.h"
#include "nicvf_logs.h"
-static void nicvf_dev_stop(struct rte_eth_dev *dev);
+static int nicvf_dev_stop(struct rte_eth_dev *dev);
static void nicvf_dev_stop_cleanup(struct rte_eth_dev *dev, bool cleanup);
static void nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic,
bool cleanup);
PMD_INIT_LOG(ERR, "Failed to reclaim CPI config %d", ret);
}
-static void
+static int
nicvf_dev_stop(struct rte_eth_dev *dev)
{
PMD_INIT_FUNC_TRACE();
nicvf_dev_stop_cleanup(dev, false);
+
+ return 0;
}
static void
return 0;
}
-static void
+static int
eth_dev_stop(struct rte_eth_dev *dev)
{
struct pmd_internal *internal = dev->data->dev_private;
dev->data->dev_started = 0;
rte_atomic32_set(&internal->started, 0);
update_queuing_status(dev);
+
+ return 0;
}
static int
{
struct pmd_internal *internal;
struct internal_list *list;
- unsigned int i;
+ unsigned int i, ret;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
if (!internal)
return 0;
- eth_dev_stop(dev);
+ ret = eth_dev_stop(dev);
list = find_internal_resource(internal->iface_name);
if (list) {
rte_free(vring_states[dev->data->port_id]);
vring_states[dev->data->port_id] = NULL;
- return 0;
+ return ret;
}
static int
static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
static int virtio_dev_configure(struct rte_eth_dev *dev);
static int virtio_dev_start(struct rte_eth_dev *dev);
-static void virtio_dev_stop(struct rte_eth_dev *dev);
+static int virtio_dev_stop(struct rte_eth_dev *dev);
static int virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
static int virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
static int virtio_dev_allmulticast_enable(struct rte_eth_dev *dev);
static int
eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
{
+ int ret;
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() == RTE_PROC_SECONDARY)
return 0;
- virtio_dev_stop(eth_dev);
+ ret = virtio_dev_stop(eth_dev);
virtio_dev_close(eth_dev);
PMD_INIT_LOG(DEBUG, "dev_uninit completed");
- return 0;
+ return ret;
}
/*
* Stop device: disable interrupt and mark link down
*/
-static void
+static int
virtio_dev_stop(struct rte_eth_dev *dev)
{
struct virtio_hw *hw = dev->data->dev_private;
rte_eth_linkstatus_set(dev, &link);
out_unlock:
rte_spinlock_unlock(&hw->state_lock);
+
+ return 0;
}
static int
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 int vmxnet3_dev_stop(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);
/*
* Stop device: disable rx and tx functions to allow for reconfiguring.
*/
-static void
+static int
vmxnet3_dev_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
if (hw->adapter_stopped == 1) {
PMD_INIT_LOG(DEBUG, "Device already stopped.");
- return;
+ return 0;
}
/* disable interrupts */
hw->adapter_stopped = 1;
dev->data->dev_started = 0;
+
+ return 0;
}
static void
static int
vmxnet3_dev_close(struct rte_eth_dev *dev)
{
+ int ret;
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- vmxnet3_dev_stop(dev);
+ ret = vmxnet3_dev_stop(dev);
vmxnet3_free_queues(dev);
- return 0;
+ return ret;
}
static void
rte_eth_dev_stop(uint16_t port_id)
{
struct rte_eth_dev *dev;
+ int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
}
dev->data->dev_started = 0;
- (*dev->dev_ops->dev_stop)(dev);
- rte_ethdev_trace_stop(port_id);
+ ret = (*dev->dev_ops->dev_stop)(dev);
+ rte_ethdev_trace_stop(port_id, ret);
- return 0;
+ return ret;
}
int
typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
/**< @internal Function used to start a configured Ethernet device. */
-typedef void (*eth_dev_stop_t)(struct rte_eth_dev *dev);
+typedef int (*eth_dev_stop_t)(struct rte_eth_dev *dev);
/**< @internal Function used to stop a configured Ethernet device. */
typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
RTE_TRACE_POINT(
rte_ethdev_trace_stop,
- RTE_TRACE_POINT_ARGS(uint16_t port_id),
+ RTE_TRACE_POINT_ARGS(uint16_t port_id, int ret),
rte_trace_point_emit_u16(port_id);
+ rte_trace_point_emit_int(ret);
)
RTE_TRACE_POINT(