[dpdk-dev] [RFC 1/1] lib/ring: add scatter gather and serial dequeue APIs
konstantin.ananyev at intel.com
Thu Feb 27 00:21:00 CET 2020
> > +/**
> > + * @internal Reserve ring elements to enqueue several objects on the ring
> > + *
> > + * @param r
> > + * A pointer to the ring structure.
> > + * @param esize
> > + * The size of ring element, in bytes. It must be a multiple of 4.
> > + * This must be the same value used while creating the ring. Otherwise
> > + * the results are undefined.
> > + * @param n
> > + * The number of elements to reserve in the ring.
> > + * @param behavior
> > + * RTE_RING_QUEUE_FIXED: Reserve a fixed number of elements from a ring
> > + * RTE_RING_QUEUE_VARIABLE: Reserve as many elements as possible from ring
> > + * @param is_sp
> > + * Indicates whether to use single producer or multi-producer reserve
> > + * @param old_head
> > + * Producer's head index before reservation.
> > + * @param new_head
> > + * Producer's head index after reservation.
> > + * @param free_space
> > + * returns the amount of space after the reserve operation has finished.
> > + * It is not updated if the number of reserved elements is zero.
> > + * @param dst1
> > + * Pointer to location in the ring to copy the data.
> > + * @param n1
> > + * Number of elements to copy at dst1
> > + * @param dst2
> > + * In case of ring wrap around, this pointer provides the location to
> > + * copy the remaining elements. The number of elements to copy at this
> > + * location is equal to (number of elements reserved - n1)
> > + * @return
> > + * Actual number of elements reserved.
> > + * If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only.
> > + */
> > +static __rte_always_inline unsigned int
> > +__rte_ring_do_enqueue_elem_reserve(struct rte_ring *r, unsigned int esize,
> I do understand the purpose of reserve, then either commit/abort for serial sync mode,
> but what is the purpose of non-serial version of reserve/commit?
> In serial MP/MC case, after _reserve_(n) you always have to do
Typo, meant 'in on-serial MP/MP case' of course.
> _commit_(n) - you can't reduce number of elements, or do _abort_.
> Again you cannot avoid memcpy(n) here anyhow.
> So what is the point of these functions for non-serial case?
> BTW, I think it would be good to have serial version of _enqueue_ too.
More information about the dev