name prefix, instead of ``dpdk_``, allowing each DPDK application instance to only
use a subset of configured queues.
+Additionally, the -a (allowlist) or -b (blocklist) commandline parameters
+are also available to further restrict the device list that will be used.
+If the -a option is used, then any device that passes the ``dpdk_``
+or ``--file-prefix`` prefix condition must also be present in the allow list.
+Similarly, when the block list is used,
+any device that passes the prefix condition must not be in the block list.
+For example, to only use ``wq0.3``, assuming the name prefix condition is met::
+
+ $ dpdk-test -a wq0.3
+
Once probed successfully, irrespective of kernel driver, the device will appear as a ``dmadev``,
that is a "DMA device type" inside DPDK, and can be accessed using APIs from the
``rte_dmadev`` library.
#include <libgen.h>
#include <rte_bus.h>
+#include <rte_devargs.h>
#include <rte_eal.h>
#include <rte_log.h>
#include <rte_dmadev_pmd.h>
return 0;
}
+static int search_devargs(const char *name)
+{
+ struct rte_devargs *devargs;
+ RTE_EAL_DEVARGS_FOREACH(dsa_bus.bus.name, devargs) {
+ if (strcmp(devargs->name, name) == 0)
+ return 1;
+ }
+ return 0;
+}
+
static int
-is_for_this_process_use(const char *name)
+is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
{
char *runtime_dir = strdup(rte_eal_get_runtime_dir());
char *prefix = basename(runtime_dir);
if (strncmp(name, prefix, prefixlen) == 0 && name[prefixlen] == '_')
retval = 1;
+ if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
+ if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
+ retval = search_devargs(dev->device.name);
+ else
+ retval = !search_devargs(dev->device.name);
+ }
+
free(runtime_dir);
return retval;
}
read_wq_string(dev, "name", name, sizeof(name)) < 0)
continue;
- if (strncmp(type, "user", 4) == 0 && is_for_this_process_use(name)) {
+ if (strncmp(type, "user", 4) == 0 &&
+ is_for_this_process_use(dev, name)) {
dev->device.driver = &dsa_bus.driver;
idxd_probe_dsa(dev);
continue;
return -1;
}
- wq->device_id = device_id;
- wq->wq_id = wq_id;
+ if (wq != NULL) {
+ wq->device_id = device_id;
+ wq->wq_id = wq_id;
+ }
+
return 0;
}