From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] librte_ether: use RTE_ETH_VALID_PORTID_OR_ERR_RET to check port_id Date: Wed, 18 May 2016 17:01:19 +0200 Message-ID: <1516323.a7INHloVkv@xps13> References: <1461943396-7094-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> <2109161.zCfKjVzhiS@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org To: Mauricio =?ISO-8859-1?Q?V=E1squez?= Return-path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 4B4066CD3 for ; Wed, 18 May 2016 17:01:53 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id a17so84084339wme.0 for ; Wed, 18 May 2016 08:01:53 -0700 (PDT) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-05-18 16:41, Mauricio V=E1squez: > On Wed, May 18, 2016 at 10:15 AM, Thomas Monjalon > wrote: >=20 > > 2016-05-17 22:02, Mauricio V=E1squez: > > > On Fri, May 13, 2016 at 6:20 PM, Thomas Monjalon < > > thomas.monjalon@6wind.com> > > > wrote: > > > > 2016-04-29 17:23, Mauricio Vasquez B: > > > > > The RTE_ETH_VALID_PORTID_OR_ERR_RET macro is used in some pla= ces > > > > > to check if a port id is valid or not. This commit makes use = of it in > > > > > some new parts of the code. > > > > > > > > There are other occurences: > > > > rte_eth_dev_socket_id > > > > > > > I missed it. > > > > > > > rte_eth_add_rx_callback > > > > rte_eth_add_tx_callback > > > > rte_eth_remove_rx_callback > > > > rte_eth_remove_tx_callback > > > > > > > The macro can not be used on those ones because they set the rte_= errno > > > variable before returning. > > > > It may be a good idea to set rte_errno to EINVAL in these macros. > > > > Generally speaking, rte_errno is not used a lot currently. >=20 >=20 > I noticed that both EINVAL and ENODEV are used. I think that returnin= g > ENODEV and setting rte_errno to EINVAL would be strange, what do you = think > about always using ENODEV? Why EINVAL is used? Why not using retval to set errno? I feel ENODEV would be better but it is an API change, so we should dis= cuss it later for another patch.