[dpdk-dev] [PATCH 1/2] net/ark: remove eth_dev

Ferruh Yigit ferruh.yigit at intel.com
Tue Apr 18 20:27:25 CEST 2017


Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
---

CC: Shepard Siegel <shepard.siegel at atomicrules.com>
CC: Ed Czeck <ed.czeck at atomicrules.com>
CC: John Miller <john.miller at atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 44 ++++++++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 651dd26..1f6cd0d 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -40,6 +40,7 @@
 #include "ark_global.h"
 #include "ark_logs.h"
 #include "ark_ethdev.h"
+#include <rte_ethdev_pci.h>
 #include "ark_ethdev_tx.h"
 #include "ark_ethdev_rx.h"
 #include "ark_mpu.h"
@@ -118,16 +119,36 @@ static const struct rte_pci_id pci_id_ark_map[] = {
 	{.vendor_id = 0, /* sentinel */ },
 };
 
-static struct eth_driver rte_ark_pmd = {
-	.pci_drv = {
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
-		.id_table = pci_id_ark_map,
-		.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC
-	},
-	.eth_dev_init = eth_ark_dev_init,
-	.eth_dev_uninit = eth_ark_dev_uninit,
-	.dev_private_size = sizeof(struct ark_adapter),
+static int
+eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+		struct rte_pci_device *pci_dev)
+{
+	struct rte_eth_dev *eth_dev;
+	int ret;
+
+	eth_dev = rte_eth_dev_pci_allocate(pci_dev, sizeof(struct ark_adapter));
+
+	if (eth_dev == NULL)
+		return -ENOMEM;
+
+	ret = eth_ark_dev_init(eth_dev);
+	if (ret)
+		rte_eth_dev_pci_release(eth_dev);
+
+	return ret;
+}
+
+static int
+eth_ark_pci_remove(struct rte_pci_device *pci_dev)
+{
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_ark_dev_uninit);
+}
+
+static struct rte_pci_driver rte_ark_pmd = {
+	.id_table = pci_id_ark_map,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+	.probe = eth_ark_pci_probe,
+	.remove = eth_ark_pci_remove,
 };
 
 static const struct eth_dev_ops ark_eth_dev_ops = {
@@ -375,7 +396,6 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 
 		eth_dev->device = &pci_dev->device;
 		eth_dev->data->dev_private = ark;
-		eth_dev->driver = ark->eth_dev->driver;
 		eth_dev->dev_ops = ark->eth_dev->dev_ops;
 		eth_dev->tx_pkt_burst = ark->eth_dev->tx_pkt_burst;
 		eth_dev->rx_pkt_burst = ark->eth_dev->rx_pkt_burst;
@@ -963,7 +983,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params)
 	return 0;
 }
 
-RTE_PMD_REGISTER_PCI(net_ark, rte_ark_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_ark, rte_ark_pmd);
 RTE_PMD_REGISTER_KMOD_DEP(net_ark, "* igb_uio | uio_pci_generic ");
 RTE_PMD_REGISTER_PCI_TABLE(net_ark, pci_id_ark_map);
 RTE_PMD_REGISTER_PARAM_STRING(net_ark,
-- 
2.9.3



More information about the dev mailing list