Skip to content

Commit b0e9df6

Browse files
yonatancodledford
authored andcommitted
IB/mlx5: Exposing modify CQ callback to uverbs layer
Exposed mlx5_ib_modify_cq to be called from ib device verb list. Signed-off-by: Yonatan Cohen <yonatanc@mellanox.com> Reviewed-by: Majd Dibbiny <majd@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 34d9a27 commit b0e9df6

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎drivers/infiniband/hw/mlx5/cq.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,9 @@ int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period)
11491149
if (!MLX5_CAP_GEN(dev->mdev, cq_moderation))
11501150
return -ENOSYS;
11511151

1152+
if (cq_period > MLX5_MAX_CQ_PERIOD)
1153+
return -EINVAL;
1154+
11521155
err = mlx5_core_modify_cq_moderation(dev->mdev, &mcq->mcq,
11531156
cq_period, cq_count);
11541157
if (err)

‎drivers/infiniband/hw/mlx5/main.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4022,7 +4022,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
40224022
(1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE) |
40234023
(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ) |
40244024
(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP) |
4025-
(1ull << IB_USER_VERBS_EX_CMD_MODIFY_QP);
4025+
(1ull << IB_USER_VERBS_EX_CMD_MODIFY_QP) |
4026+
(1ull << IB_USER_VERBS_EX_CMD_MODIFY_CQ);
40264027

40274028
dev->ib_dev.query_device = mlx5_ib_query_device;
40284029
dev->ib_dev.query_port = mlx5_ib_query_port;

‎include/linux/mlx5/cq.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ enum {
128128
CQE_SIZE_128_PAD = 2,
129129
};
130130

131+
#define MLX5_MAX_CQ_PERIOD (BIT(__mlx5_bit_sz(cqc, cq_period)) - 1)
132+
#define MLX5_MAX_CQ_COUNT (BIT(__mlx5_bit_sz(cqc, cq_max_count)) - 1)
133+
131134
static inline int cqe_sz_to_mlx_sz(u8 size, int padding_128_en)
132135
{
133136
return padding_128_en ? CQE_SIZE_128_PAD :

0 commit comments

Comments
 (0)