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

Message ID f7318e0763ac3c6ef2433df1d65dc6b36b708700.1521587199.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 fail Compilation issues

Commit Message

Gaëtan Rivet March 20, 2018, 11:20 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

Thomas Monjalon April 22, 2018, 9:42 p.m. UTC | #1
21/03/2018 00:20, Gaetan Rivet:
> Introduce new rte_devargs accessor allowing to iterate over all
> rte_devargs pertaining to a bus.

This patch can be merged with previous one.
  

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