Skip to contentSkip to conversation

remove pci driver from vdevs

RFC PATCH In review Bernard Iremonger 9 participants 31 messages Aug 27, 2015 – Sep 7, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover remove pci driver from vdevs

There is a dummy pci driver in the vdev PMD's at present.
This RFC proposes to remove the pci driver from the vdev PMD's.
Changes have been made to librte_ether to handle vdevs which do not have a pci driver.

The pdev PMD's should work as before with the changes to librte_ether
The vdev PMD's which still have a pci driver should work as before with the librte_ether changes.

The following vdev PMD's have had the pci driver removed

bonding PMD
null PMD
pcap PMD
ring PMD

Bernard Iremonger (6):
librte_ether: add fields from rte_pci_driver to rte_eth_dev and
rte_eth_dev_data.
librte_ether: handle RTE_ETH_DEV_INTR_LSC for vdevs
null: remove pci device driver
ring: remove pci device driver
bonding: remove pci device driver
pcap: remove pci device driver

 drivers/net/bonding/rte_eth_bond_alb.c |  2 +-
 drivers/net/bonding/rte_eth_bond_api.c | 49 ++++++++--------------------------
 drivers/net/bonding/rte_eth_bond_pmd.c | 22 ++++++++++-----
 drivers/net/null/rte_eth_null.c        | 28 +++++--------------
 drivers/net/pcap/rte_eth_pcap.c        | 31 +++++++--------------
 drivers/net/ring/rte_eth_ring.c        | 35 +++++-------------------
 lib/librte_ether/rte_ethdev.c          | 34 ++++++++++++++++-------
 lib/librte_ether/rte_ethdev.h          | 10 ++++++-
 8 files changed, 83 insertions(+), 128 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

RFC PATCH 1/6 librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

add dev_flags to rte_eth_dev, add macros for dev_flags. add numa_node to rte_eth_dev_data.
use dev_type to distinguish between vdev's and pdev's. remove unused RTE_ETH_DEV_MAX.

---
 lib/librte_ether/rte_ethdev.c | 19 +++++++++++++++----
 lib/librte_ether/rte_ethdev.h |  8 +++++++-
 2 files changed, 22 insertions(+), 5 deletions(-)
lib/librte_ether/rte_ethdev.c +15 -4
index 6b2400c..64e5a20 100644
@@ -260,6 +260,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
 	eth_dev->data->port_id = port_id;
 	eth_dev->attached = DEV_ATTACHED;
 	eth_dev->dev_type = type;
+	eth_dev->dev_flags = 0;
 	nb_ports++;
 	return eth_dev;
 }
@@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id)
 {
 	if (!rte_eth_dev_is_valid_port(port_id))
 		return -1;
-	return rte_eth_devices[port_id].pci_dev->numa_node;
+	if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
+		return rte_eth_devices[port_id].pci_dev->numa_node;
+	else
+		return rte_eth_devices[port_id].data->numa_node;
 }
 
 uint8_t
@@ -504,6 +508,7 @@ static int
 rte_eth_dev_is_detachable(uint8_t port_id)
 {
 	uint32_t drv_flags;
+	uint32_t dev_flags;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
 		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
@@ -520,10 +525,14 @@ rte_eth_dev_is_detachable(uint8_t port_id)
 		default:
 			return -ENOTSUP;
 		}
+		drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags;
+		return !(drv_flags & RTE_PCI_DRV_DETACHABLE);
+	} else if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_VIRTUAL) {
+		dev_flags = rte_eth_devices[port_id].dev_flags;
+		return !(dev_flags & RTE_ETH_DEV_DETACHABLE);
 	}
 
-	drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags;
-	return !(drv_flags & RTE_PCI_DRV_DETACHABLE);
+	return -ENOTSUP;
 }
 
 /* attach the new physical device, then store port_id of the device */
@@ -1795,8 +1804,10 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 	FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	dev_info->pci_dev = dev->pci_dev;
-	if (dev->driver)
+	if (dev->dev_type == RTE_ETH_DEV_PCI)
 		dev_info->driver_name = dev->driver->pci_drv.name;
+	else
+		dev_info->driver_name = dev->data->name;
 }
 
 void
lib/librte_ether/rte_ethdev.h +7 -1
index 544afe0..a0a648f 100644
@@ -1553,7 +1553,6 @@ enum rte_eth_dev_type {
 	RTE_ETH_DEV_PCI,
 		/**< Physical function and Virtual function of PCI devices */
 	RTE_ETH_DEV_VIRTUAL,	/**< non hardware device */
-	RTE_ETH_DEV_MAX		/**< max value of this enum */
 };
 
 /**
@@ -1587,8 +1586,14 @@ struct rte_eth_dev {
 	struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
 	uint8_t attached; /**< Flag indicating the port is attached */
 	enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
+	uint32_t dev_flags; /**< Flags controlling handling of device. */
 };
 
+/** Device supports link state interrupt */
+#define RTE_ETH_DEV_INTR_LSC	0x0008
+/** Device  supports detaching capability */
+#define RTE_ETH_DEV_DETACHABLE	0x0010
+
 struct rte_eth_dev_sriov {
 	uint8_t active;               /**< SRIOV is active with 16, 32 or 64 pools */
 	uint8_t nb_q_per_pool;        /**< rx queue number per pool */
@@ -1639,6 +1644,7 @@ struct rte_eth_dev_data {
 		all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
 		dev_started : 1,   /**< Device state: STARTED(1) / STOPPED(0). */
 		lro         : 1;   /**< RX LRO is ON(1) / OFF(0) */
+	int numa_node;
 };
 
 /**
Signature · 1 line
1.9.1
#7 lore raw

RFC PATCH 2/6 librte_ether: handle RTE_ETH_DEV_INTR_LSC for vdevs

In reply to Bernard Iremonger
---
 lib/librte_ether/rte_ethdev.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
lib/librte_ether/rte_ethdev.c +11 -5
index 64e5a20..65d552a 100644
@@ -1153,12 +1153,18 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 * device supports it.
 	 */
 	if (dev_conf->intr_conf.lsc == 1) {
-		const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv;
+		if (dev->dev_type == RTE_ETH_DEV_PCI) {
+			const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv;
 
-		if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
-			PMD_DEBUG_TRACE("driver %s does not support lsc\n",
-					pci_drv->name);
-			return -EINVAL;
+			if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
+				PMD_DEBUG_TRACE("driver %s does not support lsc\n",
+						pci_drv->name);
+				return -EINVAL;
+			}
+		} else if (!(dev->dev_flags & RTE_ETH_DEV_INTR_LSC)) {
+				PMD_DEBUG_TRACE("driver %s does not support lsc\n",
+						dev->data->name);
+				return -EINVAL;
 		}
 	}
 
Signature · 1 line
1.9.1
#8 lore raw

RFC PATCH 3/6 null: remove pci device driver

In reply to Bernard Iremonger

remove rte_null_pmd and pci_dev.

---
 drivers/net/null/rte_eth_null.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)
drivers/net/null/rte_eth_null.c +7 -21
index e244595..7436dee 100644
@@ -2,6 +2,7 @@
  *   BSD LICENSE
  *
  *   Copyright (C) IGEL Co.,Ltd.
+ *   Copyright(c) 2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -340,13 +341,6 @@ eth_stats_reset(struct rte_eth_dev *dev)
 	}
 }
 
