From: Bodong Wang <bodong@xxxxxxxxxxxx> This patch drops the need to extend the verbs layer each time with some non generic fields when creating a CQ. It adds an option to set some opaque vendor data in some generic way which can fit any vendor. The solution introduced for creating a CQ but expects to fit for other IB objects as of QP, SRQ, etc. It comes as a pre-patch for supplying some private mlx5 fields in downstream patches. The solution: 1) Introduce a new comp_mask bit (i.e. IBV_CQ_INIT_ATTR_MASK_VENDOR_DATA) and a matching void* vendor data field. 2) Vendor should expose its header file for direct access with relevant private structures. 3) Application should supply the input based on vendor-defined structure. 4) Upon getting the private data the vendor will cast to its internal structure and use the data as part of CQ creation. Note: The format of the input is vendor specific and should be defined in an extended way to support backward/forward compatibility. (e.g. by using comp_mask, etc.) Signed-off-by: Bodong Wang <bodong@xxxxxxxxxxxx> Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxxxx> --- libibverbs/man/ibv_create_cq_ex.3 | 2 ++ libibverbs/verbs.h | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libibverbs/man/ibv_create_cq_ex.3 b/libibverbs/man/ibv_create_cq_ex.3 index a6ae769..2a1bc92 100644 --- a/libibverbs/man/ibv_create_cq_ex.3 +++ b/libibverbs/man/ibv_create_cq_ex.3 @@ -28,6 +28,7 @@ struct ibv_comp_channel *channel; /* Completion channel where completio int comp_vector; /* Completion vector used to signal completion events. Must be >= 0 and < context->num_comp_vectors. */ uint64_t wc_flags; /* The wc_flags that should be returned in ibv_poll_cq_ex. Or'ed bit of enum ibv_wc_flags_ex. */ uint32_t comp_mask; /* compatibility mask (extended verb). */ +void *vendor_data; /* Vendor private data for creating a CQ. */ .in -8 }; @@ -44,6 +45,7 @@ enum ibv_wc_flags_ex { enum ibv_cq_init_attr_mask { IBV_CQ_INIT_ATTR_MASK_FLAGS = 1 << 0, + IBV_CQ_INIT_ATTR_MASK_VENDOR_DATA = 1 << 1, }; enum ibv_create_cq_attr_flags { diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 25f4ede..2575e01 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1399,7 +1399,8 @@ struct ibv_context { enum ibv_cq_init_attr_mask { IBV_CQ_INIT_ATTR_MASK_FLAGS = 1 << 0, - IBV_CQ_INIT_ATTR_MASK_RESERVED = 1 << 1 + IBV_CQ_INIT_ATTR_MASK_VENDOR_DATA = 1 << 1, + IBV_CQ_INIT_ATTR_MASK_RESERVED = 1 << 2 }; enum ibv_create_cq_attr_flags { @@ -1430,6 +1431,8 @@ struct ibv_cq_init_attr_ex { * enum ibv_create_cq_attr_flags */ uint32_t flags; + /* Vendor private data for creating a CQ */ + void *vendor_data; }; enum ibv_values_mask { -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html