> Subject: [PATCH rdma-next 6/6] RDMA/mana_ib: implement uapi for creation > of rnic cq > > From: Konstantin Taranov <kotaranov@xxxxxxxxxxxxx> > > Enable users to create RNIC CQs. > With the previous request size, an ethernet CQ is created. > Use the cq_buf_size from the user to create an RNIC CQ and return its ID. > > Signed-off-by: Konstantin Taranov <kotaranov@xxxxxxxxxxxxx> > --- > drivers/infiniband/hw/mana/cq.c | 56 ++++++++++++++++++++++++++++++--- > include/uapi/rdma/mana-abi.h | 7 +++++ > 2 files changed, 59 insertions(+), 4 deletions(-) > > diff --git a/drivers/infiniband/hw/mana/cq.c > b/drivers/infiniband/hw/mana/cq.c index 8323085..a62bda7 100644 > --- a/drivers/infiniband/hw/mana/cq.c > +++ b/drivers/infiniband/hw/mana/cq.c > @@ -9,17 +9,25 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct > ib_cq_init_attr *attr, > struct ib_udata *udata) > { > struct mana_ib_cq *cq = container_of(ibcq, struct mana_ib_cq, ibcq); > + struct mana_ib_create_cq_resp resp = {}; > + struct mana_ib_ucontext *mana_ucontext; > struct ib_device *ibdev = ibcq->device; > struct mana_ib_create_cq ucmd = {}; > struct mana_ib_dev *mdev; > + bool is_rnic_cq = true; > + u32 doorbell; > int err; > > mdev = container_of(ibdev, struct mana_ib_dev, ib_dev); > > - if (udata->inlen < sizeof(ucmd)) > + cq->comp_vector = attr->comp_vector % ibdev->num_comp_vectors; > + cq->cq_handle = INVALID_MANA_HANDLE; > + > + if (udata->inlen < offsetof(struct mana_ib_create_cq, cq_buf_size)) > return -EINVAL; > > - cq->comp_vector = attr->comp_vector % ibdev->num_comp_vectors; > + if (udata->inlen == offsetof(struct mana_ib_create_cq, cq_buf_size)) > + is_rnic_cq = false; I think it's okay with checking on offset in uapi message to decide if this is a newer/updated RNIC uverb. But increasing MANA_IB_UVERBS_ABI_VERSION may make the code simpler. I have a feeling that you may need to increase it anyway, because a new uapi message "mana_ib_create_cq_resp" is introduced. Jason or Leon may have a better idea on this.