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 ECC7DA04DB; Sat, 17 Oct 2020 11:22:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 06D30BCF9; Sat, 17 Oct 2020 11:22:39 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by dpdk.org (Postfix) with ESMTP id 9E4B5BCD4 for ; Sat, 17 Oct 2020 11:22:37 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 521D9CA7; Sat, 17 Oct 2020 05:22:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 17 Oct 2020 05:22:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= K822JHRyunXs7RJtDMbAiAwCTMAyD0iiTUpGrFkytVM=; b=tP6PCqdQzfjH4ULe bVABPUMLQitzKs/OFWCzPezl0RW5dt6FtnscB32m7RPP7y8VuyBkZtBk3vqG2v9G JhhfcTWJ2ddcmdkipXzBXXqam+EjuGB4uSQdV2+jDSilam4z92RAYOS5EHPXR5sP KMTtcRa8vL+RMdJjVPsH/CbemFcyInFJrHqr6Ll+89DpXhzFsDMZYwal7G7qV+Gl n0GFQi+ZKgAtLG9EjaGSjZAldKCH+4zVS5/xoq4v8UPdb0IVEcjMzYC0s+KSh6CV 6XvIlXS2AdcbG33umOt1FUtkv5zCgFy+HAxgyio0bVI76Je+1D94Daiq0bEG6hKE fxO0Jg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=K822JHRyunXs7RJtDMbAiAwCTMAyD0iiTUpGrFkyt VM=; b=lFaIOsYAILHFFYNSd7QyumAyVbT9ZfAGVfTFnaCPsAa3nf573c2ogYtGH OP3+vv8bc+3EeNgZh/GgQ/FsLHgyMdfkncvb7hzJHTVmYDEfnqUffYpvSKQywXye P3Xbhv7n5kSA7SqtR2UaW7b9rMJbetiae1ghpECPXlWF8QdPidXinsl9ghuFf4rQ hGBI18dACixDn4Byfh4LS0mBRCEuHy3jNxozvgreROufrtep1M+z+lppm4t+pRIw qGEVQu+kgF1a8aOM8LmhZkxBU+nbdW33C/RxDrL4XQIo8v2DmpmOMps/3kP6HH/V xEdA3WKwoy95iZIz3o9eizZra2ibQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrieejgdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 178DB328005E; Sat, 17 Oct 2020 05:22:33 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit Cc: Andrew Rybchenko , dev@dpdk.org, Andrew Rybchenko Date: Sat, 17 Oct 2020 11:22:30 +0200 Message-ID: <1837298.Gbl8trm7sQ@thomas> In-Reply-To: <2abbae70-2e07-23f0-df4a-51d475d24164@intel.com> References: <1602600818-7473-1-git-send-email-arybchenko@solarflare.com> <9dcbd6e0-265c-f520-d060-1ab494a9e53f@intel.com> <2abbae70-2e07-23f0-df4a-51d475d24164@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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" 17/10/2020 01:43, Ferruh Yigit: > On 10/16/2020 10:58 PM, Ferruh Yigit wrote: > > On 10/16/2020 1:05 PM, Ferruh Yigit wrote: > >> On 10/13/2020 4: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. > >>> > >>> 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. > >>> > >>> And there are a few instances returning '-1', are they left intentionally? > >>> > >> > >> Reviewed-by: Ferruh Yigit > > > > > > > Applied to dpdk-next-net/main, thanks. > > > > There are some bitratestats unit tests, that checks APIs with invalid port_id. > Unit tests checks return values as '-EINVAL', they also should be updated as > '-ENODEV' with this patch. > > Adding following update to this patch in next-net > > diff --git a/app/test/test_bitratestats.c b/app/test/test_bitratestats.c > index 39d7f734d4..fb4203c57b 100644 > --- a/app/test/test_bitratestats.c > +++ b/app/test/test_bitratestats.c > @@ -99,8 +99,8 @@ test_stats_bitrate_calc_invalid_portid_1(void) > int ret = 0; > > ret = rte_stats_bitrate_calc(bitrate_data, 33); > - TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for higher " > - "portid rte_stats_bitrate_calc ret:%d", EINVAL, ret); > + TEST_ASSERT(ret == -ENODEV, "Test Failed: Expected -%d for higher " > + "portid rte_stats_bitrate_calc ret:%d", ENODEV, ret); > > return TEST_SUCCESS; > } > @@ -112,8 +112,8 @@ test_stats_bitrate_calc_invalid_portid_2(void) > int ret = 0; > > ret = rte_stats_bitrate_calc(bitrate_data, -1); > - TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for invalid " > - "portid rte_stats_bitrate_calc ret:%d", EINVAL, ret); > + TEST_ASSERT(ret == -ENODEV, "Test Failed: Expected -%d for invalid " > + "portid rte_stats_bitrate_calc ret:%d", ENODEV, ret); > > return TEST_SUCCESS; > } > @@ -125,9 +125,9 @@ test_stats_bitrate_calc_non_existing_portid(void) > int ret = 0; > > ret = rte_stats_bitrate_calc(bitrate_data, 31); > - TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for " > + TEST_ASSERT(ret == -ENODEV, "Test Failed: Expected -%d for " > "non-existing portid rte_stats_bitrate_calc ret:%d", > - EINVAL, ret); > + ENODEV, ret); > > return TEST_SUCCESS; > } Thank you Ferruh for the extra checks.