- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
int test_pci_run = 0; /* value checked by the multiprocess test */
static unsigned pci_dev_count;
static unsigned driver_registered = 0;
int test_pci_run = 0; /* value checked by the multiprocess test */
static unsigned pci_dev_count;
static unsigned driver_registered = 0;
static int my_driver_init(struct rte_pci_driver *dr,
struct rte_pci_device *dev);
static int my_driver_init(struct rte_pci_driver *dr,
struct rte_pci_device *dev);
.name = "test_driver",
.devinit = my_driver_init,
.id_table = my_driver_id,
.name = "test_driver",
.devinit = my_driver_init,
.id_table = my_driver_id,
- unsigned idx = 0;
-
- memset(blacklist, 0, sizeof (blacklist));
-
- TAILQ_FOREACH(dev, &device_list, next) {
- if (idx >= sizeof (blacklist) / sizeof (blacklist[0])) {
- printf("Error: too many devices to blacklist");
+ unsigned i = 0;
+ char pci_addr_str[16];
+
+ TAILQ_FOREACH(dev, &pci_device_list, next) {
+ snprintf(pci_addr_str, sizeof(pci_addr_str), PCI_PRI_FMT,
+ dev->addr.domain, dev->addr.bus, dev->addr.devid,
+ dev->addr.function);
+ if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI,
+ pci_addr_str) < 0) {
+ printf("Error: cannot blacklist <%s>", pci_addr_str);
- rte_eal_pci_set_blacklist(blacklist, idx);
- printf("%u devices blacklisted\n", idx);
+/* clear devargs list that was modified by the test */
+static void free_devargs_list(void)
+{
+ struct rte_devargs *devargs;
+
+ while (!TAILQ_EMPTY(&devargs_list)) {
+ devargs = TAILQ_FIRST(&devargs_list);
+ TAILQ_REMOVE(&devargs_list, devargs, next);
+ free(devargs);
+ }
if (driver_registered == 0) {
rte_eal_pci_register(&my_driver);
rte_eal_pci_register(&my_driver2);
if (driver_registered == 0) {
rte_eal_pci_register(&my_driver);
rte_eal_pci_register(&my_driver2);