Extend CQ KABI to get an async FD for the given CQ. For now this attribute is optional, down the road this may become mandatory in few cases. (e.g. secondary process). Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx> --- libibverbs/cmd_cq.c | 7 +++++-- libibverbs/cmd_fallback.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libibverbs/cmd_cq.c b/libibverbs/cmd_cq.c index 542daa7..65293f6 100644 --- a/libibverbs/cmd_cq.c +++ b/libibverbs/cmd_cq.c @@ -31,14 +31,14 @@ */ #include <infiniband/cmd_write.h> - static int ibv_icmd_create_cq(struct ibv_context *context, int cqe, struct ibv_comp_channel *channel, int comp_vector, uint32_t flags, struct ibv_cq *cq, struct ibv_command_buffer *link) { - DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_CQ, UVERBS_METHOD_CQ_CREATE, 7, link); + DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_CQ, UVERBS_METHOD_CQ_CREATE, 8, link); struct ib_uverbs_attr *handle; + struct ib_uverbs_attr *async_fd_attr; uint32_t resp_cqe; int ret; @@ -52,6 +52,9 @@ static int ibv_icmd_create_cq(struct ibv_context *context, int cqe, if (channel) fill_attr_in_fd(cmdb, UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL, channel->fd); fill_attr_in_uint32(cmdb, UVERBS_ATTR_CREATE_CQ_COMP_VECTOR, comp_vector); + async_fd_attr = fill_attr_in_fd(cmdb, UVERBS_ATTR_CREATE_CQ_EVENT_FD, context->async_fd); + /* Prevent fallback to the 'write' mode if kernel doesn't support it */ + attr_optional(async_fd_attr); if (flags) { fallback_require_ex(cmdb); diff --git a/libibverbs/cmd_fallback.c b/libibverbs/cmd_fallback.c index 46c09f3..ee18217 100644 --- a/libibverbs/cmd_fallback.c +++ b/libibverbs/cmd_fallback.c @@ -104,7 +104,7 @@ enum write_fallback _execute_ioctl_fallback(struct ibv_context *ctx, if (*ret == EPROTONOSUPPORT) { /* * EPROTONOSUPPORT means we have the ioctl framework but this - * specific method is not supported + * specific method or a mandatory attribute is not supported */ bitmap_set_bit(priv->unsupported_ioctls, cmd_bit); return _check_legacy(cmdb, ret); -- 1.8.3.1