DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bernard Iremonger <bernard.iremonger@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v8 03/11] vdev: copy device info to eth_dev data
Date: Tue,  3 Nov 2015 13:01:57 +0000	[thread overview]
Message-ID: <1446555725-19540-4-git-send-email-bernard.iremonger@intel.com> (raw)
In-Reply-To: <1446555725-19540-1-git-send-email-bernard.iremonger@intel.com>

initialise dev_flags, driver, kdrv, drv_name and numa_node fields in eth_dev data.

for the following vdevs:
null
ring
pcap
af_packet
xenvirt
mpipe
bonding

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 12 ++++++++----
 drivers/net/bonding/rte_eth_bond_api.c    | 11 +++++++++--
 drivers/net/mpipe/mpipe_tilegx.c          |  7 +++++++
 drivers/net/null/rte_eth_null.c           | 13 +++++++++----
 drivers/net/pcap/rte_eth_pcap.c           | 13 ++++++++-----
 drivers/net/ring/rte_eth_ring.c           | 13 ++++++++-----
 drivers/net/xenvirt/rte_eth_xenvirt.c     |  8 ++++++--
 7 files changed, 55 insertions(+), 22 deletions(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index bfde661..2f14482 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -5,7 +5,7 @@
  *
  *   Originally based upon librte_pmd_pcap code:
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   Copyright(c) 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -656,8 +656,8 @@ rte_pmd_init_internals(const char *name,
 	/*
 	 * now put it all together
 	 * - store queue data in internals,
-	 * - store numa_node info in pci_driver
-	 * - point eth_dev_data to internals and pci_driver
+	 * - store numa_node in eth_dev
+	 * - point eth_dev_data to internals
 	 * - and point eth_dev structure to new eth_dev_data structure
 	 */
 
@@ -674,7 +674,11 @@ rte_pmd_init_internals(const char *name,
 
 	(*eth_dev)->data = data;
 	(*eth_dev)->dev_ops = &ops;
-	(*eth_dev)->pci_dev = pci_dev;
+	(*eth_dev)->driver = NULL;
+	(*eth_dev)->data->dev_flags = 0;
+	(*eth_dev)->data->drv_name = drivername;
+	(*eth_dev)->data->kdrv = RTE_KDRV_NONE;
+	(*eth_dev)->data->numa_node = numa_node;
 
 	return 0;
 
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 92073df..34adbde 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -44,6 +44,8 @@
 
 #define DEFAULT_POLLING_INTERVAL_10_MS (10)
 
+const char pmd_bond_driver_name[] = "rte_bond_pmd";
+
 int
 valid_bonded_ethdev(const struct rte_eth_dev *eth_dev)
 {
@@ -163,8 +165,6 @@ number_of_sockets(void)
 	return ++sockets;
 }
 
-const char pmd_bond_driver_name[] = "rte_bond_pmd";
-
 static struct rte_pci_id pci_id_table = {
 	.device_id = PCI_ANY_ID,
 	.subsystem_device_id = PCI_ANY_ID,
@@ -252,6 +252,13 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
 	eth_dev->dev_ops = &default_dev_ops;
 	eth_dev->pci_dev = pci_dev;
 
+	eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |
+		RTE_ETH_DEV_DETACHABLE;
+	eth_dev->driver = NULL;
+	eth_dev->data->kdrv = RTE_KDRV_NONE;
+	eth_dev->data->drv_name = pmd_bond_driver_name;
+	eth_dev->data->numa_node =  socket_id;
+
 	rte_spinlock_init(&internals->lock);
 
 	internals->port_id = eth_dev->data->port_id;
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 6e3e304..4dc32f7 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -80,6 +80,7 @@ struct mpipe_context {
 
 static struct mpipe_context mpipe_contexts[GXIO_MPIPE_INSTANCE_MAX];
 static int mpipe_instances;
+static const char *drivername = "MPIPE PMD";
 
 /* Per queue statistics. */
 struct mpipe_queue_stats {
@@ -1595,6 +1596,12 @@ rte_pmd_mpipe_devinit(const char *ifname,
 	eth_dev->pci_dev = &priv->pci_dev;
 	eth_dev->data->mac_addrs = &priv->mac_addr;
 
+	eth_dev->data->dev_flags = 0;
+	eth_dev->data->kdrv = RTE_KDRV_NONE;
+	eth_dev->driver = NULL;
+	eth_dev->data->drv_name = drivername;
+	eth_dev->data->numa_node = instance;
+
 	eth_dev->dev_ops      = &mpipe_dev_ops;
 	eth_dev->rx_pkt_burst = &mpipe_recv_pkts;
 	eth_dev->tx_pkt_burst = &mpipe_xmit_pkts;
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 64e9000..11d6037 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -540,8 +540,8 @@ eth_dev_null_create(const char *name,
 
 	/* now put it all together
 	 * - store queue data in internals,
-	 * - store numa_node info in pci_driver
-	 * - point eth_dev_data to internals and pci_driver
+	 * - store numa_node info in ethdev data
+	 * - point eth_dev_data to internals
 	 * - and point eth_dev structure to new eth_dev_data structure
 	 */
 	/* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -571,10 +571,15 @@ eth_dev_null_create(const char *name,
 
 	eth_dev->data = data;
 	eth_dev->dev_ops = &ops;
-	eth_dev->pci_dev = pci_dev;
-	eth_dev->driver = &rte_null_pmd;
+
 	TAILQ_INIT(&eth_dev->link_intr_cbs);
 
+	eth_dev->driver = NULL;
+	eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
+	eth_dev->data->kdrv = RTE_KDRV_NONE;
+	eth_dev->data->drv_name = drivername;
+	eth_dev->data->numa_node = numa_node;
+
 	/* finally assign rx and tx ops */
 	if (packet_copy) {
 		eth_dev->rx_pkt_burst = eth_null_copy_rx;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index f2e4634..850274c 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   Copyright(c) 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -845,8 +845,8 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
 
 	/* now put it all together
 	 * - store queue data in internals,
-	 * - store numa_node info in pci_driver
-	 * - point eth_dev_data to internals and pci_driver
+	 * - store numa_node info in eth_dev
+	 * - point eth_dev_data to internals
 	 * - and point eth_dev structure to new eth_dev_data structure
 	 */
 	/* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -874,8 +874,11 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
 
 	(*eth_dev)->data = data;
 	(*eth_dev)->dev_ops = &ops;
-	(*eth_dev)->pci_dev = pci_dev;
-	(*eth_dev)->driver = &rte_pcap_pmd;
+	(*eth_dev)->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
+	(*eth_dev)->driver = NULL;
+	(*eth_dev)->data->kdrv = RTE_KDRV_NONE;
+	(*eth_dev)->data->drv_name = drivername;
+	(*eth_dev)->data->numa_node = numa_node;
 
 	return 0;
 
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 0ba36d5..77ac23a 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -304,11 +304,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	if (eth_dev == NULL)
 		goto error;
 
-
 	/* now put it all together
 	 * - store queue data in internals,
-	 * - store numa_node info in pci_driver
-	 * - point eth_dev_data to internals and pci_driver
+	 * - store numa_node info in eth_dev_data
+	 * - point eth_dev_data to internals
 	 * - and point eth_dev structure to new eth_dev_data structure
 	 */
 	/* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -338,9 +337,13 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	data->mac_addrs = &internals->address;
 
 	eth_dev->data = data;
-	eth_dev->driver = &rte_ring_pmd;
+	eth_dev->driver = NULL;
 	eth_dev->dev_ops = &ops;
-	eth_dev->pci_dev = pci_dev;
+	eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
+	eth_dev->data->kdrv = RTE_KDRV_NONE;
+	eth_dev->data->drv_name = drivername;
+	eth_dev->data->numa_node = numa_node;
+
 	TAILQ_INIT(&(eth_dev->link_intr_cbs));
 
 	/* finally assign rx and tx ops */
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index b527552..6f9d96f 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -67,7 +67,7 @@
 /* virtio_idx is increased after new device is created.*/
 static int virtio_idx = 0;
 
-static const char *drivername = "xen dummy virtio PMD";
+static const char *drivername = "xen virtio PMD";
 
 static struct rte_eth_link pmd_link = {
 		.link_speed = 10000,
@@ -688,8 +688,12 @@ eth_dev_xenvirt_create(const char *name, const char *params,
 
 	eth_dev->data = data;
 	eth_dev->dev_ops = &ops;
+
 	eth_dev->data->dev_flags = RTE_PCI_DRV_DETACHABLE;
-	eth_dev->pci_dev = pci_dev;
+	eth_dev->data->kdrv = RTE_KDRV_NONE;
+	eth_dev->data->drv_name = drivername;
+	eth_dev->driver = NULL;
+	eth_dev->data->numa_node = numa_node;
 
 	eth_dev->rx_pkt_burst = eth_xenvirt_rx;
 	eth_dev->tx_pkt_burst = eth_xenvirt_tx;
-- 
1.9.1

  parent reply	other threads:[~2015-11-03 13:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <PATCH v8>
2015-11-03 13:01 ` [dpdk-dev] [PATCH v8 00/11] remove pci driver from vdevs Bernard Iremonger
2015-11-03 13:01   ` [dpdk-dev] [PATCH v8 01/11] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data Bernard Iremonger
2015-11-03 16:31     ` Thomas Monjalon
2015-11-03 13:01   ` [dpdk-dev] [PATCH v8 02/11] pdev: copy pci device info to eth_dev data Bernard Iremonger
2015-11-03 13:01   ` Bernard Iremonger [this message]
2015-11-03 17:17     ` [dpdk-dev] [PATCH v8 03/11] vdev: copy " Thomas Monjalon
2015-11-03 13:01   ` [dpdk-dev] [PATCH v8 04/11] librte_ether: remove branches on pci_dev Bernard Iremonger
2015-11-03 13:01   ` [dpdk-dev] [PATCH v8 05/11] null: remove pci device Bernard Iremonger
2015-11-03 13:02   ` [dpdk-dev] [PATCH v8 06/11] ring: " Bernard Iremonger
2015-11-03 13:02   ` [dpdk-dev] [PATCH v8 07/11] pcap: " Bernard Iremonger
2015-11-03 13:02   ` [dpdk-dev] [PATCH v8 08/11] af_packet: " Bernard Iremonger
2015-11-03 13:02   ` [dpdk-dev] [PATCH v8 09/11] xenvirt: " Bernard Iremonger
2015-11-03 13:02   ` [dpdk-dev] [PATCH v8 10/11] mpipe: " Bernard Iremonger
2015-11-03 13:02   ` [dpdk-dev] [PATCH v8 11/11] bonding: " Bernard Iremonger
2015-11-03 17:50   ` [dpdk-dev] [PATCH v8 00/11] remove pci driver from vdevs Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446555725-19540-4-git-send-email-bernard.iremonger@intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).