From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v4 2/6] ethdev: add iterator to match devargs input Date: Tue, 16 Oct 2018 14:06:59 +0200 Message-ID: <6565113.fUpKjTsGKJ@xps> References: <20181007222554.4886-1-thomas@monjalon.net> <20181009223338.18307-3-thomas@monjalon.net> <361f0884-e08c-d47c-4f14-0ca0dca83246@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, gaetan.rivet@6wind.com, ophirmu@mellanox.com, arybchenko@solarflare.com To: Ferruh Yigit Return-path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 3E5025B2E for ; Tue, 16 Oct 2018 14:06:59 +0200 (CEST) In-Reply-To: <361f0884-e08c-d47c-4f14-0ca0dca83246@intel.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" 16/10/2018 12:58, Ferruh Yigit: > On 10/9/2018 11:33 PM, Thomas Monjalon wrote: > > The iterator will return the ethdev port ids matching a devargs string. > > It is recommended to use the macro RTE_ETH_FOREACH_MATCHING_DEV() > > for usage convenience. > > > > The class string is prefixed with '+' in order to skip the validation > > of the parameter keys. It is tolerated for the compatibility with > > the old (current) syntax where all parameters (bus, class and driver) > > are mixed in the same string without any delimiter. > > Thanks to this compatibility prefix, the driver parameters will be > > skipped during the ethdev parsing, and not considered invalid. > > > > A macro is introduced in rte_common.h to workaround a const field. > > This hack is needed to free const strings in the iterator. > > It is preferred to keep the const for these fields, because it gives > > a hint that they are not changed at each iteration. > > > > Signed-off-by: Thomas Monjalon > > Reviewed-by: Andrew Rybchenko > > <...> > > + rte_eth_iterator_cleanup; > > + rte_eth_iterator_init; > > + rte_eth_iterator_next; > > It would be great to add some unit test for these APIs, it would both show how > they are used and verify this functionality with all that "+" trick etc.. > > Similar to previous patch, vdev iterator. > > Is it too late to add some unit test for these functionality? We do not have similar ethdev unit test yet. So for -rc1, yes it is too late to introduce a new class of unit test. I will try to work on it for -rc2.