From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id 6AEC827D for ; Tue, 24 Apr 2018 12:22:23 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id d1-v6so49175635wrj.13 for ; Tue, 24 Apr 2018 03:22:23 -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=bq3kl3NIBujMaJ8LkRV8Oqg1ZhoosCdQ8SSpZMqSyVo=; b=fjk0euB6fi/Soq8HSQvawLgzkdYcnL3pNlMSozZK7oiXDh31wDEWfayRS7y9d8ualR iq1NOdVUBlesnCKxD9aU4AbZXHSR75k3ksBgOtF88XUDFK84HYOPah/Y+GZo0co5STPl M4yJNb0sY1miFWQ/iMrTndZXt3V0j1UFdPa/rGjC5OI/SXaRQBAzhLds9OWoevdOspGs uo5d+KQVL4x7Yov4s/sxHqvdIwGuGax8OY4EHAW3dTvGbMs41kISoa2IFUR+wEOvfXFn cBaftSnhm5Td/rMEfj6FJRmJqCMigXP0fqzvf4P/RlZLDC/a7ZtDtlcU1zZajjLoGUZ4 NuRw== 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=bq3kl3NIBujMaJ8LkRV8Oqg1ZhoosCdQ8SSpZMqSyVo=; b=eHZriG97IElptPrF0KMJ7XaiY9VtEKVCZZtPnuHxeUhqHXG77dhMEwOGUAjFYD4/YN tIrYE5d+op2sosSVWH0PGvdwtSSy+kZ9Jgh2X+7987ZQr+w2YfaqPTKUOnwFXKi+fqo4 SdR11g5tmBF4Cg4op1J7TanKEimYh4ndQ07D2bg6HyXHnKT502XblIiN+VkCPQS1f4m1 o7SR8WBaJ7hr/GaTRJmdKFKZyPPSBFwv/lSZtdbZtpZ2LtG8hzAIriGSpb+p0shL4CLL KIUAn2HqnMeCj1JU9mHjc7zGExKAALqYcLCQYtOUXO/GqJTLuU2+gwWKVg27Cl2beBNm OVIQ== X-Gm-Message-State: ALQs6tB+nUAyfkBMV7F9p05Q7FlDHWwyHoeDE/DG6xPyHd+ot/Enwrk3 K+nl1Rzovm4eSIx6e6YADI6NkoZF X-Google-Smtp-Source: AB8JxZrqQX8ZAIqCeVbUE1f8lEQ5yGRA5s/uFomY7yQZGX0J/PPTTPcyUH7QYgqYSKof/4ZZOkgJsQ== X-Received: by 10.28.215.85 with SMTP id o82mr2092007wmg.71.1524565343106; Tue, 24 Apr 2018 03:22:23 -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 k28-v6sm30610702wrk.96.2018.04.24.03.22.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Apr 2018 03:22:22 -0700 (PDT) Date: Tue, 24 Apr 2018 12:22:08 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Stephen Hemminger Cc: dev@dpdk.org Message-ID: <20180424102208.pleu6haxnvn2hbvq@bidouze.vm.6wind.com> References: <4ae5a6e418b19a458aefee0621af9cc7baf76aab.1524522515.git.gaetan.rivet@6wind.com> <20180423165417.554d0ee0@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180423165417.554d0ee0@xeon-e3> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v4 01/10] devargs: introduce iterator 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: Tue, 24 Apr 2018 10:22:23 -0000 On Mon, Apr 23, 2018 at 04:54:17PM -0700, Stephen Hemminger wrote: > On Tue, 24 Apr 2018 00:41:01 +0200 > Gaetan Rivet wrote: > > > In preparation to making devargs_list private. > > > > Bus drivers generally need to access rte_devargs pertaining to their > > operations. This match is a common operation for bus drivers. > > > > Add a new accessor for the rte_devargs list. > > > > Signed-off-by: Gaetan Rivet > > --- > > lib/librte_eal/common/eal_common_devargs.c | 20 ++++++++++++++++++++ > > lib/librte_eal/common/include/rte_devargs.h | 20 ++++++++++++++++++++ > > lib/librte_eal/rte_eal_version.map | 1 + > > 3 files changed, 41 insertions(+) > > > > diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c > > index 810b3e18f..c6c5eabcf 100644 > > --- a/lib/librte_eal/common/eal_common_devargs.c > > +++ b/lib/librte_eal/common/eal_common_devargs.c > > @@ -207,3 +207,23 @@ rte_eal_devargs_dump(FILE *f) > > devargs->name, devargs->args); > > } > > } > > + > > +/* bus-aware rte_devargs iterator. */ > > +__rte_experimental > > +struct rte_devargs * > > +rte_eal_devargs_next(const char *busname, const struct rte_devargs *start) > > +{ > > + struct rte_devargs *da; > > + > > + if (start != NULL) > > + da = TAILQ_NEXT(start, next); > > + else > > + da = TAILQ_FIRST(&devargs_list); > > + while (da != NULL) { > > + if (busname == NULL || > > + (strcmp(busname, da->bus->name) == 0)) > > + return da; > > + da = TAILQ_NEXT(da, next); > > + } > > + return NULL; > > +} > > Can this be made to return a const pointer? It seems unsymmetrical to > get the next value as a non-const pointer when passed a const based on last value. > I would like to, but this iterator is used in buses to match devargs and assign it to an rte_devive. The devargs field there is not const. We don't have a deprecation notice running on this. This might be worth it, though, but I think this could come after integrating this series. -- Gaëtan Rivet 6WIND