From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=O7oKa1se+Mut8nI/IXyWykzThFWmBDW3yOLHnPEjivo=; b=fDynWe17nOdByobwX8N5ki8kGJiKi96IBt0BVNwk8bfsIIscl81mmsj3PMIzAZL4ze Anii/RGuHFLt6TAipuMfCmpPvxWgCwtFHVKpTjWxSJfr12H75Z0cr3EvisJsUv/g+xZB pV/4gXHlybNCyWLRQr/io0uUVLdCZ5OjdovWC1pFmc3s+pz6yUhNJsA40Wohjbqrmrho tGdQtRxIAlwHiiVb09AWE3rhxpTeKT0juwLojgNTW6RwBBIx1wzMiYQMq/1dWtznuOmm 11vc4gdmCRIaWtug5p+EI9WS5a/n+EHFDcJxgLjhdFe17HRl6SaZJ6ls+tbrKTYEniV6 tfxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=O7oKa1se+Mut8nI/IXyWykzThFWmBDW3yOLHnPEjivo=; b=od1RAASQsB604DB27amzWtO8AeWKaGl6IPkMO5EA60JVjen1i63nzkMeRTVBtntrkc 1orabEVoyxTi3zsXACUZkF744GO4MhxdfAN7SpkxPLwRooaGCUWdq+y86xvZgPyroXAD QfvHsgIkQnWaOLzLWyp7eT/rY8kKMUxIEZRweUWCvLT61GscwVJeZdxd6DGxSESccyK/ fD6i1iGh5SpJ1Q2QjIcTodohVYTRWibD6dyLxc9UldZiSnBI5ADbn5BGxqI/TCp4gWMP X2qKZKP3bCMR4ctczZTO/muuzTET380meUMqCOg31bv5FJntjjrDNSDT2AB888nb5Z0p /JGw== X-Gm-Message-State: AMke39lEvku8dWcxm2wiGp7r527KGDKDgmkx4i9kgZ8ahrSCEgGSL/3Vp6bGcfI3OVuGe7R8 X-Received: by 10.28.45.213 with SMTP id t204mr29595185wmt.113.1489079487674; Thu, 09 Mar 2017 09:11:27 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id x18sm26709730wmd.14.2017.03.09.09.11.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 09:11:26 -0800 (PST) From: Thomas Monjalon To: Billy McFall Cc: wenzhuo.lu@intel.com, olivier.matz@6wind.com, dev@dpdk.org, adrien.mazarguil@6wind.com Date: Thu, 09 Mar 2017 18:11:25 +0100 Message-ID: <2146383.vtkpvASGrJ@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: References: <20170123211340.22570-1-bmcfall@redhat.com> <1673691.cTdATcOVfP@xps13> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v5 1/3] ethdev: new API to free consumed buffers in Tx ring 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: Thu, 09 Mar 2017 17:11:28 -0000 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.