From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 78BB85678 for ; Wed, 23 Nov 2016 21:07:34 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 23 Nov 2016 12:07:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,539,1473145200"; d="scan'208";a="8589971" Received: from bwalker-desk.ch.intel.com ([143.182.137.60]) by orsmga002.jf.intel.com with ESMTP; 23 Nov 2016 12:07:32 -0800 From: Ben Walker To: dev@dpdk.org Cc: Ben Walker Date: Wed, 23 Nov 2016 13:07:22 -0700 Message-Id: <1479931644-78960-5-git-send-email-benjamin.walker@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479931644-78960-1-git-send-email-benjamin.walker@intel.com> References: <1479929804-19614-1-git-send-email-benjamin.walker@intel.com> <1479931644-78960-1-git-send-email-benjamin.walker@intel.com> Subject: [dpdk-dev] [PATCH v2 5/7] pci: Move driver registration above pci scan 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: Wed, 23 Nov 2016 20:07:34 -0000 The user needs to register drivers before scanning, so it makes the most sense to put the registration functions above the scan function in the header file. Signed-off-by: Ben Walker --- lib/librte_eal/common/include/rte_pci.h | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 74be1f5..5d0feac 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -358,6 +358,34 @@ rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, } /** + * Register a PCI driver. + * + * @param driver + * A pointer to a rte_pci_driver structure describing the driver + * to be registered. + */ +void rte_eal_pci_register(struct rte_pci_driver *driver); + +/** Statically register a PCI driver at start up */ +#define RTE_PMD_REGISTER_PCI(nm, pci_drv) \ +RTE_INIT(pciinitfn_ ##nm); \ +static void pciinitfn_ ##nm(void) \ +{\ + (pci_drv).driver.name = RTE_STR(nm);\ + rte_eal_pci_register(&pci_drv); \ +} \ +RTE_PMD_EXPORT_NAME(nm, __COUNTER__) + +/** + * Unregister a PCI driver. + * + * @param driver + * A pointer to a rte_pci_driver structure describing the driver + * to be unregistered. + */ +void rte_eal_pci_unregister(struct rte_pci_driver *driver); + +/** * Scan the content of the PCI bus, and the devices in the devices * list * @@ -476,34 +504,6 @@ int rte_eal_pci_detach(const struct rte_pci_addr *addr); void rte_eal_pci_dump(FILE *f); /** - * Register a PCI driver. - * - * @param driver - * A pointer to a rte_pci_driver structure describing the driver - * to be registered. - */ -void rte_eal_pci_register(struct rte_pci_driver *driver); - -/** Helper for PCI device registration from driver (eth, crypto) instance */ -#define RTE_PMD_REGISTER_PCI(nm, pci_drv) \ -RTE_INIT(pciinitfn_ ##nm); \ -static void pciinitfn_ ##nm(void) \ -{\ - (pci_drv).driver.name = RTE_STR(nm);\ - rte_eal_pci_register(&pci_drv); \ -} \ -RTE_PMD_EXPORT_NAME(nm, __COUNTER__) - -/** - * Unregister a PCI driver. - * - * @param driver - * A pointer to a rte_pci_driver structure describing the driver - * to be unregistered. - */ -void rte_eal_pci_unregister(struct rte_pci_driver *driver); - -/** * Read PCI config space. * * @param device -- 2.7.4