src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c
static int
ixgbe_dev_stop(struct rte_eth_dev *dev)
{
	struct rte_eth_link link;
	struct ixgbe_adapter *adapter = dev->data->dev_private;
	struct ixgbe_hw *hw =
		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
	struct ixgbe_vf_info *vfinfo =
		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(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 vf;
	struct ixgbe_tm_conf *tm_conf =
		IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);

	if (hw->adapter_stopped)
		return 0;

	PMD_INIT_FUNC_TRACE();

	ixgbe_dev_wait_setup_link_complete(dev, 0);

	/* disable interrupts */
	ixgbe_disable_intr(hw);

	/* reset the NIC */
	ixgbe_pf_reset_hw(hw);
	hw->adapter_stopped = 0;

	/* stop adapter */
	ixgbe_stop_adapter(hw);

	for (vf = 0; vfinfo != NULL && vf < pci_dev->max_vfs; vf++)
		vfinfo[vf].clear_to_send = false;

	if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) {
		/* Turn off the copper */
		ixgbe_set_phy_power(hw, false);
	} else {
		/* Turn off the laser */
		ixgbe_disable_tx_laser(hw);
	}

	ixgbe_dev_clear_queues(dev);

	/* Clear stored conf */
	dev->data->scattered_rx = 0;
	dev->data->lro = 0;

	/* Clear recorded link status */
	memset(&link, 0, sizeof(link));
	rte_eth_linkstatus_set(dev, &link);

	if (!rte_intr_allow_others(intr_handle))
		/* resume to the default handler */
		rte_intr_callback_register(intr_handle,
					   ixgbe_dev_interrupt_handler,
					   (void *)dev);

	/* Clean datapath event and queue/vec mapping */
	rte_intr_efd_disable(intr_handle);
	if (intr_handle->intr_vec != NULL) {
		rte_free(intr_handle->intr_vec);
		intr_handle->intr_vec = NULL;
	}

	/* reset hierarchy commit */
	tm_conf->committed = false;

	adapter->rss_reta_updated = 0;

	hw->adapter_stopped = true;
	dev->data->dev_started = 0;

	return 0;
}
/*
 * Stop device: disable rx and tx functions to allow for reconfiguring.
 */
Stop device: disable rx and tx functions to allow for reconfiguring.
Stop device : disable rx and tx functions to allow for reconfiguring .
static int
ixgbe_dev_stop(struct rte_eth_dev *dev)
{
	struct rte_eth_link link;
	struct ixgbe_adapter *adapter = dev->data->dev_private;
	struct ixgbe_hw *hw =
		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
	struct ixgbe_vf_info *vfinfo =
		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(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 vf;
	struct ixgbe_tm_conf *tm_conf =
		IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);
	if (hw->adapter_stopped)
		return 0;
	PMD_INIT_FUNC_TRACE();
	ixgbe_dev_wait_setup_link_complete(dev, 0);
	ixgbe_disable_intr(hw);
	ixgbe_pf_reset_hw(hw);
	hw->adapter_stopped = 0;
	ixgbe_stop_adapter(hw);
	for (vf = 0; vfinfo != NULL && vf < pci_dev->max_vfs; vf++)
		vfinfo[vf].clear_to_send = false;
	if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) {
		ixgbe_set_phy_power(hw, false);
	} else {
		ixgbe_disable_tx_laser(hw);
	}
	ixgbe_dev_clear_queues(dev);
	dev->data->scattered_rx = 0;
	dev->data->lro = 0;
	memset(&link, 0, sizeof(link));
	rte_eth_linkstatus_set(dev, &link);
	if (!rte_intr_allow_others(intr_handle))
		rte_intr_callback_register(intr_handle,
					   ixgbe_dev_interrupt_handler,
					   (void *)dev);
	rte_intr_efd_disable(intr_handle);
	if (intr_handle->intr_vec != NULL) {
		rte_free(intr_handle->intr_vec);
		intr_handle->intr_vec = NULL;
	}
	tm_conf->committed = false;
	adapter->rss_reta_updated = 0;
	hw->adapter_stopped = true;
	dev->data->dev_started = 0;
	return 0;
}
static int ixgbe_dev_stop ( struct rte_eth_dev * dev ) { struct rte_eth_link link ; struct ixgbe_adapter * adapter = dev -> data -> dev_private ; struct ixgbe_hw * hw = IXGBE_DEV_PRIVATE_TO_HW ( dev -> data -> dev_private ) ; struct ixgbe_vf_info * vfinfo = * IXGBE_DEV_PRIVATE_TO_P_VFDATA ( 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 vf ; struct ixgbe_tm_conf * tm_conf = IXGBE_DEV_PRIVATE_TO_TM_CONF ( dev -> data -> dev_private ) ; if ( hw -> adapter_stopped ) return 0 ; PMD_INIT_FUNC_TRACE ( ) ; ixgbe_dev_wait_setup_link_complete ( dev , 0 ) ; ixgbe_disable_intr ( hw ) ; ixgbe_pf_reset_hw ( hw ) ; hw -> adapter_stopped = 0 ; ixgbe_stop_adapter ( hw ) ; for ( vf = 0 ; vfinfo != NULL && vf < pci_dev -> max_vfs ; vf ++ ) vfinfo [ vf ] . clear_to_send = false ; if ( hw -> mac . ops . get_media_type ( hw ) == ixgbe_media_type_copper ) { ixgbe_set_phy_power ( hw , false ) ; } else { ixgbe_disable_tx_laser ( hw ) ; } ixgbe_dev_clear_queues ( dev ) ; dev -> data -> scattered_rx = 0 ; dev -> data -> lro = 0 ; memset ( & link , 0 , sizeof ( link ) ) ; rte_eth_linkstatus_set ( dev , & link ) ; if ( ! rte_intr_allow_others ( intr_handle ) ) rte_intr_callback_register ( intr_handle , ixgbe_dev_interrupt_handler , ( void * ) dev ) ; rte_intr_efd_disable ( intr_handle ) ; if ( intr_handle -> intr_vec != NULL ) { rte_free ( intr_handle -> intr_vec ) ; intr_handle -> intr_vec = NULL ; } tm_conf -> committed = false ; adapter -> rss_reta_updated = 0 ; hw -> adapter_stopped = true ; dev -> data -> dev_started = 0 ; return 0 ; }
Stop device: disable rx and tx functions to allow for reconfiguring.
Stop device : disable rx and tx functions to allow for reconfiguring .
/* disable interrupts */ /* reset the NIC */ /* stop adapter */ /* Turn off the copper */ /* Turn off the laser */ /* Clear stored conf */ /* Clear recorded link status */ /* resume to the default handler */ /* Clean datapath event and queue/vec mapping */ /* reset hierarchy commit */