From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from compass.polito.it (compass.polito.it [130.192.55.110]) by dpdk.org (Postfix) with ESMTP id 2F7695961 for ; Wed, 18 May 2016 17:25:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by compass.polito.it (Postfix) with ESMTP id 06B98100145 for ; Wed, 18 May 2016 17:25:52 +0200 (CEST) Authentication-Results: compass.polito.it (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=studenti.polito.it DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= studenti.polito.it; h=content-type:content-type:cc:to:from:from :subject:subject:message-id:date:date:references:in-reply-to :received:mime-version:received:received:received; s=y2k10; t= 1463585150; bh=FgkyqfP+F5nZqQ96E5p+F7HdP32ODEx8rvvhRA1JzQ4=; b=Y qBp8xcxENM5ovuuoyCY0nrugui29ncoUf7BHlAj7vBao6XYWFBEbRDzI5xkj00v/ e4+l3iuTHX2XknA4u6DWrn0pdockx8JOKyjqcI2/59O3+4kzWJc3RASIgIWJG1Ut Ug2lEltPs5eYnws9pUl1Oteun4sejn/m3raKPq5D80= X-Virus-Scanned: amavisd-new at studenti.polito.it X-Spam-Flag: NO X-Spam-Score: -5.895 X-Spam-Level: X-Spam-Status: No, score=-5.895 tagged_above=-100 required=3.5 tests=[ALL_TRUSTED=-5, AWL=0.604, BAYES_00=-1.5, HTML_MESSAGE=0.001] autolearn=ham Received: from compass.polito.it ([127.0.0.1]) by localhost (compass.polito.it [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Xza9hegyAGKL for ; Wed, 18 May 2016 17:25:50 +0200 (CEST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: s203403@studenti.polito.it) by compass.polito.it (Postfix) with ESMTPSA id B3F1B100144 for ; Wed, 18 May 2016 17:25:50 +0200 (CEST) Received: by mail-lb0-f172.google.com with SMTP id jj5so18778154lbc.0 for ; Wed, 18 May 2016 08:25:50 -0700 (PDT) X-Gm-Message-State: AOPr4FVrJMnRxFMX8GetKJ6T+RhhahTgXsW756Eeh8nXKwARuJwQif5+dlfFlJUdZ3JYh7QNNyFlXuixjuICSQ== MIME-Version: 1.0 X-Received: by 10.112.168.130 with SMTP id zw2mr2849030lbb.102.1463585150310; Wed, 18 May 2016 08:25:50 -0700 (PDT) Received: by 10.25.4.200 with HTTP; Wed, 18 May 2016 08:25:50 -0700 (PDT) In-Reply-To: <1516323.a7INHloVkv@xps13> References: <1461943396-7094-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> <2109161.zCfKjVzhiS@xps13> <1516323.a7INHloVkv@xps13> Date: Wed, 18 May 2016 17:25:50 +0200 X-Gmail-Original-Message-ID: Message-ID: From: =?UTF-8?Q?Mauricio_V=C3=A1squez?= To: Thomas Monjalon Cc: dev@dpdk.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] librte_ether: use RTE_ETH_VALID_PORTID_OR_ERR_RET to check port_id 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: Wed, 18 May 2016 15:25:52 -0000 On Wed, May 18, 2016 at 5:01 PM, Thomas Monjalon wrote: > 2016-05-18 16:41, Mauricio V=C3=A1squez: > > On Wed, May 18, 2016 at 10:15 AM, Thomas Monjalon < > thomas.monjalon@6wind.com > > > wrote: > > > > > 2016-05-17 22:02, Mauricio V=C3=A1squez: > > > > 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 place= s > > > > > > 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. > > > > > > I noticed that both EINVAL and ENODEV are used. I think that returning > > 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? > If we do it, the macro could no be used in rte_eth_dev_socket_id rte_eth_dev_get_device_type rte_eth_add_rx_callback rte_eth_add_tx_callback rte_eth_remove_rx_callback rte_eth_remove_tx_callback as they do not return an error number. I feel ENODEV would be better but it is an API change, so we should discuss > it later for another patch. > I agree