Skip to content

Commit

Permalink
Merge pull request #804 from yishaih/verbs_misc
Browse files Browse the repository at this point in the history
verbs: Use WQ creation flags properly
  • Loading branch information
yishaih committed Aug 13, 2020
2 parents 568ad09 + 6def1b8 commit 8a620e9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions libibverbs/cmd_wq.c
Expand Up @@ -41,6 +41,7 @@ static int ibv_icmd_create_wq(struct ibv_context *context,
DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_WQ, UVERBS_METHOD_WQ_CREATE, 13, link);
struct verbs_ex_private *priv = get_priv(context);
struct ib_uverbs_attr *handle;
uint32_t create_flags = 0;
uint32_t max_wr;
uint32_t max_sge;
uint32_t wq_num;
Expand All @@ -59,7 +60,14 @@ static int ibv_icmd_create_wq(struct ibv_context *context,
fill_attr_in_uint32(cmdb, UVERBS_ATTR_CREATE_WQ_MAX_WR, wq_init_attr->max_wr);
fill_attr_in_uint32(cmdb, UVERBS_ATTR_CREATE_WQ_MAX_SGE, wq_init_attr->max_sge);
fill_attr_in_fd(cmdb, UVERBS_ATTR_CREATE_WQ_EVENT_FD, wq->context->async_fd);
fill_attr_in_uint32(cmdb, UVERBS_ATTR_CREATE_WQ_FLAGS, wq_init_attr->create_flags);
if (wq_init_attr->comp_mask & IBV_WQ_INIT_ATTR_FLAGS) {
if (wq_init_attr->create_flags & ~(IBV_WQ_FLAGS_RESERVED - 1)) {
errno = EOPNOTSUPP;
return errno;
}
create_flags = wq_init_attr->create_flags;
}
fill_attr_in_uint32(cmdb, UVERBS_ATTR_CREATE_WQ_FLAGS, create_flags);
fill_attr_out_ptr(cmdb, UVERBS_ATTR_CREATE_WQ_RESP_MAX_WR, &max_wr);
fill_attr_out_ptr(cmdb, UVERBS_ATTR_CREATE_WQ_RESP_MAX_SGE, &max_sge);
fill_attr_out_ptr(cmdb, UVERBS_ATTR_CREATE_WQ_RESP_WQ_NUM, &wq_num);
Expand Down Expand Up @@ -127,13 +135,6 @@ int ibv_cmd_create_wq(struct ibv_context *context,
return errno;
}

if (wq_init_attr->comp_mask & IBV_WQ_INIT_ATTR_FLAGS) {
if (wq_init_attr->create_flags & ~(IBV_WQ_FLAGS_RESERVED - 1)) {
errno = EOPNOTSUPP;
return errno;
}
}

return ibv_icmd_create_wq(context, wq_init_attr, wq, cmdb);
}

Expand Down

0 comments on commit 8a620e9

Please sign in to comment.