From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2FB508D88 for ; Fri, 4 Sep 2015 13:02:02 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 04 Sep 2015 04:02:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,468,1437462000"; d="scan'208";a="638442853" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 04 Sep 2015 04:01:59 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t84B1xBQ021342; Fri, 4 Sep 2015 12:01:59 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t84B1xYJ024949; Fri, 4 Sep 2015 12:01:59 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id t84B1w6s024945; Fri, 4 Sep 2015 12:01:58 +0100 From: Bernard Iremonger To: dev@dpdk.org Date: Fri, 4 Sep 2015 12:01:37 +0100 Message-Id: <1441364514-24905-2-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1441364514-24905-1-git-send-email-bernard.iremonger@intel.com> References: <1441364514-24905-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [RFC PATCH 01/18] librte_eal: remove type field from rte_driver structure. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2015 11:02:02 -0000 Signed-off-by: Bernard Iremonger --- 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