-static struct eth_driver rte_null_pmd = {
-	.pci_drv = {
-		.name = "rte_null_pmd",
-		.drv_flags = RTE_PCI_DRV_DETACHABLE,
-	},
-};
-
 static void
 eth_queue_release(void *q)
 {
@@ -386,7 +380,6 @@ eth_dev_null_create(const char *name,
 	const unsigned nb_rx_queues = 1;
 	const unsigned nb_tx_queues = 1;
 	struct rte_eth_dev_data *data = NULL;
-	struct rte_pci_device *pci_dev = NULL;
 	struct pmd_internals *internals = NULL;
 	struct rte_eth_dev *eth_dev = NULL;
 
@@ -403,10 +396,6 @@ eth_dev_null_create(const char *name,
 	if (data == NULL)
 		goto error;
 
-	pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, numa_node);
-	if (pci_dev == NULL)
-		goto error;
-
 	internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
 	if (internals == NULL)
 		goto error;
@@ -418,8 +407,7 @@ 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
+	 * - 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
@@ -431,8 +419,7 @@ eth_dev_null_create(const char *name,
 	internals->packet_copy = packet_copy;
 	internals->numa_node = numa_node;
 
-	pci_dev->numa_node = numa_node;
-
+	data->numa_node = numa_node;
 	data->dev_private = internals;
 	data->port_id = eth_dev->data->port_id;
 	data->nb_rx_queues = (uint16_t)nb_rx_queues;
@@ -443,8 +430,9 @@ 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;
+	eth_dev->pci_dev = NULL;
+	eth_dev->driver = NULL;
+	eth_dev->dev_flags = RTE_ETH_DEV_DETACHABLE;
 
 	/* finally assign rx and tx ops */
 	if (packet_copy) {
@@ -459,7 +447,6 @@ eth_dev_null_create(const char *name,
 
 error:
 	rte_free(data);
-	rte_free(pci_dev);
 	rte_free(internals);
 
 	return -1;
@@ -562,14 +549,13 @@ rte_pmd_null_devuninit(const char *name)
 	RTE_LOG(INFO, PMD, "Closing null ethdev on numa socket %u\n",
 			rte_socket_id());
 
-	/* reserve an ethdev entry */
+	/* find the ethdev entry */
 	eth_dev = rte_eth_dev_allocated(name);
 	if (eth_dev == NULL)
 		return -1;
 
 	rte_free(eth_dev->data->dev_private);
 	rte_free(eth_dev->data);
-	rte_free(eth_dev->pci_dev);
 
 	rte_eth_dev_release_port(eth_dev);
 
Signature · 1 line
1.9.1
#11 lore raw

RFC PATCH 4/6 ring: remove pci device driver

In reply to Bernard Iremonger

remove rte_ring_pmd and pci_dev.

---
 drivers/net/ring/rte_eth_ring.c | 35 ++++++-----------------------------
 1 file changed, 6 insertions(+), 29 deletions(-)
drivers/net/ring/rte_eth_ring.c +6 -29
index 6fd3d0a..111814e 100644
@@ -44,8 +44,6 @@
 #define ETH_RING_ACTION_CREATE		"CREATE"
 #define ETH_RING_ACTION_ATTACH		"ATTACH"
 
-static const char *ring_ethdev_driver_name = "Ring PMD";
-
 static const char *valid_arguments[] = {
 	ETH_RING_NUMA_NODE_ACTION_ARG,
 	NULL
@@ -252,15 +250,6 @@ static const struct eth_dev_ops ops = {
 	.mac_addr_add = eth_mac_addr_add,
 };
 
-static struct eth_driver rte_ring_pmd = {
-	.pci_drv = {
-		.name = "rte_ring_pmd",
-		.drv_flags = RTE_PCI_DRV_DETACHABLE,
-	},
-};
-
-static struct rte_pci_id id_table;
-
 int
 rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 		const unsigned nb_rx_queues,
@@ -269,7 +258,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 		const unsigned numa_node)
 {
 	struct rte_eth_dev_data *data = NULL;
-	struct rte_pci_device *pci_dev = NULL;
 	struct pmd_internals *internals = NULL;
 	struct rte_eth_dev *eth_dev = NULL;
 
@@ -291,10 +279,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	if (data == NULL)
 		goto error;
 
-	pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, numa_node);
-	if (pci_dev == NULL)
-		goto error;
-
 	internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
 	if (internals == NULL)
 		goto error;
@@ -304,11 +288,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
@@ -323,12 +306,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 		internals->tx_ring_queues[i].rng = tx_queues[i];
 	}
 
-	rte_ring_pmd.pci_drv.name = ring_ethdev_driver_name;
-	rte_ring_pmd.pci_drv.id_table = &id_table;
-
-	pci_dev->numa_node = numa_node;
-	pci_dev->driver = &rte_ring_pmd.pci_drv;
-
 	data->dev_private = internals;
 	data->port_id = eth_dev->data->port_id;
 	memmove(data->name, eth_dev->data->name, sizeof(data->name));
@@ -336,11 +313,13 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	data->nb_tx_queues = (uint16_t)nb_tx_queues;
 	data->dev_link = pmd_link;
 	data->mac_addrs = &internals->address;
+	data->numa_node = numa_node;
 
 	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->pci_dev = NULL;
+	eth_dev->dev_flags = RTE_ETH_DEV_DETACHABLE;
 	TAILQ_INIT(&(eth_dev->link_intr_cbs));
 
 	/* finally assign rx and tx ops */
@@ -351,7 +330,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 
 error:
 	rte_free(data);
-	rte_free(pci_dev);
 	rte_free(internals);
 
 	return -1;
@@ -617,7 +595,6 @@ rte_pmd_ring_devuninit(const char *name)
 	eth_dev_stop(eth_dev);
 	rte_free(eth_dev->data->dev_private);
 	rte_free(eth_dev->data);
-	rte_free(eth_dev->pci_dev);
 
 	rte_eth_dev_release_port(eth_dev);
 	return 0;
Signature · 1 line
1.9.1
#12 lore raw

RFC PATCH 5/6 bonding: remove pci device driver

In reply to Bernard Iremonger

remove pci_dev, pci_drv, rte_bond_pmd and pci_id_table. handle numa_node for vdevs
handle RTE_ETH_DEV_INTR_LSC for vdevs

---
 drivers/net/bonding/rte_eth_bond_alb.c |  2 +-
 drivers/net/bonding/rte_eth_bond_api.c | 51 ++++++++--------------------------
 drivers/net/bonding/rte_eth_bond_pmd.c | 22 ++++++++++-----
 lib/librte_ether/rte_ethdev.h          |  2 ++
 4 files changed, 30 insertions(+), 47 deletions(-)
drivers/net/bonding/rte_eth_bond_alb.c +1 -1
index 6df318e..3157543 100644
@@ -65,7 +65,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev)
 
 	uint16_t data_size;
 	char mem_name[RTE_ETH_NAME_MAX_LEN];
-	int socket_id = bond_dev->pci_dev->numa_node;
+	int socket_id = bond_dev->data->numa_node;
 
 	/* Fill hash table with initial values */
 	memset(hash_table, 0, sizeof(struct client_data) * ALB_HASH_TABLE_SIZE);
drivers/net/bonding/rte_eth_bond_api.c +12 -39

109 lines not on this page · raw message

drivers/net/bonding/rte_eth_bond_pmd.c +15 -7
index 5cc6372..387d370 100644
@@ -1307,8 +1307,12 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
 	rte_eth_dev_stop(slave_eth_dev->data->port_id);
 
 	/* Enable interrupts on slave device if supported */
-	if (slave_eth_dev->driver->pci_drv.drv_flags & RTE_PCI_DRV_INTR_LSC)
-		slave_eth_dev->data->dev_conf.intr_conf.lsc = 1;
+	if (slave_eth_dev->dev_type == RTE_ETH_DEV_PCI) {
+		if (slave_eth_dev->driver->pci_drv.drv_flags & RTE_PCI_DRV_INTR_LSC)
+			slave_eth_dev->data->dev_conf.intr_conf.lsc = 1;
+	} else if (slave_eth_dev->dev_flags & RTE_ETH_DEV_INTR_LSC)
+			slave_eth_dev->data->dev_conf.intr_conf.lsc = 1;
+
 
 	/* Configure device */
 	errval = rte_eth_dev_configure(slave_eth_dev->data->port_id,
@@ -1362,8 +1366,12 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
 	}
 
 	/* If lsc interrupt is set, check initial slave's link status */
-	if (slave_eth_dev->driver->pci_drv.drv_flags & RTE_PCI_DRV_INTR_LSC)
-		bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
+	if (slave_eth_dev->dev_type == RTE_ETH_DEV_PCI) {
+		if (slave_eth_dev->driver->pci_drv.drv_flags & RTE_PCI_DRV_INTR_LSC)
+			bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
+				RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id);
+	} else if (slave_eth_dev->dev_flags & RTE_ETH_DEV_INTR_LSC)
+			bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
 				RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id);
 
 	return 0;
@@ -1592,7 +1600,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_tx_queues = (uint16_t)512;
 
 	dev_info->min_rx_bufsize = 0;
-	dev_info->pci_dev = dev->pci_dev;
+	dev_info->pci_dev = NULL;
 
 	dev_info->rx_offload_capa = internals->rx_offload_capa;
 	dev_info->tx_offload_capa = internals->tx_offload_capa;
@@ -1605,7 +1613,7 @@ bond_ethdev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 {
 	struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)
 			rte_zmalloc_socket(NULL, sizeof(struct bond_rx_queue),
-					0, dev->pci_dev->numa_node);
+					0, dev->data->numa_node);
 	if (bd_rx_q == NULL)
 		return -1;
 
