1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018 Gaƫtan Rivet
9 #include <rte_kvargs.h>
10 #include <rte_errno.h>
12 #include "vdev_logs.h"
13 #include "vdev_private.h"
20 static const char * const vdev_params_keys[] = {
21 [RTE_VDEV_PARAM_NAME] = "name",
22 [RTE_VDEV_PARAM_MAX] = NULL,
26 vdev_dev_match(const struct rte_device *dev,
30 const struct rte_kvargs *kvlist = _kvlist;
33 /* cannot pass const dev->name to rte_kvargs_process() */
34 name = strdup(dev->name);
37 ret = rte_kvargs_process(kvlist,
38 vdev_params_keys[RTE_VDEV_PARAM_NAME],
39 rte_kvargs_strcmp, name);
48 rte_vdev_dev_iterate(const void *start,
50 const struct rte_dev_iterator *it __rte_unused)
52 struct rte_kvargs *kvargs = NULL;
53 struct rte_device *dev;
56 kvargs = rte_kvargs_parse(str, vdev_params_keys);
58 VDEV_LOG(ERR, "cannot parse argument list\n");
63 dev = rte_vdev_find_device(start, vdev_dev_match, kvargs);
64 rte_kvargs_free(kvargs);