src/dpdk/drivers/common/mlx5/mlx5_common_mr.c
static void
mlx5_mr_garbage_collect(struct mlx5_mr_share_cache *share_cache)
{
	struct mlx5_mr *mr_next;
	struct mlx5_mr_list free_list = LIST_HEAD_INITIALIZER(free_list);

	/* Must be called from the primary process. */
	MLX5_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(&share_cache->rwlock);
	/* Detach the whole free list and release it after unlocking. */
	free_list = share_cache->mr_free_list;
	LIST_INIT(&share_cache->mr_free_list);
	rte_rwlock_write_unlock(&share_cache->rwlock);
	/* Release resources. */
	mr_next = LIST_FIRST(&free_list);
	while (mr_next != NULL) {
		struct mlx5_mr *mr = mr_next;

		mr_next = LIST_NEXT(mr, mr);
		mlx5_mr_free(mr, share_cache->dereg_mr_cb);
	}
}
/**
 * Release resources of detached MR having no online entry.
 *
 * @param share_cache
 *   Pointer to a global shared MR cache.
 */
Release resources of detached MR having no online entry.
@param share_cache
Pointer to a global shared MR cache.
Release resources of detached MR having no online entry . @param share_cache Pointer to a global shared MR cache .
static void
mlx5_mr_garbage_collect(struct mlx5_mr_share_cache *share_cache)
{
	struct mlx5_mr *mr_next;
	struct mlx5_mr_list free_list = LIST_HEAD_INITIALIZER(free_list);
	MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
	rte_rwlock_write_lock(&share_cache->rwlock);
	free_list = share_cache->mr_free_list;
	LIST_INIT(&share_cache->mr_free_list);
	rte_rwlock_write_unlock(&share_cache->rwlock);
	mr_next = LIST_FIRST(&free_list);
	while (mr_next != NULL) {
		struct mlx5_mr *mr = mr_next;
		mr_next = LIST_NEXT(mr, mr);
		mlx5_mr_free(mr, share_cache->dereg_mr_cb);
	}
}
static void mlx5_mr_garbage_collect ( struct mlx5_mr_share_cache * share_cache ) { struct mlx5_mr * mr_next ; struct mlx5_mr_list free_list = LIST_HEAD_INITIALIZER ( free_list ) ; MLX5_ASSERT ( rte_eal_process_type ( ) == RTE_PROC_PRIMARY ) ; rte_rwlock_write_lock ( & share_cache -> rwlock ) ; free_list = share_cache -> mr_free_list ; LIST_INIT ( & share_cache -> mr_free_list ) ; rte_rwlock_write_unlock ( & share_cache -> rwlock ) ; mr_next = LIST_FIRST ( & free_list ) ; while ( mr_next != NULL ) { struct mlx5_mr * mr = mr_next ; mr_next = LIST_NEXT ( mr , mr ) ; mlx5_mr_free ( mr , share_cache -> dereg_mr_cb ) ; } }
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. */