@@ -1629,7 +1637,7 @@ bond_ethdev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 {
 	struct bond_tx_queue *bd_tx_q  = (struct bond_tx_queue *)
 			rte_zmalloc_socket(NULL, sizeof(struct bond_tx_queue),
-					0, dev->pci_dev->numa_node);
+					0, dev->data->numa_node);
 
 	if (bd_tx_q == NULL)
 		return -1;
lib/librte_ether/rte_ethdev.h +2 -0
index a0a648f..6804bd3 100644
@@ -1593,6 +1593,8 @@ struct rte_eth_dev {
 #define RTE_ETH_DEV_INTR_LSC	0x0008
 /** Device  supports detaching capability */
 #define RTE_ETH_DEV_DETACHABLE	0x0010
+/** Device  is a bonded device */
+#define RTE_ETH_DEV_BONDED	0x0020
 
 struct rte_eth_dev_sriov {
 	uint8_t active;               /**< SRIOV is active with 16, 32 or 64 pools */
Signature · 1 line
1.9.1
#16 lore raw

RFC PATCH 6/6 pcap: remove pci device driver

In reply to Bernard Iremonger

remove rte_pcap_pmd and pci_dev.

---
 drivers/net/pcap/rte_eth_pcap.c | 31 +++++++++----------------------
 1 file changed, 9 insertions(+), 22 deletions(-)
drivers/net/pcap/rte_eth_pcap.c +9 -22
index f2e4634..1bd0a22 100644
@@ -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.
  *
@@ -617,13 +617,6 @@ static const struct eth_dev_ops ops = {
 	.stats_reset = eth_stats_reset,
 };
 
-static struct eth_driver rte_pcap_pmd = {
-	.pci_drv = {
-		.name = "rte_pcap_pmd",
-		.drv_flags = RTE_PCI_DRV_DETACHABLE,
-	},
-};
-
 /*
  * Function handler that opens the pcap file for reading a stores a
  * reference of it for use it later on.
@@ -806,7 +799,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
 		struct rte_kvargs *kvlist)
 {
 	struct rte_eth_dev_data *data = NULL;
-	struct rte_pci_device *pci_dev = NULL;
+
 	unsigned k_idx;
 	struct rte_kvargs_pair *pair = NULL;
 
@@ -819,17 +812,13 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
 	RTE_LOG(INFO, PMD,
 			"Creating pcap-backed ethdev on numa socket %u\n", numa_node);
 
-	/* now do all data allocation - for eth_dev structure, dummy pci driver
+	/* now do all data allocation - for eth_dev structure
 	 * and internal (private) data
 	 */
 	data = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);
 	if (data == NULL)
 		goto error;
 
-	pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, numa_node);
-	if (pci_dev == NULL)
-		goto error;
-
 	*internals = rte_zmalloc_socket(name, sizeof(**internals), 0, numa_node);
 	if (*internals == NULL)
 		goto error;
@@ -845,8 +834,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_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
@@ -860,8 +849,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
 	else
 		(*internals)->if_index = if_nametoindex(pair->value);
 
-	pci_dev->numa_node = numa_node;
-
+	data->numa_node = numa_node;
 	data->dev_private = *internals;
 	data->port_id = (*eth_dev)->data->port_id;
 	snprintf(data->name, sizeof(data->name), "%s", (*eth_dev)->data->name);
@@ -874,14 +862,14 @@ 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)->pci_dev = NULL;
+	(*eth_dev)->driver = NULL;
+	(*eth_dev)->dev_flags = RTE_ETH_DEV_DETACHABLE;
 
 	return 0;
 
 error:
 	rte_free(data);
-	rte_free(pci_dev);
 	rte_free(*internals);
 
 	return -1;
@@ -1096,7 +1084,6 @@ rte_pmd_pcap_devuninit(const char *name)
 
 	rte_free(eth_dev->data->dev_private);
 	rte_free(eth_dev->data);
-	rte_free(eth_dev->pci_dev);
 
 	rte_eth_dev_release_port(eth_dev);
 
Signature · 1 line
1.9.1
#17 lore raw
In reply to Bernard Iremonger
Quoted 7 lines · Bernard Iremonger

There is a dummy pci driver in the vdev PMD's at present.
This RFC proposes to remove the pci driver from the vdev PMD's.
Changes have been made to librte_ether to handle vdevs which do not have a pci driver.

The pdev PMD's should work as before with the changes to librte_ether
The vdev PMD's which still have a pci driver should work as before with the librte_ether changes.

Quoted 6 lines

The following vdev PMD's have had the pci driver removed

bonding PMD
null PMD
pcap PMD
ring PMD

Any reason there is no patch for the af_packet driver?

John

Quoted 23 lines

Bernard Iremonger (6):
librte_ether: add fields from rte_pci_driver to rte_eth_dev and
rte_eth_dev_data.
librte_ether: handle RTE_ETH_DEV_INTR_LSC for vdevs
null: remove pci device driver
ring: remove pci device driver
bonding: remove pci device driver
pcap: remove pci device driver

 drivers/net/bonding/rte_eth_bond_alb.c |  2 +-
 drivers/net/bonding/rte_eth_bond_api.c | 49 ++++++++--------------------------
 drivers/net/bonding/rte_eth_bond_pmd.c | 22 ++++++++++-----
 drivers/net/null/rte_eth_null.c        | 28 +++++--------------
 drivers/net/pcap/rte_eth_pcap.c        | 31 +++++++--------------
 drivers/net/ring/rte_eth_ring.c        | 35 +++++-------------------
 lib/librte_ether/rte_ethdev.c          | 34 ++++++++++++++++-------
 lib/librte_ether/rte_ethdev.h          | 10 ++++++-
 8 files changed, 83 insertions(+), 128 deletions(-)
Signature · 1 line
1.9.1
Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#13 lore raw

Re: [RFC PATCH 5/6] bonding: remove pci device driver

