From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shreyansh Jain Subject: [PATCH v10 06/13] eal/bus: introduce support for bus probing Date: Wed, 18 Jan 2017 19:35:22 +0530 Message-ID: <1484748329-5418-7-git-send-email-shreyansh.jain@nxp.com> References: <1484735880-17178-1-git-send-email-shreyansh.jain@nxp.com> <1484748329-5418-1-git-send-email-shreyansh.jain@nxp.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Shreyansh Jain To: Return-path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0057.outbound.protection.outlook.com [104.47.37.57]) by dpdk.org (Postfix) with ESMTP id 66E76FA5C for ; Wed, 18 Jan 2017 15:03:42 +0100 (CET) In-Reply-To: <1484748329-5418-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 Reviewed-by: Ferruh Yigit --- lib/librte_eal/common/eal_common_bus.c | 1 + lib/librte_eal/common/include/rte_bus.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index d5d6beb..205ddb6 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -52,6 +52,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(DEBUG, 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 ba7d866..17583ad 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -73,12 +73,25 @@ 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. + * + * @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