mirror of https://gitee.com/openkylin/linux.git
net/mlx5: Use ida_alloc_range() instead of ida_simple_alloc()
ida_simple_alloc() and remove functions are deprecated.
Related change:
commit 3264ceec8f
("lib/idr.c: document that ida_simple_{get,remove}() are deprecated")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
233dd7d656
commit
8802b8a44e
|
@ -707,7 +707,7 @@ static void *mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev,
|
|||
}
|
||||
|
||||
if (accel_xfrm->attrs.action == MLX5_ACCEL_ESP_ACTION_DECRYPT) {
|
||||
err = ida_simple_get(&fipsec->halloc, 1, 0, GFP_KERNEL);
|
||||
err = ida_alloc_min(&fipsec->halloc, 1, GFP_KERNEL);
|
||||
if (err < 0) {
|
||||
context = ERR_PTR(err);
|
||||
goto exists;
|
||||
|
@ -758,7 +758,7 @@ static void *mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev,
|
|||
unlock_hash:
|
||||
mutex_unlock(&fipsec->sa_hash_lock);
|
||||
if (accel_xfrm->attrs.action == MLX5_ACCEL_ESP_ACTION_DECRYPT)
|
||||
ida_simple_remove(&fipsec->halloc, sa_ctx->sa_handle);
|
||||
ida_free(&fipsec->halloc, sa_ctx->sa_handle);
|
||||
exists:
|
||||
mutex_unlock(&fpga_xfrm->lock);
|
||||
kfree(sa_ctx);
|
||||
|
@ -852,7 +852,7 @@ mlx5_fpga_ipsec_release_sa_ctx(struct mlx5_fpga_ipsec_sa_ctx *sa_ctx)
|
|||
|
||||
if (sa_ctx->fpga_xfrm->accel_xfrm.attrs.action &
|
||||
MLX5_ACCEL_ESP_ACTION_DECRYPT)
|
||||
ida_simple_remove(&fipsec->halloc, sa_ctx->sa_handle);
|
||||
ida_free(&fipsec->halloc, sa_ctx->sa_handle);
|
||||
|
||||
mutex_lock(&fipsec->sa_hash_lock);
|
||||
WARN_ON(rhashtable_remove_fast(&fipsec->sa_hash, &sa_ctx->hash,
|
||||
|
|
|
@ -590,7 +590,7 @@ static void del_sw_fte(struct fs_node *node)
|
|||
&fte->hash,
|
||||
rhash_fte);
|
||||
WARN_ON(err);
|
||||
ida_simple_remove(&fg->fte_allocator, fte->index - fg->start_index);
|
||||
ida_free(&fg->fte_allocator, fte->index - fg->start_index);
|
||||
kmem_cache_free(steering->ftes_cache, fte);
|
||||
}
|
||||
|
||||
|
@ -640,7 +640,7 @@ static int insert_fte(struct mlx5_flow_group *fg, struct fs_fte *fte)
|
|||
int index;
|
||||
int ret;
|
||||
|
||||
index = ida_simple_get(&fg->fte_allocator, 0, fg->max_ftes, GFP_KERNEL);
|
||||
index = ida_alloc_max(&fg->fte_allocator, fg->max_ftes - 1, GFP_KERNEL);
|
||||
if (index < 0)
|
||||
return index;
|
||||
|
||||
|
@ -656,7 +656,7 @@ static int insert_fte(struct mlx5_flow_group *fg, struct fs_fte *fte)
|
|||
return 0;
|
||||
|
||||
err_ida_remove:
|
||||
ida_simple_remove(&fg->fte_allocator, index);
|
||||
ida_free(&fg->fte_allocator, index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,12 +88,12 @@ void mlx5_core_unreserve_gids(struct mlx5_core_dev *dev, unsigned int count)
|
|||
int mlx5_core_reserved_gid_alloc(struct mlx5_core_dev *dev, int *gid_index)
|
||||
{
|
||||
int end = dev->roce.reserved_gids.start +
|
||||
dev->roce.reserved_gids.count;
|
||||
dev->roce.reserved_gids.count - 1;
|
||||
int index = 0;
|
||||
|
||||
index = ida_simple_get(&dev->roce.reserved_gids.ida,
|
||||
dev->roce.reserved_gids.start, end,
|
||||
GFP_KERNEL);
|
||||
index = ida_alloc_range(&dev->roce.reserved_gids.ida,
|
||||
dev->roce.reserved_gids.start, end,
|
||||
GFP_KERNEL);
|
||||
if (index < 0)
|
||||
return index;
|
||||
|
||||
|
@ -105,7 +105,7 @@ int mlx5_core_reserved_gid_alloc(struct mlx5_core_dev *dev, int *gid_index)
|
|||
void mlx5_core_reserved_gid_free(struct mlx5_core_dev *dev, int gid_index)
|
||||
{
|
||||
mlx5_core_dbg(dev, "Freeing reserved GID %u\n", gid_index);
|
||||
ida_simple_remove(&dev->roce.reserved_gids.ida, gid_index);
|
||||
ida_free(&dev->roce.reserved_gids.ida, gid_index);
|
||||
}
|
||||
|
||||
unsigned int mlx5_core_reserved_gids_count(struct mlx5_core_dev *dev)
|
||||
|
|
Loading…
Reference in New Issue