From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v5 1/3] ethdev: new API to free consumed buffers in Tx ring Date: Thu, 09 Mar 2017 18:11:25 +0100 Message-ID: <2146383.vtkpvASGrJ@xps13> References: <20170123211340.22570-1-bmcfall@redhat.com> <1673691.cTdATcOVfP@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: wenzhuo.lu@intel.com, olivier.matz@6wind.com, dev@dpdk.org, adrien.mazarguil@6wind.com To: Billy McFall Return-path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 3EDA82C49 for ; Thu, 9 Mar 2017 18:11:28 +0100 (CET) Received: by mail-wm0-f43.google.com with SMTP id n11so144476886wma.1 for ; Thu, 09 Mar 2017 09:11:28 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2017-03-09 10:49, Billy McFall: > On Tue, Mar 7, 2017 at 11:03 AM, Thomas Monjalon > wrote: > > 2017-03-07 09:29, Billy McFall: > > > On Mon, Feb 27, 2017 at 8:48 AM, Thomas Monjalon < > > thomas.monjalon@6wind.com> > > > wrote: > > > > I think you could use rte_errno (while keeping negative return codes). > > > > > > > > > > I can do that if you want, but if I understand your comment, it will make > > > the implementation of the function not as clean. I cannot use the > > existing > > > RTE_ETH_VALID_PORTID_OR_ERR_RET(..) and RTE_FUNC_PTR_OR_ERR_RET(..) > > MACROs > > > because they are handling the return on error. Or am I missing something? > > > > Yes. Maybe we need new macros for basic error management with rte_errno. > > > > Looking at the code. Do you think we need new MACROs or just set rte_errno > in the existing? What would be the down side to setting rte_errno for all > the existing calls? > > Looks like RTE_ETH_VALID_PORTID_OR_ERR_RET(..) is being called ~135 times. > Most calls are with retval set to either -ENODEV or -EINVAL. A few > instances of 0 and -1, but not many. > > Looks like RTE_FUNC_PTR_OR_ERR_RET(..) is being called ~100 times. Most > calls are with retval set to -ENOTSUP. A few instances of 0, but not many. > > I was thinking: > /* Macros to check for valid port */ > #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \ > if (!rte_eth_dev_is_valid_port(port_id)) { \ > RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \ > + if (retval < 0) \ > + rte_errno = -retval; \ > return retval; \ > } \ > } while (0) Yes it seems acceptable. This rework may be done separately.