From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=+x5gJTBm0lBQhbAfMO6rSc2EWWXcwRr3QQvl2OwTFlk=; b=ciomRhRCmJp1yASI8Ptfve8A/IUDgAnsQOuteJZ/pfU+4wbQ2t/sFc0r02afSLZEr7 S8OLRtQHK/s+I7Fm8pLY1zQP5u9ogdOQ5WlgnEtvZI0fW+YFIZHS9XV+eLeBvpmfGqMd +mH5hQviG7ZLOikXnpYhZhgAcQq+ru/WRPC1QM9r2PF3cRWRfZAJ9xk8/gX0s7cfhwK8 yCwaGOYn9xEVXpNb4WTK5iSFDALwJPgkfMeQ5iUXV13ceIyAzAcqdrAZJkVe+wNj2MwJ Cg2zAYzyYzfj3tz2ucX+5l8uSk5nCn8XDo35ku0bLTy1FMV2Xmfi3/zGwy4DadhQPWK9 NlIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=+x5gJTBm0lBQhbAfMO6rSc2EWWXcwRr3QQvl2OwTFlk=; b=XnHcUdSxoVz6EgCMRCAJoOfc81PgzH8ZKS0sIFbPuTqIm1RR2NNgdPVqgkJM0mKMln Vwuh0FJLQq6BAV7DMsUf4m2M7wJwHTjpkOwDhECsCCx3M5o1zHvsknoqRjrXir6WaeCz WOfsnVVzvt90Eb5qhVKnpqAFCl68dcyNZ2PE8ZPJVspKRC12mOajnBs/1tX0Z4MHODs1 2a4kuHgZjwJP9H2etK2ESM6v7D6s9SFktat3r9lMx8ypwCMnJK7KeJQXHBLU2x8PoNfe dkx2KrTB5ITL82Ws+Tf/SAYYhLJAAh6PHNig0byNXK2zykIxAX54p2rTmOdfO0fGFg53 dXHA== X-Gm-Message-State: AFeK/H2Y2EAd8MuxQIsAFHUm5JfU9/seNpEEaJdCI4H2mZBGUac3CMGgT9v2OO5s5x8s6l+Z X-Received: by 10.28.139.134 with SMTP id n128mr4817150wmd.132.1490901974216; Thu, 30 Mar 2017 12:26:14 -0700 (PDT) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id o196sm55609wmg.12.2017.03.30.12.26.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 12:26:13 -0700 (PDT) From: Thomas Monjalon To: Gaetan Rivet Cc: dev@dpdk.org Date: Thu, 30 Mar 2017 21:26:12 +0200 Message-ID: <2147239.2BbhZDoxjl@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <08811b2c92fa8c802a13000186aaebd5db5ee2ca.1488550937.git.gaetan.rivet@6wind.com> References: <08811b2c92fa8c802a13000186aaebd5db5ee2ca.1488550937.git.gaetan.rivet@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 3/4] ethdev: count devices consistently 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: , X-List-Received-Date: Thu, 30 Mar 2017 19:26:14 -0000 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?