src/dpdk/drivers/net/virtio/virtio_ethdev.c
int
virtio_dev_stop(struct rte_eth_dev *dev)
{
	struct virtio_hw *hw = dev->data->dev_private;
	struct rte_eth_link link;
	struct rte_intr_conf *intr_conf = &dev->data->dev_conf.intr_conf;

	PMD_INIT_LOG(DEBUG, "stop");
	dev->data->dev_started = 0;

	rte_spinlock_lock(&hw->state_lock);
	if (!hw->started)
		goto out_unlock;
	hw->started = 0;

	if (intr_conf->lsc || intr_conf->rxq) {
		virtio_intr_disable(dev);

		/* Reset interrupt callback  */
		if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
			rte_intr_callback_unregister(dev->intr_handle,
						     virtio_interrupt_handler,
						     dev);
		}
	}

	memset(&link, 0, sizeof(link));
	rte_eth_linkstatus_set(dev, &link);
out_unlock:
	rte_spinlock_unlock(&hw->state_lock);

	return 0;
}
/*
 * Stop device: disable interrupt and mark link down
 */
Stop device: disable interrupt and mark link down
Stop device : disable interrupt and mark link down
int
virtio_dev_stop(struct rte_eth_dev *dev)
{
	struct virtio_hw *hw = dev->data->dev_private;
	struct rte_eth_link link;
	struct rte_intr_conf *intr_conf = &dev->data->dev_conf.intr_conf;
	PMD_INIT_LOG(DEBUG, "stop");
	dev->data->dev_started = 0;
	rte_spinlock_lock(&hw->state_lock);
	if (!hw->started)
		goto out_unlock;
	hw->started = 0;
	if (intr_conf->lsc || intr_conf->rxq) {
		virtio_intr_disable(dev);
		if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
			rte_intr_callback_unregister(dev->intr_handle,
						     virtio_interrupt_handler,
						     dev);
		}
	}
	memset(&link, 0, sizeof(link));
	rte_eth_linkstatus_set(dev, &link);
out_unlock:
	rte_spinlock_unlock(&hw->state_lock);
	return 0;
}
int virtio_dev_stop ( struct rte_eth_dev * dev ) { struct virtio_hw * hw = dev -> data -> dev_private ; struct rte_eth_link link ; struct rte_intr_conf * intr_conf = & dev -> data -> dev_conf . intr_conf ; PMD_INIT_LOG ( DEBUG , " " ) ; dev -> data -> dev_started = 0 ; rte_spinlock_lock ( & hw -> state_lock ) ; if ( ! hw -> started ) goto out_unlock ; hw -> started = 0 ; if ( intr_conf -> lsc || intr_conf -> rxq ) { virtio_intr_disable ( dev ) ; if ( dev -> data -> dev_flags & RTE_ETH_DEV_INTR_LSC ) { rte_intr_callback_unregister ( dev -> intr_handle , virtio_interrupt_handler , dev ) ; } } memset ( & link , 0 , sizeof ( link ) ) ; rte_eth_linkstatus_set ( dev , & link ) ; out_unlock : rte_spinlock_unlock ( & hw -> state_lock ) ; return 0 ; }
Stop device: disable interrupt and mark link down
Stop device : disable interrupt and mark link down
/* Reset interrupt callback  */