drivers/net: do not use ethdev driver
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 6167443..5dc3ff0 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <rte_dev.h>
 #include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
 
@@ -1075,6 +1076,8 @@ init_err_disable:
        return rc;
 }
 
+static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
+
 static int
 bnxt_dev_init(struct rte_eth_dev *eth_dev)
 {
@@ -1167,7 +1170,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
        return 0;
 
 error_free:
-       eth_dev->driver->eth_dev_uninit(eth_dev);
+       bnxt_dev_uninit(eth_dev);
 error:
        return rc;
 }
@@ -1196,19 +1199,26 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
        return rc;
 }
 
-static struct eth_driver bnxt_rte_pmd = {
-       .pci_drv = {
-                   .id_table = bnxt_pci_id_map,
-                   .drv_flags = RTE_PCI_DRV_NEED_MAPPING |
-                           RTE_PCI_DRV_INTR_LSC,
-                   .probe = rte_eth_dev_pci_probe,
-                   .remove = rte_eth_dev_pci_remove
-                   },
-       .eth_dev_init = bnxt_dev_init,
-       .eth_dev_uninit = bnxt_dev_uninit,
-       .dev_private_size = sizeof(struct bnxt),
+static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+       struct rte_pci_device *pci_dev)
+{
+       return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct bnxt),
+               bnxt_dev_init);
+}
+
+static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
+{
+       return rte_eth_dev_pci_generic_remove(pci_dev, bnxt_dev_uninit);
+}
+
+static struct rte_pci_driver bnxt_rte_pmd = {
+       .id_table = bnxt_pci_id_map,
+       .drv_flags = RTE_PCI_DRV_NEED_MAPPING |
+               RTE_PCI_DRV_INTR_LSC,
+       .probe = bnxt_pci_probe,
+       .remove = bnxt_pci_remove,
 };
 
-RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio");