From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jblunck@gmail.com>
Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65])
 by dpdk.org (Postfix) with ESMTP id 3C5D55A68
 for <dev@dpdk.org>; Mon,  6 Mar 2017 11:01:09 +0100 (CET)
Received: by mail-wm0-f65.google.com with SMTP id v190so12807060wme.3
 for <dev@dpdk.org>; Mon, 06 Mar 2017 02:01:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:subject:date:message-id:in-reply-to:references;
 bh=tk6Jmc1Jp0Fbae2xxBRb3BGNr1QbM/bPbsukmkVJC8A=;
 b=GnY9p+8GM7UBDooiTzDxJh+soE1UeEQhJVDBFlmkHQlgSpvxr1dgrFOaMgoGAJTkxx
 2zUn4pxzCH4S8qXXhu2lA3WH1tfo9Ubr6XRDg1JL9Fp8rmzGnb0mmkP7xNS6QDc/ow9R
 EdKMowZ8+nf5mIi6agYgTWWZFUheEVq7tuJ/pWkq0KP+pJx2w7+y/SK16s5oQ2oETnBx
 /sqirC+ZE1us7fiDW7pid2IlH+j1MeBav8kMJhnWWnK5XKD4PiL8FdmIYdxllgbuoQig
 MwrwzexUUPTeB3+xxlgFZ3/T2pF36IOSzPNcoCCTw0RKL1OajNa2PfZ7DCF6cDuzRsGb
 gZlw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:subject:date:message-id
 :in-reply-to:references;
 bh=tk6Jmc1Jp0Fbae2xxBRb3BGNr1QbM/bPbsukmkVJC8A=;
 b=g+ddwcEfR4AhYoEBvdCyWlrgGwMxwwlW4d8IkldRvUm+rF6HjtwZqtslWq00MerR/I
 bKDMrHsoEPxWwJxeG5rbJR45m1BdWgBGkf4OWBPR2nk54dYmvR7EowGY3VWXM7b6p3GS
 Gq+/KifXg4RNxnj8kJS4NciuaepcHNQ8RNTvEk98OXfz99eBMI0gmf4lGa4I44zo1rev
 xblcQngVZxU0tpy7Q1QgAKwwh66TYtavNMRYUh0AGgIqmyRsYn/QgqCxqpDDetkLn9Hk
 ADQwa/WXci7nJZSp/1KmbEaB2/2Vv50qXsmz/VQU70Pe2l55zwxrDL4lZl+EvKjE4kwp
 C+Yg==
X-Gm-Message-State: AMke39mc+3hmN+njc2HbRn0wICSo2Inn6j+1sgxnp2IC5q8ob4UhPKDfiYabDPNIExwoqA==
X-Received: by 10.28.93.194 with SMTP id r185mr12367959wmb.47.1488794468726;
 Mon, 06 Mar 2017 02:01:08 -0800 (PST)
Received: from weierstrass.local.net ([91.200.109.169])
 by smtp.gmail.com with ESMTPSA id u145sm3829237wmu.1.2017.03.06.02.01.07
 for <dev@dpdk.org>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 06 Mar 2017 02:01:07 -0800 (PST)
Sender: Jan Blunck <jblunck@gmail.com>
From: Jan Blunck <jblunck@infradead.org>
To: dev@dpdk.org
Date: Mon,  6 Mar 2017 11:00:13 +0100
Message-Id: <1488794430-25179-22-git-send-email-jblunck@infradead.org>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1488794430-25179-1-git-send-email-jblunck@infradead.org>
References: <1488794430-25179-1-git-send-email-jblunck@infradead.org>
Subject: [dpdk-dev] [PATCH 21/38] net/igb: Don't use eth_driver
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 06 Mar 2017 10:01:09 -0000

Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
 drivers/net/e1000/igb_ethdev.c | 60 ++++++++++++++++++++++++++----------------
 1 file changed, 38 insertions(+), 22 deletions(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a112b38..1a162cc 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -45,6 +45,7 @@
 #include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
@@ -1087,31 +1088,46 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
-static struct eth_driver rte_igb_pmd = {
-	.pci_drv = {
-		.id_table = pci_id_igb_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 = eth_igb_dev_init,
-	.eth_dev_uninit = eth_igb_dev_uninit,
-	.dev_private_size = sizeof(struct e1000_adapter),
+static int eth_igb_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 e1000_adapter), eth_igb_dev_init);
+}
+
+static int eth_igb_pci_remove(struct rte_pci_device *pci_dev)
+{
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_igb_dev_uninit);
+}
+
+static struct rte_pci_driver rte_igb_pmd = {
+	.id_table = pci_id_igb_map,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+	.probe = eth_igb_pci_probe,
+	.remove = eth_igb_pci_remove,
 };
 
+
+static int eth_igbvf_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 e1000_adapter), eth_igbvf_dev_init);
+}
+
+static int eth_igbvf_pci_remove(struct rte_pci_device *pci_dev)
+{
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_igbvf_dev_uninit);
+}
+
 /*
  * virtual function driver struct
  */
-static struct eth_driver rte_igbvf_pmd = {
-	.pci_drv = {
-		.id_table = pci_id_igbvf_map,
-		.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
-		.probe = rte_eth_dev_pci_probe,
-		.remove = rte_eth_dev_pci_remove,
-	},
-	.eth_dev_init = eth_igbvf_dev_init,
-	.eth_dev_uninit = eth_igbvf_dev_uninit,
-	.dev_private_size = sizeof(struct e1000_adapter),
+static struct rte_pci_driver rte_igbvf_pmd = {
+	.id_table = pci_id_igbvf_map,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+	.probe = eth_igbvf_pci_probe,
+	.remove = eth_igbvf_pci_remove,
 };
 
 static void
@@ -5309,9 +5325,9 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
 	E1000_WRITE_FLUSH(hw);
 }
 
-RTE_PMD_REGISTER_PCI(net_e1000_igb, rte_igb_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_e1000_igb, rte_igb_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb, pci_id_igb_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb_vf, pci_id_igbvf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb_vf, "* igb_uio | vfio");
-- 
2.7.4