[dpdk-dev,v4,02/10] devargs: introduce foreach macro

Message ID 224c73b2d7b27f32376334041c217533803a7354.1524522515.git.gaetan.rivet@6wind.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Gaëtan Rivet April 23, 2018, 10:41 p.m. UTC
  Introduce new rte_devargs accessor allowing to iterate over all
rte_devargs pertaining to a bus.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_eal/common/include/rte_devargs.h | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Stephen Hemminger April 23, 2018, 11:56 p.m. UTC | #1
On Tue, 24 Apr 2018 00:41:02 +0200
Gaetan Rivet <gaetan.rivet@6wind.com> wrote:

> Introduce new rte_devargs accessor allowing to iterate over all
> rte_devargs pertaining to a bus.
> 
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---

Aren't devargs intended to be internal and not part of ABI.
If so maybe the experimental tag is not necessary, and you
want to say that in the comments.
  
Gaëtan Rivet April 24, 2018, 10:26 a.m. UTC | #2
On Mon, Apr 23, 2018 at 04:56:19PM -0700, Stephen Hemminger wrote:
> On Tue, 24 Apr 2018 00:41:02 +0200
> Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
> 
> > Introduce new rte_devargs accessor allowing to iterate over all
> > rte_devargs pertaining to a bus.
> > 
> > Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> > ---
> 
> Aren't devargs intended to be internal and not part of ABI.
> If so maybe the experimental tag is not necessary, and you
> want to say that in the comments.

The ABI is exposed, so any third-party declaring rte_devargs would be
impacted by changes to the structure. I don't think it's internal.

In any case, the API itself is not internal, and the rte_experimental
tag is meant for API I think? This function is new and prone to changes
as well as part of the public EAL API, I think it is correct to tag it
experimental.
  

Patch

diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h
index 969a10449..aba31481b 100644
--- a/lib/librte_eal/common/include/rte_devargs.h
+++ b/lib/librte_eal/common/include/rte_devargs.h
@@ -209,6 +209,14 @@  __rte_experimental
 struct rte_devargs *
 rte_eal_devargs_next(const char *busname, const struct rte_devargs *start);
 
+/**
+ * Iterate over all rte_devargs for a specific bus.
+ */
+#define RTE_EAL_DEVARGS_FOREACH(busname, da) \
+	for (da = rte_eal_devargs_next(busname, NULL); \
+	     da != NULL; \
+	     da = rte_eal_devargs_next(busname, da)) \
+
 #ifdef __cplusplus
 }
 #endif