src/dpdk/drivers/net/mlx4/mlx4.c
static int
mlx4_dev_close(struct rte_eth_dev *dev)
{
	struct mlx4_priv *priv = dev->data->dev_private;
	unsigned int i;

	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
		rte_eth_dev_release_port(dev);
		return 0;
	}
	DEBUG("%p: closing device \"%s\"",
	      (void *)dev,
	      ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
	dev->rx_pkt_burst = mlx4_rx_burst_removed;
	dev->tx_pkt_burst = mlx4_tx_burst_removed;
	rte_wmb();
	/* Disable datapath on secondary process. */
	mlx4_mp_req_stop_rxtx(dev);
	mlx4_flow_clean(priv);
	mlx4_rss_deinit(priv);
	for (i = 0; i != dev->data->nb_rx_queues; ++i)
		mlx4_rx_queue_release(dev->data->rx_queues[i]);
	for (i = 0; i != dev->data->nb_tx_queues; ++i)
		mlx4_tx_queue_release(dev->data->tx_queues[i]);
	mlx4_proc_priv_uninit(dev);
	mlx4_mr_release(dev);
	if (priv->pd != NULL) {
		MLX4_ASSERT(priv->ctx != NULL);
		claim_zero(mlx4_glue->dealloc_pd(priv->pd));
		claim_zero(mlx4_glue->close_device(priv->ctx));
	} else
		MLX4_ASSERT(priv->ctx == NULL);
	mlx4_intr_uninstall(priv);
	memset(priv, 0, sizeof(*priv));
	/* mac_addrs must not be freed because part of dev_private */
	dev->data->mac_addrs = NULL;
	return 0;
}
/**
 * DPDK callback to close the device.
 *
 * Destroy all queues and objects, free memory.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 */
DPDK callback to close the device.
Destroy all queues and objects, free memory.

@param dev
Pointer to Ethernet device structure.
DPDK callback to close the device . Destroy all queues and objects free memory . @param dev Pointer to Ethernet device structure .
static int
mlx4_dev_close(struct rte_eth_dev *dev)
{
	struct mlx4_priv *priv = dev->data->dev_private;
	unsigned int i;
	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
		rte_eth_dev_release_port(dev);
		return 0;
	}
	DEBUG("%p: closing device \"%s\"",
	      (void *)dev,
	      ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
	dev->rx_pkt_burst = mlx4_rx_burst_removed;
	dev->tx_pkt_burst = mlx4_tx_burst_removed;
	rte_wmb();
	mlx4_mp_req_stop_rxtx(dev);
	mlx4_flow_clean(priv);
	mlx4_rss_deinit(priv);
	for (i = 0; i != dev->data->nb_rx_queues; ++i)
		mlx4_rx_queue_release(dev->data->rx_queues[i]);
	for (i = 0; i != dev->data->nb_tx_queues; ++i)
		mlx4_tx_queue_release(dev->data->tx_queues[i]);
	mlx4_proc_priv_uninit(dev);
	mlx4_mr_release(dev);
	if (priv->pd != NULL) {
		MLX4_ASSERT(priv->ctx != NULL);
		claim_zero(mlx4_glue->dealloc_pd(priv->pd));
		claim_zero(mlx4_glue->close_device(priv->ctx));
	} else
		MLX4_ASSERT(priv->ctx == NULL);
	mlx4_intr_uninstall(priv);
	memset(priv, 0, sizeof(*priv));
	dev->data->mac_addrs = NULL;
	return 0;
}
static int mlx4_dev_close ( struct rte_eth_dev * dev ) { struct mlx4_priv * priv = dev -> data -> dev_private ; unsigned int i ; if ( rte_eal_process_type ( ) == RTE_PROC_SECONDARY ) { rte_eth_dev_release_port ( dev ) ; return 0 ; } DEBUG ( " \" \" " , ( void * ) dev , ( ( priv -> ctx != NULL ) ? priv -> ctx -> device -> name : " " ) ) ; dev -> rx_pkt_burst = mlx4_rx_burst_removed ; dev -> tx_pkt_burst = mlx4_tx_burst_removed ; rte_wmb ( ) ; mlx4_mp_req_stop_rxtx ( dev ) ; mlx4_flow_clean ( priv ) ; mlx4_rss_deinit ( priv ) ; for ( i = 0 ; i != dev -> data -> nb_rx_queues ; ++ i ) mlx4_rx_queue_release ( dev -> data -> rx_queues [ i ] ) ; for ( i = 0 ; i != dev -> data -> nb_tx_queues ; ++ i ) mlx4_tx_queue_release ( dev -> data -> tx_queues [ i ] ) ; mlx4_proc_priv_uninit ( dev ) ; mlx4_mr_release ( dev ) ; if ( priv -> pd != NULL ) { MLX4_ASSERT ( priv -> ctx != NULL ) ; claim_zero ( mlx4_glue -> dealloc_pd ( priv -> pd ) ) ; claim_zero ( mlx4_glue -> close_device ( priv -> ctx ) ) ; } else MLX4_ASSERT ( priv -> ctx == NULL ) ; mlx4_intr_uninstall ( priv ) ; memset ( priv , 0 , sizeof ( * priv ) ) ; dev -> data -> mac_addrs = NULL ; return 0 ; }
DPDK callback to close the device.
DPDK callback to close the device .
/* Disable datapath on secondary process. */ /* mac_addrs must not be freed because part of dev_private */