From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id DD44C71 for ; Mon, 29 Sep 2014 14:05:16 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 29 Sep 2014 05:11:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,620,1406617200"; d="scan'208";a="606950940" Received: from bricha3-mobl.ger.corp.intel.com (HELO bricha3-mobl.ir.intel.com) ([10.243.20.21]) by fmsmga002.fm.intel.com with SMTP; 29 Sep 2014 05:10:23 -0700 Received: by bricha3-mobl.ir.intel.com (sSMTP sendmail emulation); Mon, 29 Sep 2014 13:10:22 +0001 Date: Mon, 29 Sep 2014 13:10:22 +0100 From: Bruce Richardson To: "Wiles, Roger Keith" Message-ID: <20140929121022.GH12072@BRICHA3-MOBL> References: <54288A70.9020902@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.22 (2013-10-16) Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] Bulk dequeue of packets and the returned values, question X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Sep 2014 12:05:21 -0000 On Sun, Sep 28, 2014 at 11:06:17PM +0000, Wiles, Roger Keith wrote: > Thanks Venky, > On Sep 28, 2014, at 5:23 PM, Venkatesan, Venky wrote: > > > Keith, > > > > On 9/28/2014 11:04 AM, Wiles, Roger Keith wrote: > >> I am also looking at the bulk dequeue routines, which the ring can be fixed or variable. On fixed < 0 on error is returned and 0 if successful. On a variable ring < 0 on error or n on success, but I think n can be zero in the variable case, correct? > >> > >> If these are true then why not have the routines return < 0 on error and >= 0 on success. Which means a dequeue from a fixed ring would return only ’requested size n’ or < 0 if you error off the 0 case. The 0 case could be OK, if you allow zero to be return on a empty ring for the fixed ring case. > >> > >> Does this make sense to anyone? > > It won't make sense unless you're aware of the history behind these functions. The original functions that were implemented for the ring were only the bulk functions (i.e. FIXED). They would return exactly the number of items requested for dequeue (0 if success, negative if error), and not return any if the required number were not available. > > > > The burst (i.e. VARIABLE) functions came in much later (think it was r1.3 where we introduced them), and by that time, there were already quite a number of deployments of DPDK in the field using the legacy ring functions. Therefore we made the decision to keep the legacy behavior intact & not impacting deployed code - and merging the burst functions into the code. Given that there was no "versioning" of the API/ABI in those releases :). > > I see why the code is this way. If the developers used ‘if ( ret == 0 ) { /* do something */ }’ then it would break if it returned a positive value on success. I would expect the normal behavior to be ‘if ( ret < 0 ) { /* error case */ }’ and fall thru for the success case. I would love to change the code to just return <0 on error or >= 0 on success. I wonder how many customers code would break changing the code to do just just the two steps. I think it will remove some code in a couple places that were testing for FIXED or VARIABLE? > > > > Hope that helps. > > -Venky > > > >> > >> Thanks > >> ++Keith > >> > >> Keith Wiles, Principal Technologist with CTO office, Wind River mobile 972-213-5533 > > Keith Wiles, Principal Technologist with CTO office, Wind River mobile 972-213-5533 > Since we are looking at making considerable ABI changes in this release and (hopefully) also looking to version our ABI going forward, I would be in favour of making any changes to these APIs in this current release if possible. While the current behaviour makes sense for historical reason, I think an overall change to the behaviour as Keith describes would be more sensible long-term. (Also to note my previous suggestion about upping the major version to 2.0 if we continue to increase the number of ABI/API changes in this release. Anyone else any thoughts on that?) /Bruce