src/dpdk/drivers/net/mlx4/mlx4_mr.c
static void
mlx4_mr_garbage_collect(struct rte_eth_dev *dev)
{
	struct mlx4_priv *priv = dev->data->dev_private;
	struct mlx4_mr *mr_next;
	struct mlx4_mr_list free_list = LIST_HEAD_INITIALIZER(free_list);

	/* Must be called from the primary process. */
	MLX4_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
	/*
	 * MR can't be freed with holding the lock because rte_free() could call
	 * memory free callback function. This will be a deadlock situation.
	 */
	rte_rwlock_write_lock(&priv->mr.rwlock);
	/* Detach the whole free list and release it after unlocking. */
	free_list = priv->mr.mr_free_list;
	LIST_INIT(&priv->mr.mr_free_list);
	rte_rwlock_write_unlock(&priv->mr.rwlock);
	/* Release resources. */
	mr_next = LIST_FIRST(&free_list);
	while (mr_next != NULL) {
		struct mlx4_mr *mr = mr_next;

		mr_next = LIST_NEXT(mr, mr);
		mr_free(mr);
	}
}
/**
 * Release resources of detached MR having no online entry.
 *
 * @param dev
 *   Pointer to Ethernet device.
 */
Release resources of detached MR having no online entry.
@param dev
Pointer to Ethernet device.
Release resources of detached MR having no online entry . @param dev Pointer to Ethernet device .
static void
mlx4_mr_garbage_collect(struct rte_eth_dev *dev)
{
	struct mlx4_priv *priv = dev->data->dev_private;
	struct mlx4_mr *mr_next;
	struct mlx4_mr_list free_list = LIST_HEAD_INITIALIZER(free_list);
	MLX4_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
	rte_rwlock_write_lock(&priv->mr.rwlock);
	free_list = priv->mr.mr_free_list;
	LIST_INIT(&priv->mr.mr_free_list);
	rte_rwlock_write_unlock(&priv->mr.rwlock);
	mr_next = LIST_FIRST(&free_list);
	while (mr_next != NULL) {
		struct mlx4_mr *mr = mr_next;
		mr_next = LIST_NEXT(mr, mr);
		mr_free(mr);
	}
}
static void mlx4_mr_garbage_collect ( struct rte_eth_dev * dev ) { struct mlx4_priv * priv = dev -> data -> dev_private ; struct mlx4_mr * mr_next ; struct mlx4_mr_list free_list = LIST_HEAD_INITIALIZER ( free_list ) ; MLX4_ASSERT ( rte_eal_process_type ( ) == RTE_PROC_PRIMARY ) ; rte_rwlock_write_lock ( & priv -> mr . rwlock ) ; free_list = priv -> mr . mr_free_list ; LIST_INIT ( & priv -> mr . mr_free_list ) ; rte_rwlock_write_unlock ( & priv -> mr . rwlock ) ; mr_next = LIST_FIRST ( & free_list ) ; while ( mr_next != NULL ) { struct mlx4_mr * mr = mr_next ; mr_next = LIST_NEXT ( mr , mr ) ; mr_free ( mr ) ; } }
Release resources of detached MR having no online entry.
Release resources of detached MR having no online entry .
/* Must be called from the primary process. */ /*
	 * MR can't be freed with holding the lock because rte_free() could call
	 * memory free callback function. This will be a deadlock situation.
	 */ /* Detach the whole free list and release it after unlocking. */ /* Release resources. */