On Wed, Mar 08, 2017 at 11:22:40AM +0100, Olivier MATZ wrote:
> On Tue,  7 Mar 2017 11:32:10 +0000, Bruce Richardson 
> <bruce.richard...@intel.com> wrote:
> > The bulk fns for rings returns 0 for all elements enqueued and negative
> > for no space. Change that to make them consistent with the burst functions
> > in returning the number of elements enqueued/dequeued, i.e. 0 or N.
> > This change also allows the return value from enq/deq to be used directly
> > without a branch for error checking.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>
> 
> [...]
> 
> > @@ -716,7 +695,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * const 
> > *obj_table,
> >  static inline int __attribute__((always_inline))
> >  rte_ring_mp_enqueue(struct rte_ring *r, void *obj)
> >  {
> > -   return rte_ring_mp_enqueue_bulk(r, &obj, 1);
> > +   return rte_ring_mp_enqueue_bulk(r, &obj, 1) ? 0 : -ENOBUFS;
> >  }
> >  
> >  /**
> 
> I'm wondering if these functions (enqueue/dequeue of one element) should
> be modified to return 0 (fail) or 1 (success) too, for consistency with
> the bulk functions.
> 
> Any opinion?
> 
I thought about that, but I would view it as risky, unless we want to go
changing the parameters to the function also, as the compiler won't flag
a change in return value like that.

/Bruce

Reply via email to