tile: fix build
[dpdk.git] / app / test / test_pci.c
index 362ae3e..7985376 100644 (file)
  * PCI test
  * ========
  *
- * - Register a driver with a ``devinit()`` function.
+ * - Register a driver with a ``probe()`` function.
  *
  * - Dump all PCI devices.
  *
- * - Check that the ``devinit()`` function is called at least once.
+ * - Check that the ``probe()`` function is called at least once.
  */
 
 int test_pci_run = 0; /* value checked by the multiprocess test */
@@ -66,34 +66,31 @@ static int my_driver_init(struct rte_pci_driver *dr,
                          struct rte_pci_device *dev);
 
 /* IXGBE NICS */
-struct rte_pci_id my_driver_id[] = {
-
-#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
-#include <rte_pci_dev_ids.h>
-
-{ .vendor_id = 0, /* sentinel */ },
+const struct rte_pci_id my_driver_id[] = {
+       {RTE_PCI_DEVICE(0x0001, 0x1234)},
+       { .vendor_id = 0, /* sentinel */ },
 };
 
-struct rte_pci_id my_driver_id2[] = {
-
-/* IGB & EM NICS */
-#define RTE_PCI_DEV_ID_DECL_EM(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
-#define RTE_PCI_DEV_ID_DECL_IGB(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
-#include <rte_pci_dev_ids.h>
-
-{ .vendor_id = 0, /* sentinel */ },
+const struct rte_pci_id my_driver_id2[] = {
+       {RTE_PCI_DEVICE(0x0001, 0x4444)},
+       {RTE_PCI_DEVICE(0x0002, 0xabcd)},
+       { .vendor_id = 0, /* sentinel */ },
 };
 
 struct rte_pci_driver my_driver = {
-       .name = "test_driver",
-       .devinit = my_driver_init,
+       .driver = {
+               .name = "test_driver"
+       },
+       .probe = my_driver_init,
        .id_table = my_driver_id,
        .drv_flags = 0,
 };
 
 struct rte_pci_driver my_driver2 = {
-       .name = "test_driver2",
-       .devinit = my_driver_init,
+       .driver = {
+               .name = "test_driver2"
+       },
+       .probe = my_driver_init,
        .id_table = my_driver_id2,
        .drv_flags = 0,
 };
@@ -102,7 +99,7 @@ static int
 my_driver_init(__attribute__((unused)) struct rte_pci_driver *dr,
               struct rte_pci_device *dev)
 {
-       printf("My driver init called in %s\n", dr->name);
+       printf("My driver init called in %s\n", dr->driver.name);
        printf("%x:%x:%x.%d", dev->addr.domain, dev->addr.bus,
               dev->addr.devid, dev->addr.function);
        printf(" - vendor:%x device:%x\n", dev->id.vendor_id, dev->id.device_id);
@@ -238,7 +235,8 @@ test_pci_blacklist(void)
        struct rte_devargs_list save_devargs_list;
 
        printf("Dump all devices\n");
-       rte_eal_pci_dump(stdout);
+       TEST_ASSERT(TAILQ_EMPTY(&pci_driver_list),
+                       "pci_driver_list not empty");
 
        rte_eal_pci_register(&my_driver);
        rte_eal_pci_register(&my_driver2);
@@ -321,8 +319,4 @@ test_pci(void)
        return 0;
 }
 
-static struct test_command pci_cmd = {
-       .command = "pci_autotest",
-       .callback = test_pci,
-};
-REGISTER_TEST_COMMAND(pci_cmd);
+REGISTER_TEST_COMMAND(pci_autotest, test_pci);