From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id CC0B15A72 for ; Wed, 18 May 2016 17:44:23 +0200 (CEST) Received: by mail-wm0-f48.google.com with SMTP id n129so191339192wmn.1 for ; Wed, 18 May 2016 08:44:23 -0700 (PDT) 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=cd4VszNrSQGpBF9bO10j1IX0KA5R3oJakfrsAPFE70k=; b=p3GXx3FxLuGyaUCm+kLslWViGkx6ayhfVj3lTB/OS6eIKHnbasccsK5SxRejcQ0l12 8lJ+ez8JJtzawANrRXGSpJIorMc3AzU8d6uc/uTCNZZCnodUs6j5u7Rb/8UQ9XFH5FvQ Stio32wnKiQ3x4vdjor2W5v9hRkmI1cqjByEkwL9N6FhZQuEM8JJ9PTFePu6tRXD9gps LAOy1B1aRATIphmVmIttiWq+CzzWytifT372Z8Rr4xPJRU/FuJx+LQfxOZPVDezyXxuy 7x237JX53XulcdrGDj+T3SfI1OU0f3T4JEwYlwzpwrgAEGF+Xzon6SfL7yN3aM9D6HlQ 0gTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=cd4VszNrSQGpBF9bO10j1IX0KA5R3oJakfrsAPFE70k=; b=Nuxr6CUC0EANGItZXlo8KhAjyzgJDfkvn5R9DX+M2o88rHJ65QEPOvTMyRwQ+q1f/g qkrlr147LcLcDx1vzwhZx2xtN53uG7oJr3pPWQthN55T+u99F1no+ir1ZdmRbuPWupYv iF1vmvYjgk17GLh5TN2QrV3vej6ZoT8MiRJFGu4/wG96QjoPvQ+2almwsUClT2nyFGkp nO15uA4nU0+kCpgIkUbbtQyEhe+7UxTWW6QSsaAJYEiizA9gj9q2ny/r1Z3j97Z1gaeP lfeLV6GjL9UP07LeQP3w+Jb6zj4SMSmJh3FEzZcjoCIXE5l5NVoS1k9L5uauTIgIRkme c0eA== X-Gm-Message-State: AOPr4FWkuvKYpCgozbz8S8wKTTpFkCtSaA9n3RZ9C+aEfQpootucLgxii8unxhJKtyO9zYqq X-Received: by 10.28.154.73 with SMTP id c70mr8718953wme.12.1463586263561; Wed, 18 May 2016 08:44:23 -0700 (PDT) Received: from xps13.localnet (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id c7sm3863325wji.38.2016.05.18.08.44.22 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 May 2016 08:44:22 -0700 (PDT) From: Thomas Monjalon To: Mauricio =?ISO-8859-1?Q?V=E1squez?= Cc: dev@dpdk.org Date: Wed, 18 May 2016 17:43:48 +0200 Message-ID: <1725170.kb92joC1Ql@xps13> User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: References: <1461943396-7094-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> <1516323.a7INHloVkv@xps13> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" 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:44:24 -0000 2016-05-18 17:25, Mauricio V=E1squez: > On Wed, May 18, 2016 at 5:01 PM, Thomas Monjalon > wrote: >=20 > > 2016-05-18 16:41, Mauricio V=E1squez: > > > On Wed, May 18, 2016 at 10:15 AM, Thomas Monjalon < > > thomas.monjalon@6wind.com > > > > wrote: > > > > > > > 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= places > > > > > > > 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 macro= s. > > > > > > > > Generally speaking, rte_errno is not used a lot currently. > > > > > > > > > I noticed that both EINVAL and ENODEV are used. I think that retu= rning > > > 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? > > >=20 > 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 feel ENODEV would be better but it is an API change, so we should d= iscuss > > it later for another patch. It looks to be really needed to have an unique kind of error interface = to clean all this mess.