From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shreyansh Jain Subject: [PATCH v7 5/9] eal/bus: introduce support for bus probing Date: Tue, 17 Jan 2017 15:39:30 +0530 Message-ID: <1484647774-28984-6-git-send-email-shreyansh.jain@nxp.com> References: <1484581107-2025-1-git-send-email-shreyansh.jain@nxp.com> <1484647774-28984-1-git-send-email-shreyansh.jain@nxp.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Shreyansh Jain To: Return-path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0088.outbound.protection.outlook.com [104.47.40.88]) by dpdk.org (Postfix) with ESMTP id 6D9DF2BA2 for ; Tue, 17 Jan 2017 11:06:29 +0100 (CET) In-Reply-To: <1484647774-28984-1-git-send-email-shreyansh.jain@nxp.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" Bus implementations can implement a probe handler to match the devices scanned against the drivers registered. This patch introduces the callback which would be implemented for PCI in subsequent patch. Signed-off-by: Shreyansh Jain --- lib/librte_eal/common/eal_common_bus.c | 1 + lib/librte_eal/common/include/rte_bus.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index 35baff8..9c4b014 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -53,6 +53,7 @@ rte_bus_register(struct rte_bus *bus) RTE_VERIFY(bus->name && strlen(bus->name)); /* A bus should mandatorily have the scan implemented */ RTE_VERIFY(bus->scan); + RTE_VERIFY(bus->probe); TAILQ_INSERT_TAIL(&rte_bus_list, bus, next); RTE_LOG(INFO, EAL, "Registered [%s] bus.\n", bus->name); diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index 152451c..eb5c677 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -77,12 +77,30 @@ extern struct rte_bus_list rte_bus_list; typedef int (*rte_bus_scan_t)(void); /** + * Implementation specific probe function which is responsible for linking + * devices on that bus with applicable drivers. + * + * This is called while iterating over each registered bus. Bus object is + * passed along assuming this is wrapped around (embedded) by Implementation + * specific bus object. + * + * @param bus + * Generic bus object which was registered with EAL + * + * @return + * 0 for successful probe + * !0 for any error while probing + */ +typedef int (*rte_bus_probe_t)(void); + +/** * A structure describing a generic bus. */ struct rte_bus { TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */ const char *name; /**< Name of the bus */ rte_bus_scan_t scan; /**< Scan for devices attached to bus */ + rte_bus_probe_t probe; /**< Probe devices on bus */ }; /** -- 2.7.4