From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH 3/4] ethdev: count devices consistently Date: Thu, 30 Mar 2017 21:26:12 +0200 Message-ID: <2147239.2BbhZDoxjl@xps13> References: <08811b2c92fa8c802a13000186aaebd5db5ee2ca.1488550937.git.gaetan.rivet@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Gaetan Rivet Return-path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id B3C4A282 for ; Thu, 30 Mar 2017 21:26:14 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id k6so69289601wre.2 for ; Thu, 30 Mar 2017 12:26:14 -0700 (PDT) In-Reply-To: <08811b2c92fa8c802a13000186aaebd5db5ee2ca.1488550937.git.gaetan.rivet@6wind.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. > 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?