The fslmc bus interface is for drivers only. Mark as internal and move the header in the driver headers list.
While at it, cleanup internal structures: - 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 update code that relied on it, Signed-off-by: David Marchand <david.march...@redhat.com> Acked-by: Hemant Agrawal <hemant.agra...@nxp.com> --- Changes since RFC v2: - squashed cleanup for this bus code from other patches, - updated release notes, --- .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} | 28 +++---------------- drivers/bus/fslmc/fslmc_bus.c | 12 ++------ drivers/bus/fslmc/fslmc_vfio.c | 3 +- drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 2 +- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 2 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 +- drivers/bus/fslmc/portal/dpaa2_hw_dprc.c | 2 +- drivers/bus/fslmc/private.h | 27 ++++++++++++++++++ drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 2 +- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 2 +- drivers/dma/dpaa2/dpaa2_qdma.c | 2 +- drivers/event/dpaa2/dpaa2_eventdev.c | 2 +- drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 2 +- drivers/event/dpaa2/dpaa2_hw_dpcon.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.h | 2 +- drivers/net/dpaa2/dpaa2_mux.c | 2 +- drivers/net/dpaa2/dpaa2_ptp.c | 2 +- drivers/net/dpaa2/dpaa2_recycle.c | 2 +- drivers/net/dpaa2/dpaa2_rxtx.c | 2 +- 20 files changed, 50 insertions(+), 52 deletions(-) rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (89%) create mode 100644 drivers/bus/fslmc/private.h diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/bus_fslmc_driver.h similarity index 89% rename from drivers/bus/fslmc/rte_fslmc.h rename to drivers/bus/fslmc/bus_fslmc_driver.h index 8c67bfba55..798ddebf3a 100644 --- a/drivers/bus/fslmc/rte_fslmc.h +++ b/drivers/bus/fslmc/bus_fslmc_driver.h @@ -4,8 +4,8 @@ * */ -#ifndef _RTE_FSLMC_H_ -#define _RTE_FSLMC_H_ +#ifndef BUS_FSLMC_DRIVER_H +#define BUS_FSLMC_DRIVER_H /** * @file @@ -26,10 +26,10 @@ extern "C" { #include <inttypes.h> #include <linux/vfio.h> +#include <rte_compat.h> #include <rte_debug.h> #include <rte_interrupts.h> #include <rte_dev.h> -#include <rte_bus.h> #include <rte_tailq.h> #include <rte_devargs.h> #include <rte_mbuf.h> @@ -69,15 +69,9 @@ dpaa2_seqn(struct rte_mbuf *mbuf) struct rte_dpaa2_driver; -/* DPAA2 Device and Driver lists for FSLMC bus */ -TAILQ_HEAD(rte_fslmc_device_list, rte_dpaa2_device); -TAILQ_HEAD(rte_fslmc_driver_list, rte_dpaa2_driver); - #define RTE_DEV_TO_FSLMC_CONST(ptr) \ container_of(ptr, const struct rte_dpaa2_device, device) -extern struct rte_fslmc_bus rte_fslmc_bus; - enum rte_dpaa2_dev_type { /* Devices backed by DPDK driver */ DPAA2_ETH, /**< DPNI type device*/ @@ -146,26 +140,12 @@ typedef int (*rte_dpaa2_remove_t)(struct rte_dpaa2_device *dpaa2_dev); struct rte_dpaa2_driver { TAILQ_ENTRY(rte_dpaa2_driver) next; /**< Next in list. */ struct rte_driver driver; /**< Inherit core driver. */ - struct rte_fslmc_bus *fslmc_bus; /**< FSLMC bus reference */ uint32_t drv_flags; /**< Flags for controlling device.*/ enum rte_dpaa2_dev_type drv_type; /**< Driver Type */ rte_dpaa2_probe_t probe; rte_dpaa2_remove_t remove; }; -/* - * FSLMC bus - */ -struct rte_fslmc_bus { - struct rte_bus bus; /**< Generic Bus object */ - struct rte_fslmc_device_list device_list; - /**< FSLMC DPAA2 Device list */ - struct rte_fslmc_driver_list driver_list; - /**< FSLMC DPAA2 Driver list */ - int device_count[DPAA2_DEVTYPE_MAX]; - /**< Count of all devices scanned */ -}; - /** * Register a DPAA2 driver. * @@ -230,4 +210,4 @@ RTE_PMD_EXPORT_NAME(nm, __COUNTER__) } #endif -#endif /* _RTE_FSLMC_H_ */ +#endif /* BUS_FSLMC_DRIVER_H */ diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index e9edc27e0a..b9b0981329 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -16,7 +16,7 @@ #include <ethdev_driver.h> #include <rte_mbuf_dyn.h> -#include <rte_fslmc.h> +#include "private.h" #include <fslmc_vfio.h> #include "fslmc_logs.h" @@ -530,27 +530,19 @@ rte_fslmc_driver_register(struct rte_dpaa2_driver *driver) RTE_VERIFY(driver); TAILQ_INSERT_TAIL(&rte_fslmc_bus.driver_list, driver, next); - /* Update Bus references */ - driver->fslmc_bus = &rte_fslmc_bus; } /*un-register a fslmc bus based dpaa2 driver */ void rte_fslmc_driver_unregister(struct rte_dpaa2_driver *driver) { - struct rte_fslmc_bus *fslmc_bus; - - fslmc_bus = driver->fslmc_bus; - /* Cleanup the PA->VA Translation table; From wherever this function * is called from. */ if (rte_eal_iova_mode() == RTE_IOVA_PA) dpaax_iova_table_depopulate(); - TAILQ_REMOVE(&fslmc_bus->driver_list, driver, next); - /* Update Bus references */ - driver->fslmc_bus = NULL; + TAILQ_REMOVE(&rte_fslmc_bus.driver_list, driver, next); } /* diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 3d4e71a80a..8604e43947 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -29,10 +29,9 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_bus.h> #include <rte_eal_memconfig.h> -#include "rte_fslmc.h" +#include "private.h" #include "fslmc_vfio.h" #include "fslmc_logs.h" #include <mc/fsl_dpmng.h> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c index 122aa1740d..cfe4280f87 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c @@ -23,7 +23,7 @@ #include <rte_mbuf_pool_ops.h> #include <fslmc_logs.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <mc/fsl_dpbp.h> #include "portal/dpaa2_hw_pvt.h" #include "portal/dpaa2_hw_dpio.h" diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index 8ed969c7c0..b7d81b518c 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -21,7 +21,7 @@ #include <ethdev_driver.h> #include <fslmc_logs.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <mc/fsl_dpci.h> #include "portal/dpaa2_hw_pvt.h" #include "portal/dpaa2_hw_dpio.h" diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 22c51c1a82..071b0d297d 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -33,7 +33,7 @@ #include <rte_dev.h> #include <fslmc_logs.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include "dpaa2_hw_pvt.h" #include "dpaa2_hw_dpio.h" #include <mc/fsl_dpmng.h> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c index ca1d0304d5..223e34bcba 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c @@ -12,8 +12,8 @@ #include <rte_malloc.h> #include <rte_dev.h> +#include "private.h" #include <fslmc_logs.h> -#include <rte_fslmc.h> #include <mc/fsl_dprc.h> #include "portal/dpaa2_hw_pvt.h" diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h new file mode 100644 index 0000000000..60d68155e1 --- /dev/null +++ b/drivers/bus/fslmc/private.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2016,2021 NXP + */ + +#ifndef BUS_FSLMC_PRIVATE_H +#define BUS_FSLMC_PRIVATE_H + +#include <rte_bus.h> + +#include <bus_fslmc_driver.h> + +/* + * FSLMC bus + */ +struct rte_fslmc_bus { + struct rte_bus bus; /**< Generic Bus object */ + TAILQ_HEAD(, rte_dpaa2_device) device_list; + /**< FSLMC DPAA2 Device list */ + TAILQ_HEAD(, rte_dpaa2_driver) driver_list; + /**< FSLMC DPAA2 Driver list */ + int device_count[DPAA2_DEVTYPE_MAX]; + /**< Count of all devices scanned */ +}; + +extern struct rte_fslmc_bus rte_fslmc_bus; + +#endif /* BUS_FSLMC_PRIVATE_H */ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 8444f1a795..0cce861899 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -20,7 +20,7 @@ #include <rte_dev.h> #include <cryptodev_pmd.h> #include <rte_common.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <fslmc_vfio.h> #include <dpaa2_hw_pvt.h> #include <dpaa2_hw_dpio.h> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index e68a4875dd..b3242791ac 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -3,7 +3,7 @@ */ #include <cryptodev_pmd.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <fslmc_vfio.h> #include <dpaa2_hw_pvt.h> #include <dpaa2_hw_dpio.h> diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 0500e8c225..d5a5f08ecc 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -3,7 +3,7 @@ */ #include <rte_eal.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <rte_dmadev.h> #include <rte_dmadev_pmd.h> #include <rte_kvargs.h> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index ffc7b8b073..5de3e9e5f5 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -16,7 +16,7 @@ #include <rte_debug.h> #include <rte_dev.h> #include <rte_eal.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c index b549bdfcbb..941fb8fc43 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c +++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c @@ -19,7 +19,7 @@ #include <rte_random.h> #include <rte_bus_vdev.h> #include <rte_test.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include "dpaa2_eventdev.h" #include "dpaa2_eventdev_logs.h" diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c index acc1fde771..3882a9cf1d 100644 --- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c +++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c @@ -20,7 +20,7 @@ #include <rte_dev.h> #include <ethdev_driver.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <mc/fsl_dpcon.h> #include <portal/dpaa2_hw_pvt.h> #include "dpaa2_eventdev.h" diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 52eb6df310..f876f4790c 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -16,7 +16,7 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <rte_flow_driver.h> #include "rte_dpaa2_mempool.h" diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index a459181139..f69df95253 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -11,7 +11,7 @@ #include <rte_event_eth_rx_adapter.h> #include <rte_pmd_dpaa2.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <dpaa2_hw_pvt.h> #include "dpaa2_tm.h" diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c index e8689a7832..3289f388e1 100644 --- a/drivers/net/dpaa2/dpaa2_mux.c +++ b/drivers/net/dpaa2/dpaa2_mux.c @@ -16,7 +16,7 @@ #include <rte_flow_driver.h> #include <rte_tailq.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <fsl_dpdmux.h> #include <fsl_dpkg.h> diff --git a/drivers/net/dpaa2/dpaa2_ptp.c b/drivers/net/dpaa2/dpaa2_ptp.c index 4e6d375d1c..c08aa0f3bf 100644 --- a/drivers/net/dpaa2/dpaa2_ptp.c +++ b/drivers/net/dpaa2/dpaa2_ptp.c @@ -16,7 +16,7 @@ #include <rte_malloc.h> #include <rte_time.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <fsl_dprtc.h> #include <fsl_dpkg.h> diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c index 336506dc0d..932570c6e0 100644 --- a/drivers/net/dpaa2/dpaa2_recycle.c +++ b/drivers/net/dpaa2/dpaa2_recycle.c @@ -15,7 +15,7 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <rte_flow_driver.h> #include "dpaa2_pmd_logs.h" diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index c17f6ebda9..7b9c528d13 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -16,7 +16,7 @@ #include <rte_dev.h> #include <rte_hexdump.h> -#include <rte_fslmc.h> +#include <bus_fslmc_driver.h> #include <fslmc_vfio.h> #include <dpaa2_hw_pvt.h> #include <dpaa2_hw_dpio.h> -- 2.37.2