Lines Matching +full:count +full:- +full:up
1 /*-
14 * - Redistributions of source code must retain the above
18 * - Redistributions in binary form must reproduce the above
42 ida_init(&dev->roce.reserved_gids.ida); in mlx5_init_reserved_gids()
43 dev->roce.reserved_gids.start = tblsz; in mlx5_init_reserved_gids()
44 dev->roce.reserved_gids.count = 0; in mlx5_init_reserved_gids()
49 WARN_ON(!ida_is_empty(&dev->roce.reserved_gids.ida)); in mlx5_cleanup_reserved_gids()
50 dev->roce.reserved_gids.start = 0; in mlx5_cleanup_reserved_gids()
51 dev->roce.reserved_gids.count = 0; in mlx5_cleanup_reserved_gids()
52 ida_destroy(&dev->roce.reserved_gids.ida); in mlx5_cleanup_reserved_gids()
55 int mlx5_core_reserve_gids(struct mlx5_core_dev *dev, unsigned int count) in mlx5_core_reserve_gids() argument
57 if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { in mlx5_core_reserve_gids()
58 mlx5_core_err(dev, "Cannot reserve GIDs when interfaces are up\n"); in mlx5_core_reserve_gids()
59 return -EPERM; in mlx5_core_reserve_gids()
61 if (dev->roce.reserved_gids.start < count) { in mlx5_core_reserve_gids()
63 count); in mlx5_core_reserve_gids()
64 return -ENOMEM; in mlx5_core_reserve_gids()
66 if (dev->roce.reserved_gids.count + count > MLX5_MAX_RESERVED_GIDS) { in mlx5_core_reserve_gids()
67 mlx5_core_warn(dev, "Unable to reserve %d more GIDs\n", count); in mlx5_core_reserve_gids()
68 return -ENOMEM; in mlx5_core_reserve_gids()
71 dev->roce.reserved_gids.start -= count; in mlx5_core_reserve_gids()
72 dev->roce.reserved_gids.count += count; in mlx5_core_reserve_gids()
74 dev->roce.reserved_gids.count, in mlx5_core_reserve_gids()
75 dev->roce.reserved_gids.start); in mlx5_core_reserve_gids()
79 void mlx5_core_unreserve_gids(struct mlx5_core_dev *dev, unsigned int count) in mlx5_core_unreserve_gids() argument
81 …WARN(test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state), "Unreserving GIDs when interfaces are up… in mlx5_core_unreserve_gids()
82 WARN(count > dev->roce.reserved_gids.count, "Unreserving %u GIDs when only %u reserved", in mlx5_core_unreserve_gids()
83 count, dev->roce.reserved_gids.count); in mlx5_core_unreserve_gids()
85 dev->roce.reserved_gids.start += count; in mlx5_core_unreserve_gids()
86 dev->roce.reserved_gids.count -= count; in mlx5_core_unreserve_gids()
88 dev->roce.reserved_gids.count, in mlx5_core_unreserve_gids()
89 dev->roce.reserved_gids.start); in mlx5_core_unreserve_gids()
94 int end = dev->roce.reserved_gids.start + in mlx5_core_reserved_gid_alloc()
95 dev->roce.reserved_gids.count; in mlx5_core_reserved_gid_alloc()
98 index = ida_simple_get(&dev->roce.reserved_gids.ida, in mlx5_core_reserved_gid_alloc()
99 dev->roce.reserved_gids.start, end, in mlx5_core_reserved_gid_alloc()
112 ida_simple_remove(&dev->roce.reserved_gids.ida, gid_index); in mlx5_core_reserved_gid_free()
117 return dev->roce.reserved_gids.count; in mlx5_core_reserved_gids_count()
136 return -EINVAL; in mlx5_core_roce_gid_set()