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 F35508D91 for ; Wed, 18 May 2016 21:14:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by compass.polito.it (Postfix) with ESMTP id C2B7E10013C for ; Wed, 18 May 2016 21:14:56 +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= 1463598895; bh=zKFZxu+qQAezQyaZsFBm4cqWXCyrKQ041WnitM8g23k=; b=h W/sYexSD/XfZ/SLx4dMvEBzXRUy+PRQtdDXGLu4MJJV7zvHOVi4nLTilTqEIsmD1 wjT4l+fyU0bPMI5DwyIfN7n0SzPJ8yjUH7eIv+CXuhar9QxPtMt6A3TtYyuHrA/J q5iUflz0PekMhBS0uLOpe8PNKjqS5rR0CBu9yoc4lk= X-Virus-Scanned: amavisd-new at studenti.polito.it X-Spam-Flag: NO X-Spam-Score: -5.897 X-Spam-Level: X-Spam-Status: No, score=-5.897 tagged_above=-100 required=3.5 tests=[ALL_TRUSTED=-5, AWL=0.602, 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 2Ng_yKpFu7Ba for ; Wed, 18 May 2016 21:14:55 +0200 (CEST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) (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 CC56F100130 for ; Wed, 18 May 2016 21:14:54 +0200 (CEST) Received: by mail-lb0-f173.google.com with SMTP id h1so20960249lbj.3 for ; Wed, 18 May 2016 12:14:54 -0700 (PDT) X-Gm-Message-State: AOPr4FWfVU/4g4dTauiFzIjkpwsnzbomYcdQUC4a4c8wtNz0EtYCEu1BMsDlv2afaQD2JGHhFHdSrreAz10J/w== MIME-Version: 1.0 X-Received: by 10.112.219.195 with SMTP id pq3mr3252026lbc.33.1463598894284; Wed, 18 May 2016 12:14:54 -0700 (PDT) Received: by 10.25.4.200 with HTTP; Wed, 18 May 2016 12:14:54 -0700 (PDT) In-Reply-To: <1725170.kb92joC1Ql@xps13> References: <1461943396-7094-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> <1516323.a7INHloVkv@xps13> <1725170.kb92joC1Ql@xps13> Date: Wed, 18 May 2016 21:14:54 +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 19:14:57 -0000 On Wed, May 18, 2016 at 5:43 PM, Thomas Monjalon wrote: > 2016-05-18 17:25, Mauricio V=C3=A1squez: > > On Wed, May 18, 2016 at 5:01 PM, Thomas Monjalon < > thomas.monjalon@6wind.com> > > 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 > places > > > > > > > > to check if a port id is valid or not. This commit makes us= e > 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 yo= u > > > 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. > > So you should not set errno in the existing macro. > But you can create a new macro RTE_ETH_VALID_PORTID_OR_ERRNO_RET > for these functions. > > I realized that RTE_ETH_VALID_PORTID_OR_ERR_RET can be used also in rte_eth_remove_rx_callback and rte_eth_remove_tx_callback. Personally I think it is not worthy to create a macro just for the two missing functions. > > I feel ENODEV would be better but it is an API change, so we should > discuss > > > it later for another patch. > > It looks to be really needed to have an unique kind of error interface to > clean all this mess. >