1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2021 NVIDIA Corporation & Affiliates
10 #include <rte_kvargs.h>
13 #include "rte_bus_auxiliary.h"
15 enum auxiliary_params {
16 RTE_AUXILIARY_PARAM_NAME,
19 static const char * const auxiliary_params_keys[] = {
20 [RTE_AUXILIARY_PARAM_NAME] = "name",
24 auxiliary_dev_match(const struct rte_device *dev,
27 const struct rte_kvargs *kvlist = _kvlist;
30 ret = rte_kvargs_process(kvlist,
31 auxiliary_params_keys[RTE_AUXILIARY_PARAM_NAME],
32 rte_kvargs_strcmp, (void *)(uintptr_t)dev->name);
34 return ret != 0 ? -1 : 0;
38 auxiliary_dev_iterate(const void *start,
40 const struct rte_dev_iterator *it __rte_unused)
42 rte_bus_find_device_t find_device;
43 struct rte_kvargs *kvargs = NULL;
44 struct rte_device *dev;
47 kvargs = rte_kvargs_parse(str, auxiliary_params_keys);
49 AUXILIARY_LOG(ERR, "cannot parse argument list %s",
55 find_device = auxiliary_bus.bus.find_device;
56 dev = find_device(start, auxiliary_dev_match, kvargs);
57 rte_kvargs_free(kvargs);