From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f180.google.com (mail-wr0-f180.google.com [209.85.128.180]) by dpdk.org (Postfix) with ESMTP id 247B3374 for ; Mon, 26 Jun 2017 23:13:59 +0200 (CEST) Received: by mail-wr0-f180.google.com with SMTP id k67so149780745wrc.2 for ; Mon, 26 Jun 2017 14:13:59 -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=PCLyhdMIXKDJtSv4XZMv/38aGWsoha76y1guae2PSio=; b=gb3eExb/gRJhjJlPC4jLNKxTgvkWpjvkjtV9mUh67Afbgi8af/hCnzIFU5Q3XDgGsw wGXdzi6TKWCxD+wZAEn6C23Fwfi1g0D406yTAwNF8Kcgx5ZYxNwy+tD2xrZCzgbGJBGQ SQsP6kWXFKuRDCYoof+IigspwYvPKWhqB4UymqAHdrCTU/KsN3Zoesq22CXZC3nFDuHo +DaUiaDcQo3zNY4EGhh6uJ4yvG9nhfHpoMMf4MT/xyJBkE79CWP0mduTt+3m3Hlrlb2q jA+eHz1QYWv5kMoFvGEx0kAWQgXwCohc2O304kX/Ho89k8OdK+w+zjDmK2zSEoPPYwJE Vj5w== 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=PCLyhdMIXKDJtSv4XZMv/38aGWsoha76y1guae2PSio=; b=WGFFRS33+xuo5yi+aKPtsWjYNatgGlckBtntwNmyLG5GTPtJcipf/knfRwrqps1LNq qr2vm6bq8VMiOhr85bnG6ItTkE4ieODinAzmu2cL4Ll/ZpkKbj1sdsGjzNc0iYQHLKbk CEOB6FMmDFr4iwULLmj4CgmmQjXUX/MKGLn2lOLMjAU0rdG50Tj0Gv1sTH9lo9Xd7rjx NRM8Lx9ntVlC3T8Miz208we+MmZswoBXNNIwtQ4X27ZawqKeKG4ZoxbH7PE4I5kleah3 E3aQV/1ler2H4FRsglQfS46evTSQQZputgUvMFRh7pPbXJAEB9kMYD5FYi0/Z5ftPFKT jggg== X-Gm-Message-State: AKS2vOy4KtSoiY573BHSj/s4zNTpXnG4IXLR6+ebyzPdQDRnJA+8atEt qPPvRcyuEdsP3Xjn X-Received: by 10.223.171.146 with SMTP id s18mr14283343wrc.38.1498511638574; Mon, 26 Jun 2017 14:13:58 -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 r187sm871752wmg.15.2017.06.26.14.13.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jun 2017 14:13:57 -0700 (PDT) Date: Mon, 26 Jun 2017 23:13:49 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Bruce Richardson Cc: dev@dpdk.org, Jan Blunck Message-ID: <20170626211349.GO2344@bidouze.vm.6wind.com> References: <20170626162037.GB101992@bricha3-MOBL3.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170626162037.GB101992@bricha3-MOBL3.ger.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v5 02/12] bus: add device iterator method 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: Mon, 26 Jun 2017 21:13:59 -0000 On Mon, Jun 26, 2017 at 05:20:37PM +0100, Bruce Richardson wrote: > On Mon, Jun 26, 2017 at 02:22:00AM +0200, Gaetan Rivet wrote: > > From: Jan Blunck > > > > Signed-off-by: Jan Blunck > > Signed-off-by: Gaetan Rivet > > --- > > lib/librte_eal/common/include/rte_bus.h | 19 +++++++++++++++++++ > > lib/librte_eal/common/include/rte_dev.h | 21 +++++++++++++++++++++ > > 2 files changed, 40 insertions(+) > > > > diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h > > index ecf839b..5efb76e 100644 > > --- a/lib/librte_eal/common/include/rte_bus.h > > +++ b/lib/librte_eal/common/include/rte_bus.h > > @@ -82,6 +82,24 @@ typedef int (*rte_bus_scan_t)(void); > > typedef int (*rte_bus_probe_t)(void); > > > > /** > > + * Device iterator to find a device on a bus. > > + * > > + * This function returns an rte_device if one of those held by the bus > > + * matches the data passed as parameter. > > + * > > + * @param cmp > > + * Comparison function. > > + * > > + * @param data > > + * Data to compare each device against. > > + * > > + * @return > > + * The first device matching the data, NULL if none exists. > > + */ > > +typedef struct rte_device * (*rte_bus_find_device_t)(rte_dev_cmp_t cmp, > > + const void *data); > > + > > +/** > > The bus find function takes a third, start, parameter. Is it worthwhile > including such a parameter here, for consistency sake if nothing else? > I was wondering this actually. Doing so would deport the added complexity, to be repeated in each bus implementation. It would in turn simplify my own calls, ever so slightly. That means a few small-ish additional spots of complexity instead of a single one. I'm also thinking that maybe a few buses could avoid having linked lists for their containers (I know it's frowned upon to roll your own, but some might have good reasons for doing so), allowing random access, bypassing cycling through each. Well, I will do as you suggest, if anyone objects, please shout before I send the next version. > Otherwise: > > Acked-by: Bruce Richardson -- Gaëtan Rivet 6WIND