From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E838A0550; Fri, 26 Aug 2022 14:43:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CC6C410D0; Fri, 26 Aug 2022 14:43:10 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id A872F40156 for ; Fri, 26 Aug 2022 14:43:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661517789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PwOqKnD6aay/9YuVg71oKySvH96zWrL9qVYhkrmpRB8=; b=XIJoZrDS3cgdn8rpEdTG1qTVQONNTYKiGoKnDgJgT//gJ8VR7YVdG/RzEYQsru7iyyDl2J q0oBNz5Rzu+H8uqvpPn6vUu0e9Dw0mJWgTVw1LwF/hqcsTpOND5T4/0WVMbO87ALwp58k9 HOhFOmrnjBS0qqlmtgFQyCzAL4ny0Ws= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-401-uzzsrn-ENQmOWfWasPR2RA-1; Fri, 26 Aug 2022 08:43:05 -0400 X-MC-Unique: uzzsrn-ENQmOWfWasPR2RA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6DB263C10162; Fri, 26 Aug 2022 12:43:04 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.193.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8FCA40CF916; Fri, 26 Aug 2022 12:43:02 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, bruce.richardson@intel.com, Parav Pandit , Xueming Li , Ray Kinsella , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH v4 11/27] bus/auxiliary: make driver-only headers private Date: Fri, 26 Aug 2022 14:41:52 +0200 Message-Id: <20220826124208.671400-12-david.marchand@redhat.com> In-Reply-To: <20220826124208.671400-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220826124208.671400-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The auxiliary bus interface is for drivers only. Mark as internal and move the header in the driver headers list. While at it, cleanup the code: - fix indentation, - remove unneeded reference to bus specific singleton object, - remove unneeded list head structure type, - reorder the definitions and macro manipulating the bus singleton object, - remove inclusion of rte_bus.h and fix the code that relied on implicit inclusion, Signed-off-by: David Marchand --- Changes since RFC v2: - squashed cleanup for this bus code from other patches, - updated release notes, --- doc/guides/rel_notes/release_22_11.rst | 5 ++++ drivers/bus/auxiliary/auxiliary_common.c | 3 -- drivers/bus/auxiliary/auxiliary_params.c | 1 - ...bus_auxiliary.h => bus_auxiliary_driver.h} | 24 +++++++-------- drivers/bus/auxiliary/linux/auxiliary.c | 2 -- drivers/bus/auxiliary/meson.build | 4 +-- drivers/bus/auxiliary/private.h | 30 +++++++++---------- drivers/bus/auxiliary/version.map | 3 +- .../common/mlx5/linux/mlx5_common_auxiliary.c | 2 +- drivers/common/mlx5/linux/mlx5_common_os.c | 2 +- drivers/common/mlx5/mlx5_common_private.h | 2 +- drivers/net/mlx5/linux/mlx5_os.c | 2 +- 12 files changed, 36 insertions(+), 44 deletions(-) rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%) diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 225a380de0..9fd95e13dd 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -88,6 +88,11 @@ API Changes in the future. Applications can use ``devtools/cocci/func_or_ret.cocci`` to update their code. +* drivers: Registering a driver on the ``auxiliary``, + buses has been marked as an internal API. + External users may still register their driver using the associated driver + headers (see ``enable_driver_sdk`` meson option). + * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed. diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c index 2cf8fe672d..6cf6c170ec 100644 --- a/drivers/bus/auxiliary/auxiliary_common.c +++ b/drivers/bus/auxiliary/auxiliary_common.c @@ -23,7 +23,6 @@ #include #include "private.h" -#include "rte_bus_auxiliary.h" static struct rte_devargs * auxiliary_devargs_lookup(const char *name) @@ -259,7 +258,6 @@ void rte_auxiliary_register(struct rte_auxiliary_driver *driver) { TAILQ_INSERT_TAIL(&auxiliary_bus.driver_list, driver, next); - driver->bus = &auxiliary_bus; } /* Unregister a driver */ @@ -267,7 +265,6 @@ void rte_auxiliary_unregister(struct rte_auxiliary_driver *driver) { TAILQ_REMOVE(&auxiliary_bus.driver_list, driver, next); - driver->bus = NULL; } /* Add a device to auxiliary bus */ diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c index 9017118b36..0289777922 100644 --- a/drivers/bus/auxiliary/auxiliary_params.c +++ b/drivers/bus/auxiliary/auxiliary_params.c @@ -10,7 +10,6 @@ #include #include "private.h" -#include "rte_bus_auxiliary.h" enum auxiliary_params { RTE_AUXILIARY_PARAM_NAME, diff --git a/drivers/bus/auxiliary/rte_bus_auxiliary.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h similarity index 90% rename from drivers/bus/auxiliary/rte_bus_auxiliary.h rename to drivers/bus/auxiliary/bus_auxiliary_driver.h index 93b266daf7..1c2d2c04af 100644 --- a/drivers/bus/auxiliary/rte_bus_auxiliary.h +++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h @@ -2,8 +2,8 @@ * Copyright (c) 2021 NVIDIA Corporation & Affiliates */ -#ifndef RTE_BUS_AUXILIARY_H -#define RTE_BUS_AUXILIARY_H +#ifndef BUS_AUXILIARY_DRIVER_H +#define BUS_AUXILIARY_DRIVER_H /** * @file @@ -22,17 +22,16 @@ extern "C" { #include #include +#include #include #include #include -#include #include #define RTE_BUS_AUXILIARY_NAME "auxiliary" /* Forward declarations */ struct rte_auxiliary_driver; -struct rte_auxiliary_bus; struct rte_auxiliary_device; /** @@ -43,7 +42,7 @@ struct rte_auxiliary_device; * @return * Whether the driver can handle the auxiliary device. */ -typedef bool(rte_auxiliary_match_t)(const char *name); +typedef bool (rte_auxiliary_match_t)(const char *name); /** * Initialization function for the driver called during auxiliary probing. @@ -56,8 +55,8 @@ typedef bool(rte_auxiliary_match_t)(const char *name); * - 0 On success. * - Negative value and rte_errno is set otherwise. */ -typedef int(rte_auxiliary_probe_t)(struct rte_auxiliary_driver *drv, - struct rte_auxiliary_device *dev); +typedef int (rte_auxiliary_probe_t)(struct rte_auxiliary_driver *drv, + struct rte_auxiliary_device *dev); /** * Uninitialization function for the driver called during hotplugging. @@ -87,7 +86,7 @@ typedef int (rte_auxiliary_remove_t)(struct rte_auxiliary_device *dev); * - Negative value and rte_errno is set otherwise. */ typedef int (rte_auxiliary_dma_map_t)(struct rte_auxiliary_device *dev, - void *addr, uint64_t iova, size_t len); + void *addr, uint64_t iova, size_t len); /** * Driver-specific DMA un-mapping. After a successful call the device @@ -106,7 +105,7 @@ typedef int (rte_auxiliary_dma_map_t)(struct rte_auxiliary_device *dev, * - Negative value and rte_errno is set otherwise. */ typedef int (rte_auxiliary_dma_unmap_t)(struct rte_auxiliary_device *dev, - void *addr, uint64_t iova, size_t len); + void *addr, uint64_t iova, size_t len); /** * A structure describing an auxiliary device. @@ -125,7 +124,6 @@ struct rte_auxiliary_device { struct rte_auxiliary_driver { RTE_TAILQ_ENTRY(rte_auxiliary_driver) next; /**< Next in list. */ struct rte_driver driver; /**< Inherit core driver. */ - struct rte_auxiliary_bus *bus; /**< Auxiliary bus reference. */ rte_auxiliary_match_t *match; /**< Device match function. */ rte_auxiliary_probe_t *probe; /**< Device probe function. */ rte_auxiliary_remove_t *remove; /**< Device remove function. */ @@ -160,7 +158,7 @@ struct rte_auxiliary_driver { * A pointer to a rte_auxiliary_driver structure describing the driver * to be registered. */ -__rte_experimental +__rte_internal void rte_auxiliary_register(struct rte_auxiliary_driver *driver); /** Helper for auxiliary device registration from driver instance */ @@ -182,11 +180,11 @@ void rte_auxiliary_register(struct rte_auxiliary_driver *driver); * A pointer to a rte_auxiliary_driver structure describing the driver * to be unregistered. */ -__rte_experimental +__rte_internal void rte_auxiliary_unregister(struct rte_auxiliary_driver *driver); #ifdef __cplusplus } #endif -#endif /* RTE_BUS_AUXILIARY_H */ +#endif /* BUS_AUXILIARY_DRIVER_H */ diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c index 9bd4ee3295..d4c564cd78 100644 --- a/drivers/bus/auxiliary/linux/auxiliary.c +++ b/drivers/bus/auxiliary/linux/auxiliary.c @@ -6,13 +6,11 @@ #include #include -#include #include #include #include #include -#include "../rte_bus_auxiliary.h" #include "../private.h" #define AUXILIARY_SYSFS_PATH "/sys/bus/auxiliary/devices" diff --git a/drivers/bus/auxiliary/meson.build b/drivers/bus/auxiliary/meson.build index e2b356f8d2..fcb1a349c4 100644 --- a/drivers/bus/auxiliary/meson.build +++ b/drivers/bus/auxiliary/meson.build @@ -1,9 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2021 NVIDIA Corporation & Affiliates -headers = files( - 'rte_bus_auxiliary.h', -) +driver_sdk_headers += files('bus_auxiliary_driver.h') sources = files( 'auxiliary_common.c', 'auxiliary_params.c', diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h index d22e83cf7a..3f49f62493 100644 --- a/drivers/bus/auxiliary/private.h +++ b/drivers/bus/auxiliary/private.h @@ -9,9 +9,10 @@ #include #include -#include "rte_bus_auxiliary.h" +#include + +#include "bus_auxiliary_driver.h" -extern struct rte_auxiliary_bus auxiliary_bus; extern int auxiliary_bus_logtype; #define AUXILIARY_LOG(level, ...) \ @@ -19,27 +20,24 @@ extern int auxiliary_bus_logtype; RTE_FMT("auxiliary bus: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ RTE_FMT_TAIL(__VA_ARGS__,))) -/* Auxiliary bus iterators */ -#define FOREACH_DEVICE_ON_AUXILIARY_BUS(p) \ - TAILQ_FOREACH(p, &(auxiliary_bus.device_list), next) - -#define FOREACH_DRIVER_ON_AUXILIARY_BUS(p) \ - TAILQ_FOREACH(p, &(auxiliary_bus.driver_list), next) - -/* List of auxiliary devices. */ -TAILQ_HEAD(rte_auxiliary_device_list, rte_auxiliary_device); -/* List of auxiliary drivers. */ -TAILQ_HEAD(rte_auxiliary_driver_list, rte_auxiliary_driver); - /* * Structure describing the auxiliary bus */ struct rte_auxiliary_bus { struct rte_bus bus; /* Inherit the generic class */ - struct rte_auxiliary_device_list device_list; /* List of devices */ - struct rte_auxiliary_driver_list driver_list; /* List of drivers */ + TAILQ_HEAD(, rte_auxiliary_device) device_list; /* List of devices */ + TAILQ_HEAD(, rte_auxiliary_driver) driver_list; /* List of drivers */ }; +extern struct rte_auxiliary_bus auxiliary_bus; + +/* Auxiliary bus iterators */ +#define FOREACH_DEVICE_ON_AUXILIARY_BUS(p) \ + TAILQ_FOREACH(p, &(auxiliary_bus.device_list), next) + +#define FOREACH_DRIVER_ON_AUXILIARY_BUS(p) \ + TAILQ_FOREACH(p, &(auxiliary_bus.driver_list), next) + /* * Test whether the auxiliary device exist. */ diff --git a/drivers/bus/auxiliary/version.map b/drivers/bus/auxiliary/version.map index dc993e84ff..e9322e0b11 100644 --- a/drivers/bus/auxiliary/version.map +++ b/drivers/bus/auxiliary/version.map @@ -1,7 +1,6 @@ -EXPERIMENTAL { +INTERNAL { global: - # added in 21.08 rte_auxiliary_register; rte_auxiliary_unregister; diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c index a182a8bdde..33479ffd68 100644 --- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c +++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include "eal_filesystem.h" diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index c57e1918d2..b42102e84c 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include "mlx5_common.h" #include "mlx5_nl.h" diff --git a/drivers/common/mlx5/mlx5_common_private.h b/drivers/common/mlx5/mlx5_common_private.h index 04c0af3763..12a5bdb41b 100644 --- a/drivers/common/mlx5/mlx5_common_private.h +++ b/drivers/common/mlx5/mlx5_common_private.h @@ -6,7 +6,7 @@ #define MLX5_COMMON_PRIVATE_H #include -#include +#include #include "mlx5_common.h" diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 0741028dab..c9ed38ef7c 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include -- 2.37.2