DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Gaëtan Rivet" <gaetan.rivet@6wind.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 3/4] ethdev: count devices consistently
Date: Fri, 31 Mar 2017 11:13:27 +0200	[thread overview]
Message-ID: <20170331091327.GU7450@bidouze.vm.6wind.com> (raw)
In-Reply-To: <2147239.2BbhZDoxjl@xps13>

On Thu, Mar 30, 2017 at 09:26:12PM +0200, Thomas Monjalon wrote:
>2017-03-03 16:40, Gaetan Rivet:
>> Make the rte_eth_dev_count() return the correct number of devices even
>> after some are detached by the hotplug API.
>
>Please explain what is the correct number,
>or that the wrong number was a max id.
>

will do.

>> This change does not affect existing applications that do not use
>> hotplug API calls. Those that do are already aware that port IDs are not
>> necessarily contiguous.
>[...]
>> --- a/lib/librte_ether/rte_ethdev.h
>> +++ b/lib/librte_ether/rte_ethdev.h
>> -#define RTE_ETH_FOREACH_DEV(p)			\
>> -	for (p = rte_eth_find_next(0);		\
>> -	     p < RTE_MAX_ETHPORTS;		\
>> +#define RTE_ETH_FOREACH_DEV(p)					\
>> +	for (p = rte_eth_find_next(0);				\
>> +	     (unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS;	\
>>  	     p = rte_eth_find_next(p + 1))
>
>This macro was introduced in previous patch.
>Why adding the cast here?

In the function rte_eth_dev_get_port_by_name(), the iterator is an int.
When I introduced the use of the iterator there, I then realized that it 
would be better to allow users to use signed ints as well, to avoid 
unnecessary edits on their part.

In retrospective, I agree that it would have been better in the previous 
patch.

-- 
Gaëtan Rivet
6WIND

  reply	other threads:[~2017-03-31  9:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 15:40 [dpdk-dev] [PATCH 0/4] clarify eth_dev state management Gaetan Rivet
2017-03-03 15:40 ` [dpdk-dev] [PATCH 1/4] ethdev: expose device states Gaetan Rivet
2017-03-03 15:40 ` [dpdk-dev] [PATCH 2/4] ethdev: add device iterator Gaetan Rivet
2017-03-03 15:40 ` [dpdk-dev] [PATCH 3/4] ethdev: count devices consistently Gaetan Rivet
2017-03-30 19:26   ` Thomas Monjalon
2017-03-31  9:13     ` Gaëtan Rivet [this message]
2017-03-03 15:40 ` [dpdk-dev] [PATCH 4/4] app/testpmd: use ethdev iterator to list devices Gaetan Rivet
2017-03-31 12:04 ` [dpdk-dev] [PATCH v2 0/3] clarify eth_dev state management Gaetan Rivet
2017-03-31 12:04   ` [dpdk-dev] [PATCH v2 1/3] ethdev: expose device states Gaetan Rivet
2017-03-31 12:04   ` [dpdk-dev] [PATCH v2 2/3] ethdev: add device iterator Gaetan Rivet
2017-04-05 20:42     ` Thomas Monjalon
2017-03-31 12:04   ` [dpdk-dev] [PATCH v2 3/3] app/testpmd: use ethdev iterator to list devices Gaetan Rivet
2017-04-05 20:46   ` [dpdk-dev] [PATCH v2 0/3] clarify eth_dev state management Thomas Monjalon

Reply instructions:

You may reply publicly 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=20170331091327.GU7450@bidouze.vm.6wind.com \
    --to=gaetan.rivet@6wind.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).