[dpdk-dev,v4,02/10] devargs: introduce foreach macro
Checks
Commit Message
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
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.
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.
@@ -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