DPDK  21.08.0
rte_devargs.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2014 6WIND S.A.
3  */
4 
5 #ifndef _RTE_DEVARGS_H_
6 #define _RTE_DEVARGS_H_
7 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include <stdio.h>
24 #include <sys/queue.h>
25 #include <rte_compat.h>
26 #include <rte_bus.h>
27 
34 #define RTE_DEVARGS_KEY_BUS "bus"
35 
42 #define RTE_DEVARGS_KEY_CLASS "class"
43 
50 #define RTE_DEVARGS_KEY_DRIVER "driver"
51 
56  RTE_DEVTYPE_ALLOWED,
57  RTE_DEVTYPE_BLOCKED,
58  RTE_DEVTYPE_VIRTUAL,
59 };
60 
61 /* Backwards compatibility will be removed later */
62 #define RTE_DEVTYPE_WHITELISTED_PCI \
63  RTE_DEPRECATED(RTE_DEVTYPE_WHITELISTED_PCI) RTE_DEVTYPE_ALLOWED
64 #define RTE_DEVTYPE_BLACKLISTED_PCI \
65  RTE_DEPRECATED(RTE_DEVTYPE_BLACKLISTED_PCI) RTE_DEVTYPE_BLOCKED
66 
77 struct rte_devargs {
85  char name[RTE_DEV_NAME_MAX_LEN];
87  union {
88  const char *args;
89  const char *drv_str;
90  };
91  struct rte_bus *bus;
92  struct rte_class *cls;
93  const char *bus_str;
94  const char *cls_str;
95  char *data;
96 };
97 
130 int
131 rte_devargs_parse(struct rte_devargs *da, const char *dev);
132 
166 int
168  const char *format, ...)
169 __rte_format_printf(2, 0);
170 
177 __rte_experimental
178 void
179 rte_devargs_reset(struct rte_devargs *da);
180 
193 int
194 rte_devargs_insert(struct rte_devargs **da);
195 
209 int rte_devargs_add(enum rte_devtype devtype, const char *devargs_str);
210 
224 int rte_devargs_remove(struct rte_devargs *devargs);
225 
235 unsigned int
236 rte_devargs_type_count(enum rte_devtype devtype);
237 
244 void rte_devargs_dump(FILE *f);
245 
262 struct rte_devargs *
263 rte_devargs_next(const char *busname, const struct rte_devargs *start);
264 
268 #define RTE_EAL_DEVARGS_FOREACH(busname, da) \
269  for (da = rte_devargs_next(busname, NULL); \
270  da != NULL; \
271  da = rte_devargs_next(busname, da)) \
272 
273 #ifdef __cplusplus
274 }
275 #endif
276 
277 #endif /* _RTE_DEVARGS_H_ */
rte_devtype
Definition: rte_devargs.h:55
int rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
struct rte_bus * bus
Definition: rte_devargs.h:91
const char * args
Definition: rte_devargs.h:88
const char * cls_str
Definition: rte_devargs.h:94
int rte_devargs_parsef(struct rte_devargs *da, const char *format,...) __rte_format_printf(2
struct rte_class * cls
Definition: rte_devargs.h:92
struct rte_devargs * rte_devargs_next(const char *busname, const struct rte_devargs *start)
const char * bus_str
Definition: rte_devargs.h:93
int __rte_experimental void rte_devargs_reset(struct rte_devargs *da)
unsigned int rte_devargs_type_count(enum rte_devtype devtype)
int rte_devargs_insert(struct rte_devargs **da)
void rte_devargs_dump(FILE *f)
char name[RTE_DEV_NAME_MAX_LEN]
Definition: rte_devargs.h:85
rte_dev_policy
Definition: rte_dev.h:54
int rte_devargs_remove(struct rte_devargs *devargs)
#define __rte_format_printf(format_index, first_arg)
Definition: rte_common.h:146
const char * drv_str
Definition: rte_devargs.h:89
#define RTE_STD_C11
Definition: rte_common.h:42
enum rte_dev_policy policy
Definition: rte_devargs.h:83
char * data
Definition: rte_devargs.h:95
int rte_devargs_parse(struct rte_devargs *da, const char *dev)
TAILQ_ENTRY(rte_devargs) next
enum rte_devtype type
Definition: rte_devargs.h:81