In reply to Bernard Iremonger
Quoted 5 lines · On Thu, 27 Aug 2015 16:40:40 +0100 Bernard Iremonger…

remove pci_dev, pci_drv, rte_bond_pmd and pci_id_table. handle numa_node for vdevs
handle RTE_ETH_DEV_INTR_LSC for vdevs

Since Hyper-V driver does not use pci, we just went through exercise of putting necessary API calls in rte_ethdev and having bonding use that.

#18 lore raw
In reply to John W. Linville

Hi John,

Quoted 19 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Thursday, August 27, 2015 6:44 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Quoted 3 lines · Bernard Iremonger

There is a dummy pci driver in the vdev PMD's at present. This RFC proposes to remove the pci driver from the vdev PMD's. Changes have been made to librte_ether to handle vdevs which do not

have a pci driver.

Quoted 3 lines

The pdev PMD's should work as before with the changes to librte_ether The vdev PMD's which still have a pci driver should work as before with the

librte_ether changes.

Quoted 3 lines

The following vdev PMD's have had the pci driver removed

Quoted 8 lines
Quoted 4 lines

bonding PMD
null PMD
pcap PMD
ring PMD

Any reason there is no patch for the af_packet driver?

John

I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches for their drivers.

Regards,

Bernard.

<snip>

#14 lore raw

Re: [RFC PATCH 5/6] bonding: remove pci device driver

In reply to Stephen Hemminger

Hi Stephen,

Quoted 10 lines

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, August 27, 2015 6:48 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 5/6] bonding: remove pci device driver

On Thu, 27 Aug 2015 16:40:40 +0100
Bernard Iremonger <[email protected]> wrote:

Quoted 8 lines
Quoted 5 lines

remove pci_dev, pci_drv, rte_bond_pmd and pci_id_table. handle numa_node for vdevs
handle RTE_ETH_DEV_INTR_LSC for vdevs

Since Hyper-V driver does not use pci, we just went through exercise of putting necessary API calls in rte_ethdev and having bonding use that.

Have your ethdev patches been applied yet, if not could you send me the link in patchwork.

Regards,

Bernard.

#19 lore raw
In reply to Iremonger, Bernard
Quoted 26 lines · Bernard

Hi John,

Quoted 24 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Thursday, August 27, 2015 6:44 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Quoted 3 lines · Bernard Iremonger

There is a dummy pci driver in the vdev PMD's at present. This RFC proposes to remove the pci driver from the vdev PMD's. Changes have been made to librte_ether to handle vdevs which do not

have a pci driver.

Quoted 3 lines

The pdev PMD's should work as before with the changes to librte_ether The vdev PMD's which still have a pci driver should work as before with the

librte_ether changes.

Quoted 7 lines

The following vdev PMD's have had the pci driver removed

bonding PMD
null PMD
pcap PMD
ring PMD

Quoted 7 lines
Quoted 3 lines

Any reason there is no patch for the af_packet driver?

John

I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches for their drivers.

I disagree. Its ok given that this is an RFC patch I suppose, but if you intend to actually propose this change for review, you need to modify all affected drivers in a single commit. Asking individual driver maintainers to submit patches to not access a struct element that is removed in a separate patch will by definition cause FTBFS errors. All references to the structure member being removed must also be eliminated in the same or a prior commit, preferably the former.

Neil

Quoted 7 lines

Regards,

Bernard.

<snip>

#23 lore raw
In reply to Iremonger, Bernard
Quoted 26 lines · Bernard

Hi John,

Quoted 24 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Thursday, August 27, 2015 6:44 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Quoted 3 lines · Bernard Iremonger

There is a dummy pci driver in the vdev PMD's at present. This RFC proposes to remove the pci driver from the vdev PMD's. Changes have been made to librte_ether to handle vdevs which do not

have a pci driver.

Quoted 3 lines

The pdev PMD's should work as before with the changes to librte_ether The vdev PMD's which still have a pci driver should work as before with the

librte_ether changes.

Quoted 7 lines

The following vdev PMD's have had the pci driver removed

bonding PMD
null PMD
pcap PMD
ring PMD

Quoted 6 lines
Quoted 3 lines

Any reason there is no patch for the af_packet driver?

John

I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches for their drivers.

What constitutes an "Intel vdev PMD"? I thought these were all part of the DPDK project? It seems odd to me for you to pick and choose like this.

What is the overall purpose of this RFC? What benefit accrues to those vdev PMDs that implement this change? What penalty is imposed on those that do not change?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#20 lore raw
In reply to Neil Horman
Quoted 37 lines · dev on behalf of Neil Horman
Quoted 28 lines · Bernard

Hi John,

Quoted 7 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Thursday, August 27, 2015 6:44 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Quoted 7 lines
Quoted 3 lines · Bernard Iremonger

There is a dummy pci driver in the vdev PMD's at present. This RFC proposes to remove the pci driver from the vdev PMD's. Changes have been made to librte_ether to handle vdevs which do not

have a pci driver.

Quoted 2 lines

The pdev PMD's should work as before with the changes to

librte_ether

Quoted 1 line
Quoted 1 line

The vdev PMD's which still have a pci driver should work as before

with the

Quoted 9 lines

librte_ether changes.

Quoted 7 lines

The following vdev PMD's have had the pci driver removed

bonding PMD
null PMD
pcap PMD
ring PMD

Quoted 8 lines
Quoted 3 lines

Any reason there is no patch for the af_packet driver?

John

I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches for their drivers.

Quoted 13 lines

I disagree. Its ok given that this is an RFC patch I suppose, but if you intend
to actually propose this change for review, you need to modify all affected
drivers in a single commit. Asking individual driver maintainers to submit
patches to not access a struct element that is removed in a separate patch will
by definition cause FTBFS errors. All references to the structure member being
removed must also be eliminated in the same or a prior commit, preferably the
former.

+1, if you introduce a chance that effects other places in the code/drivers then you must also make the changes to those parts as well. It really should not be an option IMO.

Quoted 11 lines

Neil

Quoted 7 lines

Regards,

Bernard.

<snip>

‹
Regards,
++Keith
Intel Corporation

#24 lore raw
In reply to John W. Linville

Hi John,

Quoted 38 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Friday, August 28, 2015 6:52 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Quoted 30 lines · Bernard

Hi John,

Quoted 28 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Thursday, August 27, 2015 6:44 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Quoted 4 lines · Bernard Iremonger

There is a dummy pci driver in the vdev PMD's at present. This RFC proposes to remove the pci driver from the vdev PMD's. Changes have been made to librte_ether to handle vdevs which do not

have a pci driver.

Quoted 4 lines

The pdev PMD's should work as before with the changes to librte_ether The vdev PMD's which still have a pci driver should work as before with the

librte_ether changes.

Quoted 7 lines

The following vdev PMD's have had the pci driver removed

bonding PMD
null PMD
pcap PMD
ring PMD

Any reason there is no patch for the af_packet driver?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

John

I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches

for their drivers.

What constitutes an "Intel vdev PMD"? I thought these were all part of the DPDK project? It seems odd to me for you to pick and choose like this.

I should probably have written vdev PMD's contributed by Intel.
I am not familiar with the other vdev PMD's and thought it best that they should be modified by their owners/maintainers if required.

Quoted 2 lines

What is the overall purpose of this RFC?

The purpose of this RFC is to remove the need for a PCI device driver from Vdev's that that do not use a PCI driver. Removing the PCI driver is implemented in the ethdev changes. I have modified some of the Vdev's to verify that the ethdev changes work.

Quoted 3 lines

What benefit accrues to those vdev
PMDs that implement this change? What penalty is imposed on those that do not change?

