From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by dpdk.org (Postfix) with ESMTP id 20B152B92 for ; Fri, 31 Mar 2017 11:13:37 +0200 (CEST) Received: by mail-lf0-f48.google.com with SMTP id j90so40442477lfk.2 for ; Fri, 31 Mar 2017 02:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Eb1uJXMeR96CBOigGktWuDg5v4x2c+cNcC88th7A/Dk=; b=vlqXBPUIxoNh+MZkenU03DdWipUSHiRYIoqq5mvj1AOWMp5hCBH/EMPBShWUxxrpTz dF0ePhB/Ru8/RtbQmCfQfyn6dEj1ShPid1VyTmVX8M7KbDzE2AAQ5rYvwOAJvY8VHpML gMPfwCUh3nu3ogJUsDzvXGZRQIySL/ARrxBOzYRTMVsFcwS3k87UQZu/LEnn+W3in6Eo /39BMarIVh1KVLOIx3UIFNFK6HGWAQbbHIL+mwRmQEnalB3aM3Tk/ysrJdrNErEuSv9a yHsWy4DRS5CN8qZayF9vbR8MOC+gaVaT5z3RQSTRqtCK0AZQiEO1OKZo+9Nz8dnwUr9A iozw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=Eb1uJXMeR96CBOigGktWuDg5v4x2c+cNcC88th7A/Dk=; b=lpAPxidG+iNifY0EVAWsI0ybzafNw9O7M0Dr5qqNKkTt8I3Zn/tJb2pBiActqoYSxp 4YiNDz2MNbCMtuD65LOBxS5pc8lC+UnvPk6fRzEXALBeyDpo1MfZW13XkPz4hVyQHxrH 7SlcvJzvO/69GgWmiuz2NFRJVT+vtv6A/kUtxnYlkoyFmzsuHtFIEL1Iiw2iLU/yHjmK PQKFn+SuBfeZw4WjYW7GT3GW43gvTI3+WHt+LM4PVc9N9M5PHdeq9Nr8vKs4hW9YH75r o5Fc/zBfPmzQv0SO0l9j/sPNmJ/rxII6A/6EfrMaMT2q289Fqa+G1nErMW9MKkuca71P F1VQ== X-Gm-Message-State: AFeK/H0ZexkCV/iREyHI5cSqfLfxcFZk0qX2NdObfeobm/KapcnLSx0uDv8GlHpVHFBkDZ2Q X-Received: by 10.28.203.197 with SMTP id b188mr1892290wmg.110.1490951616540; Fri, 31 Mar 2017 02:13:36 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id i133sm2102499wmg.26.2017.03.31.02.13.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Mar 2017 02:13:35 -0700 (PDT) Date: Fri, 31 Mar 2017 11:13:27 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Thomas Monjalon Cc: dev@dpdk.org Message-ID: <20170331091327.GU7450@bidouze.vm.6wind.com> References: <08811b2c92fa8c802a13000186aaebd5db5ee2ca.1488550937.git.gaetan.rivet@6wind.com> <2147239.2BbhZDoxjl@xps13> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2147239.2BbhZDoxjl@xps13> User-Agent: Mutt/1.5.23 (2014-03-12) 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: Fri, 31 Mar 2017 09:13:37 -0000 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