Skip to content

Commit 7232c13

Browse files
Tal Gilboajgunthorpe
authored andcommitted
RDMA/mlx5: Allow CQ creation without attached EQs
The traditional DevX CQ creation flow goes through mlx5_core_create_cq() which checks that the given EQN corresponds to an existing EQ and attaches a devx handler to the EQN for the CQ. In some cases the EQ will not be a kernel EQ, but will be controlled by modify CQ, don't block creating these just because the EQN can't be found in the kernel. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tal Gilboa <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent e2853c4 commit 7232c13

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

drivers/infiniband/hw/mlx5/devx.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,16 @@ static void devx_cq_comp(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe)
14391439
rcu_read_unlock();
14401440
}
14411441

1442+
static bool is_apu_thread_cq(struct mlx5_ib_dev *dev, const void *in)
1443+
{
1444+
if (!MLX5_CAP_GEN(dev->mdev, apu) ||
1445+
!MLX5_GET(cqc, MLX5_ADDR_OF(create_cq_in, in, cq_context),
1446+
apu_thread_cq))
1447+
return false;
1448+
1449+
return true;
1450+
}
1451+
14421452
static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
14431453
struct uverbs_attr_bundle *attrs)
14441454
{
@@ -1492,7 +1502,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
14921502
obj->flags |= DEVX_OBJ_FLAGS_DCT;
14931503
err = mlx5_core_create_dct(dev, &obj->core_dct, cmd_in,
14941504
cmd_in_len, cmd_out, cmd_out_len);
1495-
} else if (opcode == MLX5_CMD_OP_CREATE_CQ) {
1505+
} else if (opcode == MLX5_CMD_OP_CREATE_CQ &&
1506+
!is_apu_thread_cq(dev, cmd_in)) {
14961507
obj->flags |= DEVX_OBJ_FLAGS_CQ;
14971508
obj->core_cq.comp = devx_cq_comp;
14981509
err = mlx5_core_create_cq(dev->mdev, &obj->core_cq,

include/linux/mlx5/mlx5_ifc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
16341634
u8 sf_set_partition[0x1];
16351635
u8 reserved_at_682[0x1];
16361636
u8 log_max_sf[0x5];
1637-
u8 reserved_at_688[0x8];
1637+
u8 apu[0x1];
1638+
u8 reserved_at_689[0x7];
16381639
u8 log_min_sf_size[0x8];
16391640
u8 max_num_sf_partitions[0x8];
16401641

@@ -3816,7 +3817,7 @@ struct mlx5_ifc_cqc_bits {
38163817
u8 status[0x4];
38173818
u8 reserved_at_4[0x2];
38183819
u8 dbr_umem_valid[0x1];
3819-
u8 reserved_at_7[0x1];
3820+
u8 apu_thread_cq[0x1];
38203821
u8 cqe_sz[0x3];
38213822
u8 cc[0x1];
38223823
u8 reserved_at_c[0x1];

0 commit comments

Comments
 (0)