6Wind have decided that only cleanup patches will be allowed in future for Vdevs that have a dummy PCI driver. Any change in functionality for these Vdevs will not be allowed. Please see email below from 6Wind

http://dpdk.org/ml/archives/dev/2015-July/022107.html

Quoted 5 lines

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

Regards,

Bernard.

#21 lore raw
In reply to Wiles, Keith

Hi Keith, Neil,

<snip>

Quoted 42 lines
Quoted 29 lines
Quoted 21 lines
Quoted 8 lines · Bernard Iremonger
Quoted 4 lines

There is a dummy pci driver in the vdev PMD's at present. This RFC proposes to remove the pci driver from the vdev PMD's. Changes have been made to librte_ether to handle vdevs which do not

have a pci driver.

Quoted 2 lines

The pdev PMD's should work as before with the changes to

librte_ether

Quoted 2 lines
Quoted 2 lines

The vdev PMD's which still have a pci driver should work as before

with the

Quoted 9 lines

librte_ether changes.

Quoted 7 lines

The following vdev PMD's have had the pci driver removed

bonding PMD
null PMD
pcap PMD
ring PMD

Quoted 8 lines
Quoted 3 lines

Any reason there is no patch for the af_packet driver?

John

I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches for their drivers.

Quoted 7 lines

I disagree. Its ok given that this is an RFC patch I suppose, but if you intend to actually propose this change for review, you need to modify all affected drivers in a single commit. Asking individual driver maintainers to submit patches to not access a struct element that is removed in a separate patch will by definition cause FTBFS errors. All references to the structure member being removed must also be eliminated in the same or a prior commit, preferably the former.

+1, if you introduce a chance that effects other places in the code/drivers then you must also make the changes to those parts as well. It really should not be an option IMO.

Quoted 2 lines

Neil

< snip >

Quoted 5 lines

Regards,
++Keith
Intel Corporation

Firstly no struct element has been removed from struct rte_eth_dev {} in the eth_dev patch.
A dev_flags element has been added to struct rte_eth_dev{}
A numa_node element has been added to struct rte_eth_dev_data{}.
Unmodified VDEV's and PDEV's will not be aware of these new elements and will be unaffected by the eth_dev changes.

Regards,

Bernard.

#22 lore raw
Quoted 54 lines · Bernard

Hi Keith, Neil,

<snip>

Quoted 42 lines
Quoted 29 lines
Quoted 21 lines
Quoted 8 lines · Bernard Iremonger
Quoted 4 lines

There is a dummy pci driver in the vdev PMD's at present. This RFC proposes to remove the pci driver from the vdev PMD's. Changes have been made to librte_ether to handle vdevs which do not

have a pci driver.

Quoted 2 lines

The pdev PMD's should work as before with the changes to

librte_ether

Quoted 2 lines
Quoted 2 lines

The vdev PMD's which still have a pci driver should work as before

with the

Quoted 9 lines

librte_ether changes.

Quoted 7 lines

The following vdev PMD's have had the pci driver removed

bonding PMD
null PMD
pcap PMD
ring PMD

Quoted 8 lines
Quoted 3 lines

Any reason there is no patch for the af_packet driver?

John

I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches for their drivers.

Quoted 7 lines

I disagree. Its ok given that this is an RFC patch I suppose, but if you intend to actually propose this change for review, you need to modify all affected drivers in a single commit. Asking individual driver maintainers to submit patches to not access a struct element that is removed in a separate patch will by definition cause FTBFS errors. All references to the structure member being removed must also be eliminated in the same or a prior commit, preferably the former.

+1, if you introduce a chance that effects other places in the code/drivers then you must also make the changes to those parts as well. It really should not be an option IMO.

Quoted 2 lines

Neil

< snip >

Quoted 5 lines

Regards,
++Keith
Intel Corporation

Quoted 5 lines

Firstly no struct element has been removed from struct rte_eth_dev {} in the eth_dev patch.
A dev_flags element has been added to struct rte_eth_dev{}
A numa_node element has been added to struct rte_eth_dev_data{}.
Unmodified VDEV's and PDEV's will not be aware of these new elements and will be unaffected by the eth_dev changes.

Then NAK to the entire series, as it doesn't address this:
http://dpdk.org/ml/archives/dev/2015-July/022107.html

If that was your intent. The desire that Thomas had was to refactor the bus code so that a drivers bus type was independent of the devices it registered. This really just makes filling out the pci driver struct optional (which likely becomes very messy down the road). I think what's being sought is something like this:

1) remove the pci driver field from the ethdev struct, perhaps replacing it with a union pointer to all the bus type structures supported (though I don't think thats required)

2) modify the driver init routine so that each driver module can register with whatever bus type it supports.

