src/dpdk/drivers/net/hinic/hinic_pmd_ethdev.c
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;

	if (rte_bit_relaxed_test_and_set32(HINIC_DEV_CLOSE,
					   &nic_dev->dev_status)) {
		PMD_DRV_LOG(WARNING, "Device %s already closed",
			    dev->data->name);
		return 0;
	}

	/* stop device first */
	ret = hinic_dev_stop(dev);

	/* rx_cqe, rx_info */
	hinic_free_all_rx_resources(dev);

	/* tx_info */
	hinic_free_all_tx_resources(dev);

	/* free wq, pi_dma_addr */
	hinic_free_all_rq(nic_dev);

	/* free wq, db_addr */
	hinic_free_all_sq(nic_dev);

	/* deinit mac vlan tbl */
	hinic_deinit_mac_addr(dev);
	hinic_remove_all_vlanid(dev);

	/* disable hardware and uio interrupt */
	hinic_disable_interrupt(dev);

	/* destroy rx mode mutex */
	hinic_mutex_destroy(&nic_dev->rx_mode_mutex);

	/* deinit nic hardware device */
	hinic_nic_dev_destroy(dev);

	return ret;
}
/**
 * DPDK callback to close the device.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 */
DPDK callback to close the device.
@param dev
Pointer to Ethernet device structure.
DPDK callback to close the device . @param dev Pointer to Ethernet device structure .
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;
	if (rte_bit_relaxed_test_and_set32(HINIC_DEV_CLOSE,
					   &nic_dev->dev_status)) {
		PMD_DRV_LOG(WARNING, "Device %s already closed",
			    dev->data->name);
		return 0;
	}
	ret = hinic_dev_stop(dev);
	hinic_free_all_rx_resources(dev);
	hinic_free_all_tx_resources(dev);
	hinic_free_all_rq(nic_dev);
	hinic_free_all_sq(nic_dev);
	hinic_deinit_mac_addr(dev);
	hinic_remove_all_vlanid(dev);
	hinic_disable_interrupt(dev);
	hinic_mutex_destroy(&nic_dev->rx_mode_mutex);
	hinic_nic_dev_destroy(dev);
	return ret;
}
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 ; if ( rte_bit_relaxed_test_and_set32 ( HINIC_DEV_CLOSE , & nic_dev -> dev_status ) ) { PMD_DRV_LOG ( WARNING , " " , dev -> data -> name ) ; return 0 ; } ret = hinic_dev_stop ( dev ) ; hinic_free_all_rx_resources ( dev ) ; hinic_free_all_tx_resources ( dev ) ; hinic_free_all_rq ( nic_dev ) ; hinic_free_all_sq ( nic_dev ) ; hinic_deinit_mac_addr ( dev ) ; hinic_remove_all_vlanid ( dev ) ; hinic_disable_interrupt ( dev ) ; hinic_mutex_destroy ( & nic_dev -> rx_mode_mutex ) ; hinic_nic_dev_destroy ( dev ) ; return ret ; }
DPDK callback to close the device.
DPDK callback to close the device .
/* stop device first */ /* rx_cqe, rx_info */ /* tx_info */ /* free wq, pi_dma_addr */ /* free wq, db_addr */ /* deinit mac vlan tbl */ /* disable hardware and uio interrupt */ /* destroy rx mode mutex */ /* deinit nic hardware device */