From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH 04/13] eal: introduce driver type Date: Mon, 19 Dec 2016 13:59:35 -0800 Message-ID: <20161219215944.17226-5-sthemmin@microsoft.com> References: <20161219215944.17226-1-sthemmin@microsoft.com> Cc: Stephen Hemminger To: dev@dpdk.org Return-path: Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) by dpdk.org (Postfix) with ESMTP id A2FFAFABC for ; Mon, 19 Dec 2016 22:59:57 +0100 (CET) Received: by mail-it0-f42.google.com with SMTP id c20so69151771itb.0 for ; Mon, 19 Dec 2016 13:59:57 -0800 (PST) In-Reply-To: <20161219215944.17226-1-sthemmin@microsoft.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Since multiple buses and device types need to be supported. Provide type field in driver. --- lib/librte_eal/common/include/rte_dev.h | 15 ++++++++++++--- lib/librte_eal/common/include/rte_pci.h | 1 + lib/librte_eal/common/include/rte_vdev.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index e5471a22..3f4e26e6 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -144,12 +144,21 @@ void rte_eal_device_insert(struct rte_device *dev); void rte_eal_device_remove(struct rte_device *dev); /** + * Type of device driver + */ +enum rte_driver_type { + PMD_VIRTUAL, + PMD_PCI, +}; + +/** * A structure describing a device driver. */ struct rte_driver { TAILQ_ENTRY(rte_driver) next; /**< Next in list. */ - const char *name; /**< Driver name. */ - const char *alias; /**< Driver alias. */ + const char *name; /**< Driver name. */ + const char *alias; /**< Driver alias. */ + enum rte_driver_type type; /**< Driver type. */ }; /** @@ -243,4 +252,4 @@ __attribute__((used)) = str } #endif -#endif /* _RTE_VDEV_H_ */ +#endif /* _RTE_DEV_H_ */ diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 9ce88472..d377d539 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -492,6 +492,7 @@ RTE_INIT(pciinitfn_ ##nm); \ static void pciinitfn_ ##nm(void) \ {\ (pci_drv).driver.name = RTE_STR(nm);\ + (pci_drv).driver.type = PMD_PCI; \ rte_eal_pci_register(&pci_drv); \ } \ RTE_PMD_EXPORT_NAME(nm, __COUNTER__) diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h index 784e837d..98fb5bb5 100644 --- a/lib/librte_eal/common/include/rte_vdev.h +++ b/lib/librte_eal/common/include/rte_vdev.h @@ -88,6 +88,7 @@ static void vdrvinitfn_ ##vdrv(void)\ {\ (vdrv).driver.name = RTE_STR(nm);\ (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\ + (vdrv).driver.type = PMD_VIRTUAL;\ rte_eal_vdrv_register(&vdrv);\ } \ RTE_PMD_EXPORT_NAME(nm, __COUNTER__) -- 2.11.0