From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 616032C71 for ; Wed, 8 Mar 2017 13:08:46 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2017 04:08:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,262,1486454400"; d="scan'208";a="941976659" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.61]) by orsmga003.jf.intel.com with SMTP; 08 Mar 2017 04:08:43 -0800 Received: by (sSMTP sendmail emulation); Wed, 08 Mar 2017 12:08:42 +0000 Date: Wed, 8 Mar 2017 12:08:42 +0000 From: Bruce Richardson To: Olivier MATZ Cc: jerin.jacob@caviumnetworks.com, dev@dpdk.org Message-ID: <20170308120842.GB286404@bricha3-MOBL3.ger.corp.intel.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170308112240.31bcb9e5@glumotte.dev.6wind.com> Organization: Intel Research and =?iso-8859-1?Q?De=ACvel?= =?iso-8859-1?Q?opment?= Ireland Ltd. User-Agent: Mutt/1.8.0 (2017-02-23) Subject: Re: [dpdk-dev] [PATCH v2 07/14] ring: make bulk and burst fn return vals consistent X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Mar 2017 12:08:46 -0000 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. /Bruce