From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4D51CA04B7; Tue, 13 Oct 2020 17:39:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2295A1DD2E; Tue, 13 Oct 2020 17:39:34 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by dpdk.org (Postfix) with ESMTP id E24541DCE8; Tue, 13 Oct 2020 17:39:31 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 7BF537F5D9; Tue, 13 Oct 2020 18:39:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 7BF537F5D9 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1602603570; bh=swH6dARloOxoiHFZqB8VskAEy/cYe+2IDYChav2iUvA=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=aEH/tMoBAlfkDq9hly2yV5S0Eb2GYY71i1y8j9di13aGGHirIxYfAUOPc3ludj1lI COyQ44bn6Jo9vocVNRCoFzoK/ob5cmT7fxogLv2Y1J9IDvfynAEHKeMQBqxfTu+UKO 9BczNh0/wf2oLtDN3P9xumCMNlDjYW/hIKDnBay8= To: Ferruh Yigit , dev@dpdk.org Cc: Thomas Monjalon , Andrew Rybchenko , "techboard@dpdk.org" References: <1602600818-7473-1-git-send-email-arybchenko@solarflare.com> <8f8907cf-d905-c867-cf42-694d16b0a0cf@intel.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <236f87f5-c798-4d83-b821-abed61253191@oktetlabs.ru> Date: Tue, 13 Oct 2020 18:39:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <8f8907cf-d905-c867-cf42-694d16b0a0cf@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] ethdev: unify error code if port ID is invalid 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/13/20 6:32 PM, Ferruh Yigit wrote: > On 10/13/2020 3:53 PM, Andrew Rybchenko wrote: >> Use ENODEV as the error code if specified port ID is invalid. >> >> Signed-off-by: Andrew Rybchenko >> --- >>   lib/librte_ethdev/rte_ethdev.c | 44 ++++++++++++++++---------------- >>   lib/librte_ethdev/rte_ethdev.h | 46 +++++++++++++++++++++++----------- >>   2 files changed, 54 insertions(+), 36 deletions(-) >> >> diff --git a/lib/librte_ethdev/rte_ethdev.c >> b/lib/librte_ethdev/rte_ethdev.c >> index 5b7979a3b8..1f862f918a 100644 >> --- a/lib/librte_ethdev/rte_ethdev.c >> +++ b/lib/librte_ethdev/rte_ethdev.c >> @@ -784,7 +784,7 @@ rte_eth_dev_get_name_by_port(uint16_t port_id, >> char *name) >>   { >>       char *tmp; >>   -    RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); >> +    RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > > Thanks Andrew, +1 to this error unification. > > This will be API change without deprecation notice, cc'ed techboard for it. Yes, thanks. > > If this should (almost) always return '-ENODEV', does it make sense to > make another wrapper macro for it, to prevent later other error types > used again. Unlikely, since most likely the line will be simply copied. RTE_ETH_VALID_PORTID_OR_ERR_RET will remain in any case, so it will be possible to misuse it anyway. > > And there are a few instances returning '-1', are they left intentionally? Yes. Inside ethdev it is either socket_id or fd in these cases.