On Mon, 8 Feb 2021 13:29:53 -0500 "Michael S. Tsirkin" <m...@redhat.com> wrote:
> On Fri, Jan 22, 2021 at 07:00:29PM +0100, Cornelia Huck wrote: > > The pvrdma code relies on the pvrdma_ring.h kernel header for some > > basic ring buffer handling. The content of that header isn't very > > exciting, but contains some (q)atomic_*() invocations that (a) > > cause manual massaging when doing a headers update, and (b) are > > an indication that we probably should not be importing that header > > at all. > > > > Let's reimplement the ring buffer handling directly in the pvrdma > > code instead. This arguably also improves readability of the code. > > > > Importing the header can now be dropped. > > > > Signed-off-by: Cornelia Huck <coh...@redhat.com> > > Given it's a single struct that we need, this is a good fix. > How about adding a comment explaining where it came from, > just in case rdma guys decide to export this in uapi properly? > > diff --git a/hw/rdma/vmw/pvrdma_dev_ring.h b/hw/rdma/vmw/pvrdma_dev_ring.h > > index 5f2a0cf9b9fa..d231588ce004 100644 > > --- a/hw/rdma/vmw/pvrdma_dev_ring.h > > +++ b/hw/rdma/vmw/pvrdma_dev_ring.h > > @@ -19,18 +19,23 @@ > > > > #define MAX_RING_NAME_SZ 32 > > /* struct pvrdma_ring from drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h */ > > +typedef struct PvrdmaRingState { > > + int prod_tail; /* producer tail */ > > + int cons_head; /* consumer head */ > > +} PvrdmaRingState; > > + I guess this can be folded in?