DPDK patches and discussions
 help / color / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Ferruh Yigit <ferruh.yigit@intel.com>, dev@dpdk.org
Cc: Thomas Monjalon <thomas@monjalon.net>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	"techboard@dpdk.org" <techboard@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] ethdev: unify error code if port ID is invalid
Date: Tue, 13 Oct 2020 18:39:30 +0300
Message-ID: <236f87f5-c798-4d83-b821-abed61253191@oktetlabs.ru> (raw)
In-Reply-To: <8f8907cf-d905-c867-cf42-694d16b0a0cf@intel.com>

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 <arybchenko@solarflare.com>
>> ---
>>   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.


  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 14:53 Andrew Rybchenko
2020-10-13 15:32 ` Ferruh Yigit
2020-10-13 15:39   ` Andrew Rybchenko [this message]
2020-10-13 16:12     ` Ferruh Yigit
2020-10-14  6:16       ` Andrew Rybchenko
2020-10-14 16:01         ` Ferruh Yigit
2020-10-13 15:47   ` Thomas Monjalon
2020-10-16 12:05   ` Ferruh Yigit
2020-10-16 21:58     ` Ferruh Yigit
2020-10-16 23:43       ` Ferruh Yigit
2020-10-17  9:22         ` Thomas Monjalon

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=236f87f5-c798-4d83-b821-abed61253191@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=techboard@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox