[dpdk-dev,RFC,3/6] null: remove pci device driver

Message ID 1440690041-32391-4-git-send-email-bernard.iremonger@intel.com (mailing list archive)
State Rejected, archived
Headers

Commit Message

Iremonger, Bernard Aug. 27, 2015, 3:40 p.m. UTC
  remove rte_null_pmd and pci_dev.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/null/rte_eth_null.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)
  

Comments

Thomas Monjalon Aug. 31, 2015, 2:11 p.m. UTC | #1
2015-08-27 16:40, Bernard Iremonger:
> remove rte_null_pmd and pci_dev.
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
[...]
> -	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?
  
Iremonger, Bernard Aug. 31, 2015, 4:05 p.m. UTC | #2
Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, August 31, 2015 3:11 PM
> To: Iremonger, Bernard
> Cc: dev@dpdk.org; david.marchand@6wind.com
> Subject: Re: [RFC PATCH 3/6] null: remove pci device driver
> 
> 2015-08-27 16:40, Bernard Iremonger:
> > remove rte_null_pmd and pci_dev.
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> [...]
> > -	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.
  

Patch

diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index e244595..7436dee 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -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);