RDMA/core: Add Completion Counters support

Add core infrastructure for Completion Counters, a light-weight
alternative to polling CQ for tracking operation completions.

Define the UVERBS_OBJECT_COMP_CNTR ioctl object with create, destroy,
modify and read methods for both success and error counters. Add a QP
attach method on the QP object to associate a completion counter with a
queue pair.

Add ib_comp_cntr struct, ib_comp_cntr_attach_attr, device ops, and
DECLARE_RDMA_OBJ_SIZE for driver object allocation.

Only userspace Completion Counters are supported at this stage.

Reviewed-by: Yonatan Nachum <ynachum@amazon.com>
Signed-off-by: Michael Margolin <mrgolin@amazon.com>
Link: https://patch.msgid.link/20260722083603.30334-2-mrgolin@amazon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
Michael Margolin
2026-07-22 08:35:58 +00:00
committed by Leon Romanovsky
parent 8b90e70134
commit b3818ea4ad
9 changed files with 310 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ enum uverbs_default_objects {
UVERBS_OBJECT_ASYNC_EVENT,
UVERBS_OBJECT_DMAH,
UVERBS_OBJECT_DMABUF,
UVERBS_OBJECT_COMP_CNTR,
};
enum {
@@ -169,9 +170,16 @@ enum uverbs_attrs_destroy_qp_cmd_attr_ids {
UVERBS_ATTR_DESTROY_QP_RESP,
};
enum uverbs_attrs_qp_attach_comp_cntr_cmd_attr_ids {
UVERBS_ATTR_QP_ATTACH_COMP_CNTR_HANDLE,
UVERBS_ATTR_QP_ATTACH_COMP_CNTR_CNTR_HANDLE,
UVERBS_ATTR_QP_ATTACH_COMP_CNTR_OP_MASK,
};
enum uverbs_methods_qp {
UVERBS_METHOD_QP_CREATE,
UVERBS_METHOD_QP_DESTROY,
UVERBS_METHOD_QP_ATTACH_COMP_CNTR,
};
enum uverbs_attrs_create_srq_cmd_attr_ids {
@@ -438,4 +446,32 @@ enum uverbs_attrs_query_gid_entry_cmd_attr_ids {
UVERBS_ATTR_QUERY_GID_ENTRY_RESP_ENTRY,
};
enum uverbs_methods_comp_cntr {
UVERBS_METHOD_COMP_CNTR_CREATE,
UVERBS_METHOD_COMP_CNTR_DESTROY,
UVERBS_METHOD_COMP_CNTR_MODIFY,
UVERBS_METHOD_COMP_CNTR_READ,
};
enum uverbs_attrs_create_comp_cntr_cmd_attr_ids {
UVERBS_ATTR_CREATE_COMP_CNTR_HANDLE,
};
enum uverbs_attrs_destroy_comp_cntr_cmd_attr_ids {
UVERBS_ATTR_DESTROY_COMP_CNTR_HANDLE,
};
enum uverbs_attrs_modify_comp_cntr_cmd_attr_ids {
UVERBS_ATTR_MODIFY_COMP_CNTR_HANDLE,
UVERBS_ATTR_MODIFY_COMP_CNTR_ENTRY,
UVERBS_ATTR_MODIFY_COMP_CNTR_OP,
UVERBS_ATTR_MODIFY_COMP_CNTR_VALUE,
};
enum uverbs_attrs_read_comp_cntr_cmd_attr_ids {
UVERBS_ATTR_READ_COMP_CNTR_HANDLE,
UVERBS_ATTR_READ_COMP_CNTR_ENTRY,
UVERBS_ATTR_READ_COMP_CNTR_RESP_VALUE,
};
#endif

View File

@@ -300,4 +300,23 @@ struct ib_uverbs_buffer_desc {
__aligned_u64 length;
};
enum ib_uverbs_comp_cntr_entry {
IB_UVERBS_COMP_CNTR_ENTRY_COMP,
IB_UVERBS_COMP_CNTR_ENTRY_ERR,
};
enum ib_uverbs_comp_cntr_modify_op {
IB_UVERBS_COMP_CNTR_MODIFY_OP_SET,
IB_UVERBS_COMP_CNTR_MODIFY_OP_INC,
};
enum ib_uverbs_qp_attach_comp_cntr_op {
IB_UVERBS_QP_ATTACH_COMP_CNTR_OP_SEND = 1 << 0,
IB_UVERBS_QP_ATTACH_COMP_CNTR_OP_RECV = 1 << 1,
IB_UVERBS_QP_ATTACH_COMP_CNTR_OP_RDMA_READ = 1 << 2,
IB_UVERBS_QP_ATTACH_COMP_CNTR_OP_REMOTE_RDMA_READ = 1 << 3,
IB_UVERBS_QP_ATTACH_COMP_CNTR_OP_RDMA_WRITE = 1 << 4,
IB_UVERBS_QP_ATTACH_COMP_CNTR_OP_REMOTE_RDMA_WRITE = 1 << 5,
};
#endif