From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH v2 07/14] ring: make bulk and burst fn return vals consistent Date: Tue, 14 Mar 2017 09:56:35 +0100 Message-ID: <20170314095635.2a5e6c8b@platinum> References: <20170223172407.27664-1-bruce.richardson@intel.com> <20170307113217.11077-1-bruce.richardson@intel.com> <20170307113217.11077-8-bruce.richardson@intel.com> <20170308112240.31bcb9e5@glumotte.dev.6wind.com> <20170308120842.GB286404@bricha3-MOBL3.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: jerin.jacob@caviumnetworks.com, dev@dpdk.org To: Bruce Richardson Return-path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id B23A6D142 for ; Tue, 14 Mar 2017 09:56:38 +0100 (CET) Received: by mail-wm0-f53.google.com with SMTP id 196so12240168wmm.1 for ; Tue, 14 Mar 2017 01:56:38 -0700 (PDT) In-Reply-To: <20170308120842.GB286404@bricha3-MOBL3.ger.corp.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, 8 Mar 2017 12:08:42 +0000, Bruce Richardson wrote: > On Wed, Mar 08, 2017 at 11:22:40AM +0100, Olivier MATZ wrote: > > On Tue, 7 Mar 2017 11:32:10 +0000, Bruce Richardson 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 > > > > [...] > > > > > @@ -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. > Ok, I have no better solution anyway. Olivier