[dpdk-dev] [RFC PATCH 01/18] librte_eal: remove type field from rte_driver structure.

Bernard Iremonger bernard.iremonger at intel.com
Fri Sep 4 13:01:37 CEST 2015


Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
---
 lib/librte_eal/common/eal_common_dev.c  | 22 +++++++++++++---------
 lib/librte_eal/common/include/rte_dev.h | 11 +----------
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 4089d66..ccfbb8c 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.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.
  *
@@ -72,8 +72,6 @@ rte_eal_vdev_init(const char *name, const char *args)
 		return -EINVAL;
 
 	TAILQ_FOREACH(driver, &dev_driver_list, next) {
-		if (driver->type != PMD_VDEV)
-			continue;
 
 		/*
 		 * search a driver prefix in virtual device name.
@@ -117,10 +115,18 @@ rte_eal_dev_init(void)
 
 	/* Once the vdevs are initalized, start calling all the pdev drivers */
 	TAILQ_FOREACH(driver, &dev_driver_list, next) {
-		if (driver->type != PMD_PDEV)
-			continue;
-		/* PDEV drivers don't get passed any parameters */
-		driver->init(NULL, NULL);
+
+		/* PCI drivers don't get passed any parameters */
+		/*
+		 * Search a virtual driver prefix in device name.
+		 * It should not be found for PCI devices.
+		 * Use strncmp to compare.
+		 */
+
+		if ((driver->name) &&
+			(strncmp(driver->name, "eth_", strlen("eth_")) != 0)) {
+			driver->init(NULL, NULL);
+		}
 	}
 	return 0;
 }
@@ -134,8 +140,6 @@ rte_eal_vdev_uninit(const char *name)
 		return -EINVAL;
 
 	TAILQ_FOREACH(driver, &dev_driver_list, next) {
-		if (driver->type != PMD_VDEV)
-			continue;
 
 		/*
 		 * search a driver prefix in virtual device name.
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index f601d21..6253185 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -62,20 +62,11 @@ typedef int (rte_dev_init_t)(const char *name, const char *args);
 typedef int (rte_dev_uninit_t)(const char *name);
 
 /**
- * Driver type enumeration
- */
-enum pmd_type {
-	PMD_VDEV = 0,
-	PMD_PDEV = 1,
-};
-
-/**
  * A structure describing a device driver.
  */
 struct rte_driver {
 	TAILQ_ENTRY(rte_driver) next;  /**< Next in list. */
-	enum pmd_type type;		   /**< PMD Driver type */
-	const char *name;                   /**< Driver name. */
+	const char *name;                  /**< Driver name. */
 	rte_dev_init_t *init;              /**< Device init. function. */
 	rte_dev_uninit_t *uninit;          /**< Device uninit. function. */
 };
-- 
1.9.1



More information about the dev mailing list