git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
crypto/qat: add device files
[dpdk.git]
/
lib
/
librte_eal
/
common
/
eal_common_devargs.c
diff --git
a/lib/librte_eal/common/eal_common_devargs.c
b/lib/librte_eal/common/eal_common_devargs.c
index
c6c5eab
..
b043415
100644
(file)
--- a/
lib/librte_eal/common/eal_common_devargs.c
+++ b/
lib/librte_eal/common/eal_common_devargs.c
@@
-11,6
+11,7
@@
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
+#include <stdarg.h>
#include <rte_compat.h>
#include <rte_dev.h>
#include <rte_compat.h>
#include <rte_dev.h>
@@
-18,6
+19,9
@@
#include <rte_tailq.h>
#include "eal_private.h"
#include <rte_tailq.h>
#include "eal_private.h"
+/** user device double-linked queue type definition */
+TAILQ_HEAD(rte_devargs_list, rte_devargs);
+
/** Global list of user devices */
struct rte_devargs_list devargs_list =
TAILQ_HEAD_INITIALIZER(devargs_list);
/** Global list of user devices */
struct rte_devargs_list devargs_list =
TAILQ_HEAD_INITIALIZER(devargs_list);
@@
-59,15
+63,23
@@
bus_name_cmp(const struct rte_bus *bus, const void *name)
}
int __rte_experimental
}
int __rte_experimental
-rte_
eal_devargs_parse(const char *dev, struct rte_devargs *da
)
+rte_
devargs_parse(struct rte_devargs *da, const char *format, ...
)
{
struct rte_bus *bus = NULL;
{
struct rte_bus *bus = NULL;
+ va_list ap;
+ va_start(ap, format);
+ char dev[vsnprintf(NULL, 0, format, ap) + 1];
const char *devname;
const size_t maxlen = sizeof(da->name);
size_t i;
const char *devname;
const size_t maxlen = sizeof(da->name);
size_t i;
- if (dev == NULL || da == NULL)
+ va_end(ap);
+ if (da == NULL)
return -EINVAL;
return -EINVAL;
+
+ va_start(ap, format);
+ vsnprintf(dev, sizeof(dev), format, ap);
+ va_end(ap);
/* Retrieve eventual bus info */
do {
devname = dev;
/* Retrieve eventual bus info */
do {
devname = dev;
@@
-113,11
+125,11
@@
rte_eal_devargs_parse(const char *dev, struct rte_devargs *da)
}
int __rte_experimental
}
int __rte_experimental
-rte_
eal_
devargs_insert(struct rte_devargs *da)
+rte_devargs_insert(struct rte_devargs *da)
{
int ret;
{
int ret;
- ret = rte_
eal_
devargs_remove(da->bus->name, da->name);
+ ret = rte_devargs_remove(da->bus->name, da->name);
if (ret < 0)
return ret;
TAILQ_INSERT_TAIL(&devargs_list, da, next);
if (ret < 0)
return ret;
TAILQ_INSERT_TAIL(&devargs_list, da, next);
@@
-125,8
+137,9
@@
rte_eal_devargs_insert(struct rte_devargs *da)
}
/* store a whitelist parameter for later parsing */
}
/* store a whitelist parameter for later parsing */
+__rte_experimental
int
int
-rte_
eal_
devargs_add(enum rte_devtype devtype, const char *devargs_str)
+rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
{
struct rte_devargs *devargs = NULL;
struct rte_bus *bus = NULL;
{
struct rte_devargs *devargs = NULL;
struct rte_bus *bus = NULL;
@@
-137,7
+150,7
@@
rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
if (devargs == NULL)
goto fail;
if (devargs == NULL)
goto fail;
- if (rte_
eal_devargs_parse(dev, devargs
))
+ if (rte_
devargs_parse(devargs, "%s", dev
))
goto fail;
devargs->type = devtype;
bus = devargs->bus;
goto fail;
devargs->type = devtype;
bus = devargs->bus;
@@
-162,7
+175,7
@@
fail:
}
int __rte_experimental
}
int __rte_experimental
-rte_
eal_
devargs_remove(const char *busname, const char *devname)
+rte_devargs_remove(const char *busname, const char *devname)
{
struct rte_devargs *d;
void *tmp;
{
struct rte_devargs *d;
void *tmp;
@@
-180,8
+193,9
@@
rte_eal_devargs_remove(const char *busname, const char *devname)
}
/* count the number of devices of a specified type */
}
/* count the number of devices of a specified type */
+__rte_experimental
unsigned int
unsigned int
-rte_
eal_
devargs_type_count(enum rte_devtype devtype)
+rte_devargs_type_count(enum rte_devtype devtype)
{
struct rte_devargs *devargs;
unsigned int count = 0;
{
struct rte_devargs *devargs;
unsigned int count = 0;
@@
-195,8
+209,9
@@
rte_eal_devargs_type_count(enum rte_devtype devtype)
}
/* dump the user devices on the console */
}
/* dump the user devices on the console */
+__rte_experimental
void
void
-rte_
eal_
devargs_dump(FILE *f)
+rte_devargs_dump(FILE *f)
{
struct rte_devargs *devargs;
{
struct rte_devargs *devargs;
@@
-211,7
+226,7
@@
rte_eal_devargs_dump(FILE *f)
/* bus-aware rte_devargs iterator. */
__rte_experimental
struct rte_devargs *
/* bus-aware rte_devargs iterator. */
__rte_experimental
struct rte_devargs *
-rte_
eal_
devargs_next(const char *busname, const struct rte_devargs *start)
+rte_devargs_next(const char *busname, const struct rte_devargs *start)
{
struct rte_devargs *da;
{
struct rte_devargs *da;