3) add a per-bus-instance init routine (akin to the probe routine in the linux and bsd driver models) called once for each instance of that device type found on a given bus. This routine allocates and registers an ethernet device (optionally associating the bus type with the device using the pointer suggested in (1)

There are other ways to do this of course, this is just a suggestion. The point being, the goal is to remove the explicit relationship of a ethdev to a pci device, as that relationship is clearly not guaranteed. Doing so allows us to remove the need to determine bus type at init time, which would be a big benefit.

Regards
Neil

Quoted 8 lines

Regards,

Bernard.

#25 lore raw
In reply to Iremonger, Bernard
Quoted 44 lines · Bernard

Hi John,

Quoted 42 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Friday, August 28, 2015 6:52 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Quoted 34 lines · Bernard

Hi John,

Quoted 21 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Thursday, August 27, 2015 6:44 PM
To: Iremonger, Bernard
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Quoted 4 lines · Bernard Iremonger

There is a dummy pci driver in the vdev PMD's at present. This RFC proposes to remove the pci driver from the vdev PMD's. Changes have been made to librte_ether to handle vdevs which do not

have a pci driver.

Quoted 4 lines

The pdev PMD's should work as before with the changes to librte_ether The vdev PMD's which still have a pci driver should work as before with the

librte_ether changes.

Quoted 3 lines

The following vdev PMD's have had the pci driver removed

Quoted 8 lines
Quoted 4 lines

bonding PMD
null PMD
pcap PMD
ring PMD

Any reason there is no patch for the af_packet driver?

John

I have just modified the Intel vdev PMD's.
It would be best if the owners of the non Intel vdev's submitted patches

Quoted 8 lines
Quoted 4 lines

for their drivers.

What constitutes an "Intel vdev PMD"? I thought these were all part of the DPDK project? It seems odd to me for you to pick and choose like this.

I should probably have written vdev PMD's contributed by Intel.
I am not familiar with the other vdev PMD's and thought it best that they should be modified by their owners/maintainers if required.

These are fairly rote changes, familiarity isn't really needed here, just a willingness to do some minor testing. The right approach is to make the changes to all the drivers, and cc their authors on the patch set so that they can review it.

Quoted 5 lines
Quoted 2 lines

What is the overall purpose of this RFC?

The purpose of this RFC is to remove the need for a PCI device driver from Vdev's that that do not use a PCI driver. Removing the PCI driver is implemented in the ethdev changes. I have modified some of the Vdev's to verify that the ethdev changes work.

You didn't remove the relationship of the ethdev to the pci driver though, which is really the problem, An ethdev may reside on any number of bus types (pci/usb/vmbus/virt/none). This patch series just papers over the fact that an ethdev is implicitly a pci device by making the assignment of its pci_dev pointer optional. Whats really needed is a way to associate an ethdev with an arbitrary bus

Quoted 9 lines
Quoted 3 lines

What benefit accrues to those vdev
PMDs that implement this change? What penalty is imposed on those that do not change?

6Wind have decided that only cleanup patches will be allowed in future for Vdevs that have a dummy PCI driver. Any change in functionality for these Vdevs will not be allowed. Please see email below from 6Wind

http://dpdk.org/ml/archives/dev/2015-July/022107.html

I think you misread that. I think all Thomas is asking for (correct me if I'm wrong Thomas), is for someone to start refactoring the ethdev registration code so that we can have a single init path without the need for wierd typing and differentiation at init time. He's not going to stop accepting bug fixes for existing drivers just because it uses the existing initalization infrastructure. I would even go so far as to say new drivers will be accepted for as long as the existing init path exists as it does. We just need to start thinking about how to make bus registration independent of ethernet device registration, and while your patch series sort of eliminates some of that, its really not a proper refactoring of the sort I think Thomas is asking for

Regards
Neil

Quoted 12 lines
Quoted 5 lines

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

Regards,

Bernard.

#2 lore raw

Re: [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

In reply to Bernard Iremonger

2015-08-27 16:40, Bernard Iremonger:

Quoted 6 lines

add dev_flags to rte_eth_dev, add macros for dev_flags. add numa_node to rte_eth_dev_data.
use dev_type to distinguish between vdev's and pdev's. remove unused RTE_ETH_DEV_MAX.

[...]

lib/librte_ether/rte_ethdev.c rte_eth_dev_socket_id(uint8_t port_id) · line 431

Quoted 9 lines
lib/librte_ether/rte_ethdev.c +4 -1
@@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id)
 {
 	if (!rte_eth_dev_is_valid_port(port_id))
 		return -1;
-	return rte_eth_devices[port_id].pci_dev->numa_node;
+	if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
+		return rte_eth_devices[port_id].pci_dev->numa_node;
+	else
+		return rte_eth_devices[port_id].data->numa_node;

Clearly not the way to go.
We should remove the special cases (PCI, PDEV, VDEV) instead of adding more checks.

#9 lore raw

Re: [RFC PATCH 3/6] null: remove pci device driver

In reply to Bernard Iremonger

2015-08-27 16:40, Bernard Iremonger:

Quoted 3 lines

remove rte_null_pmd and pci_dev.

[...]

drivers/net/null/rte_eth_null.c eth_dev_null_create(const char *name, · line 433

Quoted 3 lines
drivers/net/null/rte_eth_null.c +1 -2
-	eth_dev->pci_dev = pci_dev;
-	eth_dev->driver = &rte_null_pmd;
+	eth_dev->pci_dev = NULL;

Simple comment:
Why a driver should reset a PCI field if it does not care about PCI?

#26 lore raw
In reply to Neil Horman

2015-08-31 08:59, Neil Horman:

Quoted 6 lines · Bernard
Quoted 5 lines

The purpose of this RFC is to remove the need for a PCI device driver from Vdev's that that do not use a PCI driver. Removing the PCI driver is implemented in the ethdev changes. I have modified some of the Vdev's to verify that the ethdev changes work.

Quoted 12 lines

You didn't remove the relationship of the ethdev to the pci driver though, which is really the problem, An ethdev may reside on any number of bus types (pci/usb/vmbus/virt/none). This patch series just papers over the fact that an ethdev is implicitly a pci device by making the assignment of its pci_dev pointer optional. Whats really needed is a way to associate an ethdev with an arbitrary bus

Quoted 5 lines
Quoted 3 lines

What benefit accrues to those vdev
PMDs that implement this change? What penalty is imposed on those that do not change?

6Wind have decided that only cleanup patches will be allowed in future

Not a 6WIND decision. This is a community project.
I gave my opinion regarding maintenance of the code.
I may be wrong but after discussions with others and recent comments, it seems well justified.

Quoted 11 lines
Quoted 6 lines

for Vdevs that have a dummy PCI driver. Any change in functionality for these Vdevs will not be allowed.
Please see email below from 6Wind

http://dpdk.org/ml/archives/dev/2015-July/022107.html

I think you misread that. I think all Thomas is asking for (correct me if I'm wrong Thomas), is for someone to start refactoring the ethdev registration code so that we can have a single init path without the need for wierd typing and differentiation at init time. He's not going to stop accepting bug fixes for existing drivers just because it uses the existing initalization infrastructure.

Yes. Such cleanup can be enforced by rejecting new features on top of these workarounds. But driver fixes will be accepted.

Quoted 5 lines

I would even go so far as to say new drivers will be accepted for as long as the existing init path exists as it does. We just need to start thinking about how to make bus registration independent of ethernet device registration, and while your patch series sort of eliminates some of that, its really not a proper refactoring of the sort I think Thomas is asking for

Yes
The sooner will be the better :)
Thanks for taking care of this issue.

#10 lore raw

Re: [RFC PATCH 3/6] null: remove pci device driver

In reply to Thomas Monjalon

Hi Thomas,

Quoted 10 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, August 31, 2015 3:11 PM
To: Iremonger, Bernard
Cc: [email protected]; [email protected]
Subject: Re: [RFC PATCH 3/6] null: remove pci device driver

2015-08-27 16:40, Bernard Iremonger:

Quoted 2 lines

remove rte_null_pmd and pci_dev.

Quoted 8 lines
Quoted 1 line

[...]

drivers/net/null/rte_eth_null.c eth_dev_null_create(const char *name, · line 433

Quoted 3 lines
drivers/net/null/rte_eth_null.c +1 -2
-	eth_dev->pci_dev = pci_dev;
-	eth_dev->driver = &rte_null_pmd;
+	eth_dev->pci_dev = NULL;

Simple comment:
Why a driver should reset a PCI field if it does not care about PCI?

Setting the pci_dev field to NULL, was needed in an earlier internal revision of the patch set. This line is no longer needed and can be removed.
The dev_type field of struct rte_eth_dev{} is now used instead in rte_ethdev.c.

Regards,

Bernard.

#3 lore raw

Re: [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

In reply to Thomas Monjalon

Hi THomas,

<snip>

Quoted 4 lines
Quoted 4 lines
lib/librte_ether/rte_ethdev.c +0 -1
@@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id)  {
 	if (!rte_eth_dev_is_valid_port(port_id))
 		return -1;
-	return rte_eth_devices[port_id].pci_dev->numa_node;
Quoted 8 lines

lib/librte_ether/rte_ethdev.c rte_eth_dev_socket_id(uint8_t port_id) · line 431

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +4 -0
+	if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
+		return rte_eth_devices[port_id].pci_dev->numa_node;
+	else
+		return rte_eth_devices[port_id].data->numa_node;

Clearly not the way to go.
We should remove the special cases (PCI, PDEV, VDEV) instead of adding more checks.

The dev_type field is not new, just using it now to distinguish between PCI and non PCI devices.

I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in struct rte_eth_dev{}, These flags are independent of the driver type (PCI or non PCI).
Do you have view on this new dev_flags field and macros?

Regards,

Bernard.

#4 lore raw

Re: [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

Quoted 19 lines · Bernard

Hi THomas,

<snip>

Quoted 4 lines
Quoted 4 lines
lib/librte_ether/rte_ethdev.c +0 -1
@@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id)  {
 	if (!rte_eth_dev_is_valid_port(port_id))
 		return -1;
-	return rte_eth_devices[port_id].pci_dev->numa_node;
Quoted 8 lines

lib/librte_ether/rte_ethdev.c rte_eth_dev_socket_id(uint8_t port_id) · line 431

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +4 -0
+	if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
+		return rte_eth_devices[port_id].pci_dev->numa_node;
+	else
+		return rte_eth_devices[port_id].data->numa_node;

Clearly not the way to go.
We should remove the special cases (PCI, PDEV, VDEV) instead of adding more checks.

The dev_type field is not new, just using it now to distinguish between PCI and non PCI devices.

Quoted 8 lines

I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in struct rte_eth_dev{}, These flags are independent of the driver type (PCI or non PCI).
Do you have view on this new dev_flags field and macros?

Regards,

Bernard.

Just to give my 2c.

The branch in the snippet above should not exist. Each PMD should set the data numa_node and the flags fields appropriately at initialization, either directly or by copying in the relevant data from the interface specific structure e.g. pci. The ethdev should never need to check the device type here, it should always just read data->numa_node.

/Bruce

#5 lore raw

Re: [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

In reply to Iremonger, Bernard
Quoted 26 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Iremonger, Bernard
Sent: Tuesday, September 01, 2015 12:39 PM
To: Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

Hi THomas,

<snip>

Quoted 4 lines
Quoted 4 lines
lib/librte_ether/rte_ethdev.c +0 -1
@@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id)  {
 	if (!rte_eth_dev_is_valid_port(port_id))
 		return -1;
-	return rte_eth_devices[port_id].pci_dev->numa_node;
Quoted 8 lines

lib/librte_ether/rte_ethdev.c rte_eth_dev_socket_id(uint8_t port_id) · line 431

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +4 -0
+	if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
+		return rte_eth_devices[port_id].pci_dev->numa_node;
+	else
+		return rte_eth_devices[port_id].data->numa_node;

Clearly not the way to go.
We should remove the special cases (PCI, PDEV, VDEV) instead of adding more checks.

Quoted 5 lines

The dev_type field is not new, just using it now to distinguish between PCI and non PCI devices.

I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in struct rte_eth_dev{}, These flags are independent of the driver type (PCI or non PCI).
Do you have view on this new dev_flags field and macros?

What looks strange here to me, I that we now we duplicate some fields here?
Let say for PCI devices numa_node would be precent in pci_dev and in data, right?
If there are some fields that are common for all device types (PCI, VDEV, etc) why not to create some unified structure for them that would be used by all device types and remove subsequent fields from pci_dev? Or alternatively create a union of structs (one struct per device type)?
Then, as was pointed before, we wouldn't these branches by device_type at all.
Konstantin

Quoted 6 lines

Regards,

Bernard.

#6 lore raw

Re: [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

Quoted 46 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ananyev, Konstantin
Sent: Tuesday, September 1, 2015 1:37 PM
To: Iremonger, Bernard; Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Iremonger, Bernard
Sent: Tuesday, September 01, 2015 12:39 PM
To: Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from

rte_pci_driver to rte_eth_dev and rte_eth_dev_data.

Quoted 18 lines

Hi THomas,

<snip>

Quoted 4 lines
Quoted 4 lines
lib/librte_ether/rte_ethdev.c +0 -1
@@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id)  {
 	if (!rte_eth_dev_is_valid_port(port_id))
 		return -1;
-	return rte_eth_devices[port_id].pci_dev->numa_node;
Quoted 8 lines

lib/librte_ether/rte_ethdev.c rte_eth_dev_socket_id(uint8_t port_id) · line 431

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +4 -0
+	if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI)
+		return rte_eth_devices[port_id].pci_dev->numa_node;
+	else
+		return rte_eth_devices[port_id].data->numa_node;

Clearly not the way to go.
We should remove the special cases (PCI, PDEV, VDEV) instead of adding more checks.

Quoted 1 line

The dev_type field is not new, just using it now to distinguish between

PCI and non PCI devices.

Quoted 3 lines

I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in struct rte_eth_dev{}, These flags are independent of the driver type

(PCI or non PCI).

Quoted 1 line

Do you have view on this new dev_flags field and macros?

Quoted 12 lines

What looks strange here to me, I that we now we duplicate some fields here?
Let say for PCI devices numa_node would be precent in pci_dev and in data, right?
If there are some fields that are common for all device types (PCI, VDEV, etc) why not to create some unified structure for them that would be used by all device types and remove subsequent fields from pci_dev? Or alternatively create a union of structs (one struct per device type)? Then, as was pointed before, we wouldn't these branches by device_type at all.
Konstantin

I wouldn't worry so much about the duplicated data, so long as the ethdev APIs only have to look for the data in a single place when necessary. [Some data may be naturally present in the pci_dev structure, for instance, and then be copied by the driver into the common ethdev structure. If however, that copy and duplication can be avoided, great!]

/Bruce

#27 lore raw
In reply to Thomas Monjalon

Hi Neil, Thomas,

<snip>

Quoted 3 lines
Quoted 3 lines

You didn't remove the relationship of the ethdev to the pci driver though, which is really the problem, An ethdev may reside on any number of bus types (pci/usb/vmbus/virt/none).

<snip>

Quoted 1 line
Quoted 1 line

Whats really needed is a way to associate an ethdev with an arbitrary bus

<snip>

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Please see email below from 6Wind

http://dpdk.org/ml/archives/dev/2015-July/022107.html

I think you misread that. I think all Thomas is asking for (correct me if I'm wrong Thomas), is for someone to start refactoring the ethdev registration code so that we can have a single init path without the need for wierd typing and differentiation at init time.

<snip >

Quoted 5 lines
Quoted 5 lines

We just need to
start thinking about how to make bus registration independent of ethernet device registration, and while your patch series sort of eliminates some of that, its really not a proper refactoring of the sort I think Thomas is asking for.

I am just trying to distill what the actual requirement is from the above discussion.

(1) Remove relationship of the ethdev to the pci driver.
(2) Refactor ethdev registration code so that there is a single init path.
(3) Make bus registration independent of ethdev registration.
(4) Change all (17) PMD's to use the modified structures.

The rte_eal_driver_registration() code is in librte_eal, untouched as yet by this patch set.

The rte_eth_driver_registration() code is in librte_ether.
Should the pci fields be removed from the struct rte_eth_dev{} and struct eth_driver{}, and put somewhere else or replaced with a union of bus types and drivers?

Regards,

Bernard.

#28 lore raw
Quoted 31 lines · Bernard

Hi Neil, Thomas,

<snip>

Quoted 3 lines
Quoted 3 lines

You didn't remove the relationship of the ethdev to the pci driver though, which is really the problem, An ethdev may reside on any number of bus types (pci/usb/vmbus/virt/none).

<snip>

Quoted 1 line
Quoted 1 line

Whats really needed is a way to associate an ethdev with an arbitrary bus

<snip>

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Please see email below from 6Wind

http://dpdk.org/ml/archives/dev/2015-July/022107.html

I think you misread that. I think all Thomas is asking for (correct me if I'm wrong Thomas), is for someone to start refactoring the ethdev registration code so that we can have a single init path without the need for wierd typing and differentiation at init time.

<snip >

Quoted 5 lines
Quoted 5 lines

We just need to
start thinking about how to make bus registration independent of ethernet device registration, and while your patch series sort of eliminates some of that, its really not a proper refactoring of the sort I think Thomas is asking for.

Quoted 3 lines

I am just trying to distill what the actual requirement is from the above discussion.

(1) Remove relationship of the ethdev to the pci driver.

Correct

Quoted 1 line

(2) Refactor ethdev registration code so that there is a single init path.

Correct (or mostly correct, in rereading my initial post, there may be some ambiguitiy here)

Quoted 1 line

(3) Make bus registration independent of ethdev registration.

Correct

Quoted 2 lines

(4) Change all (17) PMD's to use the modified structures.

Correct (I assume the 17 number is accurate here)

Quoted 2 lines

The rte_eal_driver_registration() code is in librte_eal, untouched as yet by this patch set.

Correct, the code that registers an init function is a single path, which is great. However, that path requires that you specify a device type (in this case PMD_PDEV or PMD_VDEV to differentiate pci vs virtual devices (it uses this for ordering of initalization in rte_eal_dev_init, which is a hack). What would be preferred would be if the structure that was registered via that macro only held a name and an init routine to initalize the driver itself. Inside that init routine, the driver would then be responsible for registering with the appropriate bus type (virtual/pci/usb/whatever). A secondary function would be registered as part of that process (akin to the linux/bsd probe() method) which was called once for each instance of the device found on that bus.

Quoted 2 lines

The rte_eth_driver_registration() code is in librte_ether.
Should the pci fields be removed from the struct rte_eth_dev{} and struct eth_driver{},

IMO, yes, they should, as the driver can store pointers to those devices in their private per-device data area. That said, there may be value in including a union of all bus types in the ethdev itself, if there are higher layer functions that need to be aware of a given ethdevs bus type

Quoted 8 lines

and put somewhere else or replaced with a union of bus types and drivers?

Regards,

Bernard.

#29 lore raw

Hi Neil, Thomas,

Quoted 31 lines
Quoted 13 lines

<snip>

Quoted 3 lines
Quoted 3 lines

You didn't remove the relationship of the ethdev to the pci driver though, which is really the problem, An ethdev may reside on any number of bus types (pci/usb/vmbus/virt/none).

<snip>

Quoted 2 lines
Quoted 2 lines

Whats really needed is a way to associate an ethdev with an
arbitrary bus

<snip>

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Please see email below from 6Wind

http://dpdk.org/ml/archives/dev/2015-July/022107.html

I think you misread that. I think all Thomas is asking for (correct me if I'm wrong Thomas), is for someone to start refactoring the ethdev registration code so that we can have a single init path without the need for wierd typing and differentiation at

init time.

Quoted 9 lines

<snip >

Quoted 5 lines
Quoted 5 lines

We just need to
start thinking about how to make bus registration independent of ethernet device registration, and while your patch series sort of eliminates some of that, its really not a proper refactoring of the sort I think Thomas is asking for.

Quoted 5 lines
Quoted 1 line

I am just trying to distill what the actual requirement is from the above

discussion.

Quoted 2 lines

(1) Remove relationship of the ethdev to the pci driver.

Correct

I plan to continue work on the RFC to address this.

Quoted 11 lines
Quoted 2 lines

(2) Refactor ethdev registration code so that there is a single init path.

Correct (or mostly correct, in rereading my initial post, there may be some ambiguitiy here)

Quoted 1 line

(3) Make bus registration independent of ethdev registration.

Correct

Quoted 2 lines

(4) Change all (17) PMD's to use the modified structures.

Correct (I assume the 17 number is accurate here)

There are 17 PMD directories some of which have multiple PMD's. The total number of PMD's is 23 at present.

Quoted 15 lines
Quoted 1 line

The rte_eal_driver_registration() code is in librte_eal, untouched as yet by

this patch set.

Quoted 1 line

Correct, the code that registers an init function is a single path, which is great. However, that path requires that you specify a device type (in this case PMD_PDEV or PMD_VDEV to differentiate pci vs virtual devices (it uses this for ordering of initalization in rte_eal_dev_init, which is a hack). What would be preferred would be if the structure that was registered via that macro only held a name and an init routine to initalize the driver itself. Inside that init routine, the driver would then be responsible for registering with the appropriate bus type (virtual/pci/usb/whatever). A secondary function would be registered as part of that process (akin to the linux/bsd probe() method) which was called once for each instance of the device found on that bus.

I will send a second RFC to address the eal driver registration code issues in librte_eal.

Quoted 7 lines
Quoted 3 lines

The rte_eth_driver_registration() code is in librte_ether. Should the pci fields be removed from the struct rte_eth_dev{} and struct eth_driver{},

IMO, yes, they should, as the driver can store pointers to those devices in their private per-device data area. That said, there may be value in including a union of all bus types in the ethdev itself, if there are higher layer functions that need to be aware of a given ethdevs bus type

I plan to park the issue of multiple bus types for now. More consensus is needed on the best way forward.

Quoted 3 lines
Quoted 2 lines

and put somewhere else or replaced with a union of bus types and

drivers?

Regards,

Bernard.

#30 lore raw

Certain functions like "rte_eth_dev_socket_id" assume the device to be a PCI device and access pointers like rte_eth_devices[port_id].pci_dev->numa_node. Any such assumptions and dependencies should also be removed.

Thanks & regards,
Amruta Zende
+91-20-4305-2969

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Iremonger, Bernard
Sent: Thursday, September 3, 2015 7:33 PM
To: Thomas Monjalon; Neil Horman
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] remove pci driver from vdevs

Hi Neil, Thomas,

Quoted 32 lines
Quoted 15 lines

<snip>

Quoted 3 lines
Quoted 3 lines

You didn't remove the relationship of the ethdev to the pci driver though, which is really the problem, An ethdev may reside on any number of bus types (pci/usb/vmbus/virt/none).

<snip>

Quoted 2 lines
Quoted 2 lines

Whats really needed is a way to associate an ethdev with an
arbitrary bus

<snip>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Please see email below from 6Wind

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

http://dpdk.org/ml/archives/dev/2015-July/022107.html

I think you misread that. I think all Thomas is asking for (correct me if I'm wrong Thomas), is for someone to start refactoring the ethdev registration code so that we can have a single init path without the need for wierd typing and differentiation at

init time.

Quoted 9 lines

<snip >

Quoted 5 lines
Quoted 5 lines

We just need to
start thinking about how to make bus registration independent of ethernet device registration, and while your patch series sort of eliminates some of that, its really not a proper refactoring of the sort I think Thomas is asking for.

Quoted 6 lines
Quoted 2 lines

I am just trying to distill what the actual requirement is from the above

discussion.

Quoted 2 lines

(1) Remove relationship of the ethdev to the pci driver.

Correct

I plan to continue work on the RFC to address this.

Quoted 11 lines
Quoted 2 lines

(2) Refactor ethdev registration code so that there is a single init path.

Correct (or mostly correct, in rereading my initial post, there may be some ambiguitiy here)

Quoted 1 line

(3) Make bus registration independent of ethdev registration.

Correct

Quoted 2 lines

(4) Change all (17) PMD's to use the modified structures.

Correct (I assume the 17 number is accurate here)

There are 17 PMD directories some of which have multiple PMD's. The total number of PMD's is 23 at present.

Quoted 4 lines
Quoted 2 lines

The rte_eal_driver_registration() code is in librte_eal, untouched as yet by

this patch set.

Quoted 1 line
Quoted 13 lines

Correct, the code that registers an init function is a single path, which is great. However, that path requires that you specify a device type (in this case PMD_PDEV or PMD_VDEV to differentiate pci vs virtual devices (it uses this for ordering of initalization in rte_eal_dev_init, which is a hack). What would be preferred would be if the structure that was registered via that macro only held a name and an init routine to initalize the driver itself. Inside that init routine, the driver would then be responsible for registering with the appropriate bus type (virtual/pci/usb/whatever). A secondary function would be registered as part of that process (akin to the linux/bsd probe() method) which was called once for each instance of the device found on that bus.

I will send a second RFC to address the eal driver registration code issues in librte_eal.

Quoted 8 lines
Quoted 3 lines

The rte_eth_driver_registration() code is in librte_ether. Should the pci fields be removed from the struct rte_eth_dev{} and struct eth_driver{},

IMO, yes, they should, as the driver can store pointers to those devices in their private per-device data area. That said, there may be value in including a union of all bus types in the ethdev itself, if there are higher layer functions that need to be aware of a given ethdevs bus type

I plan to park the issue of multiple bus types for now. More consensus is needed on the best way forward.

Quoted 3 lines
Quoted 2 lines

and put somewhere else or replaced with a union of bus types and

drivers?

Regards,

Bernard.