On Fri, Feb 15, 2019 at 06:45:33AM -0800, Kamenee Arumugam wrote: > The rvt_cq_wc struct elements are shared between rdmavt > and the providers but not in uapi directory. > As per the comment in > https://marc.info/?l=linux-rdma&m=152296522708522&w=2 > The hfi1 driver and the rdma core driver are not using > shared structures in the uapi directory. > > In that case, move rvt_cq_wc struct into the rvt-abi.h > header file and create a rvt_k_cq_w for the kernel > completion queue. > > Signed-off-by: Kamenee Arumugam <kamenee.arumugam@xxxxxxxxx> > Reviewed-by: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxx> > Signed-off-by: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx> > --- > Changes from v2 (https://patchwork.kernel.org/patch/10714369/) > Changed READ_ONCE/WRITE_ONCE macro to use smp_load_acquire > and smp_store_release. You need to resend the whole series. > @@ -212,17 +227,22 @@ struct ib_cq *rvt_create_cq(struct ib_device *ibdev, > * We need to use vmalloc() in order to support mmap and large > * numbers of entries. > */ > - sz = sizeof(*wc); > - if (udata && udata->outlen >= sizeof(__u64)) Probably for another patch, but what is this? I should never see udata linked to any type that is not a struct. > diff --git a/include/rdma/rdmavt_cq.h b/include/rdma/rdmavt_cq.h > index 75dc65c..9f25be0 100644 > --- a/include/rdma/rdmavt_cq.h > +++ b/include/rdma/rdmavt_cq.h > @@ -59,20 +59,17 @@ > * notifications are armed. > */ > #define RVT_CQ_NONE (IB_CQ_NEXT_COMP + 1) > +#include <rdma/rvt-abi.h> > > /* > * This structure is used to contain the head pointer, tail pointer, > * and completion queue entries as a single memory allocation so > * it can be mmap'ed into user space. > */ > -struct rvt_cq_wc { > +struct rvt_k_cq_wc { > u32 head; /* index of next entry to fill */ > u32 tail; /* index of next ib_poll_cq() entry */ > - union { > - /* these are actually size ibcq.cqe + 1 */ > - struct ib_uverbs_wc uqueue[0]; > - struct ib_wc kqueue[0]; > - }; > + struct ib_wc kqueue[0]; [] not [0] > diff --git a/include/uapi/rdma/rvt-abi.h b/include/uapi/rdma/rvt-abi.h > new file mode 100644 > index 0000000..87fe7c5 > --- /dev/null > +++ b/include/uapi/rdma/rvt-abi.h > @@ -0,0 +1,33 @@ > +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ > + > +/* > + * This file contains defines, structures, etc. that are used > + * to communicate between kernel and user code. > + */ > + > +#ifndef RVT_ABI_USER_H > +#define RVT_ABI_USER_H > + > +#include <linux/types.h> > +#include <rdma/ib_user_verbs.h> > +#ifndef RDMA_ATOMIC_UAPI > +#define RDMA_ATOMIC_UAPI(_type, _name) struct{ _type val; }_name > +#endif Bernard wants to use this too, maybe put it in ib_user_verbs.h? > +#define RDMA_READ_UAPI_ATOMIC(member) smp_load_acquire(&(member).val) > +#define RDMA_WRITE_UAPI_ATOMIC(member, x) smp_store_release(&(member).val, x) This should not be in a uapi header. Otherwise looks OK now. Jason