src/dpdk/drivers/net/e1000/igb_ethdev.c
static int
eth_igb_stop(struct rte_eth_dev *dev)
{
	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
	struct rte_eth_link link;
	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
	struct e1000_adapter *adapter =
		E1000_DEV_PRIVATE(dev->data->dev_private);

	if (adapter->stopped)
		return 0;

	eth_igb_rxtx_control(dev, false);

	igb_intr_disable(dev);

	/* disable intr eventfd mapping */
	rte_intr_disable(intr_handle);

	igb_pf_reset_hw(hw);
	E1000_WRITE_REG(hw, E1000_WUC, 0);

	/* Set bit for Go Link disconnect if PHY reset is not blocked */
	if (hw->mac.type >= e1000_82580 &&
	    (e1000_check_reset_block(hw) != E1000_BLK_PHY_RESET)) {
		uint32_t phpm_reg;

		phpm_reg = E1000_READ_REG(hw, E1000_82580_PHY_POWER_MGMT);
		phpm_reg |= E1000_82580_PM_GO_LINKD;
		E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, phpm_reg);
	}

	/* Power down the phy. Needed to make the link go Down */
	eth_igb_dev_set_link_down(dev);

	igb_dev_clear_queues(dev);

	/* clear the 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,
					   eth_igb_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;
	}

	adapter->stopped = true;
	dev->data->dev_started = 0;

	return 0;
}
/*********************************************************************
 *
 *  This routine disables all traffic on the adapter by issuing a
 *  global reset on the MAC.
 *
 **********************************************************************/
This routine disables all traffic on the adapter by issuing a
global reset on the MAC.
This routine disables all traffic on the adapter by issuing a global reset on the MAC .
static int
eth_igb_stop(struct rte_eth_dev *dev)
{
	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
	struct rte_eth_link link;
	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
	struct e1000_adapter *adapter =
		E1000_DEV_PRIVATE(dev->data->dev_private);
	if (adapter->stopped)
		return 0;
	eth_igb_rxtx_control(dev, false);
	igb_intr_disable(dev);
	rte_intr_disable(intr_handle);
	igb_pf_reset_hw(hw);
	E1000_WRITE_REG(hw, E1000_WUC, 0);
	if (hw->mac.type >= e1000_82580 &&
	    (e1000_check_reset_block(hw) != E1000_BLK_PHY_RESET)) {
		uint32_t phpm_reg;
		phpm_reg = E1000_READ_REG(hw, E1000_82580_PHY_POWER_MGMT);
		phpm_reg |= E1000_82580_PM_GO_LINKD;
		E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, phpm_reg);
	}
	eth_igb_dev_set_link_down(dev);
	igb_dev_clear_queues(dev);
	memset(&link, 0, sizeof(link));
	rte_eth_linkstatus_set(dev, &link);
	if (!rte_intr_allow_others(intr_handle))
		rte_intr_callback_register(intr_handle,
					   eth_igb_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;
	}
	adapter->stopped = true;
	dev->data->dev_started = 0;
	return 0;
}
static int eth_igb_stop ( struct rte_eth_dev * dev ) { struct e1000_hw * hw = E1000_DEV_PRIVATE_TO_HW ( dev -> data -> dev_private ) ; struct rte_pci_device * pci_dev = RTE_ETH_DEV_TO_PCI ( dev ) ; struct rte_eth_link link ; struct rte_intr_handle * intr_handle = & pci_dev -> intr_handle ; struct e1000_adapter * adapter = E1000_DEV_PRIVATE ( dev -> data -> dev_private ) ; if ( adapter -> stopped ) return 0 ; eth_igb_rxtx_control ( dev , false ) ; igb_intr_disable ( dev ) ; rte_intr_disable ( intr_handle ) ; igb_pf_reset_hw ( hw ) ; E1000_WRITE_REG ( hw , E1000_WUC , 0 ) ; if ( hw -> mac . type >= e1000_82580 && ( e1000_check_reset_block ( hw ) != E1000_BLK_PHY_RESET ) ) { uint32_t phpm_reg ; phpm_reg = E1000_READ_REG ( hw , E1000_82580_PHY_POWER_MGMT ) ; phpm_reg |= E1000_82580_PM_GO_LINKD ; E1000_WRITE_REG ( hw , E1000_82580_PHY_POWER_MGMT , phpm_reg ) ; } eth_igb_dev_set_link_down ( dev ) ; igb_dev_clear_queues ( dev ) ; memset ( & link , 0 , sizeof ( link ) ) ; rte_eth_linkstatus_set ( dev , & link ) ; if ( ! rte_intr_allow_others ( intr_handle ) ) rte_intr_callback_register ( intr_handle , eth_igb_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 ; } adapter -> stopped = true ; dev -> data -> dev_started = 0 ; return 0 ; }
This routine disables all traffic on the adapter by issuing a
  global reset on the MAC.
This routine disables all traffic on the adapter by issuing a global reset on the MAC .
/* disable intr eventfd mapping */ /* Set bit for Go Link disconnect if PHY reset is not blocked */ /* Power down the phy. Needed to make the link go Down */ /* clear the recorded link status */ /* resume to the default handler */ /* Clean datapath event and queue/vec mapping */