DPDK patches and discussions
 help / color / mirror / Atom feed
* [RFC PATCH 00/11] Bus cleanup for 22.11
@ 2022-06-28 14:46 David Marchand
  2022-06-28 14:46 ` [RFC PATCH 01/11] common/mlx5: rework check on driver registration David Marchand
                   ` (16 more replies)
  0 siblings, 17 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, kevin.laatz

This is a PoC for hiding the rte_bus object and mark associated API
as internal.

A good amount of the patches are preparation work on rte_bus.h,
rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
between them. This is something I had in store for some time, maybe I
should have dropped it from the PoC, but I think those cleanups are
worth it in any case.

The last two patches do the actual job: add accessors and make the
rte_bus object opaque to non internal users.


Disclaimer: this series is a bit rushed (I brute forced compilation
tests in GHA so that it passes between patches, but there still may be
something broken...).
Not surprisingly, the ABI check in the CI is expected to fail.

Comments welcome.

I also hope we can do the same work on other generic objects
(rte_driver, rte_device), but this is another story.


-- 
David Marchand

David Marchand (11):
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  dev: hide debug messages in device iterator
  dev: move unrelated macros from header
  devargs: remove dependency on bus header
  bus: remove unneded inclusion of bus header
  bus: move IOVA definition from header
  drivers/bus: remove back reference to bus objects
  drivers/bus: hide specific structures
  bus: introduce accessors
  bus: hide bus object

 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/config.c                         |  10 +-
 app/test-pmd/testpmd.c                        |   4 +-
 app/test-pmd/testpmd.h                        |   5 +-
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |   7 +-
 app/test/test_vdev.c                          |   1 +
 drivers/bus/auxiliary/auxiliary_common.c      |   2 -
 drivers/bus/auxiliary/linux/auxiliary.c       |   1 -
 drivers/bus/auxiliary/private.h               |  30 +-
 drivers/bus/auxiliary/rte_bus_auxiliary.h     |   5 -
 drivers/bus/dpaa/dpaa_bus.c                   |  20 +-
 drivers/bus/dpaa/rte_dpaa_bus.h               |  14 -
 drivers/bus/fslmc/fslmc_bus.c                 |  11 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   1 +
 drivers/bus/fslmc/private.h                   |  27 ++
 drivers/bus/fslmc/rte_fslmc.h                 |  21 --
 drivers/bus/ifpga/ifpga_bus.c                 |   2 +-
 drivers/bus/ifpga/ifpga_common.c              |   1 -
 drivers/bus/ifpga/rte_bus_ifpga.h             |   1 -
 drivers/bus/pci/bsd/pci.c                     |   2 -
 drivers/bus/pci/linux/pci.c                   |   3 -
 drivers/bus/pci/pci_common.c                  |   2 -
 drivers/bus/pci/private.h                     |  18 +-
 drivers/bus/pci/rte_bus_pci.h                 |  23 --
 drivers/bus/pci/windows/pci.c                 |   1 +
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/vdev.c                       |   2 +-
 drivers/bus/vdev/vdev_params.c                |   1 -
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/private.h                   |  18 ++
 drivers/bus/vmbus/rte_bus_vmbus.h             |  21 --
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  10 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/qat/qat_device.c               |   1 +
 drivers/compress/qat/qat_comp_pmd.c           |   1 +
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 .../scheduler/rte_cryptodev_scheduler.c       |   1 +
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/dma/cnxk/cnxk_dmadev.c                |   1 -
 drivers/dma/idxd/idxd_bus.c                   |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   1 +
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   3 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   1 +
 drivers/net/liquidio/lio_ethdev.c             |   1 +
 drivers/net/mlx5/linux/mlx5_os.c              |   3 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   7 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   6 -
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 examples/ethtool/lib/rte_ethtool.c            |   4 +-
 examples/ip_pipeline/kni.c                    |   3 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 lib/compressdev/rte_compressdev.c             |   2 +
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/dmadev/rte_dmadev.c                       |   1 +
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  15 +-
 lib/eal/common/eal_common_devargs.c           |  14 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   9 +-
 lib/eal/include/bus_driver.h                  | 295 ++++++++++++++++++
 lib/eal/include/meson.build                   |   4 +
 lib/eal/include/rte_bus.h                     | 290 +----------------
 lib/eal/include/rte_common.h                  |  11 +
 lib/eal/include/rte_dev.h                     |  11 -
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |   7 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   1 +
 lib/ethdev/rte_ethdev.c                       |  11 +-
 lib/mempool/rte_mempool_ops.c                 |   1 +
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/regexdev/rte_regexdev.c                   |   1 +
 lib/security/rte_security.c                   |   1 +
 lib/vhost/vdpa.c                              |   1 +
 90 files changed, 554 insertions(+), 531 deletions(-)
 create mode 100644 drivers/bus/fslmc/private.h
 create mode 100644 lib/eal/include/bus_driver.h

-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 01/11] common/mlx5: rework check on driver registration
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 02/11] raw/ifpga: remove PCI bus accessor David Marchand
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Matan Azrad, Viacheslav Ovsiienko

Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@ static struct rte_auxiliary_driver mlx5_auxiliary_driver = {
 	.dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-	if (mlx5_auxiliary_driver.bus == NULL)
+	if (!mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_register(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = true;
+	}
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-	if (mlx5_auxiliary_driver.bus != NULL)
+	if (mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = false;
+	}
 }
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 02/11] raw/ifpga: remove PCI bus accessor
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
  2022-06-28 14:46 ` [RFC PATCH 01/11] common/mlx5: rework check on driver registration David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 03/11] dev: hide debug messages in device iterator David Marchand
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Rosen Xu, Tianfei zhang,
	Ray Kinsella

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/raw/ifpga/ifpga_rawdev.c  |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h  |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h | 10 ----------
 drivers/raw/ifpga/version.map     |  1 -
 5 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index ff71a453e2..340d8eb3c7 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -10,7 +10,6 @@ DPDK_22 {
 	rte_pmd_ifpga_stop_update;
 	rte_pmd_ifpga_reboot_try;
 	rte_pmd_ifpga_reload;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_partial_reconfigure;
 	rte_pmd_ifpga_cleanup;
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 03/11] dev: hide debug messages in device iterator
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
  2022-06-28 14:46 ` [RFC PATCH 01/11] common/mlx5: rework check on driver registration David Marchand
  2022-06-28 14:46 ` [RFC PATCH 02/11] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 04/11] dev: move unrelated macros from header David Marchand
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, kevin.laatz, Aman Singh, Yuying Zhang

For any bus that does not support device iteration, rte_dev_iterator_init
both returned an error code and logged an error message.
An application (like testpmd) that only wants to list devices, would have
no choice but to inspect a bus object to avoid spewing error logs.

Make those log messages debug level, and remove the check in testpmd.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/config.c           | 4 ----
 lib/eal/common/eal_common_dev.c | 7 +++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 62833fe97c..82db14f3a6 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -612,10 +612,6 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		/* Skip buses that don't have iterate method */
-		if (!next->dev_iterate)
-			continue;
-
 		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 9d913e5478..b6f0392f30 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -592,18 +592,17 @@ rte_dev_iterator_init(struct rte_dev_iterator *it,
 	 * one layer specified.
 	 */
 	if (bus == NULL && cls == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Either bus or class must be specified.\n");
+		RTE_LOG(DEBUG, EAL, "Either bus or class must be specified.\n");
 		rte_errno = EINVAL;
 		goto get_out;
 	}
 	if (bus != NULL && bus->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Bus %s not supported\n", bus->name);
+		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", bus->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
 	if (cls != NULL && cls->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Class %s not supported\n", cls->name);
+		RTE_LOG(DEBUG, EAL, "Class %s not supported\n", cls->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 04/11] dev: move unrelated macros from header
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (2 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 03/11] dev: hide debug messages in device iterator David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 05/11] devargs: remove dependency on bus header David Marchand
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Fan Zhang, Ashish Gupta,
	Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Chengwen Feng, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz, Ori Kam, Akhil Goyal,
	Maxime Coquelin, Chenbo Xia

RTE_FUNC_PTR_OR_* macros have nothing to do with the rte_device object
and associated API.
Move them to rte_common.h and include it where needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/qat/qat_device.c                    |  1 +
 drivers/compress/qat/qat_comp_pmd.c                |  1 +
 drivers/crypto/scheduler/rte_cryptodev_scheduler.c |  1 +
 drivers/net/ixgbe/rte_pmd_ixgbe.c                  |  1 +
 drivers/net/liquidio/lio_ethdev.c                  |  1 +
 lib/compressdev/rte_compressdev.c                  |  1 +
 lib/dmadev/rte_dmadev.c                            |  1 +
 lib/eal/include/rte_common.h                       | 11 +++++++++++
 lib/eal/include/rte_dev.h                          | 11 -----------
 lib/ethdev/ethdev_driver.c                         |  1 +
 lib/ethdev/ethdev_pci.h                            |  1 +
 lib/mempool/rte_mempool_ops.c                      |  1 +
 lib/regexdev/rte_regexdev.c                        |  1 +
 lib/security/rte_security.c                        |  1 +
 lib/vhost/vdpa.c                                   |  1 +
 15 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index db4b087d2b..6583cf0554 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2018-2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_devargs.h>
 #include <ctype.h>
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index dc8db84a68..e4cac159be 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2015-2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_malloc.h>
 
 #include "qat_comp.h"
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 1e0c4fe464..88c9b21cd8 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Intel Corporation
  */
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_reorder.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f8575f..8ae4d9b39a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2017 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <ethdev_driver.h>
 
 #include "base/ixgbe_api.h"
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 90ffe31b9f..ccbd0ff849 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017 Cavium, Inc
  */
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 22c438f2dd..12469042f7 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <inttypes.h>
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_eal.h>
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..e199b888c8 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -5,6 +5,7 @@
 
 #include <inttypes.h>
 
+#include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index a96cc2a138..1617b5ed14 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -861,6 +861,17 @@ rte_log2_u64(uint64_t v)
 /** Number of elements in the array. */
 #define	RTE_DIM(a)	(sizeof (a) / sizeof ((a)[0]))
 
+/* Macros to check for invalid function pointers */
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+	if ((func) == NULL) \
+		return retval; \
+} while (0)
+
+#define RTE_FUNC_PTR_OR_RET(func) do { \
+	if ((func) == NULL) \
+		return; \
+} while (0)
+
 /**
  * Converts a numeric string to the equivalent uint64_t value.
  * As well as straight number conversion, also recognises the suffixes
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index e6ff1218f9..24f9122558 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -36,17 +36,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					enum rte_dev_event_type event,
 					void *cb_arg);
 
-/* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
-	if ((func) == NULL) \
-		return retval; \
-} while (0)
-
-#define RTE_FUNC_PTR_OR_RET(func) do { \
-	if ((func) == NULL) \
-		return; \
-} while (0)
-
 /**
  * Device policies.
  */
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
index a285f213f0..86f5a37874 100644
--- a/lib/ethdev/ethdev_driver.c
+++ b/lib/ethdev/ethdev_driver.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 0549842709..b4bb460dcb 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -10,6 +10,7 @@
 extern "C" {
 #endif
 
+#include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 2d36dee8f0..d60235a7e3 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
index 02a388bc5d..aa57ab5bfa 100644
--- a/lib/regexdev/rte_regexdev.c
+++ b/lib/regexdev/rte_regexdev.c
@@ -5,6 +5,7 @@
 
 #include <string.h>
 
+#include <rte_common.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
 
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..046b6496d2 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -4,6 +4,7 @@
  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
  */
 
+#include <rte_common.h>
 #include <rte_cryptodev.h>
 #include <rte_dev.h>
 #include <rte_telemetry.h>
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index 8fa2153023..3597fe897d 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <rte_common.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 05/11] devargs: remove dependency on bus header
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (3 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 04/11] dev: move unrelated macros from header David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 06/11] bus: remove unneeded inclusion of " David Marchand
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, kevin.laatz

We don't need to include rte_bus.h.
Only a forward declaration of rte_bus and an inclusion of rte_dev.h are
needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_vdev.c          | 1 +
 lib/eal/include/rte_devargs.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 720722c363..5eeff3106d 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/lib/eal/include/rte_devargs.h b/lib/eal/include/rte_devargs.h
index 37a0f042ab..38dee2f288 100644
--- a/lib/eal/include/rte_devargs.h
+++ b/lib/eal/include/rte_devargs.h
@@ -22,7 +22,9 @@ extern "C" {
 
 #include <stdio.h>
 #include <rte_compat.h>
-#include <rte_bus.h>
+#include <rte_dev.h>
+
+struct rte_bus;
 
 /**
  * Bus type key in global devargs syntax.
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 06/11] bus: remove unneeded inclusion of bus header
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (4 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 05/11] devargs: remove dependency on bus header David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 07/11] bus: move IOVA definition from header David Marchand
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Parav Pandit, Xueming Li,
	Rosen Xu, Stephen Hemminger, Long Li, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru

Those files don't need to include rte_bus.h.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/auxiliary/linux/auxiliary.c | 1 -
 drivers/bus/ifpga/ifpga_common.c        | 1 -
 drivers/bus/ifpga/rte_bus_ifpga.h       | 1 -
 drivers/bus/vdev/vdev_params.c          | 1 -
 drivers/bus/vmbus/linux/vmbus_uio.c     | 1 -
 drivers/bus/vmbus/vmbus_bufring.c       | 1 -
 drivers/bus/vmbus/vmbus_channel.c       | 1 -
 drivers/bus/vmbus/vmbus_common_uio.c    | 1 -
 drivers/crypto/virtio/virtio_pci.c      | 1 -
 drivers/dma/cnxk/cnxk_dmadev.c          | 1 -
 10 files changed, 10 deletions(-)

diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index 9bd4ee3295..28092e31c4 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -6,7 +6,6 @@
 #include <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c
index 78e2eaee4e..223660d6ff 100644
--- a/drivers/bus/ifpga/ifpga_common.c
+++ b/drivers/bus/ifpga/ifpga_common.c
@@ -14,7 +14,6 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/rte_bus_ifpga.h
index 007ad19875..682d565891 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/rte_bus_ifpga.h
@@ -15,7 +15,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 3969faf16d..2c72614776 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -5,7 +5,6 @@
 #include <string.h>
 
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5db70f8e0d..26edef342d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -13,7 +13,6 @@
 
 #include <rte_eal.h>
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_memory.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
diff --git a/drivers/bus/vmbus/vmbus_bufring.c b/drivers/bus/vmbus/vmbus_bufring.c
index c4aa07b307..c78619dc44 100644
--- a/drivers/bus/vmbus/vmbus_bufring.c
+++ b/drivers/bus/vmbus/vmbus_bufring.c
@@ -15,7 +15,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_pause.h>
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 119b9b367e..8d9f32270e 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -12,7 +12,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 882a24f869..4d4613513c 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -13,7 +13,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_bus_vmbus.h>
 
 #include "private.h"
diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c
index ae069794a6..95a43c8801 100644
--- a/drivers/crypto/virtio/virtio_pci.c
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -10,7 +10,6 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
 
 #include "virtio_pci.h"
 #include "virtqueue.h"
diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c
index 2824c1b44f..3e8c15d617 100644
--- a/drivers/dma/cnxk/cnxk_dmadev.c
+++ b/drivers/dma/cnxk/cnxk_dmadev.c
@@ -5,7 +5,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_eal.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 07/11] bus: move IOVA definition from header
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (5 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 06/11] bus: remove unneeded inclusion of " David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 08/11] drivers/bus: remove back reference to bus objects David Marchand
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Stephen Hemminger,
	Long Li, Sunila Sahu, Fan Zhang, Ashish Gupta, Gaetan Rivet,
	Anatoly Burakov, Akhil Goyal, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

iova enum definition does not need to be defined as part of the bus API.
Move it to rte_eal.h.
With this step, rte_eal.h does not depend on rte_bus.h and rte_dev.h.
Fix existing code that was relying on these implicit inclusions.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-compress-perf/comp_perf_options.h   |  2 ++
 drivers/bus/vmbus/rte_bus_vmbus.h            |  1 +
 drivers/compress/zlib/zlib_pmd_ops.c         |  1 +
 drivers/net/failsafe/failsafe.c              |  1 +
 drivers/net/failsafe/failsafe_eal.c          |  1 +
 examples/multi_process/hotplug_mp/commands.c |  2 ++
 lib/compressdev/rte_compressdev.c            |  1 +
 lib/compressdev/rte_compressdev_pmd.c        |  1 +
 lib/cryptodev/cryptodev_pmd.c                |  2 ++
 lib/eal/common/eal_thread.h                  |  1 +
 lib/eal/common/hotplug_mp.c                  |  1 +
 lib/eal/include/rte_bus.h                    | 18 ++----------------
 lib/eal/include/rte_eal.h                    | 15 ++++++++++++++-
 lib/eal/include/rte_lcore.h                  |  2 ++
 lib/eal/windows/eal.c                        |  1 +
 lib/ethdev/rte_ethdev.c                      |  1 +
 lib/pcapng/rte_pcapng.c                      |  1 +
 17 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0b777521c5..57dd146330 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -5,6 +5,8 @@
 #ifndef _COMP_PERF_OPS_
 #define _COMP_PERF_OPS_
 
+#include <rte_dev.h>
+
 #define MAX_LIST		32
 #define MIN_COMPRESSED_BUF_SIZE 8
 #define EXPANSE_RATIO 1.1
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index a24bad831d..4421326fe8 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -23,6 +23,7 @@ extern "C" {
 #include <stdint.h>
 #include <inttypes.h>
 
+#include <rte_bus.h>
 #include <rte_compat.h>
 #include <rte_uuid.h>
 #include <rte_debug.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 0a73aed949..7d657d81bc 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_dev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 05cf533896..3eb7d32b76 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,6 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index cb4a2abc02..130344dce2 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,6 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
+#include <rte_bus.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index 41ea265e45..da8b5e5924 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -8,6 +8,8 @@
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
 #include <cmdline.h>
+
+#include <rte_bus.h>
 #include <rte_ethdev.h>
 
 /**********************************************************/
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 12469042f7..7f6dedbc52 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -9,6 +9,7 @@
 #include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 7f500d76d4..9bfae077db 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,6 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 1903ade388..75d0075b86 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -3,6 +3,8 @@
  */
 
 #include <sys/queue.h>
+
+#include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/eal/common/eal_thread.h b/lib/eal/common/eal_thread.h
index ca3378d463..e0240ccc60 100644
--- a/lib/eal/common/eal_thread.h
+++ b/lib/eal/common/eal_thread.h
@@ -5,6 +5,7 @@
 #ifndef EAL_THREAD_H
 #define EAL_THREAD_H
 
+#include <rte_common.h>
 #include <rte_lcore.h>
 
 /**
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index bde0de196e..1614a57752 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,6 +3,7 @@
  */
 #include <string.h>
 
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index bbbb6efd28..17edaa37c9 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,27 +20,13 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_log.h>
 #include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_log.h>
 
 /** Double linked list of buses */
 RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
 
-
-/**
- * IOVA mapping mode.
- *
- * IOVA mapping mode is iommu programming mode of a device.
- * That device (for example: IOMMU backed DMA device) based
- * on rte_iova_mode will generate physical or virtual address.
- *
- */
-enum rte_iova_mode {
-	RTE_IOVA_DC = 0,	/* Don't care mode */
-	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
-	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
-};
-
 /**
  * Bus specific scan for devices attached on the bus.
  * For each bus object, the scan would be responsible for finding devices and
diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h
index 5dfc50e987..fd3d7c1da8 100644
--- a/lib/eal/include/rte_eal.h
+++ b/lib/eal/include/rte_eal.h
@@ -17,7 +17,6 @@
 #include <rte_config.h>
 #include <rte_compat.h>
 #include <rte_per_lcore.h>
-#include <rte_bus.h>
 #include <rte_uuid.h>
 
 #include <rte_pci_dev_feature_defs.h>
@@ -458,6 +457,20 @@ static inline int rte_gettid(void)
 __rte_internal
 uint64_t rte_eal_get_baseaddr(void);
 
+/**
+ * IOVA mapping mode.
+ *
+ * IOVA mapping mode is iommu programming mode of a device.
+ * That device (for example: IOMMU backed DMA device) based
+ * on rte_iova_mode will generate physical or virtual address.
+ *
+ */
+enum rte_iova_mode {
+	RTE_IOVA_DC = 0,	/* Don't care mode */
+	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
+	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
+};
+
 /**
  * Get the iova mode
  *
diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h
index b598e1b9ec..4d3978512c 100644
--- a/lib/eal/include/rte_lcore.h
+++ b/lib/eal/include/rte_lcore.h
@@ -11,6 +11,8 @@
  * API for lcore and socket manipulation
  *
  */
+#include <stdio.h>
+
 #include <rte_config.h>
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index 122de2a319..79322d2ce9 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 
 #include <rte_debug.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <eal_memcfg.h>
 #include <rte_errno.h>
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0850..ebbe8cca3d 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
+#include <rte_bus.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 06ad712bd1..5b079cd14a 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,6 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <rte_bus.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 08/11] drivers/bus: remove back reference to bus objects
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (6 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 07/11] bus: move IOVA definition from header David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 09/11] drivers/bus: hide specific structures David Marchand
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Stephen Hemminger, Long Li

There is no need for a back reference to a singleton object in the bus
driver objects: each function is contextually aware of which bus object
it should manipulate.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/auxiliary/auxiliary_common.c  |  2 --
 drivers/bus/auxiliary/rte_bus_auxiliary.h |  2 --
 drivers/bus/dpaa/dpaa_bus.c               | 10 +---------
 drivers/bus/dpaa/rte_dpaa_bus.h           |  1 -
 drivers/bus/fslmc/fslmc_bus.c             | 10 +---------
 drivers/bus/fslmc/rte_fslmc.h             |  1 -
 drivers/bus/pci/pci_common.c              |  2 --
 drivers/bus/pci/rte_bus_pci.h             |  1 -
 drivers/bus/vmbus/rte_bus_vmbus.h         |  2 --
 drivers/bus/vmbus/vmbus_common.c          |  2 --
 10 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 2cf8fe672d..0b212f2d64 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -259,7 +259,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 +266,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/rte_bus_auxiliary.h b/drivers/bus/auxiliary/rte_bus_auxiliary.h
index 93b266daf7..b19696e5e6 100644
--- a/drivers/bus/auxiliary/rte_bus_auxiliary.h
+++ b/drivers/bus/auxiliary/rte_bus_auxiliary.h
@@ -32,7 +32,6 @@ extern "C" {
 
 /* Forward declarations */
 struct rte_auxiliary_driver;
-struct rte_auxiliary_bus;
 struct rte_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. */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e442bc4c33..2c286d5817 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -520,23 +520,15 @@ rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
 	BUS_INIT_FUNC_TRACE();
 
 	TAILQ_INSERT_TAIL(&rte_dpaa_bus.driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = &rte_dpaa_bus;
 }
 
 /* un-register a dpaa bus based dpaa driver */
 void
 rte_dpaa_driver_unregister(struct rte_dpaa_driver *driver)
 {
-	struct rte_dpaa_bus *dpaa_bus;
-
 	BUS_INIT_FUNC_TRACE();
 
-	dpaa_bus = driver->dpaa_bus;
-
-	TAILQ_REMOVE(&dpaa_bus->driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = NULL;
+	TAILQ_REMOVE(&rte_dpaa_bus.driver_list, driver, next);
 }
 
 static int
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index 1f04d9ebd3..5e8f32dfbf 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -119,7 +119,6 @@ typedef int (*rte_dpaa_remove_t)(struct rte_dpaa_device *dpaa_dev);
 struct rte_dpaa_driver {
 	TAILQ_ENTRY(rte_dpaa_driver) next;
 	struct rte_driver driver;
-	struct rte_dpaa_bus *dpaa_bus;
 	enum rte_dpaa_type drv_type;
 	rte_dpaa_probe_t probe;
 	rte_dpaa_remove_t remove;
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index e9edc27e0a..f112d2afeb 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -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/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index 8c67bfba55..9c3791635c 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -146,7 +146,6 @@ 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;
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 37ab879779..0d61d49287 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -443,7 +443,6 @@ void
 rte_pci_register(struct rte_pci_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = &rte_pci_bus;
 }
 
 /* unregister a driver */
@@ -451,7 +450,6 @@ void
 rte_pci_unregister(struct rte_pci_driver *driver)
 {
 	TAILQ_REMOVE(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to PCI bus */
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1c6a8fdd7b..1913bc111c 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -161,7 +161,6 @@ typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
 struct rte_pci_driver {
 	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
 	struct rte_driver driver;          /**< Inherit core driver. */
-	struct rte_pci_bus *bus;           /**< PCI bus reference. */
 	rte_pci_probe_t *probe;            /**< Device probe function. */
 	rte_pci_remove_t *remove;          /**< Device remove function. */
 	pci_dma_map_t *dma_map;		   /**< device dma map function. */
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 4421326fe8..8d6ba26028 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -34,7 +34,6 @@ extern "C" {
 /* Forward declarations */
 struct rte_vmbus_device;
 struct rte_vmbus_driver;
-struct rte_vmbus_bus;
 struct vmbus_channel;
 struct vmbus_mon_page;
 
@@ -95,7 +94,6 @@ typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
 struct rte_vmbus_driver {
 	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
 	struct rte_driver driver;
-	struct rte_vmbus_bus *bus;          /**< VM bus reference. */
 	vmbus_probe_t *probe;               /**< Device Probe function. */
 	vmbus_remove_t *remove;             /**< Device Remove function. */
 
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..0f2d878126 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -235,7 +235,6 @@ rte_vmbus_register(struct rte_vmbus_driver *driver)
 		"Registered driver %s", driver->driver.name);
 
 	TAILQ_INSERT_TAIL(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = &rte_vmbus_bus;
 }
 
 /* unregister vmbus driver */
@@ -243,7 +242,6 @@ void
 rte_vmbus_unregister(struct rte_vmbus_driver *driver)
 {
 	TAILQ_REMOVE(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to VMBUS bus */
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 09/11] drivers/bus: hide specific structures
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (7 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 08/11] drivers/bus: remove back reference to bus objects David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 10/11] bus: introduce accessors David Marchand
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Aman Singh, Yuying Zhang,
	Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena,
	Stephen Hemminger, Long Li, Matan Azrad, Viacheslav Ovsiienko,
	Chas Williams, Min Hu (Connor),
	Cristian Dumitrescu

Now that there is no bus specific object referenced in the driver
objects, we can hide rte_dpaa_bus, rte_fslmc_bus, rte_pci_bus,
rte_vmbus_bus specific structures into their bus code.

While at it:
- move enumerators only used in the bus code itself,
- 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.marchand@redhat.com>
---
 app/test-pmd/testpmd.h                    |  1 +
 app/test/test_kni.c                       |  1 +
 drivers/bus/auxiliary/private.h           | 30 +++++++++++------------
 drivers/bus/auxiliary/rte_bus_auxiliary.h |  3 ---
 drivers/bus/dpaa/dpaa_bus.c               |  8 ++++++
 drivers/bus/dpaa/rte_dpaa_bus.h           | 13 ----------
 drivers/bus/fslmc/fslmc_bus.c             |  1 +
 drivers/bus/fslmc/fslmc_vfio.c            |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c  |  1 +
 drivers/bus/fslmc/private.h               | 27 ++++++++++++++++++++
 drivers/bus/fslmc/rte_fslmc.h             | 20 ---------------
 drivers/bus/pci/bsd/pci.c                 |  2 --
 drivers/bus/pci/linux/pci.c               |  3 ---
 drivers/bus/pci/private.h                 | 18 +++++++++++++-
 drivers/bus/pci/rte_bus_pci.h             | 22 -----------------
 drivers/bus/pci/windows/pci.c             |  1 +
 drivers/bus/pci/windows/pci_netuio.c      |  1 +
 drivers/bus/vmbus/private.h               | 18 ++++++++++++++
 drivers/bus/vmbus/rte_bus_vmbus.h         | 20 ---------------
 drivers/bus/vmbus/vmbus_common.c          |  1 -
 drivers/common/mlx5/mlx5_common_pci.c     |  1 +
 drivers/net/bonding/rte_eth_bond_args.c   |  1 +
 drivers/net/mlx5/linux/mlx5_os.c          |  1 +
 drivers/net/netvsc/hn_ethdev.c            |  1 +
 examples/ethtool/lib/rte_ethtool.c        |  1 +
 examples/ip_pipeline/kni.c                |  1 +
 26 files changed, 98 insertions(+), 101 deletions(-)
 create mode 100644 drivers/bus/fslmc/private.h

diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index eeefb5e70f..34bdccef71 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -8,6 +8,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 622315c8b1..9d76b6253e 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -25,6 +25,7 @@ test_kni(void)
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index d22e83cf7a..06a920114c 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,9 +9,10 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
+#include <rte_bus.h>
+
 #include "rte_bus_auxiliary.h"
 
-extern struct rte_auxiliary_bus auxiliary_bus;
 extern int auxiliary_bus_logtype;
 
 #define AUXILIARY_LOG(level, ...) \
@@ -19,27 +20,26 @@ 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 */
 };
 
+#define RTE_BUS_AUXILIARY_NAME "auxiliary"
+
+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/rte_bus_auxiliary.h b/drivers/bus/auxiliary/rte_bus_auxiliary.h
index b19696e5e6..23eefe2360 100644
--- a/drivers/bus/auxiliary/rte_bus_auxiliary.h
+++ b/drivers/bus/auxiliary/rte_bus_auxiliary.h
@@ -25,11 +25,8 @@ extern "C" {
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 
-#define RTE_BUS_AUXILIARY_NAME "auxiliary"
-
 /* Forward declarations */
 struct rte_auxiliary_driver;
 struct rte_auxiliary_device;
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 2c286d5817..ad4ea156a6 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -43,6 +43,14 @@
 #include <fsl_bman.h>
 #include <netcfg.h>
 
+struct rte_dpaa_bus {
+	struct rte_bus bus;
+	TAILQ_HEAD(, rte_dpaa_device) device_list;
+	TAILQ_HEAD(, rte_dpaa_driver) driver_list;
+	int device_count;
+	int detected;
+};
+
 static struct rte_dpaa_bus rte_dpaa_bus;
 struct netcfg_info *dpaa_netcfg;
 
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index 5e8f32dfbf..69c759c68b 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -6,7 +6,6 @@
 #ifndef __RTE_DPAA_BUS_H__
 #define __RTE_DPAA_BUS_H__
 
-#include <rte_bus.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 #include <dpaax_iova_table.h>
@@ -73,24 +72,12 @@ extern unsigned int dpaa_svr_family;
 struct rte_dpaa_device;
 struct rte_dpaa_driver;
 
-/* DPAA Device and Driver lists for DPAA bus */
-TAILQ_HEAD(rte_dpaa_device_list, rte_dpaa_device);
-TAILQ_HEAD(rte_dpaa_driver_list, rte_dpaa_driver);
-
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
 	FSL_DPAA_QDMA
 };
 
-struct rte_dpaa_bus {
-	struct rte_bus bus;
-	struct rte_dpaa_device_list device_list;
-	struct rte_dpaa_driver_list driver_list;
-	int device_count;
-	int detected;
-};
-
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index f112d2afeb..8498f5321a 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -16,6 +16,7 @@
 #include <ethdev_driver.h>
 #include <rte_mbuf_dyn.h>
 
+#include "private.h"
 #include <rte_fslmc.h>
 #include <fslmc_vfio.h>
 #include "fslmc_logs.h"
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 3d4e71a80a..b172c84d52 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -29,9 +29,9 @@
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_eal_memconfig.h>
 
+#include "private.h"
 #include "rte_fslmc.h"
 #include "fslmc_vfio.h"
 #include "fslmc_logs.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index ca1d0304d5..28780717bd 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -12,6 +12,7 @@
 #include <rte_malloc.h>
 #include <rte_dev.h>
 
+#include "private.h"
 #include <fslmc_logs.h>
 #include <rte_fslmc.h>
 #include <mc/fsl_dprc.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
new file mode 100644
index 0000000000..80d4673ca8
--- /dev/null
+++ b/drivers/bus/fslmc/private.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ *   Copyright 2016,2021 NXP
+ */
+
+#ifndef __PRIVATE_H__
+#define __PRIVATE_H__
+
+#include <rte_bus.h>
+
+#include <rte_fslmc.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 /* __PRIVATE_H__ */
diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index 9c3791635c..6bdee86aaf 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -29,7 +29,6 @@ extern "C" {
 #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 +68,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*/
@@ -152,19 +145,6 @@ struct rte_dpaa2_driver {
 	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.
  *
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 9a11f99ae3..bcd772427b 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -48,8 +48,6 @@
  * PCI probing under BSD.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /* Map pci device */
 int
 rte_pci_map_device(struct rte_pci_device *dev)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index e521459870..fa5d5e131d 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -6,7 +6,6 @@
 #include <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_malloc.h>
@@ -24,8 +23,6 @@
  * PCI probing using Linux sysfs.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 static int
 pci_get_kernel_driver_by_path(const char *filename, char *dri_name,
 			      size_t len)
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 0fbef8e1d8..6ccec15655 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,12 +8,28 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
+/**
+ * Structure describing the PCI bus
+ */
+struct rte_pci_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_pci_device) device_list; /**< List of PCI devices */
+	RTE_TAILQ_HEAD(, rte_pci_driver) driver_list; /**< List of PCI drivers */
+};
+
 extern struct rte_pci_bus rte_pci_bus;
 
+/* PCI Bus iterators */
+#define FOREACH_DEVICE_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+
 struct rte_pci_driver;
 struct rte_pci_device;
 
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1913bc111c..01d834e3cc 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -25,7 +25,6 @@ extern "C" {
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 
 /** Pathname of PCI devices directory. */
@@ -35,18 +34,6 @@ const char *rte_pci_get_sysfs_path(void);
 struct rte_pci_device;
 struct rte_pci_driver;
 
-/** List of PCI devices */
-RTE_TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
-/** List of PCI drivers */
-RTE_TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
-
-/* PCI Bus iterators */
-#define FOREACH_DEVICE_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
-
 struct rte_devargs;
 
 enum rte_pci_kernel_driver {
@@ -169,15 +156,6 @@ struct rte_pci_driver {
 	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
 };
 
-/**
- * Structure describing the PCI bus
- */
-struct rte_pci_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_pci_device_list device_list;  /**< List of PCI devices */
-	struct rte_pci_driver_list driver_list;  /**< List of PCI drivers */
-};
-
 /** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
 #define RTE_PCI_DRV_NEED_MAPPING 0x0001
 /** Device needs PCI BAR mapping with enabled write combining (wc) */
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 7bf091158b..f013b743b3 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -9,6 +9,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_bus_pci.h>
 
 #include "private.h"
 #include "pci_netuio.h"
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index 5460399eea..314bbcf547 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 #include <rte_log.h>
 #include <rte_eal.h>
+#include <rte_bus_pci.h>
 
 #ifdef __MINGW32__
 #include <ddk/ndisguid.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 1bca147e12..732cb6d583 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -8,13 +8,31 @@
 
 #include <stdbool.h>
 #include <sys/uio.h>
+
+#include <rte_bus.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
 #include <rte_bus_vmbus.h>
 
+/**
+ * Structure describing the VM bus
+ */
+struct rte_vmbus_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_vmbus_device) device_list; /**< List of devices */
+	RTE_TAILQ_HEAD(, rte_vmbus_driver) driver_list; /**< List of drivers */
+};
+
 extern struct rte_vmbus_bus rte_vmbus_bus;
 
+/* VMBus iterators */
+#define FOREACH_DEVICE_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
+
 extern int vmbus_logtype_bus;
 #define VMBUS_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 8d6ba26028..763c077623 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -23,7 +23,6 @@ extern "C" {
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_bus.h>
 #include <rte_compat.h>
 #include <rte_uuid.h>
 #include <rte_debug.h>
@@ -37,16 +36,6 @@ struct rte_vmbus_driver;
 struct vmbus_channel;
 struct vmbus_mon_page;
 
-RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
-RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
-
-/* VMBus iterators */
-#define FOREACH_DEVICE_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
-
 /** Maximum number of VMBUS resources. */
 enum hv_uio_map {
 	HV_TXRX_RING_MAP = 0,
@@ -101,15 +90,6 @@ struct rte_vmbus_driver {
 };
 
 
-/**
- * Structure describing the VM bus
- */
-struct rte_vmbus_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_vmbus_device_list device_list;  /**< List of devices */
-	struct rte_vmbus_driver_list driver_list;  /**< List of drivers */
-};
-
 /**
  * Scan the content of the VMBUS bus, and the devices in the devices
  * list
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 0f2d878126..03b39c82b7 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -11,7 +11,6 @@
 #include <sys/mman.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 66626953f1..e708e23a7f 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,6 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 5406e1c934..b90757756a 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,6 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 0741028dab..04b9614f5c 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,6 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_bus_auxiliary.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 0a357d3645..93ee4a6e86 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,6 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
+#include <rte_bus.h>
 #include <rte_bus_vmbus.h>
 #include <rte_alarm.h>
 
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index ffaad96498..62f6de84d5 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -8,6 +8,7 @@
 #include <rte_version.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #ifdef RTE_NET_IXGBE
 #include <rte_pmd_ixgbe.h>
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index a2d3331cb0..270b961bba 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -6,6 +6,7 @@
 #include <string.h>
 
 #include <rte_ethdev.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_string_fns.h>
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 10/11] bus: introduce accessors
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (8 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 09/11] drivers/bus: hide specific structures David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 14:46 ` [RFC PATCH 11/11] bus: hide bus object David Marchand
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Aman Singh, Yuying Zhang,
	Matan Azrad, Viacheslav Ovsiienko, Gaetan Rivet,
	Stephen Hemminger, Long Li, Cristian Dumitrescu, Anatoly Burakov,
	Ray Kinsella, Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

Prepare for making the bus object opaque by adding one accessor.
Update existing users.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/config.c                        |  6 ++---
 app/test-pmd/testpmd.c                       |  4 +--
 app/test-pmd/testpmd.h                       |  4 +--
 app/test/test_devargs.c                      |  4 +--
 app/test/test_kni.c                          |  6 ++---
 drivers/common/mlx5/mlx5_common_pci.c        |  2 +-
 drivers/net/failsafe/failsafe.c              |  2 +-
 drivers/net/failsafe/failsafe_eal.c          |  2 +-
 drivers/net/mlx5/linux/mlx5_os.c             |  2 +-
 drivers/net/netvsc/hn_ethdev.c               |  4 +--
 examples/ethtool/lib/rte_ethtool.c           |  3 ++-
 examples/ip_pipeline/kni.c                   |  2 +-
 examples/multi_process/hotplug_mp/commands.c |  4 +--
 lib/eal/common/eal_common_bus.c              | 26 ++++++++++++--------
 lib/eal/common/eal_common_dev.c              |  8 +++---
 lib/eal/common/eal_common_devargs.c          | 12 ++++-----
 lib/eal/common/hotplug_mp.c                  |  8 +++---
 lib/eal/include/rte_bus.h                    | 13 ++++++++++
 lib/eal/version.map                          |  3 +++
 lib/ethdev/rte_ethdev.c                      | 10 ++++----
 lib/pcapng/rte_pcapng.c                      |  2 +-
 21 files changed, 75 insertions(+), 52 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 82db14f3a6..3c027701e3 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -612,7 +612,7 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
+		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
 			if (!dev->driver)
@@ -623,7 +623,7 @@ device_infos_display(const char *identifier)
 				continue;
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
-			printf("Bus name: %s", dev->bus->name);
+			printf("Bus name: %s", rte_bus_name(dev->bus));
 			printf("\nDriver name: %s", dev->driver->name);
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
@@ -1076,7 +1076,7 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
 	}
 
 	bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
 	} else {
 		fprintf(stderr, "Not a PCI device\n");
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index addcbcac85..51c2488b45 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3507,9 +3507,9 @@ detach_devargs(char *identifier)
 		}
 	}
 
-	if (rte_eal_hotplug_remove(da.bus->name, da.name) != 0) {
+	if (rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name) != 0) {
 		TESTPMD_LOG(ERR, "Failed to detach device %s(%s)\n",
-			    da.name, da.bus->name);
+			    da.name, rte_bus_name(da.bus));
 		rte_devargs_reset(&da);
 		return;
 	}
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 34bdccef71..ea242de34c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -817,7 +817,7 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
 	}
 
 	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
 	} else {
 		fprintf(stderr, "Not a PCI device\n");
@@ -845,7 +845,7 @@ port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
 	}
 
 	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
 	} else {
 		fprintf(stderr, "Not a PCI device\n");
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 16621285d2..ac5bc34c18 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -98,9 +98,9 @@ test_valid_devargs_cases(const struct devargs_case *list, size_t n)
 			      list[i].bus_kv) != 0)
 			goto fail;
 		if (list[i].bus != NULL &&
-		    strcmp(da.bus->name, list[i].bus) != 0) {
+		    strcmp(rte_bus_name(da.bus), list[i].bus) != 0) {
 			printf("rte_devargs_parse(%s) bus name (%s) not expected (%s)\n",
-			       list[i].devargs, da.bus->name, list[i].bus);
+			       list[i].devargs, rte_bus_name(da.bus), list[i].bus);
 			goto fail;
 		}
 		if ((list[i].class_kv > 0 || list[i].class != NULL) &&
diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 9d76b6253e..524af31e01 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -446,7 +446,7 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 
 	if (info.device)
 		bus = rte_bus_find_by_device(info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(info.device);
 		conf.addr = pci_dev->addr;
 		conf.id = pci_dev->id;
@@ -650,7 +650,7 @@ test_kni(void)
 		bus = rte_bus_find_by_device(info.device);
 	else
 		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(info.device);
 		conf.addr = pci_dev->addr;
 		conf.id = pci_dev->id;
@@ -694,7 +694,7 @@ test_kni(void)
 		bus = rte_bus_find_by_device(info.device);
 	else
 		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(info.device);
 		conf.addr = pci_dev->addr;
 		conf.id = pci_dev->id;
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e708e23a7f..578bd0a9b5 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -105,7 +105,7 @@ pci_ids_table_update(const struct rte_pci_id *driver_id_table)
 bool
 mlx5_dev_is_pci(const struct rte_device *dev)
 {
-	return strcmp(dev->bus->name, "pci") == 0;
+	return strcmp(rte_bus_name(dev->bus), "pci") == 0;
 }
 
 bool
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 3eb7d32b76..f69bb42add 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -319,7 +319,7 @@ devargs_already_listed(struct rte_devargs *devargs)
 {
 	struct rte_devargs *list_da;
 
-	RTE_EAL_DEVARGS_FOREACH(devargs->bus->name, list_da) {
+	RTE_EAL_DEVARGS_FOREACH(rte_bus_name(devargs->bus), list_da) {
 		if (strcmp(list_da->name, devargs->name) == 0)
 			/* devargs already in the list */
 			return true;
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..fe5acdc1b6 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -46,7 +46,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 		if (fs_ethdev_portid_get(da->name, &pid) != 0) {
 			struct rte_eth_dev_owner pid_owner;
 
-			ret = rte_eal_hotplug_add(da->bus->name,
+			ret = rte_eal_hotplug_add(rte_bus_name(da->bus),
 						  da->name,
 						  da->args);
 			if (ret < 0) {
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 04b9614f5c..4baa4c766e 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1191,7 +1191,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 
 	DRV_LOG(DEBUG,
 		"dev_port=%u bus=%s pci=%s master=%d representor=%d pf_bond=%d\n",
-		priv->dev_port, dpdk_dev->bus->name,
+		priv->dev_port, rte_bus_name(dpdk_dev->bus),
 		priv->pci_dev ? priv->pci_dev->name : "NONE",
 		priv->master, priv->representor, priv->pf_bond);
 
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 93ee4a6e86..8070880c06 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -620,7 +620,7 @@ static void netvsc_hotplug_retry(void *args)
 			/* If this device has been hot removed from this
 			 * parent device, restore its args.
 			 */
-			ret = rte_eal_hotplug_add(d->bus->name, d->name,
+			ret = rte_eal_hotplug_add(rte_bus_name(d->bus), d->name,
 						  hv->vf_devargs ?
 						  hv->vf_devargs : "");
 			if (ret) {
@@ -686,7 +686,7 @@ netvsc_hotadd_callback(const char *device_name, enum rte_dev_event_type type,
 			goto free_ctx;
 		}
 
-		if (!strcmp(d->bus->name, "pci")) {
+		if (!strcmp(rte_bus_name(d->bus), "pci")) {
 			/* Start the process of figuring out if this
 			 * PCI device is a VF device
 			 */
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 62f6de84d5..4034a241aa 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
+
 #include <rte_string_fns.h>
 #include <rte_version.h>
 #include <rte_ethdev.h>
@@ -56,7 +57,7 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	/* TODO: replace bus_info by rte_devargs.name */
 	if (dev_info.device)
 		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
 		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
 			"%04x:%02x:%02x.%x",
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index 270b961bba..5778a6440e 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -137,7 +137,7 @@ kni_create(const char *name, struct kni_params *params)
 	kni_conf.mbuf_size = mempool->buffer_size;
 	if (dev_info.device)
 		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
 		kni_conf.addr = pci_dev->addr;
 		kni_conf.id = pci_dev->id;
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index da8b5e5924..88f44e00a0 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -126,7 +126,7 @@ static void cmd_dev_attach_parsed(void *parsed_result,
 		return;
 	}
 
-	if (!rte_eal_hotplug_add(da.bus->name, da.name, da.args))
+	if (!rte_eal_hotplug_add(rte_bus_name(da.bus), da.name, da.args))
 		cmdline_printf(cl, "attached device %s\n", da.name);
 	else
 		cmdline_printf(cl, "failed to attached device %s\n",
@@ -173,7 +173,7 @@ static void cmd_dev_detach_parsed(void *parsed_result,
 	}
 
 	printf("detaching...\n");
-	if (!rte_eal_hotplug_remove(da.bus->name, da.name))
+	if (!rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name))
 		cmdline_printf(cl, "detached device %s\n",
 			da.name);
 	else
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index baa5b532af..cbf382f967 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -16,11 +16,17 @@
 static struct rte_bus_list rte_bus_list =
 	TAILQ_HEAD_INITIALIZER(rte_bus_list);
 
+const char *
+rte_bus_name(const struct rte_bus *bus)
+{
+	return bus->name;
+}
+
 void
 rte_bus_register(struct rte_bus *bus)
 {
 	RTE_VERIFY(bus);
-	RTE_VERIFY(bus->name && strlen(bus->name));
+	RTE_VERIFY(rte_bus_name(bus) && strlen(rte_bus_name(bus)));
 	/* A bus should mandatorily have the scan implemented */
 	RTE_VERIFY(bus->scan);
 	RTE_VERIFY(bus->probe);
@@ -29,14 +35,14 @@ rte_bus_register(struct rte_bus *bus)
 	RTE_VERIFY(!bus->plug || bus->unplug);
 
 	TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", rte_bus_name(bus));
 }
 
 void
 rte_bus_unregister(struct rte_bus *bus)
 {
 	TAILQ_REMOVE(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", rte_bus_name(bus));
 }
 
 /* Scan all the buses for registered devices */
@@ -50,7 +56,7 @@ rte_bus_scan(void)
 		ret = bus->scan();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	return 0;
@@ -64,7 +70,7 @@ rte_bus_probe(void)
 	struct rte_bus *bus, *vbus = NULL;
 
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
-		if (!strcmp(bus->name, "vdev")) {
+		if (!strcmp(rte_bus_name(bus), "vdev")) {
 			vbus = bus;
 			continue;
 		}
@@ -72,14 +78,14 @@ rte_bus_probe(void)
 		ret = bus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				vbus->name);
+				rte_bus_name(vbus));
 	}
 
 	return 0;
@@ -92,7 +98,7 @@ bus_dump_one(FILE *f, struct rte_bus *bus)
 	int ret;
 
 	/* For now, dump only the bus name */
-	ret = fprintf(f, " %s\n", bus->name);
+	ret = fprintf(f, " %s\n", rte_bus_name(bus));
 
 	/* Error in case of inability in writing to stream */
 	if (ret < 0)
@@ -163,7 +169,7 @@ cmp_bus_name(const struct rte_bus *bus, const void *_name)
 {
 	const char *name = _name;
 
-	return strcmp(bus->name, name);
+	return strcmp(rte_bus_name(bus), name);
 }
 
 struct rte_bus *
@@ -213,7 +219,7 @@ rte_bus_get_iommu_class(void)
 
 		bus_iova_mode = bus->get_iommu_class();
 		RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n",
-			bus->name,
+			rte_bus_name(bus),
 			bus_iova_mode == RTE_IOVA_DC ? "DC" :
 			(bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA"));
 		if (bus_iova_mode == RTE_IOVA_PA)
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..bbaf518570 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -140,7 +140,7 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)
 
 	if (da->bus->plug == NULL) {
 		RTE_LOG(ERR, EAL, "Function plug not supported by bus (%s)\n",
-			da->bus->name);
+			rte_bus_name(da->bus));
 		ret = -ENOTSUP;
 		goto err_devarg;
 	}
@@ -309,7 +309,7 @@ local_dev_remove(struct rte_device *dev)
 
 	if (dev->bus->unplug == NULL) {
 		RTE_LOG(ERR, EAL, "Function unplug not supported by bus (%s)\n",
-			dev->bus->name);
+			rte_bus_name(dev->bus));
 		return -ENOTSUP;
 	}
 
@@ -335,7 +335,7 @@ rte_dev_remove(struct rte_device *dev)
 		return -ENOENT;
 	}
 
-	ret = build_devargs(dev->bus->name, dev->name, "", &devargs);
+	ret = build_devargs(rte_bus_name(dev->bus), dev->name, "", &devargs);
 	if (ret != 0)
 		return ret;
 
@@ -597,7 +597,7 @@ rte_dev_iterator_init(struct rte_dev_iterator *it,
 		goto get_out;
 	}
 	if (bus != NULL && bus->dev_iterate == NULL) {
-		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", bus->name);
+		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", rte_bus_name(bus));
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..fa95c52708 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -176,7 +176,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 static int
 bus_name_cmp(const struct rte_bus *bus, const void *name)
 {
-	return strncmp(bus->name, name, strlen(bus->name));
+	return strncmp(rte_bus_name(bus), name, strlen(bus->name));
 }
 
 int
@@ -206,7 +206,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 		bus = rte_bus_find(bus, bus_name_cmp, dev);
 		if (bus == NULL)
 			break;
-		devname = dev + strlen(bus->name) + 1;
+		devname = dev + strlen(rte_bus_name(bus)) + 1;
 		if (rte_bus_find_by_device_name(devname) == bus)
 			break;
 	} while (1);
@@ -301,7 +301,7 @@ rte_devargs_insert(struct rte_devargs **da)
 		if (listed_da == *da)
 			/* devargs already in the list */
 			return 0;
-		if (strcmp(listed_da->bus->name, (*da)->bus->name) == 0 &&
+		if (strcmp(rte_bus_name(listed_da->bus), (*da)->bus->name) == 0 &&
 				strcmp(listed_da->name, (*da)->name) == 0) {
 			/* device already in devargs list, must be updated */
 			(*da)->next = listed_da->next;
@@ -365,7 +365,7 @@ rte_devargs_remove(struct rte_devargs *devargs)
 		return -1;
 
 	RTE_TAILQ_FOREACH_SAFE(d, &devargs_list, next, tmp) {
-		if (strcmp(d->bus->name, devargs->bus->name) == 0 &&
+		if (strcmp(rte_bus_name(d->bus), devargs->bus->name) == 0 &&
 		    strcmp(d->name, devargs->name) == 0) {
 			TAILQ_REMOVE(&devargs_list, d, next);
 			rte_devargs_reset(d);
@@ -400,7 +400,7 @@ rte_devargs_dump(FILE *f)
 	fprintf(f, "User device list:\n");
 	TAILQ_FOREACH(devargs, &devargs_list, next) {
 		fprintf(f, "  [%s]: %s %s\n",
-			(devargs->bus ? devargs->bus->name : "??"),
+			(devargs->bus ? rte_bus_name(devargs->bus) : "??"),
 			devargs->name, devargs->args);
 	}
 }
@@ -417,7 +417,7 @@ rte_devargs_next(const char *busname, const struct rte_devargs *start)
 		da = TAILQ_FIRST(&devargs_list);
 	while (da != NULL) {
 		if (busname == NULL ||
-		    (strcmp(busname, da->bus->name) == 0))
+		    (strcmp(busname, rte_bus_name(da->bus)) == 0))
 			return da;
 		da = TAILQ_NEXT(da, next);
 	}
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..252f147b6f 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -127,9 +127,9 @@ __handle_secondary_request(void *param)
 			goto rollback;
 		}
 
-		bus = rte_bus_find_by_name(da.bus->name);
+		bus = rte_bus_find_by_name(rte_bus_name(da.bus));
 		if (bus == NULL) {
-			RTE_LOG(ERR, EAL, "Cannot find bus (%s)\n", da.bus->name);
+			RTE_LOG(ERR, EAL, "Cannot find bus (%s)\n", rte_bus_name(da.bus));
 			ret = -ENOENT;
 			goto finish;
 		}
@@ -254,9 +254,9 @@ static void __handle_primary_request(void *param)
 		if (ret != 0)
 			goto quit;
 
-		bus = rte_bus_find_by_name(da->bus->name);
+		bus = rte_bus_find_by_name(rte_bus_name(da->bus));
 		if (bus == NULL) {
-			RTE_LOG(ERR, EAL, "Cannot find bus (%s)\n", da->bus->name);
+			RTE_LOG(ERR, EAL, "Cannot find bus (%s)\n", rte_bus_name(da->bus));
 			ret = -ENOENT;
 			goto quit;
 		}
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 17edaa37c9..9b70f2f7b2 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -266,6 +266,19 @@ struct rte_bus {
 
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ * @return
+ *   A pointer to the bus name string.
+ */
+__rte_experimental
+const char *rte_bus_name(const struct rte_bus *bus);
+
 /**
  * Register a Bus handler.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index c2a2cebf69..6f713c987d 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_bus_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index ebbe8cca3d..c94d6573d5 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -232,11 +232,11 @@ rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs_str)
 	}
 
 	/* Convert bus args to new syntax for use with new API dev_iterate. */
-	if ((strcmp(iter->bus->name, "vdev") == 0) ||
-		(strcmp(iter->bus->name, "fslmc") == 0) ||
-		(strcmp(iter->bus->name, "dpaa_bus") == 0)) {
+	if ((strcmp(rte_bus_name(iter->bus), "vdev") == 0) ||
+		(strcmp(rte_bus_name(iter->bus), "fslmc") == 0) ||
+		(strcmp(rte_bus_name(iter->bus), "dpaa_bus") == 0)) {
 		bus_param_key = "name";
-	} else if (strcmp(iter->bus->name, "pci") == 0) {
+	} else if (strcmp(rte_bus_name(iter->bus), "pci") == 0) {
 		bus_param_key = "addr";
 	} else {
 		ret = -ENOTSUP;
@@ -264,7 +264,7 @@ rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs_str)
 error:
 	if (ret == -ENOTSUP)
 		RTE_ETHDEV_LOG(ERR, "Bus %s does not support iterating.\n",
-				iter->bus->name);
+				rte_bus_name(iter->bus));
 	rte_devargs_reset(&devargs);
 	free(bus_str);
 	free(cls_str);
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..83d692d095 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -211,7 +211,7 @@ pcapng_add_interface(rte_pcapng_t *self, uint16_t port)
 	dev = dev_info.device;
 	if (dev)
 		snprintf(ifhw, sizeof(ifhw),
-			 "%s-%s", dev->bus->name, dev->name);
+			 "%s-%s", rte_bus_name(dev->bus), dev->name);
 
 	/* DPDK reports in units of Mbps */
 	if (rte_eth_link_get(port, &link) == 0 &&
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC PATCH 11/11] bus: hide bus object
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (9 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 10/11] bus: introduce accessors David Marchand
@ 2022-06-28 14:46 ` David Marchand
  2022-06-28 16:22   ` Tyler Retzlaff
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-06-28 14:46 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, kevin.laatz, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Stephen Hemminger,
	Long Li, Chas Williams, Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_devargs.c                 |   2 +-
 app/test/test_vdev.c                    |   2 +-
 drivers/bus/auxiliary/private.h         |   2 +-
 drivers/bus/dpaa/dpaa_bus.c             |   2 +-
 drivers/bus/fslmc/private.h             |   2 +-
 drivers/bus/ifpga/ifpga_bus.c           |   2 +-
 drivers/bus/pci/private.h               |   2 +-
 drivers/bus/vdev/vdev.c                 |   2 +-
 drivers/bus/vmbus/private.h             |   2 +-
 drivers/dma/idxd/idxd_bus.c             |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c   |   2 +-
 lib/eal/common/eal_common_bus.c         |   2 +-
 lib/eal/common/eal_common_dev.c         |   2 +-
 lib/eal/common/eal_common_devargs.c     |   2 +-
 lib/eal/common/hotplug_mp.c             |   2 +-
 lib/eal/include/bus_driver.h            | 295 ++++++++++++++++++++++++
 lib/eal/include/meson.build             |   4 +
 lib/eal/include/rte_bus.h               | 275 +---------------------
 lib/eal/linux/eal_dev.c                 |   2 +-
 lib/eal/version.map                     |   4 +-
 lib/ethdev/rte_ethdev.c                 |   2 +-
 22 files changed, 322 insertions(+), 292 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..0a4c34a1ad 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 5eeff3106d..1904e76e44 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 06a920114c..7e8ae8c2f9 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "rte_bus_auxiliary.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index ad4ea156a6..4f12944470 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -29,7 +29,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 80d4673ca8..f08dc7716b 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef __PRIVATE_H__
 #define __PRIVATE_H__
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <rte_fslmc.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index e005f2cb70..a2c2f13cf7 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 6ccec15655..0cefed5edf 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index a8d8b2327e..dd4e931687 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 732cb6d583..5205e17a3f 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index b90757756a..f461bf9207 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 2587195168..24edf9f3c4 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_vdev.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index bbaf518570..a366bb3689 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index fa95c52708..adccfa713f 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 252f147b6f..9e6eddec92 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..ac404c3d5e
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,295 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+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);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_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 */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 9b70f2f7b2..1b08407e53 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,251 +20,11 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
+#include <rte_compat.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-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);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_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 */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * @warning
@@ -279,24 +39,6 @@ struct rte_bus {
 __rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -386,17 +128,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..098a2c3076 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -13,7 +13,7 @@
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 6f713c987d..48c8a2f511 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -13,9 +13,7 @@ DPDK_22 {
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -432,6 +430,8 @@ EXPERIMENTAL {
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index c94d6573d5..6679bd8276 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-06-28 14:46 ` [RFC PATCH 11/11] bus: hide bus object David Marchand
@ 2022-06-28 16:22   ` Tyler Retzlaff
  2022-06-28 16:24     ` Tyler Retzlaff
  2022-06-28 16:29     ` Stephen Hemminger
  0 siblings, 2 replies; 231+ messages in thread
From: Tyler Retzlaff @ 2022-06-28 16:22 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, thomas, bruce.richardson, kevin.laatz, Parav Pandit,
	Xueming Li, Hemant Agrawal, Sachin Saxena, Rosen Xu,
	Stephen Hemminger, Long Li, Chas Williams, Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Tue, Jun 28, 2022 at 04:46:43PM +0200, David Marchand wrote:
> Make rte_bus opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Introduce a new driver header and move rte_bus definition and helpers.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

... snip ...

> -struct rte_bus {
> -	RTE_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 */
> -	rte_bus_find_device_t find_device; /**< Find a device on the bus */
> -	rte_bus_plug_t plug;         /**< Probe single device for drivers */
> -	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
> -	rte_bus_parse_t parse;       /**< Parse a device name */
> -	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
> -	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
> -	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
> -	struct rte_bus_conf conf;    /**< Bus configuration */
> -	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
> -	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
> -	rte_bus_hot_unplug_handler_t hot_unplug_handler;
> -				/**< handle hot-unplug failure on the bus */
> -	rte_bus_sigbus_handler_t sigbus_handler;
> -					/**< handle sigbus error on the bus */
> -
> -};

since we're overhauling anyway we could follow suit with a number of the
lessons from posix apis e.g. pthread and eliminate typed pointers for a
little extra value.

> +struct rte_bus;
> +struct rte_device;

to avoid people tripping over mishandling pointers in/out of the api
surface taking the opaque object you could declare opaque handle for the
api to operate on instead. it would force the use of a cast in the
implementation but would avoid accidental void * of the wrong thing that
got cached being passed in. if the cast was really undesirable just
whack it under an inline / internal function.

e.g. make the opaque object an explicit type.

struct {
    uintptr_t opaque;
} rte_bus_handle_t;

// implementation
rte_bus_handle_t
rte_bus_find(rte_bus_handle_t start,
	rte_bus_cmp_t cmp, const void *data)
{
	struct rte_bus *bus = (struct rte_bus *)start.opaque;

	// do bus things on bus

	return {.opaque = whatever};
}

then you will get hard compile time failure if someone messes up
argument passing.

e.g.

void *somerandomp = ...;

...
rte_bus_find(somerandomp, ...); // compile fail

i would actually suggest this wrapping in a struct / handle approach for
any opaque object that is passed over the api surface. the change is
bigger of course...

it has various other advantages when/if we decide to make the bus/driver
surface stable in abi which i understand is not a promise dpdk makes
right now but still we might one day.

anyway, just a suggestion. i like the series either way.


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-06-28 16:22   ` Tyler Retzlaff
@ 2022-06-28 16:24     ` Tyler Retzlaff
  2022-06-28 16:29     ` Stephen Hemminger
  1 sibling, 0 replies; 231+ messages in thread
From: Tyler Retzlaff @ 2022-06-28 16:24 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, thomas, bruce.richardson, kevin.laatz, Parav Pandit,
	Xueming Li, Hemant Agrawal, Sachin Saxena, Rosen Xu,
	Stephen Hemminger, Long Li, Chas Williams, Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Tue, Jun 28, 2022 at 09:22:13AM -0700, Tyler Retzlaff wrote:
> 
> e.g. make the opaque object an explicit type.
> 
oops missed the typedef there but you probably know what i meant.

typedef
> struct {
>     uintptr_t opaque;
> } rte_bus_handle_t;
> 

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-06-28 16:22   ` Tyler Retzlaff
  2022-06-28 16:24     ` Tyler Retzlaff
@ 2022-06-28 16:29     ` Stephen Hemminger
  2022-06-28 17:07       ` Tyler Retzlaff
  1 sibling, 1 reply; 231+ messages in thread
From: Stephen Hemminger @ 2022-06-28 16:29 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: David Marchand, dev, thomas, bruce.richardson, kevin.laatz,
	Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena,
	Rosen Xu, Stephen Hemminger, Long Li, Chas Williams,
	Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Tue, 28 Jun 2022 09:22:13 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> On Tue, Jun 28, 2022 at 04:46:43PM +0200, David Marchand wrote:
> > Make rte_bus opaque for non internal users.
> > This will make extending this object possible without breaking the ABI.
> > 
> > Introduce a new driver header and move rte_bus definition and helpers.
> > 
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---  
> 
> ... snip ...
> 
> > -struct rte_bus {
> > -	RTE_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 */
> > -	rte_bus_find_device_t find_device; /**< Find a device on the bus */
> > -	rte_bus_plug_t plug;         /**< Probe single device for drivers */
> > -	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
> > -	rte_bus_parse_t parse;       /**< Parse a device name */
> > -	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
> > -	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
> > -	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
> > -	struct rte_bus_conf conf;    /**< Bus configuration */
> > -	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
> > -	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
> > -	rte_bus_hot_unplug_handler_t hot_unplug_handler;
> > -				/**< handle hot-unplug failure on the bus */
> > -	rte_bus_sigbus_handler_t sigbus_handler;
> > -					/**< handle sigbus error on the bus */
> > -
> > -};  
> 
> since we're overhauling anyway we could follow suit with a number of the
> lessons from posix apis e.g. pthread and eliminate typed pointers for a
> little extra value.
> 
> > +struct rte_bus;
> > +struct rte_device;  
> 
> to avoid people tripping over mishandling pointers in/out of the api
> surface taking the opaque object you could declare opaque handle for the
> api to operate on instead. it would force the use of a cast in the
> implementation but would avoid accidental void * of the wrong thing that
> got cached being passed in. if the cast was really undesirable just
> whack it under an inline / internal function.

I don't like that because it least to dangerous casts in the internal code.
Better to keep the the type of the object. As long as the API only passes
around an pointer to a struct, without exposing the contents of the struct;
it is safer and easier to debug.

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-06-28 16:29     ` Stephen Hemminger
@ 2022-06-28 17:07       ` Tyler Retzlaff
  2022-06-28 17:38         ` Stephen Hemminger
  0 siblings, 1 reply; 231+ messages in thread
From: Tyler Retzlaff @ 2022-06-28 17:07 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: David Marchand, dev, thomas, bruce.richardson, kevin.laatz,
	Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena,
	Rosen Xu, Stephen Hemminger, Long Li, Chas Williams,
	Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Tue, Jun 28, 2022 at 09:29:05AM -0700, Stephen Hemminger wrote:
> On Tue, 28 Jun 2022 09:22:13 -0700
> Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> 
> > On Tue, Jun 28, 2022 at 04:46:43PM +0200, David Marchand wrote:
> > > Make rte_bus opaque for non internal users.
> > > This will make extending this object possible without breaking the ABI.
> > > 
> > > Introduce a new driver header and move rte_bus definition and helpers.
> > > 
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---  
> > 
> > ... snip ...
> > 
> > > -struct rte_bus {
> > > -	RTE_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 */
> > > -	rte_bus_find_device_t find_device; /**< Find a device on the bus */
> > > -	rte_bus_plug_t plug;         /**< Probe single device for drivers */
> > > -	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
> > > -	rte_bus_parse_t parse;       /**< Parse a device name */
> > > -	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
> > > -	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
> > > -	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
> > > -	struct rte_bus_conf conf;    /**< Bus configuration */
> > > -	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
> > > -	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
> > > -	rte_bus_hot_unplug_handler_t hot_unplug_handler;
> > > -				/**< handle hot-unplug failure on the bus */
> > > -	rte_bus_sigbus_handler_t sigbus_handler;
> > > -					/**< handle sigbus error on the bus */
> > > -
> > > -};  
> > 
> > since we're overhauling anyway we could follow suit with a number of the
> > lessons from posix apis e.g. pthread and eliminate typed pointers for a
> > little extra value.
> > 
> > > +struct rte_bus;
> > > +struct rte_device;  
> > 
> > to avoid people tripping over mishandling pointers in/out of the api
> > surface taking the opaque object you could declare opaque handle for the
> > api to operate on instead. it would force the use of a cast in the
> > implementation but would avoid accidental void * of the wrong thing that
> > got cached being passed in. if the cast was really undesirable just
> > whack it under an inline / internal function.
> 
> I don't like that because it least to dangerous casts in the internal code.
> Better to keep the the type of the object. As long as the API only passes
> around an pointer to a struct, without exposing the contents of the struct;
> it is safer and easier to debug.

as i mentioned you can use an inline/internal function or even a macro
to hide the cast, you could provide some additional integrity checks
here if desired as a value add.

the fact that you expose that it is a struct is an internal
implementation detail, if truly opaque tomorrow you could convert it
to a simple integer that indexes or enumerates something and prevents
any meaningful interpretation in the application.

when you say it is safer to debug i think you mean for dpdk devs not the
application developer because unless the app developer does something
really gross/dangerous casting they really can't "mishandle" the opaque
object except to use one that isn't initialized at all which we
can detect and handle internally in a general way.

i will however concede there would be slightly more finger work when
debugging dpdk itself since gdb / debugger doesn't automatically infer
type so you end up having to tell gdb what is in the uintptr_t.

anyway just drawing from experience in the driver frameworks we maintain
in windows, i think one of our regrets is that we didn't do this from
day 1 and subsequentl that we initially only used one opaque type
instead of defining separate (not implicitly convertable) types to each
opaque type.

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-06-28 17:07       ` Tyler Retzlaff
@ 2022-06-28 17:38         ` Stephen Hemminger
  2022-06-28 18:23           ` Tyler Retzlaff
  0 siblings, 1 reply; 231+ messages in thread
From: Stephen Hemminger @ 2022-06-28 17:38 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: David Marchand, dev, thomas, bruce.richardson, kevin.laatz,
	Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena,
	Rosen Xu, Stephen Hemminger, Long Li, Chas Williams,
	Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Tue, 28 Jun 2022 10:07:12 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> > > to avoid people tripping over mishandling pointers in/out of the api
> > > surface taking the opaque object you could declare opaque handle for the
> > > api to operate on instead. it would force the use of a cast in the
> > > implementation but would avoid accidental void * of the wrong thing that
> > > got cached being passed in. if the cast was really undesirable just
> > > whack it under an inline / internal function.  
> > 
> > I don't like that because it least to dangerous casts in the internal code.
> > Better to keep the the type of the object. As long as the API only passes
> > around an pointer to a struct, without exposing the contents of the struct;
> > it is safer and easier to debug.  
> 
> as i mentioned you can use an inline/internal function or even a macro
> to hide the cast, you could provide some additional integrity checks
> here if desired as a value add.
> 
> the fact that you expose that it is a struct is an internal
> implementation detail, if truly opaque tomorrow you could convert it
> to a simple integer that indexes or enumerates something and prevents
> any meaningful interpretation in the application.
> 
> when you say it is safer to debug i think you mean for dpdk devs not the
> application developer because unless the app developer does something
> really gross/dangerous casting they really can't "mishandle" the opaque
> object except to use one that isn't initialized at all which we
> can detect and handle internally in a general way.
> 
> i will however concede there would be slightly more finger work when
> debugging dpdk itself since gdb / debugger doesn't automatically infer
> type so you end up having to tell gdb what is in the uintptr_t.
> 
> anyway just drawing from experience in the driver frameworks we maintain
> in windows, i think one of our regrets is that we didn't do this from
> day 1 and subsequentl that we initially only used one opaque type
> instead of defining separate (not implicitly convertable) types to each
> opaque type.

It seems to be a difference in style/taste.
The Linux/Unix side prefers opaque structure pointers.
Windows (and LLVM) uses numeric handles.

At this point DPDK should follow the Linux bus.

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-06-28 17:38         ` Stephen Hemminger
@ 2022-06-28 18:23           ` Tyler Retzlaff
  2022-07-09  8:16             ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Tyler Retzlaff @ 2022-06-28 18:23 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: David Marchand, dev, thomas, bruce.richardson, kevin.laatz,
	Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena,
	Rosen Xu, Stephen Hemminger, Long Li, Chas Williams,
	Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Tue, Jun 28, 2022 at 10:38:27AM -0700, Stephen Hemminger wrote:
> On Tue, 28 Jun 2022 10:07:12 -0700
> Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> 
> > > > to avoid people tripping over mishandling pointers in/out of the api
> > > > surface taking the opaque object you could declare opaque handle for the
> > > > api to operate on instead. it would force the use of a cast in the
> > > > implementation but would avoid accidental void * of the wrong thing that
> > > > got cached being passed in. if the cast was really undesirable just
> > > > whack it under an inline / internal function.  
> > > 
> > > I don't like that because it least to dangerous casts in the internal code.
> > > Better to keep the the type of the object. As long as the API only passes
> > > around an pointer to a struct, without exposing the contents of the struct;
> > > it is safer and easier to debug.  
> > 
> > as i mentioned you can use an inline/internal function or even a macro
> > to hide the cast, you could provide some additional integrity checks
> > here if desired as a value add.
> > 
> > the fact that you expose that it is a struct is an internal
> > implementation detail, if truly opaque tomorrow you could convert it
> > to a simple integer that indexes or enumerates something and prevents
> > any meaningful interpretation in the application.
> > 
> > when you say it is safer to debug i think you mean for dpdk devs not the
> > application developer because unless the app developer does something
> > really gross/dangerous casting they really can't "mishandle" the opaque
> > object except to use one that isn't initialized at all which we
> > can detect and handle internally in a general way.
> > 
> > i will however concede there would be slightly more finger work when
> > debugging dpdk itself since gdb / debugger doesn't automatically infer
> > type so you end up having to tell gdb what is in the uintptr_t.
> > 
> > anyway just drawing from experience in the driver frameworks we maintain
> > in windows, i think one of our regrets is that we didn't do this from
> > day 1 and subsequentl that we initially only used one opaque type
> > instead of defining separate (not implicitly convertable) types to each
> > opaque type.
> 
> It seems to be a difference in style/taste.

it's not i've sited at least one example of a mistake that becomes a
compile time failure where application code is incorrectly authored
where use of a pointer offers no such protection.

> The Linux/Unix side prefers opaque structure pointers.
> Windows (and LLVM) uses numeric handles.
> 
> At this point DPDK should follow the Linux bus.

dpdk is multi-platform and unix does not necessarily standardize on
pointer to struct for opaque objects. freebsd has many apis notably
bus_space that does uses handles and as previously mentioned posix
threads uses handles.

i understand that linux is an important platform but it isn't the only
platform dpdk targets and just because it is important doesn't mean it
should always enjoy being the defacto standard.

anyway, i'll leave it for the patch author to decide. i still like the
patch series either way. i just think this would make applications more
robust.

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-06-28 18:23           ` Tyler Retzlaff
@ 2022-07-09  8:16             ` David Marchand
  2022-07-09 16:28               ` Stephen Hemminger
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:16 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: Stephen Hemminger, dev, Thomas Monjalon, Bruce Richardson,
	Kevin Laatz, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Rosen Xu, Stephen Hemminger, Long Li,
	Chas Williams, Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Tue, Jun 28, 2022 at 8:23 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> On Tue, Jun 28, 2022 at 10:38:27AM -0700, Stephen Hemminger wrote:
> > On Tue, 28 Jun 2022 10:07:12 -0700
> > Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> >
> > > > > to avoid people tripping over mishandling pointers in/out of the api
> > > > > surface taking the opaque object you could declare opaque handle for the
> > > > > api to operate on instead. it would force the use of a cast in the
> > > > > implementation but would avoid accidental void * of the wrong thing that
> > > > > got cached being passed in. if the cast was really undesirable just
> > > > > whack it under an inline / internal function.
> > > >
> > > > I don't like that because it least to dangerous casts in the internal code.
> > > > Better to keep the the type of the object. As long as the API only passes
> > > > around an pointer to a struct, without exposing the contents of the struct;
> > > > it is safer and easier to debug.
> > >
> > > as i mentioned you can use an inline/internal function or even a macro
> > > to hide the cast, you could provide some additional integrity checks
> > > here if desired as a value add.
> > >
> > > the fact that you expose that it is a struct is an internal
> > > implementation detail, if truly opaque tomorrow you could convert it
> > > to a simple integer that indexes or enumerates something and prevents
> > > any meaningful interpretation in the application.
> > >
> > > when you say it is safer to debug i think you mean for dpdk devs not the
> > > application developer because unless the app developer does something
> > > really gross/dangerous casting they really can't "mishandle" the opaque
> > > object except to use one that isn't initialized at all which we
> > > can detect and handle internally in a general way.
> > >
> > > i will however concede there would be slightly more finger work when
> > > debugging dpdk itself since gdb / debugger doesn't automatically infer
> > > type so you end up having to tell gdb what is in the uintptr_t.
> > >
> > > anyway just drawing from experience in the driver frameworks we maintain
> > > in windows, i think one of our regrets is that we didn't do this from
> > > day 1 and subsequentl that we initially only used one opaque type
> > > instead of defining separate (not implicitly convertable) types to each
> > > opaque type.
> >
> > It seems to be a difference in style/taste.
>
> it's not i've sited at least one example of a mistake that becomes a
> compile time failure where application code is incorrectly authored
> where use of a pointer offers no such protection.
>
> > The Linux/Unix side prefers opaque structure pointers.
> > Windows (and LLVM) uses numeric handles.
> >
> > At this point DPDK should follow the Linux bus.
>
> dpdk is multi-platform and unix does not necessarily standardize on
> pointer to struct for opaque objects. freebsd has many apis notably
> bus_space that does uses handles and as previously mentioned posix
> threads uses handles.
>
> i understand that linux is an important platform but it isn't the only
> platform dpdk targets and just because it is important doesn't mean it
> should always enjoy being the defacto standard.
>
> anyway, i'll leave it for the patch author to decide. i still like the
> patch series either way. i just think this would make applications more
> robust.

Thanks for this feedback Tyler.
I would lean towards Stephen opinion atm, but I am not decided yet.

For now, I'll post a v2, extending the series to other internal objects.
We can conclude on this topic during 22.11.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 00/29] Bus and device cleanup for 22.11
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (10 preceding siblings ...)
  2022-06-28 14:46 ` [RFC PATCH 11/11] bus: hide bus object David Marchand
@ 2022-07-09  8:26 ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 01/29] common/mlx5: rework check on driver registration David Marchand
                     ` (30 more replies)
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                   ` (4 subsequent siblings)
  16 siblings, 31 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev

This is a PoC for hiding the rte_bus, rte_driver and rte_device objects.
And mark associated driver only API as internal.

A good amount of the patches are preparation work on rte_bus.h,
rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
between them. This is something I had in store for some time, maybe I
should have dropped it from the PoC, but I think those cleanups are
worth it in any case.

Then PCI bus specific handling are moved from unit tests and examples,
though there is still a special case left in testpmd that may require a
new API, to be discussed.

After this series, driver-only API headers for registering to buses are
not exported anymore, unless the enable_driver_sdk meson option is
selected.

New accessors for rte_bus, rte_driver and rte_device have been added,
marked with an experimental tag though we may declare them as stable
right away so that users can switch to them directly. That's also
something to agree on.

I simplified my series and switched to only update "external" users,
like app/ and examples/ files.
We need some checkpatch new checks to be sure we won't get some
driver-only headers included in these areas. That's something I'll work
on in the non RFC series.

"Internal" users are simply using the internal headers. That helps
greatly reducing the size of the changes.

Disclaimer: again, in this v2, this series is a bit rushed (I brute forced
compilation tests in GHA so that it passes between patches, but there still
may be something broken...).
Not surprisingly, the ABI check in the CI is expected to fail.


Comments welcome.

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (29):
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  dev: move unrelated macros from header
  devargs: remove dependency on bus header
  bus: remove unneeded inclusion of bus header
  bus: move IOVA definition from header
  drivers/bus: remove back reference to bus objects
  drivers/bus: hide specific structures
  bus: introduce accessors
  bus: hide bus object
  bbdev: mark driver header
  ethdev: mark some headers as driver only
  rawdev: mark driver header
  drivers: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  dev: introduce driver name
  dev: hide driver object
  dev: introduce device accessors
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/config.c                         |  12 +-
 app/test-pmd/testpmd.c                        |   4 +-
 app/test-pmd/testpmd.h                        |   7 +-
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   3 +-
 app/test/virtual_pmd.c                        |   2 +-
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  20 +-
 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 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  24 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  19 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  23 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 ------
 drivers/bus/ifpga/ifpga_common.h              |  54 +++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |   3 -
 drivers/bus/pci/bus_pci_driver.h              | 200 ++++++++++++
 drivers/bus/pci/linux/pci.c                   |   3 -
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |   4 +-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  19 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +-----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   1 +
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 +++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 --------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 +++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   1 +
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |   4 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   1 +
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   1 +
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   2 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 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             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   1 +
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   1 +
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  15 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |   4 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/bbdev/meson.build                         |   5 +-
 lib/compressdev/rte_compressdev.c             |   2 +
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |   2 +-
 lib/dmadev/rte_dmadev.c                       |   1 +
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  41 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 ++++++++++++++++++
 lib/eal/include/dev_driver.h                  |  42 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 293 +----------------
 lib/eal/include/rte_common.h                  |  11 +
 lib/eal/include/rte_dev.h                     |  89 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |   1 +
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/meson.build                        |   6 +-
 lib/ethdev/rte_ethdev.c                       |   1 +
 lib/ethdev/rte_ethdev.h                       |   2 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |   2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |   2 +-
 lib/eventdev/rte_eventdev.c                   |   2 +-
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   3 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/meson.build                        |   3 +-
 lib/rawdev/rte_rawdev.c                       |   2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |   1 +
 lib/security/rte_security.c                   |   3 +-
 lib/vhost/vdpa.c                              |   2 +
 353 files changed, 1605 insertions(+), 1480 deletions(-)
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (91%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 01/29] common/mlx5: rework check on driver registration
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 02/29] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Matan Azrad, Viacheslav Ovsiienko

Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@ static struct rte_auxiliary_driver mlx5_auxiliary_driver = {
 	.dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-	if (mlx5_auxiliary_driver.bus == NULL)
+	if (!mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_register(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = true;
+	}
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-	if (mlx5_auxiliary_driver.bus != NULL)
+	if (mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = false;
+	}
 }
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 02/29] raw/ifpga: remove PCI bus accessor
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 01/29] common/mlx5: rework check on driver registration David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 03/29] kni: stop populating PCI info in examples David Marchand
                     ` (28 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Rosen Xu, Tianfei zhang, Ray Kinsella

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/raw/ifpga/ifpga_rawdev.c  |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h  |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h | 10 ----------
 drivers/raw/ifpga/version.map     |  1 -
 5 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index ff71a453e2..340d8eb3c7 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -10,7 +10,6 @@ DPDK_22 {
 	rte_pmd_ifpga_stop_update;
 	rte_pmd_ifpga_reboot_try;
 	rte_pmd_ifpga_reload;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_partial_reconfigure;
 	rte_pmd_ifpga_cleanup;
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 03/29] kni: stop populating PCI info in examples
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 01/29] common/mlx5: rework check on driver registration David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 02/29] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 04/29] examples/ethtool: prefer device name David Marchand
                     ` (27 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Cristian Dumitrescu

addr and id fields are deprecated and are not used in the kni library.
Stop populating them in in-tree examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_kni.c        | 30 ------------------------------
 examples/ip_pipeline/kni.c | 10 ----------
 2 files changed, 40 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 622315c8b1..4039da0b08 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -25,7 +25,6 @@ test_kni(void)
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
@@ -426,8 +425,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 
 	if (!mp)
 		return -1;
@@ -443,13 +440,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
 
 	/* core id 1 configured for kernel thread */
@@ -545,8 +535,6 @@ test_kni(void)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
 	FILE *fd;
 	DIR *dir;
 	char buf[16];
@@ -645,15 +633,6 @@ test_kni(void)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
@@ -689,15 +668,6 @@ test_kni(void)
 		goto fail;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index a2d3331cb0..cd02c39478 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_string_fns.h>
 
 #include "kni.h"
@@ -107,8 +106,6 @@ kni_create(const char *name, struct kni_params *params)
 	struct mempool *mempool;
 	struct link *link;
 	struct rte_kni *k;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int ret;
 
 	/* Check input params */
@@ -134,13 +131,6 @@ kni_create(const char *name, struct kni_params *params)
 	kni_conf.core_id = params->thread_id;
 	kni_conf.group_id = link->port_id;
 	kni_conf.mbuf_size = mempool->buffer_size;
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		kni_conf.addr = pci_dev->addr;
-		kni_conf.id = pci_dev->id;
-	}
 
 	memset(&kni_ops, 0, sizeof(kni_ops));
 	kni_ops.port_id = link->port_id;
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 04/29] examples/ethtool: prefer device name
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (2 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 03/29] kni: stop populating PCI info in examples David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 05/29] dev: hide debug messages in device iterator David Marchand
                     ` (26 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev

Rely on the generic device name rather than restrict to only supporting
PCI devices.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/ethtool/lib/rte_ethtool.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index ffaad96498..88dc917b73 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -8,7 +8,6 @@
 #include <rte_version.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_NET_IXGBE
 #include <rte_pmd_ixgbe.h>
 #endif
@@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 {
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int n;
 	int ret;
 
@@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	/* TODO: replace bus_info by rte_devargs.name */
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
-			"%04x:%02x:%02x.%x",
-			pci_dev->addr.domain, pci_dev->addr.bus,
-			pci_dev->addr.devid, pci_dev->addr.function);
-	} else {
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
-	}
+	strlcpy(drvinfo->bus_info, dev_info.device->name,
+		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
 	rte_eth_dev_get_reg_info(port_id, &reg_info);
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 05/29] dev: hide debug messages in device iterator
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (3 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 04/29] examples/ethtool: prefer device name David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 06/29] dev: move unrelated macros from header David Marchand
                     ` (25 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Aman Singh, Yuying Zhang

For any bus that does not support device iteration, rte_dev_iterator_init
both returned an error code and logged an error message.
An application (like testpmd) that only wants to list devices, would have
no choice but to inspect a bus object to avoid spewing error logs.

Make those log messages debug level, and remove the check in testpmd.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/config.c           | 4 ----
 lib/eal/common/eal_common_dev.c | 7 +++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 608bec9796..39bce480bf 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -642,10 +642,6 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		/* Skip buses that don't have iterate method */
-		if (!next->dev_iterate)
-			continue;
-
 		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 9d913e5478..b6f0392f30 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -592,18 +592,17 @@ rte_dev_iterator_init(struct rte_dev_iterator *it,
 	 * one layer specified.
 	 */
 	if (bus == NULL && cls == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Either bus or class must be specified.\n");
+		RTE_LOG(DEBUG, EAL, "Either bus or class must be specified.\n");
 		rte_errno = EINVAL;
 		goto get_out;
 	}
 	if (bus != NULL && bus->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Bus %s not supported\n", bus->name);
+		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", bus->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
 	if (cls != NULL && cls->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Class %s not supported\n", cls->name);
+		RTE_LOG(DEBUG, EAL, "Class %s not supported\n", cls->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 06/29] dev: move unrelated macros from header
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (4 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 05/29] dev: hide debug messages in device iterator David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 07/29] devargs: remove dependency on bus header David Marchand
                     ` (24 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Chengwen Feng, Kevin Laatz,
	Bruce Richardson, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz, Ori Kam, Akhil Goyal,
	Maxime Coquelin, Chenbo Xia

RTE_FUNC_PTR_OR_* macros have nothing to do with the rte_device object
and associated API.
Move them to rte_common.h and include it where needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/qat/qat_device.c                    |  1 +
 drivers/compress/qat/qat_comp_pmd.c                |  1 +
 drivers/crypto/scheduler/rte_cryptodev_scheduler.c |  1 +
 drivers/net/ixgbe/rte_pmd_ixgbe.c                  |  1 +
 drivers/net/liquidio/lio_ethdev.c                  |  1 +
 lib/compressdev/rte_compressdev.c                  |  1 +
 lib/dmadev/rte_dmadev.c                            |  1 +
 lib/eal/include/rte_common.h                       | 11 +++++++++++
 lib/eal/include/rte_dev.h                          | 11 -----------
 lib/ethdev/ethdev_driver.c                         |  1 +
 lib/ethdev/ethdev_pci.h                            |  1 +
 lib/mempool/rte_mempool_ops.c                      |  1 +
 lib/regexdev/rte_regexdev.c                        |  1 +
 lib/security/rte_security.c                        |  1 +
 lib/vhost/vdpa.c                                   |  1 +
 15 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index db4b087d2b..6583cf0554 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2018-2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_devargs.h>
 #include <ctype.h>
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index dc8db84a68..e4cac159be 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2015-2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_malloc.h>
 
 #include "qat_comp.h"
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 1e0c4fe464..88c9b21cd8 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Intel Corporation
  */
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_reorder.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f8575f..8ae4d9b39a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2017 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <ethdev_driver.h>
 
 #include "base/ixgbe_api.h"
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 90ffe31b9f..ccbd0ff849 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017 Cavium, Inc
  */
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 22c438f2dd..12469042f7 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <inttypes.h>
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_eal.h>
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..e199b888c8 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -5,6 +5,7 @@
 
 #include <inttypes.h>
 
+#include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index a96cc2a138..e2d1271c53 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -861,6 +861,17 @@ rte_log2_u64(uint64_t v)
 /** Number of elements in the array. */
 #define	RTE_DIM(a)	(sizeof (a) / sizeof ((a)[0]))
 
+/** Macros to check for invalid function pointers. */
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+	if ((func) == NULL) \
+		return retval; \
+} while (0)
+
+#define RTE_FUNC_PTR_OR_RET(func) do { \
+	if ((func) == NULL) \
+		return; \
+} while (0)
+
 /**
  * Converts a numeric string to the equivalent uint64_t value.
  * As well as straight number conversion, also recognises the suffixes
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index e6ff1218f9..24f9122558 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -36,17 +36,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					enum rte_dev_event_type event,
 					void *cb_arg);
 
-/* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
-	if ((func) == NULL) \
-		return retval; \
-} while (0)
-
-#define RTE_FUNC_PTR_OR_RET(func) do { \
-	if ((func) == NULL) \
-		return; \
-} while (0)
-
 /**
  * Device policies.
  */
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
index a285f213f0..86f5a37874 100644
--- a/lib/ethdev/ethdev_driver.c
+++ b/lib/ethdev/ethdev_driver.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 0549842709..b4bb460dcb 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -10,6 +10,7 @@
 extern "C" {
 #endif
 
+#include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 2d36dee8f0..d60235a7e3 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
index 02a388bc5d..aa57ab5bfa 100644
--- a/lib/regexdev/rte_regexdev.c
+++ b/lib/regexdev/rte_regexdev.c
@@ -5,6 +5,7 @@
 
 #include <string.h>
 
+#include <rte_common.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
 
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..046b6496d2 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -4,6 +4,7 @@
  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
  */
 
+#include <rte_common.h>
 #include <rte_cryptodev.h>
 #include <rte_dev.h>
 #include <rte_telemetry.h>
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index b2a2919fc0..bdebcbe565 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <rte_common.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 07/29] devargs: remove dependency on bus header
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (5 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 06/29] dev: move unrelated macros from header David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 08/29] bus: remove unneeded inclusion of " David Marchand
                     ` (23 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev

We don't need to include rte_bus.h.
Only a forward declaration of rte_bus and an inclusion of rte_dev.h are
needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_vdev.c          | 1 +
 lib/eal/include/rte_devargs.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 720722c363..5eeff3106d 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/lib/eal/include/rte_devargs.h b/lib/eal/include/rte_devargs.h
index 37a0f042ab..38dee2f288 100644
--- a/lib/eal/include/rte_devargs.h
+++ b/lib/eal/include/rte_devargs.h
@@ -22,7 +22,9 @@ extern "C" {
 
 #include <stdio.h>
 #include <rte_compat.h>
-#include <rte_bus.h>
+#include <rte_dev.h>
+
+struct rte_bus;
 
 /**
  * Bus type key in global devargs syntax.
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 08/29] bus: remove unneeded inclusion of bus header
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (6 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 07/29] devargs: remove dependency on bus header David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 09/29] bus: move IOVA definition from header David Marchand
                     ` (22 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Parav Pandit, Xueming Li, Rosen Xu, Stephen Hemminger, Long Li,
	Jay Zhou, Radha Mohan Chintakuntla, Veerasenareddy Burru

Those files don't need to include rte_bus.h.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/auxiliary/linux/auxiliary.c | 1 -
 drivers/bus/ifpga/ifpga_common.c        | 1 -
 drivers/bus/ifpga/rte_bus_ifpga.h       | 1 -
 drivers/bus/vdev/vdev_params.c          | 1 -
 drivers/bus/vmbus/linux/vmbus_uio.c     | 1 -
 drivers/bus/vmbus/vmbus_bufring.c       | 1 -
 drivers/bus/vmbus/vmbus_channel.c       | 1 -
 drivers/bus/vmbus/vmbus_common_uio.c    | 1 -
 drivers/crypto/virtio/virtio_pci.c      | 1 -
 drivers/dma/cnxk/cnxk_dmadev.c          | 1 -
 10 files changed, 10 deletions(-)

diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index 9bd4ee3295..28092e31c4 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -6,7 +6,6 @@
 #include <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c
index 78e2eaee4e..223660d6ff 100644
--- a/drivers/bus/ifpga/ifpga_common.c
+++ b/drivers/bus/ifpga/ifpga_common.c
@@ -14,7 +14,6 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/rte_bus_ifpga.h
index 007ad19875..682d565891 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/rte_bus_ifpga.h
@@ -15,7 +15,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 3969faf16d..2c72614776 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -5,7 +5,6 @@
 #include <string.h>
 
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5db70f8e0d..26edef342d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -13,7 +13,6 @@
 
 #include <rte_eal.h>
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_memory.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
diff --git a/drivers/bus/vmbus/vmbus_bufring.c b/drivers/bus/vmbus/vmbus_bufring.c
index c4aa07b307..c78619dc44 100644
--- a/drivers/bus/vmbus/vmbus_bufring.c
+++ b/drivers/bus/vmbus/vmbus_bufring.c
@@ -15,7 +15,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_pause.h>
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 9bd01679c3..5549fd0944 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -12,7 +12,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 882a24f869..4d4613513c 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -13,7 +13,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_bus_vmbus.h>
 
 #include "private.h"
diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c
index ae069794a6..95a43c8801 100644
--- a/drivers/crypto/virtio/virtio_pci.c
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -10,7 +10,6 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
 
 #include "virtio_pci.h"
 #include "virtqueue.h"
diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c
index 2824c1b44f..3e8c15d617 100644
--- a/drivers/dma/cnxk/cnxk_dmadev.c
+++ b/drivers/dma/cnxk/cnxk_dmadev.c
@@ -5,7 +5,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_eal.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 09/29] bus: move IOVA definition from header
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (7 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 08/29] bus: remove unneeded inclusion of " David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 10/29] drivers/bus: remove back reference to bus objects David Marchand
                     ` (21 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Long Li, Sunila Sahu, Fan Zhang, Ashish Gupta,
	Gaetan Rivet, Anatoly Burakov, Akhil Goyal, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

iova enum definition does not need to be defined as part of the bus API.
Move it to rte_eal.h.
With this step, rte_eal.h does not depend on rte_bus.h and rte_dev.h.
Fix existing code that was relying on these implicit inclusions.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-compress-perf/comp_perf_options.h   |  2 ++
 drivers/bus/vmbus/rte_bus_vmbus.h            |  1 +
 drivers/compress/zlib/zlib_pmd_ops.c         |  1 +
 drivers/net/failsafe/failsafe.c              |  1 +
 drivers/net/failsafe/failsafe_eal.c          |  1 +
 examples/multi_process/hotplug_mp/commands.c |  2 ++
 lib/compressdev/rte_compressdev.c            |  1 +
 lib/compressdev/rte_compressdev_pmd.c        |  1 +
 lib/cryptodev/cryptodev_pmd.c                |  2 ++
 lib/eal/common/eal_thread.h                  |  1 +
 lib/eal/common/hotplug_mp.c                  |  1 +
 lib/eal/include/rte_bus.h                    | 18 ++----------------
 lib/eal/include/rte_eal.h                    | 15 ++++++++++++++-
 lib/eal/include/rte_lcore.h                  |  2 ++
 lib/eal/windows/eal.c                        |  1 +
 lib/ethdev/rte_ethdev.c                      |  1 +
 lib/pcapng/rte_pcapng.c                      |  1 +
 17 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0b777521c5..57dd146330 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -5,6 +5,8 @@
 #ifndef _COMP_PERF_OPS_
 #define _COMP_PERF_OPS_
 
+#include <rte_dev.h>
+
 #define MAX_LIST		32
 #define MIN_COMPRESSED_BUF_SIZE 8
 #define EXPANSE_RATIO 1.1
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index a24bad831d..4421326fe8 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -23,6 +23,7 @@ extern "C" {
 #include <stdint.h>
 #include <inttypes.h>
 
+#include <rte_bus.h>
 #include <rte_compat.h>
 #include <rte_uuid.h>
 #include <rte_debug.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 0a73aed949..7d657d81bc 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_dev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 05cf533896..3eb7d32b76 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,6 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index cb4a2abc02..130344dce2 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,6 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
+#include <rte_bus.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index 41ea265e45..da8b5e5924 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -8,6 +8,8 @@
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
 #include <cmdline.h>
+
+#include <rte_bus.h>
 #include <rte_ethdev.h>
 
 /**********************************************************/
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 12469042f7..7f6dedbc52 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -9,6 +9,7 @@
 #include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 7f500d76d4..9bfae077db 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,6 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 1903ade388..75d0075b86 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -3,6 +3,8 @@
  */
 
 #include <sys/queue.h>
+
+#include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/eal/common/eal_thread.h b/lib/eal/common/eal_thread.h
index ca3378d463..e0240ccc60 100644
--- a/lib/eal/common/eal_thread.h
+++ b/lib/eal/common/eal_thread.h
@@ -5,6 +5,7 @@
 #ifndef EAL_THREAD_H
 #define EAL_THREAD_H
 
+#include <rte_common.h>
 #include <rte_lcore.h>
 
 /**
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index bde0de196e..1614a57752 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,6 +3,7 @@
  */
 #include <string.h>
 
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index bbbb6efd28..17edaa37c9 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,27 +20,13 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_log.h>
 #include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_log.h>
 
 /** Double linked list of buses */
 RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
 
-
-/**
- * IOVA mapping mode.
- *
- * IOVA mapping mode is iommu programming mode of a device.
- * That device (for example: IOMMU backed DMA device) based
- * on rte_iova_mode will generate physical or virtual address.
- *
- */
-enum rte_iova_mode {
-	RTE_IOVA_DC = 0,	/* Don't care mode */
-	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
-	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
-};
-
 /**
  * Bus specific scan for devices attached on the bus.
  * For each bus object, the scan would be responsible for finding devices and
diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h
index 5dfc50e987..fd3d7c1da8 100644
--- a/lib/eal/include/rte_eal.h
+++ b/lib/eal/include/rte_eal.h
@@ -17,7 +17,6 @@
 #include <rte_config.h>
 #include <rte_compat.h>
 #include <rte_per_lcore.h>
-#include <rte_bus.h>
 #include <rte_uuid.h>
 
 #include <rte_pci_dev_feature_defs.h>
@@ -458,6 +457,20 @@ static inline int rte_gettid(void)
 __rte_internal
 uint64_t rte_eal_get_baseaddr(void);
 
+/**
+ * IOVA mapping mode.
+ *
+ * IOVA mapping mode is iommu programming mode of a device.
+ * That device (for example: IOMMU backed DMA device) based
+ * on rte_iova_mode will generate physical or virtual address.
+ *
+ */
+enum rte_iova_mode {
+	RTE_IOVA_DC = 0,	/* Don't care mode */
+	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
+	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
+};
+
 /**
  * Get the iova mode
  *
diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h
index b598e1b9ec..4d3978512c 100644
--- a/lib/eal/include/rte_lcore.h
+++ b/lib/eal/include/rte_lcore.h
@@ -11,6 +11,8 @@
  * API for lcore and socket manipulation
  *
  */
+#include <stdio.h>
+
 #include <rte_config.h>
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index 122de2a319..79322d2ce9 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 
 #include <rte_debug.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <eal_memcfg.h>
 #include <rte_errno.h>
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0850..ebbe8cca3d 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
+#include <rte_bus.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 06ad712bd1..5b079cd14a 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,6 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <rte_bus.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 10/29] drivers/bus: remove back reference to bus objects
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (8 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 09/29] bus: move IOVA definition from header David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 11/29] drivers/bus: hide specific structures David Marchand
                     ` (20 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena,
	Stephen Hemminger, Long Li

There is no need for a back reference to a singleton object in the bus
driver objects: each function is contextually aware of which bus object
it should manipulate.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/auxiliary/auxiliary_common.c  |  2 --
 drivers/bus/auxiliary/rte_bus_auxiliary.h |  2 --
 drivers/bus/dpaa/dpaa_bus.c               | 10 +---------
 drivers/bus/dpaa/rte_dpaa_bus.h           |  1 -
 drivers/bus/fslmc/fslmc_bus.c             | 10 +---------
 drivers/bus/fslmc/rte_fslmc.h             |  1 -
 drivers/bus/pci/pci_common.c              |  2 --
 drivers/bus/pci/rte_bus_pci.h             |  1 -
 drivers/bus/vmbus/rte_bus_vmbus.h         |  2 --
 drivers/bus/vmbus/vmbus_common.c          |  2 --
 10 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 2cf8fe672d..0b212f2d64 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -259,7 +259,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 +266,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/rte_bus_auxiliary.h b/drivers/bus/auxiliary/rte_bus_auxiliary.h
index 93b266daf7..b19696e5e6 100644
--- a/drivers/bus/auxiliary/rte_bus_auxiliary.h
+++ b/drivers/bus/auxiliary/rte_bus_auxiliary.h
@@ -32,7 +32,6 @@ extern "C" {
 
 /* Forward declarations */
 struct rte_auxiliary_driver;
-struct rte_auxiliary_bus;
 struct rte_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. */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e442bc4c33..2c286d5817 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -520,23 +520,15 @@ rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
 	BUS_INIT_FUNC_TRACE();
 
 	TAILQ_INSERT_TAIL(&rte_dpaa_bus.driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = &rte_dpaa_bus;
 }
 
 /* un-register a dpaa bus based dpaa driver */
 void
 rte_dpaa_driver_unregister(struct rte_dpaa_driver *driver)
 {
-	struct rte_dpaa_bus *dpaa_bus;
-
 	BUS_INIT_FUNC_TRACE();
 
-	dpaa_bus = driver->dpaa_bus;
-
-	TAILQ_REMOVE(&dpaa_bus->driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = NULL;
+	TAILQ_REMOVE(&rte_dpaa_bus.driver_list, driver, next);
 }
 
 static int
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index 1f04d9ebd3..5e8f32dfbf 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -119,7 +119,6 @@ typedef int (*rte_dpaa_remove_t)(struct rte_dpaa_device *dpaa_dev);
 struct rte_dpaa_driver {
 	TAILQ_ENTRY(rte_dpaa_driver) next;
 	struct rte_driver driver;
-	struct rte_dpaa_bus *dpaa_bus;
 	enum rte_dpaa_type drv_type;
 	rte_dpaa_probe_t probe;
 	rte_dpaa_remove_t remove;
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index e9edc27e0a..f112d2afeb 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -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/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index 8c67bfba55..9c3791635c 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -146,7 +146,6 @@ 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;
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 37ab879779..0d61d49287 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -443,7 +443,6 @@ void
 rte_pci_register(struct rte_pci_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = &rte_pci_bus;
 }
 
 /* unregister a driver */
@@ -451,7 +450,6 @@ void
 rte_pci_unregister(struct rte_pci_driver *driver)
 {
 	TAILQ_REMOVE(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to PCI bus */
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1c6a8fdd7b..1913bc111c 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -161,7 +161,6 @@ typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
 struct rte_pci_driver {
 	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
 	struct rte_driver driver;          /**< Inherit core driver. */
-	struct rte_pci_bus *bus;           /**< PCI bus reference. */
 	rte_pci_probe_t *probe;            /**< Device probe function. */
 	rte_pci_remove_t *remove;          /**< Device remove function. */
 	pci_dma_map_t *dma_map;		   /**< device dma map function. */
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 4421326fe8..8d6ba26028 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -34,7 +34,6 @@ extern "C" {
 /* Forward declarations */
 struct rte_vmbus_device;
 struct rte_vmbus_driver;
-struct rte_vmbus_bus;
 struct vmbus_channel;
 struct vmbus_mon_page;
 
@@ -95,7 +94,6 @@ typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
 struct rte_vmbus_driver {
 	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
 	struct rte_driver driver;
-	struct rte_vmbus_bus *bus;          /**< VM bus reference. */
 	vmbus_probe_t *probe;               /**< Device Probe function. */
 	vmbus_remove_t *remove;             /**< Device Remove function. */
 
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..0f2d878126 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -235,7 +235,6 @@ rte_vmbus_register(struct rte_vmbus_driver *driver)
 		"Registered driver %s", driver->driver.name);
 
 	TAILQ_INSERT_TAIL(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = &rte_vmbus_bus;
 }
 
 /* unregister vmbus driver */
@@ -243,7 +242,6 @@ void
 rte_vmbus_unregister(struct rte_vmbus_driver *driver)
 {
 	TAILQ_REMOVE(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to VMBUS bus */
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 11/29] drivers/bus: hide specific structures
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (9 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 10/29] drivers/bus: remove back reference to bus objects David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 12/29] bus: introduce accessors David Marchand
                     ` (19 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Aman Singh, Yuying Zhang, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Stephen Hemminger,
	Long Li, Matan Azrad, Viacheslav Ovsiienko, Chas Williams,
	Min Hu (Connor)

Now that there is no bus specific object referenced in the driver
objects, we can hide rte_dpaa_bus, rte_fslmc_bus, rte_pci_bus,
rte_vmbus_bus specific structures into their bus code.

While at it:
- move enumerators only used in the bus code itself,
- 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.marchand@redhat.com>
---
Changes since RFC v1:
- dropped kni UT and ethtool example changes after new cleanup was added,
- cleaned ifgpa and vdev bus,

---
 app/test-pmd/testpmd.h                    |  1 +
 drivers/bus/auxiliary/private.h           | 28 +++++++++++------------
 drivers/bus/auxiliary/rte_bus_auxiliary.h |  1 -
 drivers/bus/dpaa/dpaa_bus.c               |  8 +++++++
 drivers/bus/dpaa/rte_dpaa_bus.h           | 13 -----------
 drivers/bus/fslmc/fslmc_bus.c             |  1 +
 drivers/bus/fslmc/fslmc_vfio.c            |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c  |  1 +
 drivers/bus/fslmc/private.h               | 27 ++++++++++++++++++++++
 drivers/bus/fslmc/rte_fslmc.h             | 20 ----------------
 drivers/bus/ifpga/ifpga_bus.c             |  4 ++--
 drivers/bus/ifpga/rte_bus_ifpga.h         |  6 -----
 drivers/bus/pci/bsd/pci.c                 |  2 --
 drivers/bus/pci/linux/pci.c               |  3 ---
 drivers/bus/pci/private.h                 | 18 ++++++++++++++-
 drivers/bus/pci/rte_bus_pci.h             | 22 ------------------
 drivers/bus/pci/windows/pci.c             |  1 +
 drivers/bus/pci/windows/pci_netuio.c      |  1 +
 drivers/bus/vdev/rte_bus_vdev.h           |  3 ---
 drivers/bus/vdev/vdev.c                   |  6 ++---
 drivers/bus/vmbus/private.h               | 18 +++++++++++++++
 drivers/bus/vmbus/rte_bus_vmbus.h         | 20 ----------------
 drivers/bus/vmbus/vmbus_common.c          |  1 -
 drivers/common/mlx5/mlx5_common_pci.c     |  1 +
 drivers/net/bonding/rte_eth_bond_args.c   |  1 +
 drivers/net/mlx5/linux/mlx5_os.c          |  1 +
 drivers/net/netvsc/hn_ethdev.c            |  1 +
 27 files changed, 97 insertions(+), 114 deletions(-)
 create mode 100644 drivers/bus/fslmc/private.h

diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index fb2f5195d3..8694c65539 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -8,6 +8,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index d22e83cf7a..d97e8c694e 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,9 +9,10 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
+#include <rte_bus.h>
+
 #include "rte_bus_auxiliary.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/rte_bus_auxiliary.h b/drivers/bus/auxiliary/rte_bus_auxiliary.h
index b19696e5e6..3b3dbc866a 100644
--- a/drivers/bus/auxiliary/rte_bus_auxiliary.h
+++ b/drivers/bus/auxiliary/rte_bus_auxiliary.h
@@ -25,7 +25,6 @@ extern "C" {
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 2c286d5817..ad4ea156a6 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -43,6 +43,14 @@
 #include <fsl_bman.h>
 #include <netcfg.h>
 
+struct rte_dpaa_bus {
+	struct rte_bus bus;
+	TAILQ_HEAD(, rte_dpaa_device) device_list;
+	TAILQ_HEAD(, rte_dpaa_driver) driver_list;
+	int device_count;
+	int detected;
+};
+
 static struct rte_dpaa_bus rte_dpaa_bus;
 struct netcfg_info *dpaa_netcfg;
 
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index 5e8f32dfbf..69c759c68b 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -6,7 +6,6 @@
 #ifndef __RTE_DPAA_BUS_H__
 #define __RTE_DPAA_BUS_H__
 
-#include <rte_bus.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 #include <dpaax_iova_table.h>
@@ -73,24 +72,12 @@ extern unsigned int dpaa_svr_family;
 struct rte_dpaa_device;
 struct rte_dpaa_driver;
 
-/* DPAA Device and Driver lists for DPAA bus */
-TAILQ_HEAD(rte_dpaa_device_list, rte_dpaa_device);
-TAILQ_HEAD(rte_dpaa_driver_list, rte_dpaa_driver);
-
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
 	FSL_DPAA_QDMA
 };
 
-struct rte_dpaa_bus {
-	struct rte_bus bus;
-	struct rte_dpaa_device_list device_list;
-	struct rte_dpaa_driver_list driver_list;
-	int device_count;
-	int detected;
-};
-
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index f112d2afeb..8498f5321a 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -16,6 +16,7 @@
 #include <ethdev_driver.h>
 #include <rte_mbuf_dyn.h>
 
+#include "private.h"
 #include <rte_fslmc.h>
 #include <fslmc_vfio.h>
 #include "fslmc_logs.h"
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 3d4e71a80a..b172c84d52 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -29,9 +29,9 @@
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_eal_memconfig.h>
 
+#include "private.h"
 #include "rte_fslmc.h"
 #include "fslmc_vfio.h"
 #include "fslmc_logs.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index ca1d0304d5..28780717bd 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -12,6 +12,7 @@
 #include <rte_malloc.h>
 #include <rte_dev.h>
 
+#include "private.h"
 #include <fslmc_logs.h>
 #include <rte_fslmc.h>
 #include <mc/fsl_dprc.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
new file mode 100644
index 0000000000..80d4673ca8
--- /dev/null
+++ b/drivers/bus/fslmc/private.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ *   Copyright 2016,2021 NXP
+ */
+
+#ifndef __PRIVATE_H__
+#define __PRIVATE_H__
+
+#include <rte_bus.h>
+
+#include <rte_fslmc.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 /* __PRIVATE_H__ */
diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index 9c3791635c..6bdee86aaf 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -29,7 +29,6 @@ extern "C" {
 #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 +68,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*/
@@ -152,19 +145,6 @@ struct rte_dpaa2_driver {
 	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.
  *
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index e005f2cb70..5353dbdb01 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -37,9 +37,9 @@
  */
 static struct rte_bus rte_ifpga_bus;
 
-static struct ifpga_afu_dev_list ifpga_afu_dev_list =
+static TAILQ_HEAD(, rte_afu_device) ifpga_afu_dev_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_dev_list);
-static struct ifpga_afu_drv_list ifpga_afu_drv_list =
+static TAILQ_HEAD(, rte_afu_driver) ifpga_afu_drv_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_drv_list);
 
 
diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/rte_bus_ifpga.h
index 682d565891..8792e23dd0 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/rte_bus_ifpga.h
@@ -19,18 +19,12 @@ extern "C" {
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
 
-/** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
 
 /* Forward declarations */
 struct rte_afu_device;
 struct rte_afu_driver;
 
-/** Double linked list of Intel FPGA AFU device. */
-RTE_TAILQ_HEAD(ifpga_afu_dev_list, rte_afu_device);
-/** Double linked list of Intel FPGA AFU device drivers. */
-RTE_TAILQ_HEAD(ifpga_afu_drv_list, rte_afu_driver);
-
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
 struct rte_afu_uuid {
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 9a11f99ae3..bcd772427b 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -48,8 +48,6 @@
  * PCI probing under BSD.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /* Map pci device */
 int
 rte_pci_map_device(struct rte_pci_device *dev)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index e521459870..fa5d5e131d 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -6,7 +6,6 @@
 #include <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_malloc.h>
@@ -24,8 +23,6 @@
  * PCI probing using Linux sysfs.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 static int
 pci_get_kernel_driver_by_path(const char *filename, char *dri_name,
 			      size_t len)
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 0fbef8e1d8..6ccec15655 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,12 +8,28 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
+/**
+ * Structure describing the PCI bus
+ */
+struct rte_pci_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_pci_device) device_list; /**< List of PCI devices */
+	RTE_TAILQ_HEAD(, rte_pci_driver) driver_list; /**< List of PCI drivers */
+};
+
 extern struct rte_pci_bus rte_pci_bus;
 
+/* PCI Bus iterators */
+#define FOREACH_DEVICE_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+
 struct rte_pci_driver;
 struct rte_pci_device;
 
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1913bc111c..01d834e3cc 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -25,7 +25,6 @@ extern "C" {
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 
 /** Pathname of PCI devices directory. */
@@ -35,18 +34,6 @@ const char *rte_pci_get_sysfs_path(void);
 struct rte_pci_device;
 struct rte_pci_driver;
 
-/** List of PCI devices */
-RTE_TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
-/** List of PCI drivers */
-RTE_TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
-
-/* PCI Bus iterators */
-#define FOREACH_DEVICE_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
-
 struct rte_devargs;
 
 enum rte_pci_kernel_driver {
@@ -169,15 +156,6 @@ struct rte_pci_driver {
 	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
 };
 
-/**
- * Structure describing the PCI bus
- */
-struct rte_pci_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_pci_device_list device_list;  /**< List of PCI devices */
-	struct rte_pci_driver_list driver_list;  /**< List of PCI drivers */
-};
-
 /** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
 #define RTE_PCI_DRV_NEED_MAPPING 0x0001
 /** Device needs PCI BAR mapping with enabled write combining (wc) */
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 7bf091158b..f013b743b3 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -9,6 +9,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_bus_pci.h>
 
 #include "private.h"
 #include "pci_netuio.h"
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index 5460399eea..314bbcf547 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 #include <rte_log.h>
 #include <rte_eal.h>
+#include <rte_bus_pci.h>
 
 #ifdef __MINGW32__
 #include <ddk/ndisguid.h>
diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
index 5af6be009f..ce20faf649 100644
--- a/drivers/bus/vdev/rte_bus_vdev.h
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -51,9 +51,6 @@ rte_vdev_device_args(const struct rte_vdev_device *dev)
 	return "";
 }
 
-/** Double linked list of virtual device drivers. */
-RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
 /**
  * Probe function called for each virtual device driver once.
  */
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index a8d8b2327e..804486d3ba 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -30,16 +30,14 @@
 /* Forward declare to access virtual bus name */
 static struct rte_bus rte_vdev_bus;
 
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
 
-static struct vdev_device_list vdev_device_list =
+static TAILQ_HEAD(, rte_vdev_device) vdev_device_list =
 	TAILQ_HEAD_INITIALIZER(vdev_device_list);
 /* The lock needs to be recursive because a vdev can manage another vdev. */
 static rte_spinlock_recursive_t vdev_device_list_lock =
 	RTE_SPINLOCK_RECURSIVE_INITIALIZER;
 
-static struct vdev_driver_list vdev_driver_list =
+static TAILQ_HEAD(, rte_vdev_driver) vdev_driver_list =
 	TAILQ_HEAD_INITIALIZER(vdev_driver_list);
 
 struct vdev_custom_scan {
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 658303bc27..597ba18df9 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -8,13 +8,31 @@
 
 #include <stdbool.h>
 #include <sys/uio.h>
+
+#include <rte_bus.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
 #include <rte_bus_vmbus.h>
 
+/**
+ * Structure describing the VM bus
+ */
+struct rte_vmbus_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_vmbus_device) device_list; /**< List of devices */
+	RTE_TAILQ_HEAD(, rte_vmbus_driver) driver_list; /**< List of drivers */
+};
+
 extern struct rte_vmbus_bus rte_vmbus_bus;
 
+/* VMBus iterators */
+#define FOREACH_DEVICE_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
+
 extern int vmbus_logtype_bus;
 #define VMBUS_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 8d6ba26028..763c077623 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -23,7 +23,6 @@ extern "C" {
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_bus.h>
 #include <rte_compat.h>
 #include <rte_uuid.h>
 #include <rte_debug.h>
@@ -37,16 +36,6 @@ struct rte_vmbus_driver;
 struct vmbus_channel;
 struct vmbus_mon_page;
 
-RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
-RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
-
-/* VMBus iterators */
-#define FOREACH_DEVICE_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
-
 /** Maximum number of VMBUS resources. */
 enum hv_uio_map {
 	HV_TXRX_RING_MAP = 0,
@@ -101,15 +90,6 @@ struct rte_vmbus_driver {
 };
 
 
-/**
- * Structure describing the VM bus
- */
-struct rte_vmbus_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_vmbus_device_list device_list;  /**< List of devices */
-	struct rte_vmbus_driver_list driver_list;  /**< List of drivers */
-};
-
 /**
  * Scan the content of the VMBUS bus, and the devices in the devices
  * list
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 0f2d878126..03b39c82b7 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -11,7 +11,6 @@
 #include <sys/mman.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 66626953f1..e708e23a7f 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,6 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 5406e1c934..b90757756a 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,6 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 0741028dab..04b9614f5c 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,6 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_bus_auxiliary.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 787139c0b2..308936ad9f 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,6 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
+#include <rte_bus.h>
 #include <rte_bus_vmbus.h>
 #include <rte_alarm.h>
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 12/29] bus: introduce accessors
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (10 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 11/29] drivers/bus: hide specific structures David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 13/29] bus: hide bus object David Marchand
                     ` (18 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Aman Singh, Yuying Zhang, Anatoly Burakov, Ray Kinsella

Add helpers to get a rte_bus object details.
This will be used externally.
Internal users may still dereference a rte_bus object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v1:
- changed approach: only external users are updated,

---
 app/test-pmd/config.c                        |  6 ++---
 app/test-pmd/testpmd.c                       |  4 +--
 app/test-pmd/testpmd.h                       |  4 +--
 app/test/test_devargs.c                      |  4 +--
 examples/multi_process/hotplug_mp/commands.c |  4 +--
 lib/eal/common/eal_common_bus.c              | 26 ++++++++++++--------
 lib/eal/include/rte_bus.h                    | 12 +++++++++
 lib/eal/version.map                          |  3 +++
 8 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 39bce480bf..bc154e8bf7 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -642,7 +642,7 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
+		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
 			if (!dev->driver)
@@ -653,7 +653,7 @@ device_infos_display(const char *identifier)
 				continue;
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
-			printf("Bus name: %s", dev->bus->name);
+			printf("Bus name: %s", rte_bus_name(dev->bus));
 			printf("\nDriver name: %s", dev->driver->name);
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
@@ -1154,7 +1154,7 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
 	}
 
 	bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
 	} else {
 		fprintf(stderr, "Not a PCI device\n");
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index addcbcac85..51c2488b45 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3507,9 +3507,9 @@ detach_devargs(char *identifier)
 		}
 	}
 
-	if (rte_eal_hotplug_remove(da.bus->name, da.name) != 0) {
+	if (rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name) != 0) {
 		TESTPMD_LOG(ERR, "Failed to detach device %s(%s)\n",
-			    da.name, da.bus->name);
+			    da.name, rte_bus_name(da.bus));
 		rte_devargs_reset(&da);
 		return;
 	}
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 8694c65539..59a8a429c5 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -819,7 +819,7 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
 	}
 
 	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
 	} else {
 		fprintf(stderr, "Not a PCI device\n");
@@ -847,7 +847,7 @@ port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
 	}
 
 	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
+	if (bus && !strcmp(rte_bus_name(bus), "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
 	} else {
 		fprintf(stderr, "Not a PCI device\n");
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 16621285d2..ac5bc34c18 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -98,9 +98,9 @@ test_valid_devargs_cases(const struct devargs_case *list, size_t n)
 			      list[i].bus_kv) != 0)
 			goto fail;
 		if (list[i].bus != NULL &&
-		    strcmp(da.bus->name, list[i].bus) != 0) {
+		    strcmp(rte_bus_name(da.bus), list[i].bus) != 0) {
 			printf("rte_devargs_parse(%s) bus name (%s) not expected (%s)\n",
-			       list[i].devargs, da.bus->name, list[i].bus);
+			       list[i].devargs, rte_bus_name(da.bus), list[i].bus);
 			goto fail;
 		}
 		if ((list[i].class_kv > 0 || list[i].class != NULL) &&
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index da8b5e5924..88f44e00a0 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -126,7 +126,7 @@ static void cmd_dev_attach_parsed(void *parsed_result,
 		return;
 	}
 
-	if (!rte_eal_hotplug_add(da.bus->name, da.name, da.args))
+	if (!rte_eal_hotplug_add(rte_bus_name(da.bus), da.name, da.args))
 		cmdline_printf(cl, "attached device %s\n", da.name);
 	else
 		cmdline_printf(cl, "failed to attached device %s\n",
@@ -173,7 +173,7 @@ static void cmd_dev_detach_parsed(void *parsed_result,
 	}
 
 	printf("detaching...\n");
-	if (!rte_eal_hotplug_remove(da.bus->name, da.name))
+	if (!rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name))
 		cmdline_printf(cl, "detached device %s\n",
 			da.name);
 	else
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index baa5b532af..cbf382f967 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -16,11 +16,17 @@
 static struct rte_bus_list rte_bus_list =
 	TAILQ_HEAD_INITIALIZER(rte_bus_list);
 
+const char *
+rte_bus_name(const struct rte_bus *bus)
+{
+	return bus->name;
+}
+
 void
 rte_bus_register(struct rte_bus *bus)
 {
 	RTE_VERIFY(bus);
-	RTE_VERIFY(bus->name && strlen(bus->name));
+	RTE_VERIFY(rte_bus_name(bus) && strlen(rte_bus_name(bus)));
 	/* A bus should mandatorily have the scan implemented */
 	RTE_VERIFY(bus->scan);
 	RTE_VERIFY(bus->probe);
@@ -29,14 +35,14 @@ rte_bus_register(struct rte_bus *bus)
 	RTE_VERIFY(!bus->plug || bus->unplug);
 
 	TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", rte_bus_name(bus));
 }
 
 void
 rte_bus_unregister(struct rte_bus *bus)
 {
 	TAILQ_REMOVE(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", rte_bus_name(bus));
 }
 
 /* Scan all the buses for registered devices */
@@ -50,7 +56,7 @@ rte_bus_scan(void)
 		ret = bus->scan();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	return 0;
@@ -64,7 +70,7 @@ rte_bus_probe(void)
 	struct rte_bus *bus, *vbus = NULL;
 
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
-		if (!strcmp(bus->name, "vdev")) {
+		if (!strcmp(rte_bus_name(bus), "vdev")) {
 			vbus = bus;
 			continue;
 		}
@@ -72,14 +78,14 @@ rte_bus_probe(void)
 		ret = bus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				vbus->name);
+				rte_bus_name(vbus));
 	}
 
 	return 0;
@@ -92,7 +98,7 @@ bus_dump_one(FILE *f, struct rte_bus *bus)
 	int ret;
 
 	/* For now, dump only the bus name */
-	ret = fprintf(f, " %s\n", bus->name);
+	ret = fprintf(f, " %s\n", rte_bus_name(bus));
 
 	/* Error in case of inability in writing to stream */
 	if (ret < 0)
@@ -163,7 +169,7 @@ cmp_bus_name(const struct rte_bus *bus, const void *_name)
 {
 	const char *name = _name;
 
-	return strcmp(bus->name, name);
+	return strcmp(rte_bus_name(bus), name);
 }
 
 struct rte_bus *
@@ -213,7 +219,7 @@ rte_bus_get_iommu_class(void)
 
 		bus_iova_mode = bus->get_iommu_class();
 		RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n",
-			bus->name,
+			rte_bus_name(bus),
 			bus_iova_mode == RTE_IOVA_DC ? "DC" :
 			(bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA"));
 		if (bus_iova_mode == RTE_IOVA_PA)
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 17edaa37c9..2775e1ac66 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -266,6 +266,18 @@ struct rte_bus {
 
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure.
+ * @return
+ *   A pointer to the bus name string.
+ */
+__rte_experimental
+const char *rte_bus_name(const struct rte_bus *bus);
+
 /**
  * Register a Bus handler.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index c2a2cebf69..6f713c987d 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_bus_name;
 };
 
 INTERNAL {
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 13/29] bus: hide bus object
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (11 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 12/29] bus: introduce accessors David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 14/29] bbdev: mark driver header David Marchand
                     ` (17 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena,
	Rosen Xu, Anatoly Burakov, Stephen Hemminger, Long Li,
	Matan Azrad, Viacheslav Ovsiienko, Bruce Richardson, Kevin Laatz,
	Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Ray Kinsella,
	Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v1:
- update all existing users of the public header to use the internal one,

---
 app/test/test_devargs.c                  |   2 +-
 app/test/test_vdev.c                     |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c |   2 +-
 drivers/bus/auxiliary/auxiliary_params.c |   2 +-
 drivers/bus/auxiliary/private.h          |   2 +-
 drivers/bus/dpaa/dpaa_bus.c              |   4 +-
 drivers/bus/fslmc/fslmc_bus.c            |   2 +-
 drivers/bus/fslmc/private.h              |   2 +-
 drivers/bus/ifpga/ifpga_bus.c            |   2 +-
 drivers/bus/pci/linux/pci_vfio.c         |   2 +-
 drivers/bus/pci/pci_common.c             |   2 +-
 drivers/bus/pci/pci_params.c             |   2 +-
 drivers/bus/pci/private.h                |   2 +-
 drivers/bus/vdev/vdev.c                  |   2 +-
 drivers/bus/vmbus/private.h              |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c    |   2 +-
 drivers/dma/idxd/idxd_bus.c              |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c  |   2 +-
 drivers/net/failsafe/failsafe.c          |   2 +-
 drivers/net/failsafe/failsafe_eal.c      |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c         |   2 +-
 drivers/net/netvsc/hn_ethdev.c           |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c    |   2 +-
 drivers/net/virtio/virtio_pci.c          |   2 +-
 drivers/raw/ioat/idxd_bus.c              |   2 +-
 lib/eal/common/eal_common_bus.c          |   2 +-
 lib/eal/common/eal_common_dev.c          |   2 +-
 lib/eal/common/eal_common_devargs.c      |   2 +-
 lib/eal/common/hotplug_mp.c              |   2 +-
 lib/eal/include/bus_driver.h             | 296 +++++++++++++++++++++++
 lib/eal/include/meson.build              |   4 +
 lib/eal/include/rte_bus.h                | 275 +--------------------
 lib/eal/linux/eal_dev.c                  |   2 +-
 lib/eal/version.map                      |   4 +-
 lib/ethdev/rte_ethdev.c                  |   2 +-
 lib/pcapng/rte_pcapng.c                  |   2 +-
 36 files changed, 338 insertions(+), 307 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..14a0b11fbe 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -6,10 +6,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 5eeff3106d..9e39993e90 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -6,9 +6,9 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 0b212f2d64..38d722e653 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -12,7 +12,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 9017118b36..542083dc89 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index d97e8c694e..1e0e584039 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "rte_bus_auxiliary.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index ad4ea156a6..ed3036a642 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -14,6 +14,8 @@
 #include <sys/types.h>
 #include <sys/eventfd.h>
 
+#include <bus_driver.h>
+#include <ethdev_driver.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
@@ -26,10 +28,8 @@
 #include <rte_eal.h>
 #include <rte_alarm.h>
 #include <rte_ether.h>
-#include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 8498f5321a..0b52c8e46c 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 80d4673ca8..f08dc7716b 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef __PRIVATE_H__
 #define __PRIVATE_H__
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <rte_fslmc.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 5353dbdb01..d962fb8362 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -13,8 +13,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 
+#include <bus_driver.h>
 #include <rte_errno.h>
-#include <rte_bus.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index cd0d0b1670..fab3483d9f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_vfio.h>
 #include <rte_eal.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 0d61d49287..c26aacd364 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_lcore.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 61a868707f..39d702a418 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 6ccec15655..0cefed5edf 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 804486d3ba..ee569fcdf2 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -10,9 +10,9 @@
 #include <stdbool.h>
 #include <sys/queue.h>
 
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 597ba18df9..600530c4f6 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e708e23a7f..838b62b81c 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index b90757756a..cc3805baba 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -2,9 +2,9 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 3eb7d32b76..7fe77cfe8e 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_vdev.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..d71b512f81 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,7 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 04b9614f5c..6899f430cb 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_bus_auxiliary.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 308936ad9f..0aedecd358 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_vmbus.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 2587195168..9d65f75048 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -23,8 +23,8 @@
 #include <sys/socket.h>
 #include <unistd.h>
 
+#include <bus_driver.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..9cf4d760b4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -9,7 +9,7 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "virtio_pci.h"
 #include "virtio_logs.h"
diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 539f51b1b1..f32d811055 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include "ioat_private.h"
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..62a598957c 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..03e6e59baf 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..5202bd5658 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..d2e615a736
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,296 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_devargs;
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+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);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_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 */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 2775e1ac66..902a6c7c59 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,251 +20,11 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
+#include <rte_compat.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-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);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_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 */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * @warning
@@ -278,24 +38,6 @@ struct rte_bus {
 __rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -385,17 +127,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..b5eab93fbf 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -8,12 +8,12 @@
 #include <sys/socket.h>
 #include <linux/netlink.h>
 
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_log.h>
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 6f713c987d..48c8a2f511 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -13,9 +13,7 @@ DPDK_22 {
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -432,6 +430,8 @@ EXPERIMENTAL {
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index ebbe8cca3d..9eba97f2d2 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..72aabd4dd0 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 14/29] bbdev: mark driver header
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (12 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 13/29] bus: hide bus object David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 15/29] ethdev: mark some headers as driver only David Marchand
                     ` (16 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Nicolas Chautru

rte_bbdev_pmd.h is a driver only header.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/bbdev/meson.build | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/bbdev/meson.build b/lib/bbdev/meson.build
index 07685e7578..7d035065f1 100644
--- a/lib/bbdev/meson.build
+++ b/lib/bbdev/meson.build
@@ -8,7 +8,6 @@ if is_windows
 endif
 
 sources = files('rte_bbdev.c')
-headers = files('rte_bbdev.h',
-        'rte_bbdev_pmd.h',
-        'rte_bbdev_op.h')
+headers = files('rte_bbdev.h', 'rte_bbdev_op.h')
+driver_sdk_headers = files('rte_bbdev_pmd.h')
 deps += ['mbuf']
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 15/29] ethdev: mark some headers as driver only
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (13 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 14/29] bbdev: mark driver header David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 16/29] rawdev: mark driver header David Marchand
                     ` (15 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: stable, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Tyler Retzlaff

Those headers are for drivers as they include ethdev_driver.h, a
driver-only header.

Fixes: 19cc526d6c79 ("ethdev: install driver headers")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/ethdev/meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
index 47bb2625b0..c25762ce66 100644
--- a/lib/ethdev/meson.build
+++ b/lib/ethdev/meson.build
@@ -24,11 +24,8 @@ headers = files(
         'rte_ethdev_trace_fp.h',
         'rte_dev_info.h',
         'rte_flow.h',
-        'rte_flow_driver.h',
         'rte_mtr.h',
-        'rte_mtr_driver.h',
         'rte_tm.h',
-        'rte_tm_driver.h',
 )
 
 indirect_headers += files(
@@ -40,6 +37,9 @@ driver_sdk_headers += files(
         'ethdev_driver.h',
         'ethdev_pci.h',
         'ethdev_vdev.h',
+        'rte_flow_driver.h',
+        'rte_mtr_driver.h',
+        'rte_tm_driver.h',
 )
 
 deps += ['net', 'kvargs', 'meter', 'telemetry']
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 16/29] rawdev: mark driver header
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (14 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 15/29] ethdev: mark some headers as driver only David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 17/29] drivers: export drivers headers David Marchand
                     ` (14 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Sachin Saxena, Hemant Agrawal

rte_rawdev_pmd.h is a driver only header.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/rawdev/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/rawdev/meson.build b/lib/rawdev/meson.build
index 7dfc3d5cf9..ccfd922fda 100644
--- a/lib/rawdev/meson.build
+++ b/lib/rawdev/meson.build
@@ -8,6 +8,7 @@ if is_windows
 endif
 
 sources = files('rte_rawdev.c')
-headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h')
+headers = files('rte_rawdev.h')
+driver_sdk_headers = files('rte_rawdev_pmd.h')
 
 deps += ['telemetry']
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 17/29] drivers: export drivers headers
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (15 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 16/29] rawdev: mark driver header David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 18/29] bus/auxiliary: make driver-only headers private David Marchand
                     ` (13 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev

Same as for device classes, external DPDK users may need to include some
bus headers for their out of tree drivers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/meson.build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/meson.build b/drivers/meson.build
index b22c2adda7..7449643fa9 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -89,6 +89,7 @@ foreach subpath:subdirs
         name = drv
         sources = []
         headers = []
+        driver_sdk_headers = [] # public headers included by drivers
         objs = []
         cflags = default_cflags
         includes = [include_directories(drv_path)]
@@ -158,6 +159,9 @@ foreach subpath:subdirs
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         install_headers(headers)
+        if get_option('enable_driver_sdk')
+            install_headers(driver_sdk_headers)
+        endif
 
         # generate pmdinfo sources by building a temporary
         # lib and then running pmdinfogen on the contents of
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 18/29] bus/auxiliary: make driver-only headers private
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (16 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 17/29] drivers: export drivers headers David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 19/29] bus/dpaa: " David Marchand
                     ` (12 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Parav Pandit, Xueming Li, Ray Kinsella, Matan Azrad,
	Viacheslav Ovsiienko

The auxiliary bus interface is for drivers only.
Mark as internal and move the header on the driver headers list.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/auxiliary/auxiliary_common.c          |  1 -
 drivers/bus/auxiliary/auxiliary_params.c          |  1 -
 ...rte_bus_auxiliary.h => bus_auxiliary_driver.h} | 15 ++++++++-------
 drivers/bus/auxiliary/linux/auxiliary.c           |  1 -
 drivers/bus/auxiliary/meson.build                 |  4 +---
 drivers/bus/auxiliary/private.h                   |  2 +-
 drivers/bus/auxiliary/version.map                 |  3 +--
 drivers/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 +-
 11 files changed, 15 insertions(+), 20 deletions(-)
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (94%)

diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 38d722e653..259ff152c4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -23,7 +23,6 @@
 #include <rte_devargs.h>
 
 #include "private.h"
-#include "rte_bus_auxiliary.h"
 
 static struct rte_devargs *
 auxiliary_devargs_lookup(const char *name)
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 542083dc89..a889e392c6 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -10,7 +10,6 @@
 #include <rte_kvargs.h>
 
 #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 94%
rename from drivers/bus/auxiliary/rte_bus_auxiliary.h
rename to drivers/bus/auxiliary/bus_auxiliary_driver.h
index 3b3dbc866a..44bacc3c0e 100644
--- a/drivers/bus/auxiliary/rte_bus_auxiliary.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -22,6 +22,7 @@ extern "C" {
 #include <stdint.h>
 #include <inttypes.h>
 
+#include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
@@ -41,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.
@@ -54,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.
@@ -85,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
@@ -104,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.
@@ -157,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 */
@@ -179,7 +180,7 @@ 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
diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index 28092e31c4..d4c564cd78 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -11,7 +11,6 @@
 #include <rte_memcpy.h>
 #include <eal_filesystem.h>
 
-#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 1e0e584039..3dee13e1d1 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -11,7 +11,7 @@
 
 #include <bus_driver.h>
 
-#include "rte_bus_auxiliary.h"
+#include "bus_auxiliary_driver.h"
 
 extern int auxiliary_bus_logtype;
 
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 <rte_malloc.h>
 #include <rte_errno.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #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 <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <rte_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #include "mlx5_common.h"
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 6899f430cb..62f654d18e 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -21,7 +21,7 @@
 #include <rte_pci.h>
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 19/29] bus/dpaa: make driver-only headers private
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (17 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 18/29] bus/auxiliary: make driver-only headers private David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 20/29] bus/fslmc: " David Marchand
                     ` (11 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Sachin Saxena, Gagandeep Singh

The dpaa bus interface is for drivers only.
Mark as internal and move the header on the driver headers list.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/dpaa/base/qbman/qman.c                     | 2 +-
 drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} | 9 ++++++---
 drivers/bus/dpaa/dpaa_bus.c                            | 2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c                     | 2 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c              | 2 +-
 drivers/dma/dpaa/dpaa_qdma.c                           | 2 +-
 drivers/event/dpaa/dpaa_eventdev.c                     | 2 +-
 drivers/mempool/dpaa/dpaa_mempool.h                    | 2 +-
 drivers/net/dpaa/dpaa_ethdev.c                         | 2 +-
 drivers/net/dpaa/dpaa_rxtx.c                           | 2 +-
 10 files changed, 15 insertions(+), 12 deletions(-)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (97%)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 447c091770..3949bf8712 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -7,7 +7,7 @@
 
 #include "qman.h"
 #include <rte_branch_prediction.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_eventdev.h>
 #include <rte_byteorder.h>
 
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/bus_dpaa_driver.h
similarity index 97%
rename from drivers/bus/dpaa/rte_dpaa_bus.h
rename to drivers/bus/dpaa/bus_dpaa_driver.h
index 69c759c68b..4360295335 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -3,9 +3,10 @@
  *   Copyright 2017-2022 NXP
  *
  */
-#ifndef __RTE_DPAA_BUS_H__
-#define __RTE_DPAA_BUS_H__
+#ifndef BUS_DPAA_DRIVER_H
+#define BUS_DPAA_DRIVER_H
 
+#include <rte_compat.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 #include <dpaax_iova_table.h>
@@ -152,6 +153,7 @@ extern struct dpaa_memseg_list rte_dpaa_memsegs;
 /* Either iterate over the list of internal memseg references or fallback to
  * EAL memseg based iova2virt.
  */
+__rte_internal
 static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 {
 	struct dpaa_memseg *ms;
@@ -178,6 +180,7 @@ static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 	return va;
 }
 
+__rte_internal
 static inline rte_iova_t
 rte_dpaa_mem_vtop(void *vaddr)
 {
@@ -249,4 +252,4 @@ struct fm_eth_port_cfg *dpaa_get_eth_port_cfg(int dev_id);
 }
 #endif
 
-#endif /* __RTE_DPAA_BUS_H__ */
+#endif /* BUS_DPAA_DRIVER_H */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index ed3036a642..4b6473674f 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,7 +34,7 @@
 #include <rte_mbuf_dyn.h>
 
 #include <dpaa_of.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaax_iova_table.h>
 
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 05415dbf3b..7e554cb2b1 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -41,7 +41,7 @@
 #include <desc/pdcp.h>
 #include <desc/sdap.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_event.h>
 #include <dpaa_sec_log.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d081953e26..29c5935739 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -15,7 +15,7 @@
 #include <desc/algo.h>
 #include <desc/ipsec.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_log.h>
 
diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c
index 9386fe5698..10e65ef1d7 100644
--- a/drivers/dma/dpaa/dpaa_qdma.c
+++ b/drivers/dma/dpaa/dpaa_qdma.c
@@ -2,7 +2,7 @@
  * Copyright 2021 NXP
  */
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dmadev_pmd.h>
 
 #include "dpaa_qdma.h"
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index ff6cc0be18..aa403f9e06 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -29,7 +29,7 @@
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_event_eth_tx_adapter.h>
 #include <cryptodev_pmd.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h
index dc0058e6dd..3f0eafa7dd 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.h
+++ b/drivers/mempool/dpaa/dpaa_mempool.h
@@ -14,7 +14,7 @@
 
 #include <rte_mempool.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 
 #include <fsl_usd.h>
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index e5a072cf49..f21cbba0d9 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -33,7 +33,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaa_mempool.h>
 
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 956fe946fa..20b75efb63 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -37,7 +37,7 @@
 
 #include "dpaa_ethdev.h"
 #include "dpaa_rxtx.h"
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_mempool.h>
 
 #include <qman.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 20/29] bus/fslmc: make driver-only headers private
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (18 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 19/29] bus/dpaa: " David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 21/29] bus/ifpga: cleanup exported symbols David Marchand
                     ` (10 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Sachin Saxena, Gagandeep Singh

The fslmc bus interface is for drivers only.
Mark as internal and move the header on the driver headers list.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} | 7 ++++---
 drivers/bus/fslmc/fslmc_bus.c                         | 1 -
 drivers/bus/fslmc/fslmc_vfio.c                        | 1 -
 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              | 1 -
 drivers/bus/fslmc/private.h                           | 2 +-
 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, 20 insertions(+), 22 deletions(-)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (98%)

diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/bus_fslmc_driver.h
similarity index 98%
rename from drivers/bus/fslmc/rte_fslmc.h
rename to drivers/bus/fslmc/bus_fslmc_driver.h
index 6bdee86aaf..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,6 +26,7 @@ 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>
@@ -209,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 0b52c8e46c..8503004e3d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -17,7 +17,6 @@
 #include <rte_mbuf_dyn.h>
 
 #include "private.h"
-#include <rte_fslmc.h>
 #include <fslmc_vfio.h>
 #include "fslmc_logs.h"
 
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index b172c84d52..8604e43947 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -32,7 +32,6 @@
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
-#include "rte_fslmc.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 28780717bd..223e34bcba 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -14,7 +14,6 @@
 
 #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
index f08dc7716b..e7425d819b 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -7,7 +7,7 @@
 
 #include <bus_driver.h>
 
-#include <rte_fslmc.h>
+#include <bus_fslmc_driver.h>
 
 /*
  * FSLMC bus
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.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 21/29] bus/ifpga: cleanup exported symbols
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (19 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 20/29] bus/fslmc: " David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 22/29] bus/ifpga: make driver-only headers private David Marchand
                     ` (9 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Rosen Xu, Ray Kinsella, Tianfei zhang

Remove unused symbols (exposed only in an internal header which
guarantees that no application out there relied on them).

Remove rte_ prefix and inline the rest to avoid having to expose them as
global symbols for a relatively small added value.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/ifpga/ifpga_bus.c    | 13 +++--
 drivers/bus/ifpga/ifpga_common.c | 87 --------------------------------
 drivers/bus/ifpga/ifpga_common.h | 54 ++++++++++++++++----
 drivers/bus/ifpga/meson.build    |  2 +-
 drivers/bus/ifpga/version.map    |  2 -
 drivers/raw/ifpga/ifpga_rawdev.c |  2 +-
 6 files changed, 53 insertions(+), 107 deletions(-)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c

diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index d962fb8362..988e336a1b 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -117,9 +117,9 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-		&rte_ifpga_get_integer32_arg, &afu_pr_conf.afu_id.port) < 0) {
-			IFPGA_BUS_ERR("error to parse %s",
-				     IFPGA_ARG_PORT);
+				ifpga_get_integer32_arg,
+				&afu_pr_conf.afu_id.port) < 0) {
+			IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_PORT);
 			goto end;
 		}
 	} else {
@@ -130,9 +130,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_AFU_BTS) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_AFU_BTS,
-				       &rte_ifpga_get_string_arg, &path) < 0) {
-			IFPGA_BUS_ERR("Failed to parse %s",
-				     IFPGA_AFU_BTS);
+				ifpga_get_string_arg, &path) < 0) {
+			IFPGA_BUS_ERR("Failed to parse %s", IFPGA_AFU_BTS);
 			goto end;
 		}
 		afu_pr_conf.pr_enable = 1;
@@ -228,7 +227,7 @@ ifpga_scan(void)
 
 		if (rte_kvargs_count(kvlist, IFPGA_ARG_NAME) == 1) {
 			if (rte_kvargs_process(kvlist, IFPGA_ARG_NAME,
-				       &rte_ifpga_get_string_arg, &name) < 0) {
+					ifpga_get_string_arg, &name) < 0) {
 				IFPGA_BUS_ERR("error to parse %s",
 				     IFPGA_ARG_NAME);
 				goto end;
diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c
deleted file mode 100644
index 223660d6ff..0000000000
--- a/drivers/bus/ifpga/ifpga_common.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2018 Intel Corporation
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/queue.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <rte_errno.h>
-#include <rte_per_lcore.h>
-#include <rte_memory.h>
-#include <rte_memzone.h>
-#include <rte_eal.h>
-#include <rte_common.h>
-
-#include <rte_devargs.h>
-#include <rte_kvargs.h>
-#include <rte_alarm.h>
-
-#include "rte_bus_ifpga.h"
-#include "ifpga_logs.h"
-#include "ifpga_common.h"
-
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(char **)extra_args = strdup(value);
-
-	if (!*(char **)extra_args)
-		return -ENOMEM;
-
-	return 0;
-}
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(int *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_unsigned_long(const char *str, int base)
-{
-	unsigned long num;
-	char *end = NULL;
-
-	errno = 0;
-
-	num = strtoul(str, &end, base);
-	if ((str[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0))
-		return -1;
-
-	return num;
-}
-
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1)
-{
-	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
-		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
-		(afu_id0->port == afu_id1->port)) {
-		return 0;
-	} else
-		return 1;
-}
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index f9254b9d5d..bb6524030f 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -5,14 +5,50 @@
 #ifndef _IFPGA_COMMON_H_
 #define _IFPGA_COMMON_H_
 
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_unsigned_long(const char *str, int base);
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1);
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_bus_ifpga.h>
+#include <rte_common.h>
+
+static inline int
+ifpga_get_string_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(char **)extra_args = strdup(value);
+
+	if (!*(char **)extra_args)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static inline int
+ifpga_get_integer32_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(int *)extra_args = strtoull(value, NULL, 0);
+
+	return 0;
+}
+
+static inline int
+ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
+	const struct rte_afu_id *afu_id1)
+{
+	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
+		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
+		(afu_id0->port == afu_id1->port)) {
+		return 0;
+	} else
+		return 1;
+}
 
 #endif /* _IFPGA_COMMON_H_ */
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index cc5047e3ce..9d56a4bb2b 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -9,4 +9,4 @@ endif
 
 deps += ['pci', 'kvargs', 'rawdev']
 headers = files('rte_bus_ifpga.h')
-sources = files('ifpga_common.c', 'ifpga_bus.c')
+sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index 8ac3a4d258..c33537d39d 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -4,8 +4,6 @@ DPDK_22 {
 	rte_ifpga_driver_register;
 	rte_ifpga_driver_unregister;
 	rte_ifpga_find_afu_by_name;
-	rte_ifpga_get_integer32_arg;
-	rte_ifpga_get_string_arg;
 
 	local: *;
 };
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 78a7123528..93a7e74959 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1752,7 +1752,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-			&rte_ifpga_get_integer32_arg, &port) < 0) {
+				ifpga_get_integer32_arg, &port) < 0) {
 			IFPGA_RAWDEV_PMD_ERR("error to parse %s",
 				IFPGA_ARG_PORT);
 			goto end;
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 22/29] bus/ifpga: make driver-only headers private
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (20 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 21/29] bus/ifpga: cleanup exported symbols David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 23/29] bus/pci: " David Marchand
                     ` (8 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Rosen Xu, Ray Kinsella, Tianfei zhang

The ifpga bus interface is for drivers only.
Mark as internal and move the header on the driver headers list.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 .../bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} | 11 ++++++++---
 drivers/bus/ifpga/ifpga_bus.c                         |  4 ++--
 drivers/bus/ifpga/ifpga_common.h                      |  2 +-
 drivers/bus/ifpga/meson.build                         |  2 +-
 drivers/bus/ifpga/version.map                         |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c                    |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h                    |  2 +-
 drivers/net/ipn3ke/ipn3ke_flow.c                      |  2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c               |  2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                        |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h                      |  2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c                   |  2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c                   |  2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c                    |  2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c                     |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c                      |  2 +-
 16 files changed, 24 insertions(+), 19 deletions(-)
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (95%)

diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/bus_ifpga_driver.h
similarity index 95%
rename from drivers/bus/ifpga/rte_bus_ifpga.h
rename to drivers/bus/ifpga/bus_ifpga_driver.h
index 8792e23dd0..7b75c2ddbc 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -2,8 +2,8 @@
  * Copyright(c) 2010-2018 Intel Corporation
  */
 
-#ifndef _RTE_BUS_IFPGA_H_
-#define _RTE_BUS_IFPGA_H_
+#ifndef BUS_IFPGA_DRIVER_H
+#define BUS_IFPGA_DRIVER_H
 
 /**
  * @file
@@ -15,6 +15,7 @@
 extern "C" {
 #endif /* __cplusplus */
 
+#include <rte_compat.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
@@ -105,6 +106,7 @@ struct rte_afu_driver {
 	const struct rte_afu_uuid *id_table;    /**< AFU uuid within FPGA. */
 };
 
+__rte_internal
 static inline const char *
 rte_ifpga_device_name(const struct rte_afu_device *afu)
 {
@@ -119,6 +121,7 @@ rte_ifpga_device_name(const struct rte_afu_device *afu)
  * @param name
  *   A pointer to AFU name string.
  */
+__rte_internal
 struct rte_afu_device *
 rte_ifpga_find_afu_by_name(const char *name);
 
@@ -129,6 +132,7 @@ rte_ifpga_find_afu_by_name(const char *name);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be registered.
  */
+__rte_internal
 void rte_ifpga_driver_register(struct rte_afu_driver *driver);
 
 /**
@@ -138,6 +142,7 @@ void rte_ifpga_driver_register(struct rte_afu_driver *driver);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be unregistered.
  */
+__rte_internal
 void rte_ifpga_driver_unregister(struct rte_afu_driver *driver);
 
 #define RTE_PMD_REGISTER_AFU(nm, afudrv)\
@@ -157,4 +162,4 @@ static const char *afudrvinit_ ## nm ## _alias = RTE_STR(alias)
 }
 #endif /* __cplusplus */
 
-#endif /* _RTE_BUS_IFPGA_H_ */
+#endif /* BUS_IFPGA_DRIVER_H */
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 988e336a1b..8c3021cd1a 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -28,7 +28,7 @@
 
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_logs.h"
 #include "ifpga_common.h"
 
@@ -65,7 +65,7 @@ ifpga_find_afu_dev(const struct rte_rawdev *rdev,
 
 	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
 		if (afu_dev->rawdev == rdev &&
-			!ifpga_afu_id_cmp(&afu_dev->id, afu_id))
+				!ifpga_afu_id_cmp(&afu_dev->id, afu_id))
 			return afu_dev;
 	}
 	return NULL;
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index bb6524030f..a41a1628f5 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_common.h>
 
 static inline int
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index 9d56a4bb2b..dedc94db2d 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -8,5 +8,5 @@ if is_windows
 endif
 
 deps += ['pci', 'kvargs', 'rawdev']
-headers = files('rte_bus_ifpga.h')
+driver_sdk_headers += files('bus_ifpga_driver.h')
 sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index c33537d39d..3d1943afe4 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -1,4 +1,4 @@
-DPDK_22 {
+INTERNAL {
 	global:
 
 	rte_ifpga_driver_register;
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 550a8b0466..2e39113941 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 58fcc50c57..dbf57f9ba8 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -24,7 +24,7 @@
 #include <rte_spinlock.h>
 
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_tm_driver.h>
 
 #define IPN3KE_TM_SCRATCH_RW 0
diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c
index 66ae31a5a9..5b57ee9341 100644
--- a/drivers/net/ipn3ke/ipn3ke_flow.c
+++ b/drivers/net/ipn3ke/ipn3ke_flow.c
@@ -20,7 +20,7 @@
 #include <rte_tailq.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index abbecfdf2e..2f088d767f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 6a9b98fd7f..2f242b678a 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/raw/ifpga/afu_pmd_core.h b/drivers/raw/ifpga/afu_pmd_core.h
index 91118a19ab..ab5a228147 100644
--- a/drivers/raw/ifpga/afu_pmd_core.h
+++ b/drivers/raw/ifpga/afu_pmd_core.h
@@ -15,7 +15,7 @@ extern "C" {
 
 #include <rte_spinlock.h>
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "ifpga_rawdev.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index 102de50812..eca1edc270 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index 8b2c85b5f8..da0aba6e00 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 0f57a03b0e..3c41aa9ee8 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 5120df5f77..b7438bd372 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 93a7e74959..d9beb72db3 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -35,7 +35,7 @@
 #include "base/ifpga_api.h"
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include <bus_ifpga_driver.h>
 #include "ifpga_common.h"
 #include "ifpga_logs.h"
 #include "ifpga_rawdev.h"
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 23/29] bus/pci: make driver-only headers private
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (21 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 22/29] bus/ifpga: make driver-only headers private David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 24/29] bus/vdev: " David Marchand
                     ` (7 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Aman Singh, Yuying Zhang, Nicolas Chautru, Ray Kinsella,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Matan Azrad, Viacheslav Ovsiienko, Fan Zhang, Andrew Rybchenko,
	Ashish Gupta, Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph,
	Tejasree Kondoj, Nagadheeraj Rottela, Srikanth Jampala, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru, Chengwen Feng,
	Bruce Richardson, Kevin Laatz, Conor Walsh, Timothy McDaniel,
	Jerin Jacob, Pavan Nikhilesh, Elena Agostini, Ashwin Sekhar T K,
	Harman Kalra, Shepard Siegel, Ed Czeck, John Miller,
	Steven Webster, Matt Peters, Rasesh Mody, Shahed Shaikh,
	Ajit Khaparde, Somnath Kotur, Chas Williams, Min Hu (Connor),
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Dongdong Liu, Yisen Zhuang, Beilei Xing,
	Junfeng Guo, Andrew Boyer, Rosen Xu, Qiming Yang,
	Stephen Hemminger, Long Li, Jiawen Wu, Devendra Singh Rawat,
	Maciej Czekaj, Jian Wang, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Tianfei zhang,
	Jingjing Wu, Ori Kam, Xiao Wang, Vijay Kumar Srivastava,
	Thomas Monjalon, Ferruh Yigit

The pci bus interface is for drivers only.
Mark as internal and move the header on the driver headers list.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/testpmd.h                        |   2 +-
 app/test/virtual_pmd.c                        |   2 +-
 drivers/baseband/acc100/rte_acc100_pmd.c      |   2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   2 +-
 drivers/bus/pci/bsd/pci.c                     |   1 -
 drivers/bus/pci/bus_pci_driver.h              | 200 ++++++++++++++++++
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/private.h                     |   1 +
 drivers/bus/pci/rte_bus_pci.h                 | 178 +---------------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/common/cnxk/roc_platform.h            |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |   2 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   2 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   2 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   2 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   2 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   2 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   2 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/netvsc/hn_vf.c                    |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   2 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   2 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 lib/ethdev/ethdev_pci.h                       |   4 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 123 files changed, 329 insertions(+), 299 deletions(-)
 create mode 100644 drivers/bus/pci/bus_pci_driver.h

diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 59a8a429c5..d71c9ce107 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -7,9 +7,9 @@
 
 #include <stdbool.h>
 
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_bus.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index cd4611ab48..2b55c85fd8 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index a8482bd411..801e8920df 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -14,7 +14,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_hexdump.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
 #endif
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 82ae6ba678..c1d877c87f 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 21d35292a3..f16814e241 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index bcd772427b..bc560a2a56 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -28,7 +28,6 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
new file mode 100644
index 0000000000..b5c7dee617
--- /dev/null
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -0,0 +1,200 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2015 Intel Corporation.
+ * Copyright 2013-2014 6WIND S.A.
+ */
+
+#ifndef BUS_PCI_DRIVER_H
+#define BUS_PCI_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_pci.h>
+#include <rte_dev.h>
+#include <rte_compat.h>
+
+/** Pathname of PCI devices directory. */
+__rte_internal
+const char *rte_pci_get_sysfs_path(void);
+
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* no attached driver */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
+};
+
+/**
+ * A structure describing a PCI device.
+ */
+struct rte_pci_device {
+	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
+	struct rte_device device;           /**< Inherit core device */
+	struct rte_pci_addr addr;           /**< PCI location. */
+	struct rte_pci_id id;               /**< PCI ID. */
+	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
+					    /**< PCI Memory Resource */
+	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
+	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
+	uint16_t max_vfs;                   /**< sriov enable if not zero */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
+	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	struct rte_intr_handle *vfio_req_intr_handle;
+				/**< Handler of VFIO request interrupt */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_pci_device.
+ */
+#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
+
+#define RTE_DEV_TO_PCI_CONST(ptr) \
+	container_of(ptr, const struct rte_pci_device, device)
+
+#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
+
+#ifdef __cplusplus
+/** C++ macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev) \
+	RTE_CLASS_ANY_ID,         \
+	(vend),                   \
+	(dev),                    \
+	RTE_PCI_ANY_ID,           \
+	RTE_PCI_ANY_ID
+#else
+/** Macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev)          \
+	.class_id = RTE_CLASS_ANY_ID,      \
+	.vendor_id = (vend),               \
+	.device_id = (dev),                \
+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
+	.subsystem_device_id = RTE_PCI_ANY_ID
+#endif
+
+/**
+ * Initialisation function for the driver called during PCI probing.
+ */
+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
+
+/**
+ * Uninitialisation function for the driver called during hotplugging.
+ */
+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A structure describing a PCI driver.
+ */
+struct rte_pci_driver {
+	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
+	struct rte_driver driver;          /**< Inherit core driver. */
+	rte_pci_probe_t *probe;            /**< Device probe function. */
+	rte_pci_remove_t *remove;          /**< Device remove function. */
+	pci_dma_map_t *dma_map;		   /**< device dma map function. */
+	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
+	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
+	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
+};
+
+/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
+#define RTE_PCI_DRV_NEED_MAPPING 0x0001
+/** Device needs PCI BAR mapping with enabled write combining (wc) */
+#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
+/** Device already probed can be probed again to check for new ports. */
+#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
+/** Device driver supports link state interrupt */
+#define RTE_PCI_DRV_INTR_LSC	0x0008
+/** Device driver supports device removal interrupt */
+#define RTE_PCI_DRV_INTR_RMV 0x0010
+/** Device driver needs to keep mapped resources if unsupported dev detected */
+#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
+
+/**
+ * Register a PCI driver.
+ *
+ * @param driver
+ *   A pointer to a rte_pci_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_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) \
+{\
+	(pci_drv).driver.name = RTE_STR(nm);\
+	rte_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.
+ */
+__rte_internal
+void rte_pci_unregister(struct rte_pci_driver *driver);
+
+/*
+ * A structure used to access io resources for a pci device.
+ * rte_pci_ioport is arch, os, driver specific, and should not be used outside
+ * of pci ioport api.
+ */
+struct rte_pci_ioport {
+	struct rte_pci_device *dev;
+	uint64_t base;
+	uint64_t len; /* only filled for memory mapped ports */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_PCI_DRIVER_H */
diff --git a/drivers/bus/pci/meson.build b/drivers/bus/pci/meson.build
index 81c7e94c00..f50f039a68 100644
--- a/drivers/bus/pci/meson.build
+++ b/drivers/bus/pci/meson.build
@@ -3,6 +3,7 @@
 
 deps += ['pci']
 headers = files('rte_bus_pci.h')
+driver_sdk_headers = files('bus_pci_driver.h')
 sources = files('pci_common.c',
     'pci_params.c')
 if is_linux
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 0cefed5edf..fddf49251d 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -9,6 +9,7 @@
 #include <stdio.h>
 
 #include <bus_driver.h>
+#include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 01d834e3cc..60e50ca875 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -24,153 +24,15 @@ extern "C" {
 
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
 #include <rte_pci.h>
 
-/** Pathname of PCI devices directory. */
-const char *rte_pci_get_sysfs_path(void);
-
 /* Forward declarations */
 struct rte_pci_device;
 struct rte_pci_driver;
+struct rte_pci_ioport;
 
 struct rte_devargs;
 
-enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
-	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
-	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
-	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
-	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
-	RTE_PCI_KDRV_NONE,         /* no attached driver */
-	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
-};
-
-/**
- * A structure describing a PCI device.
- */
-struct rte_pci_device {
-	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
-	struct rte_device device;           /**< Inherit core device */
-	struct rte_pci_addr addr;           /**< PCI location. */
-	struct rte_pci_id id;               /**< PCI ID. */
-	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
-					    /**< PCI Memory Resource */
-	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
-	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
-	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
-	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
-	struct rte_intr_handle *vfio_req_intr_handle;
-				/**< Handler of VFIO request interrupt */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_pci_device.
- */
-#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
-
-#define RTE_DEV_TO_PCI_CONST(ptr) \
-	container_of(ptr, const struct rte_pci_device, device)
-
-#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
-
-#ifdef __cplusplus
-/** C++ macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev) \
-	RTE_CLASS_ANY_ID,         \
-	(vend),                   \
-	(dev),                    \
-	RTE_PCI_ANY_ID,           \
-	RTE_PCI_ANY_ID
-#else
-/** Macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev)          \
-	.class_id = RTE_CLASS_ANY_ID,      \
-	.vendor_id = (vend),               \
-	.device_id = (dev),                \
-	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
-	.subsystem_device_id = RTE_PCI_ANY_ID
-#endif
-
-/**
- * Initialisation function for the driver called during PCI probing.
- */
-typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
-
-/**
- * Uninitialisation function for the driver called during hotplugging.
- */
-typedef int (rte_pci_remove_t)(struct rte_pci_device *);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A structure describing a PCI driver.
- */
-struct rte_pci_driver {
-	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
-	struct rte_driver driver;          /**< Inherit core driver. */
-	rte_pci_probe_t *probe;            /**< Device probe function. */
-	rte_pci_remove_t *remove;          /**< Device remove function. */
-	pci_dma_map_t *dma_map;		   /**< device dma map function. */
-	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
-	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
-	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
-};
-
-/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
-#define RTE_PCI_DRV_NEED_MAPPING 0x0001
-/** Device needs PCI BAR mapping with enabled write combining (wc) */
-#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
-/** Device already probed can be probed again to check for new ports. */
-#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
-/** Device driver supports link state interrupt */
-#define RTE_PCI_DRV_INTR_LSC	0x0008
-/** Device driver supports device removal interrupt */
-#define RTE_PCI_DRV_INTR_RMV 0x0010
-/** Device driver needs to keep mapped resources if unsupported dev detected */
-#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
-
 /**
  * Map the PCI device resources in user space virtual memory address
  *
@@ -238,33 +100,6 @@ off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap);
 __rte_experimental
 int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable);
 
-/**
- * Register a PCI driver.
- *
- * @param driver
- *   A pointer to a rte_pci_driver structure describing the driver
- *   to be registered.
- */
-void rte_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) \
-{\
-	(pci_drv).driver.name = RTE_STR(nm);\
-	rte_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_pci_unregister(struct rte_pci_driver *driver);
-
 /**
  * Read PCI config space.
  *
@@ -299,17 +134,6 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 int rte_pci_write_config(const struct rte_pci_device *device,
 		const void *buf, size_t len, off_t offset);
 
-/**
- * A structure used to access io resources for a pci device.
- * rte_pci_ioport is arch, os, driver specific, and should not be used outside
- * of pci ioport api.
- */
-struct rte_pci_ioport {
-	struct rte_pci_device *dev;
-	uint64_t base;
-	uint64_t len; /* only filled for memory mapped ports */
-};
-
 /**
  * Initialize a rte_pci_ioport object for a pci device io resource.
  *
diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map
index aa56439c2b..c823c1fe45 100644
--- a/drivers/bus/pci/version.map
+++ b/drivers/bus/pci/version.map
@@ -2,16 +2,13 @@ DPDK_22 {
 	global:
 
 	rte_pci_dump;
-	rte_pci_get_sysfs_path;
 	rte_pci_ioport_map;
 	rte_pci_ioport_read;
 	rte_pci_ioport_unmap;
 	rte_pci_ioport_write;
 	rte_pci_map_device;
 	rte_pci_read_config;
-	rte_pci_register;
 	rte_pci_unmap_device;
-	rte_pci_unregister;
 	rte_pci_write_config;
 
 	local: *;
@@ -25,3 +22,11 @@ EXPERIMENTAL {
 	# added in 21.08
 	rte_pci_set_bus_master;
 };
+
+INTERNAL {
+	global:
+
+	rte_pci_get_sysfs_path;
+	rte_pci_register;
+	rte_pci_unregister;
+};
diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h
index 502f243a81..a7cbe444ae 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -7,7 +7,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bitmap.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c
index b42102e84c..aafff60eeb 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -15,7 +15,7 @@
 
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 
 #include "mlx5_common.h"
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h
index 479bb3c7cb..81702b8768 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.h
+++ b/drivers/common/mlx5/linux/mlx5_common_os.h
@@ -9,7 +9,7 @@
 #include <malloc.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_log.h>
diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
index 63f31437da..629a639a81 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -8,7 +8,7 @@
 #include <stdio.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_rwlock.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 838b62b81c..73178ce0f3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -10,7 +10,7 @@
 #include <rte_class.h>
 #include <rte_pci.h>
 #include <bus_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
 #include "mlx5_common_private.h"
diff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c
index f2fc7cd494..2b6058eb3e 100644
--- a/drivers/common/mlx5/windows/mlx5_common_os.c
+++ b/drivers/common/mlx5/windows/mlx5_common_os.c
@@ -7,7 +7,7 @@
 #include <stdio.h>
 
 #include <rte_mempool.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_errno.h>
 
diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h
index e1a32a7e87..d1512f3b89 100644
--- a/drivers/common/qat/qat_device.h
+++ b/drivers/common/qat/qat_device.h
@@ -4,7 +4,7 @@
 #ifndef _QAT_DEVICE_H_
 #define _QAT_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "qat_common.h"
 #include "qat_logs.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 08ac91eac4..4a1be35b47 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
diff --git a/drivers/common/sfc_efx/sfc_efx.h b/drivers/common/sfc_efx/sfc_efx.h
index c16eca60f3..d3ea586cb8 100644
--- a/drivers/common/sfc_efx/sfc_efx.h
+++ b/drivers/common/sfc_efx/sfc_efx.h
@@ -10,7 +10,7 @@
 #ifndef _SFC_EFX_H_
 #define _SFC_EFX_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "efx.h"
 #include "efsys.h"
diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c
index d64a628c74..3d2c45fcee 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -5,7 +5,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h
index 46c80c8dc2..cdef8cc6cb 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -7,7 +7,7 @@
 
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
 #include <rte_compressdev_pmd.h>
diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index e8f57c3cc4..fe4a4999c6 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_hexdump.h>
 #include <rte_comp.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_memcpy.h>
 #include <rte_common.h>
diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h
index 2a205cd446..9deaae7980 100644
--- a/drivers/crypto/ccp/ccp_dev.h
+++ b/drivers/crypto/ccp/ccp_dev.h
@@ -10,7 +10,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_byteorder.h>
 #include <rte_io.h>
diff --git a/drivers/crypto/ccp/ccp_pci.h b/drivers/crypto/ccp/ccp_pci.h
index 7ed3bac406..6736bf8ad3 100644
--- a/drivers/crypto/ccp/ccp_pci.h
+++ b/drivers/crypto/ccp/ccp_pci.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
 #define PROC_MODULES "/proc/modules"
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a35a8cd775..4957f11e97 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_bus_vdev.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 1e0a7b91c9..3fd9f3c426 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index 54cd77e575..bd425f95ff 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index eb7616257e..dc8e291f50 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -7,7 +7,7 @@
 #include <rte_eal_paging.h>
 #include <rte_errno.h>
 #include <rte_log.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/crypto/nitrox/nitrox_device.h b/drivers/crypto/nitrox/nitrox_device.h
index 6b8095f42b..1ff7c59b63 100644
--- a/drivers/crypto/nitrox/nitrox_device.h
+++ b/drivers/crypto/nitrox/nitrox_device.h
@@ -5,7 +5,7 @@
 #ifndef _NITROX_DEVICE_H_
 #define _NITROX_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 struct nitrox_sym_device;
diff --git a/drivers/crypto/octeontx/otx_cryptodev.c b/drivers/crypto/octeontx/otx_cryptodev.c
index 337d06aab8..b5ab937c3a 100644
--- a/drivers/crypto/octeontx/otx_cryptodev.c
+++ b/drivers/crypto/octeontx/otx_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium, Inc
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_log.h>
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 7aee67ab09..11840f5ecf 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eventdev.h>
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index db6316fbe9..f3a99ae15c 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -7,7 +7,7 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_crypto_sym.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 
 #include "qat_sym.h"
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index ed64866758..21bd996064 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eal.h>
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
index 0a7ea1bb64..41949c3d13 100644
--- a/drivers/crypto/virtio/virtio_pci.h
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 
 #include <rte_eal_paging.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 #include "virtio_crypto.h"
diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c
index 3e8c15d617..9f0de60861 100644
--- a/drivers/dma/cnxk/cnxk_dmadev.c
+++ b/drivers/dma/cnxk/cnxk_dmadev.c
@@ -5,7 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index 9494b60779..0e11ca14cc 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c
index 2f8ec06d9e..781fa02db3 100644
--- a/drivers/dma/idxd/idxd_pci.c
+++ b/drivers/dma/idxd/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_devargs.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
index a230496b11..5906eb45aa 100644
--- a/drivers/dma/ioat/ioat_dmadev.c
+++ b/drivers/dma/ioat/ioat_dmadev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
 #include <rte_prefetch.h>
diff --git a/drivers/event/dlb2/pf/dlb2_main.h b/drivers/event/dlb2/pf/dlb2_main.h
index 9eeda482a3..5aa51b1616 100644
--- a/drivers/event/dlb2/pf/dlb2_main.h
+++ b/drivers/event/dlb2/pf/dlb2_main.h
@@ -9,7 +9,7 @@
 #include <rte_log.h>
 #include <rte_spinlock.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include "base/dlb2_hw_types.h"
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index dd3f2b8ece..9f8c6cd8b8 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -25,7 +25,7 @@
 #include <rte_cycles.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
 #include <eventdev_pmd_pci.h>
diff --git a/drivers/event/octeontx/ssovf_probe.c b/drivers/event/octeontx/ssovf_probe.c
index 4da7d1ae45..2c9601a8ff 100644
--- a/drivers/event/octeontx/ssovf_probe.c
+++ b/drivers/event/octeontx/ssovf_probe.c
@@ -7,7 +7,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "octeontx_mbox.h"
 #include "ssovf_evdev.h"
diff --git a/drivers/event/octeontx/timvf_probe.c b/drivers/event/octeontx/timvf_probe.c
index 59bba31e8e..7ce3eddd7e 100644
--- a/drivers/event/octeontx/timvf_probe.c
+++ b/drivers/event/octeontx/timvf_probe.c
@@ -5,7 +5,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <octeontx_mbox.h>
 
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 664605d9fb..2be7b8d2df 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -6,7 +6,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_dev.h>
 
diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index 54a1a7d3ae..78caf987d0 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_atomic.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 8fd9edced2..1513c632c6 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -13,7 +13,7 @@
 
 #include <rte_atomic.h>
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index e8e4092be6..c654a229f7 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7ac55584ff..7c0cb666fb 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index d7e1729e68..89414ac88a 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -16,7 +16,7 @@
 
 #include <rte_byteorder.h>
 #include <rte_spinlock.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_io.h>
 
 #include "bnx2x_osal.h"
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e86e51e1fa..c9aa45ed3b 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index cc3805baba..4adf2d51f7 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -5,7 +5,7 @@
 #include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index 1c016a7115..16cbc1a345 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -8,7 +8,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index cf9a2fdc19..fd71a50a58 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_tailq.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 794496abfc..409de50083 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index cea5b490ba..d48fd52404 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -18,7 +18,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a9c18b27e8..43979992d3 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 3f3fd0d61e..c7588ea57e 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -10,7 +10,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 0db0918b43..4709675af8 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -12,7 +12,7 @@
 #include <ethdev_pci.h>
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_timer.h>
 #include <rte_dev.h>
 #include <rte_net.h>
diff --git a/drivers/net/enic/base/vnic_dev.h b/drivers/net/enic/base/vnic_dev.h
index 4b9f75b65f..44ca5c739f 100644
--- a/drivers/net/enic/base/vnic_dev.h
+++ b/drivers/net/enic/base/vnic_dev.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "enic_compat.h"
 #include "vnic_resource.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index a8d470e8ac..998436e5e8 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9f351de72e..19a99a82c5 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 1ad6ad3dfb..7312c411bd 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c
index 5eb022297e..818698dcb3 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwdev.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c
@@ -3,7 +3,7 @@
  */
 
 #include<ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index 26fa1e27d4..2d3f192b21 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_csr.h"
diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index ad5db9f1de..ad42773bd3 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
-#include<rte_bus_pci.h>
+#include<bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_pmd_hwdev.h"
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 35788f46eb..7aa5e7d8e9 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 424205356e..e8e5aa2c86 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_kvargs.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
 
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6b1d1a5fb1..144daf1636 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 
 #include "hns3_ethdev.h"
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 95f711e7eb..cd0c91f3a3 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018-2021 HiSilicon Limited.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7ab788246c..87c22b6b54 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 7f8e81858e..cc0f992453 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Intel Corporation.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 7f221a5d34..e3727b7b41 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -7,7 +7,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h
index 49b90d1b7c..a55202b178 100644
--- a/drivers/net/ionic/ionic.h
+++ b/drivers/net/ionic/ionic.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "ionic_dev.h"
 #include "ionic_if.h"
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 28280c5377..d72033c32c 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 2e39113941..70a06a3b15 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -4,7 +4,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 2f088d767f..2ef96a984a 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 2f242b678a..0260227900 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f31bbb7895..552e41692c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index cc6049a66a..ff34fd1515 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index ce74c51ce2..bb1dd33e7c 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -32,7 +32,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_ether.h>
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index aaf636aa0d..661d362dc0 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -25,7 +25,7 @@
 #include <time.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 62f654d18e..4f0a6f4d55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -20,7 +20,7 @@
 #include <ethdev_pci.h>
 #include <rte_pci.h>
 #include <bus_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 998846adbe..30923b0732 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 05c919ed39..a5c7ca8c52 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -11,7 +11,7 @@
 #include <errno.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index bee9363515..e122b39cb3 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -15,7 +15,7 @@
 #include <rte_flow_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ip.h>
 #include <rte_gre.h>
 #include <rte_vxlan.h>
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 0140f8b3b2..9150ced72d 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -13,7 +13,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal_paging.h>
 
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 62948bf889..cce0a79edb 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h
index bf1fa30312..8783fce4dd 100644
--- a/drivers/net/ngbe/base/ngbe_osdep.h
+++ b/drivers/net/ngbe/base/ngbe_osdep.h
@@ -19,7 +19,7 @@
 #include <rte_config.h>
 #include <rte_io.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../ngbe_logs.h"
 
diff --git a/drivers/net/ngbe/ngbe_pf.c b/drivers/net/ngbe/ngbe_pf.c
index 12a18de31d..947ae7fe94 100644
--- a/drivers/net/ngbe/ngbe_pf.c
+++ b/drivers/net/ngbe/ngbe_pf.c
@@ -6,7 +6,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/ngbe.h"
 #include "ngbe_ethdev.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c
index 0ddff54886..6a48a22de6 100644
--- a/drivers/net/octeontx/base/octeontx_pkivf.c
+++ b/drivers/net/octeontx/base/octeontx_pkivf.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../octeontx_logs.h"
 #include "octeontx_io.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c
index bf28bc7992..5d445dfb49 100644
--- a/drivers/net/octeontx/base/octeontx_pkovf.c
+++ b/drivers/net/octeontx/base/octeontx_pkovf.c
@@ -10,7 +10,7 @@
 #include <rte_cycles.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 
 #include "../octeontx_logs.h"
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 9ea579bfc8..67e7f759fe 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -20,7 +20,7 @@
 #include <rte_ether.h>
 #include <rte_io.h>
 #include <rte_version.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 /* Forward declaration */
 struct ecore_dev;
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index a0979618be..0a1e224fa2 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -13,7 +13,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 39f85e8b84..506c62a726 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_ether.h>
diff --git a/drivers/net/sfc/sfc_sriov.c b/drivers/net/sfc/sfc_sriov.c
index 385b172e2e..009b884d8d 100644
--- a/drivers/net/sfc/sfc_sriov.c
+++ b/drivers/net/sfc/sfc_sriov.c
@@ -8,7 +8,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc.h"
 #include "sfc_log.h"
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 262c024560..28183ec740 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -32,7 +32,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index 262dbb5e38..6fb22ca7d9 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_ethdev_core.h>
 #include <rte_hash.h>
 #include <rte_hash_crc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index d0093c0163..f19bdf36dc 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -4,7 +4,7 @@
  */
 
 #include <sys/queue.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c
index 0b82fb1a88..176f79005c 100644
--- a/drivers/net/txgbe/txgbe_pf.c
+++ b/drivers/net/txgbe/txgbe_pf.c
@@ -20,7 +20,7 @@
 #include <rte_memcpy.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/txgbe.h"
 #include "txgbe_ethdev.h"
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 11e25a0142..6d4a8712c2 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 
 #include "virtio.h"
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 1f6bdeddda..2b9e35cef5 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 
 #include <rte_memory.h>
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 2af67dc0a3..101b1cb500 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index 349d551839..db029cbf34 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_eal.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
index 26def43564..2d8466ef91 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
index bbe7f74def..b424d6127d 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index eca1edc270..859f28dcc1 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index da0aba6e00..c7c5cda48c 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 3c41aa9ee8..a1db533eeb 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -17,7 +17,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index b7438bd372..67b3941265 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index d9beb72db3..f6e07dc37b 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -16,7 +16,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 #include <rte_alarm.h>
 #include <rte_interrupts.h>
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 1ca248123b..a47d5a0350 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 #include "rte_pmd_ifpga.h"
diff --git a/drivers/raw/ioat/idxd_pci.c b/drivers/raw/ioat/idxd_pci.c
index 13515dbc6c..90ec0222e6 100644
--- a/drivers/raw/ioat/idxd_pci.c
+++ b/drivers/raw/ioat/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_devargs.h>
 
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 11341fcf5d..f58006bbda 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index f5e773c53b..76e98fe515 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_mbuf.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_memcpy.h>
 #include <rte_rawdev.h>
diff --git a/drivers/raw/ntb/ntb_hw_intel.c b/drivers/raw/ntb/ntb_hw_intel.c
index 20cdb761a3..9b4465176a 100644
--- a/drivers/raw/ntb/ntb_hw_intel.c
+++ b/drivers/raw/ntb/ntb_hw_intel.c
@@ -8,7 +8,7 @@
 #include <rte_io.h>
 #include <rte_eal.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index 9f79c6907c..4c20daac94 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -9,7 +9,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_common_mr.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c
index 9a2db7e43f..0a8c83fe14 100644
--- a/drivers/regex/mlx5/mlx5_regex_fastpath.c
+++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c
@@ -10,7 +10,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_regexdev_driver.h>
 #include <rte_mbuf.h>
diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h
index 6aef25ea45..f462193f55 100644
--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h
+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h
@@ -10,7 +10,7 @@
 
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_io.h>
 
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index ac42de9c79..d5ac583589 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -14,7 +14,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_vhost.h>
 #include <rte_vdpa.h>
 #include <vdpa_driver.h>
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index 91af792a3a..026daa3f24 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/vdpa/sfc/sfc_vdpa.h b/drivers/vdpa/sfc/sfc_vdpa.h
index daeb27d4cd..b25eb3a5fe 100644
--- a/drivers/vdpa/sfc/sfc_vdpa.h
+++ b/drivers/vdpa/sfc/sfc_vdpa.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc_efx.h"
 #include "sfc_efx_mcdi.h"
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index b4bb460dcb..7e4ff46684 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -10,12 +10,12 @@
 extern "C" {
 #endif
 
+#include <bus_pci_driver.h>
+#include <ethdev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
 #include <rte_config.h>
-#include <ethdev_driver.h>
 
 /**
  * Copy pci device info to the Ethernet device data.
diff --git a/lib/eventdev/eventdev_pmd_pci.h b/lib/eventdev/eventdev_pmd_pci.h
index 24b56faaa9..7bbec40c71 100644
--- a/lib/eventdev/eventdev_pmd_pci.h
+++ b/lib/eventdev/eventdev_pmd_pci.h
@@ -23,7 +23,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 24/29] bus/vdev: make driver-only headers private
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (22 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 23/29] bus/pci: " David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 25/29] bus/vmbus: " David Marchand
                     ` (6 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Gagandeep Singh, Hemant Agrawal, Nicolas Chautru, Ray Kinsella,
	Lee Daly, Fan Zhang, Ashish Gupta, Sunila Sahu, Ruifeng Wang,
	Ajit Khaparde, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Pablo de Lara, Michael Shamis, Liron Himi,
	Chengwen Feng, Kevin Laatz, Bruce Richardson, Sachin Saxena,
	Jerin Jacob, Liang Ma, Peter Mccarthy, Harry van Haaren,
	John W. Linville, Ciara Loftus, Qi Zhang, Chas Williams,
	Min Hu (Connor),
	Gaetan Rivet, Rosen Xu, Jakub Grajciar, Zyta Szpak,
	Tetsuya Mukawa, Harman Kalra, Jasvinder Singh,
	Cristian Dumitrescu, Matan Azrad, Maxime Coquelin, Chenbo Xia,
	Jakub Palider, Tomasz Duszynski, Tianfei zhang, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko

The vdev bus interface is for drivers only.
Mark as internal and move the header on the driver headers list.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_vdev.c                          |   2 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++++++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 131 ---------------
 drivers/bus/vdev/vdev.c                       |   2 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_evdev.c          |   2 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   2 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/failsafe/failsafe.c               |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   2 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   2 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   2 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |   2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   2 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 61 files changed, 216 insertions(+), 190 deletions(-)
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 9e39993e90..0b71e9329b 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -7,9 +7,9 @@
 #include <string.h>
 
 #include <bus_driver.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
 
 #include "test.h"
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 4d1bd16751..f0927d9fca 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -10,7 +10,7 @@
 #include <dirent.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 248e12987f..e76ef2313f 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index af7bc416f9..e8d0c43e6f 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
new file mode 100644
index 0000000000..36748cdfae
--- /dev/null
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -0,0 +1,151 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ */
+
+#ifndef BUS_VDEV_DRIVER_H
+#define BUS_VDEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vdev.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
+	struct rte_device device;               /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+	container_of(ptr, struct rte_vdev_device, device)
+
+#define RTE_DEV_TO_VDEV_CONST(ptr) \
+	container_of(ptr, const struct rte_vdev_device, device)
+
+#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.name)
+		return dev->device.name;
+	return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.devargs)
+		return dev->device.devargs->args;
+	return "";
+}
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+	struct rte_driver driver;        /**< Inherited general driver. */
+	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
+	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
+	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
+	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
+	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
+};
+
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+static const char *vdrvinit_ ## nm ## _alias;\
+RTE_INIT(vdrvinitfn_ ##vdrv)\
+{\
+	(vdrv).driver.name = RTE_STR(nm);\
+	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+	rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VDEV_DRIVER_H */
diff --git a/drivers/bus/vdev/meson.build b/drivers/bus/vdev/meson.build
index 8adf674530..1532ed4f35 100644
--- a/drivers/bus/vdev/meson.build
+++ b/drivers/bus/vdev/meson.build
@@ -6,5 +6,6 @@ sources = files(
         'vdev_params.c',
 )
 headers = files('rte_bus_vdev.h')
+driver_sdk_headers = files('bus_vdev_driver.h')
 
 deps += ['kvargs']
diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
index ce20faf649..f48dd24e5e 100644
--- a/drivers/bus/vdev/rte_bus_vdev.h
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -15,137 +15,6 @@
 extern "C" {
 #endif
 
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
-	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
-	struct rte_device device;               /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
-	container_of(ptr, struct rte_vdev_device, device)
-
-#define RTE_DEV_TO_VDEV_CONST(ptr) \
-	container_of(ptr, const struct rte_vdev_device, device)
-
-#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.name)
-		return dev->device.name;
-	return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.devargs)
-		return dev->device.devargs->args;
-	return "";
-}
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
-	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
-	struct rte_driver driver;        /**< Inherited general driver. */
-	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
-	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
-	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
-	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
-	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
-};
-
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-static const char *vdrvinit_ ## nm ## _alias;\
-RTE_INIT(vdrvinitfn_ ##vdrv)\
-{\
-	(vdrv).driver.name = RTE_STR(nm);\
-	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
-	rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
 typedef void (*rte_vdev_scan_callback)(void *user_arg);
 
 /**
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index ee569fcdf2..1b8410fe5b 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -11,6 +11,7 @@
 #include <sys/queue.h>
 
 #include <bus_driver.h>
+#include <bus_vdev_driver.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
 #include <rte_common.h>
@@ -21,7 +22,6 @@
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 
-#include "rte_bus_vdev.h"
 #include "vdev_logs.h"
 #include "vdev_private.h"
 
diff --git a/drivers/bus/vdev/version.map b/drivers/bus/vdev/version.map
index 0d60b7e2bc..594646d550 100644
--- a/drivers/bus/vdev/version.map
+++ b/drivers/bus/vdev/version.map
@@ -3,10 +3,15 @@ DPDK_22 {
 
 	rte_vdev_add_custom_scan;
 	rte_vdev_init;
-	rte_vdev_register;
 	rte_vdev_remove_custom_scan;
 	rte_vdev_uninit;
-	rte_vdev_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vdev_register;
+	rte_vdev_unregister;
+};
diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index b7ba61c434..cb23e929ed 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -3,7 +3,7 @@
  */
 #include <isa-l.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_malloc.h>
diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zlib_pmd.c
index 0220c6d038..98abd41013 100644
--- a/drivers/compress/zlib/zlib_pmd.c
+++ b/drivers/compress/zlib/zlib_pmd.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium Networks
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 
 #include "zlib_pmd_private.h"
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 32127a874c..5c060e71a3 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -8,7 +8,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_device.h b/drivers/crypto/bcmfs/bcmfs_device.h
index 4901a6cfd9..610454dd5e 100644
--- a/drivers/crypto/bcmfs/bcmfs_device.h
+++ b/drivers/crypto/bcmfs/bcmfs_device.h
@@ -9,7 +9,7 @@
 #include <sys/queue.h>
 
 #include <rte_spinlock.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "bcmfs_logs.h"
 #include "bcmfs_qp.h"
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8e9cfe73d8..8c0b4909cf 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -12,7 +12,7 @@
 #include <cryptodev_pmd.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_security_driver.h>
 #include <rte_hexdump.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 4957f11e97..6c3e45e333 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_string_fns.h>
 #include <bus_pci_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.c b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
index aab42c360c..2e7347fa79 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index e2c240dfc0..d0d4258ee1 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -7,7 +7,7 @@
 
 #include <intel-ipsec-mb.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #if defined(RTE_LIB_SECURITY)
 #define IPSEC_MB_DOCSIS_SEC_ENABLED 1
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index c9d4f9d0ae..fba10b8cf4 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2016-2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 04efd9aaa8..c35876c8b4 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_security_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 9ecb434fd0..eab74ad45f 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 
 #include "null_crypto_pmd_private.h"
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index e01dacc98d..ed6d215f1b 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index dd198080bf..a15c02b4d8 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 82b4661323..09068a9521 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -4,7 +4,7 @@
 
 #include <inttypes.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 5de3e9e5f5..08df6e223a 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -23,7 +23,7 @@
 #include <rte_memcpy.h>
 #include <rte_memory.h>
 #include <rte_pci.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
index 941fb8fc43..427aff4b11 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index 9e14e35d10..fe157c59d5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -16,7 +16,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "ssovf_evdev.h"
 #include "timvf_evdev.h"
diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c
index b55523632a..3dbf31efa9 100644
--- a/drivers/event/octeontx/ssovf_evdev_selftest.c
+++ b/drivers/event/octeontx/ssovf_evdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 #include "ssovf_evdev.h"
diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c
index 8b6890b220..368e5a9657 100644
--- a/drivers/event/opdl/opdl_evdev.c
+++ b/drivers/event/opdl/opdl_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memzone.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/opdl/opdl_evdev_init.c b/drivers/event/opdl/opdl_evdev_init.c
index 15aae47524..be3437fc2f 100644
--- a/drivers/event/opdl/opdl_evdev_init.c
+++ b/drivers/event/opdl/opdl_evdev_init.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_errno.h>
 #include <rte_cycles.h>
 #include <rte_memzone.h>
diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 24b92df476..50c12a18b0 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -19,7 +19,7 @@
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
 #include <rte_eventdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_pause.h>
 
 #include "opdl_evdev.h"
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index bf3b01ebc8..6bd8fec6d4 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "skeleton_eventdev.h"
 
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index f93313b31b..22cba1e74b 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_ring.h>
 #include <rte_errno.h>
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index cb97a4d615..59bcdf5734 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -21,7 +21,7 @@
 #include <rte_pause.h>
 #include <rte_service.h>
 #include <rte_service_component.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "sw_evdev.h"
 
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 1396f32c3d..e2771e6765 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -12,7 +12,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <errno.h>
 #include <linux/if_ether.h>
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fce649c2a1..fd7be47311 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -20,7 +20,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 4ac191c468..b44dd219cb 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_tcp.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 73e6972035..cd80a0af46 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -15,7 +15,7 @@
 #include <rte_ip_frag.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 7fe77cfe8e..32811403b4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -12,7 +12,7 @@
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <bus_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
 
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index dbf57f9ba8..4b93d2649e 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -19,7 +19,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index 0532de5315..c0e1f8db40 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -12,7 +12,7 @@
 #include <rte_kni.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 /* Only single queue supported */
 #define KNI_MAX_QUEUE_PER_PORT 1
diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 7886644412..4700ce2e77 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -17,7 +17,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index dd951b8296..a574bce49e 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -21,7 +21,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index eef016aa0b..6a0dd6091d 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_string_fns.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <stdio.h>
 #include <fcntl.h>
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 735efb6cfc..310e3e5acf 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -9,7 +9,7 @@
 #include <rte_kvargs.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <fcntl.h>
 #include <linux/ethtool.h>
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index bb89c1abc4..a517376d40 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -8,7 +8,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3aca53fb98..9ada22e2ff 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -12,7 +12,7 @@
 #include <eventdev_pmd.h>
 #include <rte_alarm.h>
 #include <rte_branch_prediction.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
 #include <rte_dev.h>
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index ec29fd6bc5..7fb4abb20b 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_os_shim.h>
 
 #include "pcap_osdep.h"
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index c2991ab1cc..0352a57950 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/epoll.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_ether.h>
 #include <dpaa_of.h>
 
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cfb81da5fe..37e7ccfda0 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 8c098cad5b..fa89940735 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -9,7 +9,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 #include <rte_ring.h>
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 9e1032fe72..d047489e94 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -10,7 +10,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_net.h>
 #include <rte_debug.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 9d65f75048..5c7430718b 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -25,7 +25,7 @@
 
 #include <bus_driver.h>
 #include <rte_alarm.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7e512d94bf..6c81967c6f 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_net.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_vhost.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index a7d7063c2a..3edfd7439e 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 
diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c
index d759ed82d4..e2907c18b5 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.c
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/stat.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_lcore.h>
diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index c7bddbc6cc..aeee4ac289 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -6,7 +6,7 @@
 #include <errno.h>
 #include <stdint.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_atomic.h>
 #include <rte_interrupts.h>
 #include <rte_branch_prediction.h>
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index f6e07dc37b..dea68d5764 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -26,7 +26,7 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_pmd_i40e.h>
 
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 16ecae3d92..19b523a815 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index 693b24c415..fc257c5f44 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -8,7 +8,7 @@
 #include <rte_memcpy.h>
 #include <rte_dev.h>
 #include <rte_rawdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 /* Using relative path as skeleton_rawdev is not part of exported headers */
diff --git a/lib/ethdev/ethdev_vdev.h b/lib/ethdev/ethdev_vdev.h
index f5f536ce64..364f140f91 100644
--- a/lib/ethdev/ethdev_vdev.h
+++ b/lib/ethdev/ethdev_vdev.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_config.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd_vdev.h b/lib/eventdev/eventdev_pmd_vdev.h
index 77904910a2..cf2333cf41 100644
--- a/lib/eventdev/eventdev_pmd_vdev.h
+++ b/lib/eventdev/eventdev_pmd_vdev.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_config.h>
 #include <rte_debug.h>
 #include <rte_eal.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 25/29] bus/vmbus: make driver-only headers private
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (23 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 24/29] bus/vdev: " David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 26/29] dev: introduce driver name David Marchand
                     ` (5 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Long Li, Ray Kinsella

The vmbus bus interface is for drivers only.
Mark as internal and move the header on the driver headers list.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/vmbus/bus_vmbus_driver.h | 106 +++++++++++++++++++++++++++
 drivers/bus/vmbus/meson.build        |   1 +
 drivers/bus/vmbus/private.h          |   2 +-
 drivers/bus/vmbus/rte_bus_vmbus.h    |  83 ---------------------
 drivers/bus/vmbus/version.map        |   9 ++-
 drivers/net/netvsc/hn_ethdev.c       |   2 +-
 drivers/net/netvsc/hn_nvs.c          |   2 +-
 drivers/net/netvsc/hn_rndis.c        |   2 +-
 drivers/net/netvsc/hn_rxtx.c         |   2 +-
 drivers/net/netvsc/hn_vf.c           |   2 +-
 10 files changed, 120 insertions(+), 91 deletions(-)
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h

diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
new file mode 100644
index 0000000000..3424e791c9
--- /dev/null
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018, Microsoft Corporation.
+ * All Rights Reserved.
+ */
+
+#ifndef BUS_VMBUS_DRIVER_H
+#define BUS_VMBUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vmbus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+
+struct vmbus_channel;
+struct vmbus_mon_page;
+
+/** Maximum number of VMBUS resources. */
+enum hv_uio_map {
+	HV_TXRX_RING_MAP = 0,
+	HV_INT_PAGE_MAP,
+	HV_MON_PAGE_MAP,
+	HV_RECV_BUF_MAP,
+	HV_SEND_BUF_MAP
+};
+#define VMBUS_MAX_RESOURCE 5
+
+/**
+ * A structure describing a VMBUS device.
+ */
+struct rte_vmbus_device {
+	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
+	const struct rte_vmbus_driver *driver; /**< Associated driver */
+	struct rte_device device;              /**< Inherit core device */
+	rte_uuid_t device_id;		       /**< VMBUS device id */
+	rte_uuid_t class_id;		       /**< VMBUS device type */
+	uint32_t relid;			       /**< id for primary */
+	uint8_t monitor_id;		       /**< monitor page */
+	int uio_num;			       /**< UIO device number */
+	uint32_t *int_page;		       /**< VMBUS interrupt page */
+	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
+	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
+
+	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
+	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
+};
+
+/**
+ * Initialization function for the driver called during VMBUS probing.
+ */
+typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
+			    struct rte_vmbus_device *);
+
+/**
+ * Initialization function for the driver called during hot plugging.
+ */
+typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
+
+/**
+ * A structure describing a VMBUS driver.
+ */
+struct rte_vmbus_driver {
+	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
+	struct rte_driver driver;
+	vmbus_probe_t *probe;               /**< Device Probe function. */
+	vmbus_remove_t *remove;             /**< Device Remove function. */
+
+	const rte_uuid_t *id_table;	    /**< ID table. */
+};
+
+/**
+ * Register a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vmbus_register(struct rte_vmbus_driver *driver);
+
+/**
+ * Unregister a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
+
+/** Helper for VMBUS device registration from driver instance */
+#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
+	RTE_INIT(vmbusinitfn_ ##nm)			\
+	{						\
+		(vmbus_drv).driver.name = RTE_STR(nm);	\
+		rte_vmbus_register(&vmbus_drv);		\
+	}						\
+	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VMBUS_DRIVER_H */
diff --git a/drivers/bus/vmbus/meson.build b/drivers/bus/vmbus/meson.build
index 3892cbf67f..34988d1d84 100644
--- a/drivers/bus/vmbus/meson.build
+++ b/drivers/bus/vmbus/meson.build
@@ -8,6 +8,7 @@ endif
 
 
 headers = files('rte_bus_vmbus.h','rte_vmbus_reg.h')
+driver_sdk_headers = files('bus_vmbus_driver.h')
 
 sources = files(
         'vmbus_bufring.c',
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 600530c4f6..e33424675c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -10,10 +10,10 @@
 #include <sys/uio.h>
 
 #include <bus_driver.h>
+#include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
-#include <rte_bus_vmbus.h>
 
 /**
  * Structure describing the VM bus
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 763c077623..03894a5d46 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -27,68 +27,12 @@ extern "C" {
 #include <rte_uuid.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
 #include <rte_vmbus_reg.h>
 
 /* Forward declarations */
 struct rte_vmbus_device;
 struct rte_vmbus_driver;
 struct vmbus_channel;
-struct vmbus_mon_page;
-
-/** Maximum number of VMBUS resources. */
-enum hv_uio_map {
-	HV_TXRX_RING_MAP = 0,
-	HV_INT_PAGE_MAP,
-	HV_MON_PAGE_MAP,
-	HV_RECV_BUF_MAP,
-	HV_SEND_BUF_MAP
-};
-#define VMBUS_MAX_RESOURCE 5
-
-/**
- * A structure describing a VMBUS device.
- */
-struct rte_vmbus_device {
-	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
-	const struct rte_vmbus_driver *driver; /**< Associated driver */
-	struct rte_device device;              /**< Inherit core device */
-	rte_uuid_t device_id;		       /**< VMBUS device id */
-	rte_uuid_t class_id;		       /**< VMBUS device type */
-	uint32_t relid;			       /**< id for primary */
-	uint8_t monitor_id;		       /**< monitor page */
-	int uio_num;			       /**< UIO device number */
-	uint32_t *int_page;		       /**< VMBUS interrupt page */
-	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
-	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
-
-	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
-	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
-};
-
-/**
- * Initialization function for the driver called during VMBUS probing.
- */
-typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
-			    struct rte_vmbus_device *);
-
-/**
- * Initialization function for the driver called during hot plugging.
- */
-typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
-
-/**
- * A structure describing a VMBUS driver.
- */
-struct rte_vmbus_driver {
-	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
-	struct rte_driver driver;
-	vmbus_probe_t *probe;               /**< Device Probe function. */
-	vmbus_remove_t *remove;             /**< Device Remove function. */
-
-	const rte_uuid_t *id_table;	    /**< ID table. */
-};
-
 
 /**
  * Scan the content of the VMBUS bus, and the devices in the devices
@@ -357,15 +301,6 @@ void rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
 			   const struct vmbus_channel *chan,
 			   uint32_t latency);
 
-/**
- * Register a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be registered.
- */
-void rte_vmbus_register(struct rte_vmbus_driver *driver);
-
 /**
  * For debug dump contents of ring buffer.
  *
@@ -374,24 +309,6 @@ void rte_vmbus_register(struct rte_vmbus_driver *driver);
  */
 void rte_vmbus_chan_dump(FILE *f, const struct vmbus_channel *chan);
 
-/**
- * Unregister a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
-
-/** Helper for VMBUS device registration from driver instance */
-#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
-	RTE_INIT(vmbusinitfn_ ##nm)			\
-	{						\
-		(vmbus_drv).driver.name = RTE_STR(nm);	\
-		rte_vmbus_register(&vmbus_drv);		\
-	}						\
-	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/drivers/bus/vmbus/version.map b/drivers/bus/vmbus/version.map
index 3cadec7fae..fb7bed747d 100644
--- a/drivers/bus/vmbus/version.map
+++ b/drivers/bus/vmbus/version.map
@@ -16,13 +16,18 @@ DPDK_22 {
 	rte_vmbus_map_device;
 	rte_vmbus_max_channels;
 	rte_vmbus_probe;
-	rte_vmbus_register;
 	rte_vmbus_scan;
 	rte_vmbus_set_latency;
 	rte_vmbus_sub_channel_index;
 	rte_vmbus_subchan_open;
 	rte_vmbus_unmap_device;
-	rte_vmbus_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vmbus_register;
+	rte_vmbus_unregister;
+};
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 0aedecd358..ccc06bdda6 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -32,7 +32,7 @@
 #include <rte_eal.h>
 #include <rte_dev.h>
 #include <bus_driver.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index b90280c9ff..817fb06dfb 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -29,7 +29,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 1b63b27e0c..20f75a17b0 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -27,7 +27,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 909c07a4ab..61cf374224 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -27,7 +27,7 @@
 #include <rte_eal.h>
 #include <rte_dev.h>
 #include <rte_net.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index cce0a79edb..40981706d5 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_log.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 26/29] dev: introduce driver name
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (24 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 25/29] bus/vmbus: " David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 27/29] dev: hide driver object David Marchand
                     ` (4 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Aman Singh, Yuying Zhang, Ray Kinsella, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko

Add a helper to get a rte_driver object name.
This will be used externally.
Internal users may still dereference a rte_driver object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/config.c           |  2 +-
 lib/eal/common/eal_common_dev.c |  6 ++++++
 lib/eal/include/rte_dev.h       | 13 +++++++++++++
 lib/eal/version.map             |  1 +
 lib/ethdev/rte_ethdev.h         |  2 +-
 5 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index bc154e8bf7..22aa086ef1 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,7 +654,7 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
 			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", dev->driver->name);
+			printf("\nDriver name: %s", rte_driver_name(dev->driver));
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
 			printf("\nConnect to socket: %d", dev->numa_node);
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 62a598957c..16c5aef1d8 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -19,6 +19,12 @@
 #include "eal_private.h"
 #include "hotplug_mp.h"
 
+const char *
+rte_driver_name(const struct rte_driver *driver)
+{
+	return driver->name;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 24f9122558..871a046ffe 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -62,6 +62,19 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param driver
+ *   A pointer to a driver structure.
+ * @return
+ *   A pointer to the driver name string.
+ */
+__rte_experimental
+const char *
+rte_driver_name(const struct rte_driver *driver);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 48c8a2f511..54f85ab01f 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -425,6 +425,7 @@ EXPERIMENTAL {
 
 	# added in 22.11
 	rte_bus_name;
+	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index de9e970d4d..e9574f646f 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = dev->device->driver->name
+ * driver_name = rte_driver_name(dev->device->driver)
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 27/29] dev: hide driver object
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (25 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 26/29] dev: introduce driver name David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 28/29] dev: introduce device accessors David Marchand
                     ` (3 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Rosen Xu, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Ajit Khaparde, Raveendra Padasalagi,
	Vikas Gupta, Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph,
	Tejasree Kondoj, Gagandeep Singh, Bruce Richardson, Kevin Laatz,
	Timothy McDaniel, Jerin Jacob, Elena Agostini, Ciara Loftus,
	Qi Zhang, Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Gaetan Rivet, Xiao Wang,
	Yuying Zhang, Beilei Xing, Jingjing Wu, Qiming Yang, Matan Azrad,
	Viacheslav Ovsiienko, Chaoyong He, Niklas Soderlund,
	Harman Kalra, Devendra Singh Rawat, Andrew Rybchenko,
	Maciej Czekaj, Maxime Coquelin, Chenbo Xia, Jochen Behrens,
	Jakub Palider, Tomasz Duszynski, Ori Kam, Akhil Goyal,
	Chengwen Feng, Thomas Monjalon, Ferruh Yigit, Abhinandan Gujjar,
	Jay Jayatheerthan, Olivier Matz, Reshma Pattan

Make rte_driver opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_driver definition.
Update drivers and library to use the internal header.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
 drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
 drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
 drivers/bus/dpaa/bus_dpaa_driver.h            |  2 ++
 drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
 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/ifpga/bus_ifpga_driver.h          |  1 +
 drivers/bus/pci/bus_pci_driver.h              |  2 +-
 drivers/bus/pci/pci_params.c                  |  2 +-
 drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
 drivers/bus/vdev/vdev.c                       |  2 +-
 drivers/bus/vdev/vdev_params.c                |  2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
 drivers/common/qat/qat_qp.c                   |  2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
 drivers/dma/idxd/idxd_bus.c                   |  1 +
 drivers/event/dlb2/dlb2.c                     |  2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
 drivers/event/octeontx/ssovf_evdev.c          |  2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
 drivers/gpu/cuda/cuda.c                       |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
 drivers/net/ark/ark_global.h                  |  2 +-
 drivers/net/avp/avp_ethdev.c                  |  2 +-
 drivers/net/axgbe/axgbe_common.h              |  2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
 drivers/net/cxgbe/base/t4_hw.c                |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                |  2 +-
 drivers/net/cxgbe/sge.c                       |  2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
 drivers/net/e1000/em_ethdev.c                 |  2 +-
 drivers/net/e1000/igb_ethdev.c                |  2 +-
 drivers/net/e1000/igb_flow.c                  |  2 +-
 drivers/net/ena/ena_ethdev.h                  |  2 +-
 drivers/net/enic/enic_ethdev.c                |  2 +-
 drivers/net/enic/enic_vf_representor.c        |  2 +-
 drivers/net/failsafe/failsafe_private.h       |  2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
 drivers/net/i40e/i40e_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_vchnl.c                 |  2 +-
 drivers/net/ice/ice_dcf.c                     |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
 drivers/net/mlx4/mlx4.c                       |  2 +-
 drivers/net/netvsc/hn_ethdev.c                |  2 +-
 drivers/net/netvsc/hn_nvs.c                   |  2 +-
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/netvsc/hn_rxtx.c                  |  2 +-
 drivers/net/nfp/nfp_common.c                  |  2 +-
 drivers/net/nfp/nfp_ethdev.c                  |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
 drivers/net/qede/qede_ethdev.h                |  2 +-
 drivers/net/sfc/sfc_ethdev.c                  |  2 +-
 drivers/net/sfc/sfc_sw_stats.c                |  2 +-
 drivers/net/sfc/sfc_sw_stats.h                |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
 lib/compressdev/rte_compressdev.c             |  2 +-
 lib/compressdev/rte_compressdev_pmd.c         |  2 +-
 lib/compressdev/rte_compressdev_pmd.h         |  1 +
 lib/cryptodev/cryptodev_pmd.c                 |  2 +-
 lib/cryptodev/cryptodev_pmd.h                 |  1 +
 lib/cryptodev/rte_cryptodev.c                 |  2 +-
 lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
 lib/eal/common/eal_common_dev.c               |  2 +-
 lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
 lib/eal/include/meson.build                   |  1 +
 lib/eal/include/rte_dev.h                     | 11 ++------
 lib/ethdev/ethdev_driver.h                    |  1 +
 lib/eventdev/eventdev_pmd.h                   |  2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
 lib/eventdev/rte_eventdev.c                   |  2 +-
 lib/gpudev/gpudev_driver.h                    |  2 +-
 lib/mempool/rte_mempool_ops.c                 |  2 +-
 lib/pcapng/rte_pcapng.c                       |  2 +-
 lib/rawdev/rte_rawdev.c                       |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
 lib/security/rte_security.c                   |  2 +-
 114 files changed, 143 insertions(+), 114 deletions(-)
 create mode 100644 lib/eal/include/dev_driver.h

diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 801e8920df..e2d9409185 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_byteorder.h>
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index c1d877c87f..51dd090c1b 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index f16814e241..036579e3ec 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a889e392c6..e4c7ee0c3b 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <bus_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 44bacc3c0e..13c18418bd 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -22,10 +22,10 @@ extern "C" {
 #include <stdint.h>
 #include <inttypes.h>
 
+#include <dev_driver.h>
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index 4360295335..937a742525 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -6,9 +6,11 @@
 #ifndef BUS_DPAA_DRIVER_H
 #define BUS_DPAA_DRIVER_H
 
+#include <dev_driver.h>
 #include <rte_compat.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
+
 #include <dpaax_iova_table.h>
 
 #include <dpaa_of.h>
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 798ddebf3a..ac3d98dcc0 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -26,10 +26,10 @@ extern "C" {
 #include <inttypes.h>
 #include <linux/vfio.h>
 
+#include <dev_driver.h>
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8604e43947..5966776a85 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -28,7 +28,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index cfe4280f87..d7f6e45b7d 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -18,7 +18,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_pool_ops.h>
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index b7d81b518c..07256ed7ec 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <fslmc_logs.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 071b0d297d..4aec7b2cd8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -30,7 +30,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index 223e34bcba..65e2d799c3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "private.h"
 #include <fslmc_logs.h>
diff --git a/drivers/bus/ifpga/bus_ifpga_driver.h b/drivers/bus/ifpga/bus_ifpga_driver.h
index 7b75c2ddbc..10bf2f92ce 100644
--- a/drivers/bus/ifpga/bus_ifpga_driver.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -15,6 +15,7 @@
 extern "C" {
 #endif /* __cplusplus */
 
+#include <dev_driver.h>
 #include <rte_compat.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b5c7dee617..9c56307405 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -10,8 +10,8 @@
 extern "C" {
 #endif
 
+#include <dev_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
 #include <rte_compat.h>
 
 /** Pathname of PCI devices directory. */
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 39d702a418..d24cc201b8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -6,7 +6,7 @@
 
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 36748cdfae..d05a7f7115 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -9,9 +9,9 @@
 extern "C" {
 #endif
 
+#include <dev_driver.h>
 #include <rte_bus_vdev.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 1b8410fe5b..7c8170e5a6 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -13,7 +13,7 @@
 #include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 2c72614776..2d10a1e8ad 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index 3424e791c9..e60290c835 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -10,9 +10,9 @@
 extern "C" {
 #endif
 
+#include <dev_driver.h>
 #include <rte_bus_vmbus.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
 
 struct vmbus_channel;
 struct vmbus_mon_page;
diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
index 7ffde5f4c8..85d6ddfcf4 100644
--- a/drivers/common/qat/dev/qat_dev_gen4.c
+++ b/drivers/common/qat/dev/qat_dev_gen4.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "qat_device.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 4a1be35b47..e58e4ceec0 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 7d657d81bc..445a3baa67 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
index 61d457f4e0..d1ede5e990 100644
--- a/drivers/crypto/bcmfs/bcmfs_qp.c
+++ b/drivers/crypto/bcmfs/bcmfs_qp.c
@@ -8,7 +8,7 @@
 #include <rte_atomic.h>
 #include <rte_bitmap.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_prefetch.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
index bc7fb67218..78272d616c 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
@@ -4,7 +4,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 6c3e45e333..013f3be1e6 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 
 #include "ccp_crypto.h"
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 3fd9f3c426..db11ac7444 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn10k_cryptodev.h"
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index bd425f95ff..4cfc1f2150 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn9k_cryptodev.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0cce861899..3b13578de0 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_common.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7e554cb2b1..c6bd785262 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -19,7 +19,7 @@
 #include <rte_security_driver.h>
 #endif
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index f3a1bd626c..971f82897c 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -5,7 +5,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index e30dcfc281..9b7b16c6e3 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -9,6 +9,7 @@
 #include <libgen.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 26af75beb8..d7ac58bfde 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -17,7 +17,7 @@
 #include <rte_config.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 9f8c6cd8b8..71ac141b66 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -15,7 +15,7 @@
 
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
 #include <rte_ring.h>
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index aa403f9e06..8e470584ea 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 08df6e223a..1001297cda 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <bus_fslmc_driver.h>
 #include <rte_lcore.h>
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 3882a9cf1d..a68d3ac154 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index fe157c59d5..99fa326ad5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <ethdev_driver.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 6bd8fec6d4..8513b9a013 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -12,7 +12,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 2be7b8d2df..a552aabeb8 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -8,7 +8,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <gpudev_driver.h>
 
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 56c629c681..84371d5d1a 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -20,7 +20,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include "rte_dpaa2_mempool.h"
 
 #include "fslmc_vfio.h"
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fd7be47311..9957de2314 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -24,7 +24,7 @@
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 748db590c1..71d0b53e03 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_version.h>
 
 #include "ark_pktdir.h"
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7c0cb666fb..b2a08f5635 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_cycles.h>
 #include <rte_spinlock.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index b9ebf64fb8..a5d11c5832 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -33,7 +33,7 @@
 #include <rte_memzone.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_pci.h>
 #include <rte_common.h>
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f36ad30e17..4448cf2de2 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -9,7 +9,7 @@
 #include "bnx2x_rxtx.h"
 
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53f..1460dce2ab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef04c..fd1506ddd4 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -7,7 +7,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 384080e6d3..bed755f5d9 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -18,7 +18,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_byteorder.h>
 
 #include "common.h"
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index fd71a50a58..45bbeaef0c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -31,7 +31,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "cxgbe.h"
 #include "cxgbe_pfvf.h"
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3c02c98b3d..f8dd833032 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -31,7 +31,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "base/common.h"
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5d91355c9a..5b13cb5c94 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -30,7 +30,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 9509f6e8a3..4d33b51fea 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <dpaa2_pmd_logs.h>
 #include <dpaa2_hw_pvt.h>
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index f876f4790c..37a8b43114 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 #include "rte_dpaa2_mempool.h"
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 932570c6e0..fbfdf360d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -14,7 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7b9c528d13..9436a95ac8 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hexdump.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
index ba0d500f74..63463c4fbf 100644
--- a/drivers/net/dpaa2/dpaa2_sparser.c
+++ b/drivers/net/dpaa2/dpaa2_sparser.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <fslmc_vfio.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 409de50083..8ee9be12ad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 43979992d3..d6bcc5bf58 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index e46697b6a1..b775310651 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -21,7 +21,7 @@
 #include <rte_eal.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 4709675af8..4d27fba585 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -14,7 +14,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_timer.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 
 #include "ena_com.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 998436e5e8..cdf0915591 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 7312c411bd..46f85964e9 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -7,7 +7,7 @@
 
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index a80f5e2caf..53a451c1b1 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -11,7 +11,7 @@
 #include <pthread.h>
 
 #include <rte_atomic.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_devargs.h>
 #include <rte_flow.h>
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8bbd8b445d..7adb20bff9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_spinlock.h>
 #include <rte_kvargs.h>
 #include <rte_vect.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 87c22b6b54..1775be63c6 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -23,7 +23,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_alarm.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_hash_crc.h>
 #include <rte_bitmap.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..ef2ab06475 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,7 +24,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 21bd1e2193..15f695682d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,7 +19,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..1c3d22ae0f 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -21,7 +21,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "ice_dcf.h"
 #include "ice_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 0da267db1f..dee712af98 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -18,7 +18,7 @@
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <iavf_devids.h>
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 552e41692c..04c9ce78a2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..67373a7b78 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -27,7 +27,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 910b76a92c..7e7e1824ef 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ccc06bdda6..d0bbc0a4c0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -30,7 +30,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 817fb06dfb..7db82af9f3 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -28,7 +28,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 20f75a17b0..e6f1f28768 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -26,7 +26,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 61cf374224..bc6f60c64a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -25,7 +25,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 #include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c792..eaafe11fb9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -19,7 +19,7 @@
 #include <rte_debug.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e588..47359501bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_common.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9ada22e2ff..0eee191566 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -15,7 +15,7 @@
 #include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index a38b701183..b781bcdcfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -13,7 +13,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ip.h>
 
 /* ecore includes */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 506c62a726..2ec743ebce 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -7,7 +7,7 @@
  * for Solarflare) and Solarflare Communications, Inc.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 81f5aa3cc4..3ae5023b6f 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2021 Xilinx, Inc.
  */
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_bitmap.h>
 
 #include "sfc.h"
diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
index 1abded8018..d9738e5214 100644
--- a/drivers/net/sfc/sfc_sw_stats.h
+++ b/drivers/net/sfc/sfc_sw_stats.h
@@ -5,7 +5,7 @@
 #ifndef _SFC_SW_STATS_H
 #define _SFC_SW_STATS_H
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "sfc.h"
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 28183ec740..9f57cb1a20 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 5c7430718b..32b7296877 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -27,7 +27,7 @@
 #include <rte_alarm.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d180162abd..edf3becd32 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -24,7 +24,7 @@
 #include <rte_memory.h>
 #include <rte_eal_paging.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 2b9e35cef5..abc63b0935 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -16,7 +16,7 @@
 
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "virtio.h"
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 101b1cb500..fd946dec5c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/vmxnet3_defs.h"
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index db029cbf34..909fb8faab 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -3,7 +3,7 @@
  */
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 19b523a815..a06b724866 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index fc257c5f44..8ef7a6b127 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_rawdev.h>
 #include <bus_vdev_driver.h>
 #include <rte_test.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 6ab62a12fc..92cf5f495e 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -11,7 +11,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_glue.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 7f6dedbc52..639a0d66ca 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 9bfae077db..41f1415bea 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
index 9fabc399c5..72e52f876f 100644
--- a/lib/compressdev/rte_compressdev_pmd.h
+++ b/lib/compressdev/rte_compressdev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 
 #include "rte_compressdev.h"
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 75d0075b86..f07b92dfd7 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..96d7e225b0 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..1dad092317 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -13,7 +13,7 @@
 
 #include <rte_log.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index 82ab7a8cc7..acd7f71cd1 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -14,7 +14,7 @@
  * by any application.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_dmadev.h"
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 16c5aef1d8..5b64b80cb9 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -8,8 +8,8 @@
 #include <sys/queue.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_class.h>
-#include <rte_dev.h>
 #include <rte_devargs.h>
 #include <rte_errno.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
new file mode 100644
index 0000000000..015188abd5
--- /dev/null
+++ b/lib/eal/include/dev_driver.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef DEV_DRIVER_H
+#define DEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include <rte_dev.h>
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+	const char *name;                   /**< Driver name. */
+	const char *alias;              /**< Driver alias. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEV_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index 77d8621a51..cfcd40aaed 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -57,6 +57,7 @@ headers += files(
 
 driver_sdk_headers = files(
         'bus_driver.h',
+        'dev_driver.h',
 )
 
 # special case install the generic headers, since they go in a subdir
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 871a046ffe..875ecee371 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -23,6 +23,8 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_driver;
+
 /**
  * The device event type.
  */
@@ -53,15 +55,6 @@ struct rte_mem_resource {
 	void *addr;         /**< Virtual address, NULL when not mapped. */
 };
 
-/**
- * A structure describing a device driver.
- */
-struct rte_driver {
-	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
-	const char *name;                   /**< Driver name. */
-	const char *alias;              /**< Driver alias. */
-};
-
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..47a55a419e 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -19,6 +19,7 @@ extern "C" {
  *
  */
 
+#include <dev_driver.h>
 #include <rte_ethdev.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..def6cd0876 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7c695176f4..5bc10312fc 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bf8741d2ea..4f4efdae9f 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -9,7 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_log.h>
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 1dc4f966be..54abee2b3f 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 0e55b00bfe..23972b3dbd 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_gpudev.h"
 
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index d60235a7e3..058ad147a5 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -10,7 +10,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_mempool_trace.h"
 
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 72aabd4dd0..af2b814251 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -14,7 +14,7 @@
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index 2f0a4f132e..bc51258143 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_telemetry.h>
diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 3b7be57d3e..a51944c8ff 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -19,7 +19,7 @@ extern "C" {
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 046b6496d2..d036ed33f6 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_cryptodev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_telemetry.h>
 #include "rte_security.h"
 #include "rte_security_driver.h"
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 28/29] dev: introduce device accessors
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (26 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 27/29] dev: hide driver object David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09  8:26   ` [RFC v2 v2 29/29] dev: hide device object David Marchand
                     ` (2 subsequent siblings)
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev
  Cc: Maryam Tahhan, Reshma Pattan, Maxime Coquelin, Chenbo Xia,
	Ray Kinsella, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko

Prepare for making the device object opaque by adding accessors.
Update existing "external" users.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/proc-info/main.c               |  6 ++--
 examples/ethtool/lib/rte_ethtool.c |  2 +-
 examples/l3fwd/l3fwd_em.c          |  4 +--
 examples/l3fwd/l3fwd_fib.c         |  8 ++---
 examples/l3fwd/l3fwd_lpm.c         |  4 +--
 examples/vdpa/main.c               | 16 ++++-----
 lib/eal/common/eal_common_dev.c    | 24 ++++++++++++++
 lib/eal/include/rte_dev.h          | 53 ++++++++++++++++++++++++++++++
 lib/eal/version.map                |  4 +++
 lib/ethdev/rte_ethdev.h            |  2 +-
 10 files changed, 102 insertions(+), 21 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 1bfba5f60d..d52ac8a038 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -755,7 +755,7 @@ show_port(void)
 		}
 
 		printf("\t  -- driver %s device %s socket %d\n",
-		       dev_info.driver_name, dev_info.device->name,
+		       dev_info.driver_name, rte_dev_name(dev_info.device),
 		       rte_eth_dev_socket_id(i));
 
 		ret = rte_eth_dev_owner_get(i, &owner);
@@ -1254,7 +1254,7 @@ show_crypto(void)
 		       rte_cryptodev_name_get(i),
 		       dev_info.driver_name,
 		       dev_info.driver_id,
-		       dev_info.device->numa_node,
+		       rte_dev_numa_node(dev_info.device),
 		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
@@ -1466,7 +1466,7 @@ dump_regs(char *file_prefix)
 			else
 				printf("Device (%s) regs dumped successfully, "
 					"driver:%s version:0X%08X\n",
-					dev_info.device->name,
+					rte_dev_name(dev_info.device),
 					dev_info.driver_name, reg_info.version);
 
 			fclose(fp_regs);
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 88dc917b73..33acc5e3cc 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -49,7 +49,7 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	strlcpy(drvinfo->bus_info, dev_info.device->name,
+	strlcpy(drvinfo->bus_info, rte_dev_name(dev_info.device),
 		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index 10be24c61d..0531282a1f 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -403,7 +403,7 @@ populate_ipv4_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v4[i].v4_key.port_dst,
 			   em_route_base_v4[i].v4_key.port_src,
 			   em_route_base_v4[i].v4_key.proto,
-		       em_route_base_v4[i].if_out, dev_info.device->name);
+		       em_route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 " keys\n",
 		(uint64_t)route_num_v4);
@@ -455,7 +455,7 @@ populate_ipv6_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v6[i].v6_key.port_dst,
 			   em_route_base_v6[i].v6_key.port_src,
 			   em_route_base_v6[i].v6_key.proto,
-		       em_route_base_v6[i].if_out, dev_info.device->name);
+		       em_route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 "keys\n",
 		(uint64_t)route_num_v6);
diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index e02e4b3f5a..b82e0c0354 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -640,11 +640,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v4[i].depth,
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv4 route added to port %d [%s]\n",
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 	/* >8 End of setup fib. */
@@ -695,11 +695,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v6[i].depth,
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv6 route added to port %d [%s]\n",
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 }
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index d1b850dd5b..22d7f61a42 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -598,7 +598,7 @@ setup_lpm(const int socketid)
 		printf("LPM: Adding route %s / %d (%d) [%s]\n",
 		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 		       route_base_v4[i].depth,
-		       route_base_v4[i].if_out, dev_info.device->name);
+		       route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 
 	/* create the LPM6 table */
@@ -642,7 +642,7 @@ setup_lpm(const int socketid)
 		       inet_ntop(AF_INET6, route_base_v6[i].ip_8, abuf,
 				 sizeof(abuf)),
 		       route_base_v6[i].depth,
-		       route_base_v6[i].if_out, dev_info.device->name);
+		       route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 }
 
diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 7e11ef4e26..ee240dd15a 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -119,7 +119,7 @@ new_device(int vid)
 				"Failed to get generic device for port %d\n", i);
 			continue;
 		}
-		printf("\nnew port %s, device : %s\n", ifname, dev->name);
+		printf("\nnew port %s, device : %s\n", ifname, rte_dev_name(dev));
 		vports[i].vid = vid;
 		break;
 	}
@@ -149,7 +149,7 @@ destroy_device(int vid)
 			continue;
 		}
 
-		printf("\ndestroy port %s, device: %s\n", ifname, dev->name);
+		printf("\ndestroy port %s, device: %s\n", ifname, rte_dev_name(dev));
 		break;
 	}
 }
@@ -353,23 +353,23 @@ static void cmd_list_vdpa_devices_parsed(
 
 	cmdline_printf(cl, "device name\tqueue num\tsupported features\n");
 	RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-		vdev = rte_vdpa_find_device_by_name(dev->name);
+		vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 		if (!vdev)
 			continue;
 		if (rte_vdpa_get_queue_num(vdev, &queue_num) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa queue number "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		if (rte_vdpa_get_features(vdev, &features) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa features "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		cmdline_printf(cl, "%s\t\t%" PRIu32 "\t\t0x%" PRIx64 "\n",
-			dev->name, queue_num, features);
+			rte_dev_name(dev), queue_num, features);
 	}
 }
 
@@ -606,10 +606,10 @@ main(int argc, char *argv[])
 		cmdline_stdin_exit(cl);
 	} else {
 		RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-			vdev = rte_vdpa_find_device_by_name(dev->name);
+			vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 			if (vdev == NULL) {
 				rte_panic("Failed to find vDPA dev for %s\n",
-						dev->name);
+						rte_dev_name(dev));
 			}
 			vports[devcnt].dev = vdev;
 			snprintf(vports[devcnt].ifname, MAX_PATH_LEN, "%s%d",
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 5b64b80cb9..e2d77e02a5 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -25,6 +25,30 @@ rte_driver_name(const struct rte_driver *driver)
 	return driver->name;
 }
 
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev)
+{
+	return dev->bus;
+}
+
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev)
+{
+	return dev->driver;
+}
+
+const char *
+rte_dev_name(const struct rte_device *dev)
+{
+	return dev->name;
+}
+
+int
+rte_dev_numa_node(const struct rte_device *dev)
+{
+	return dev->numa_node;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 875ecee371..a80447a645 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -23,6 +23,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_bus;
 struct rte_driver;
 
 /**
@@ -68,12 +69,64 @@ __rte_experimental
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device bus.
+ */
+__rte_experimental
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device driver.
+ */
+__rte_experimental
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device name.
+ */
+__rte_experimental
+const char *
+rte_dev_name(const struct rte_device *dev);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device numa node.
+ */
+__rte_experimental
+int
+rte_dev_numa_node(const struct rte_device *dev);
+
 /**
  * A structure describing a generic device.
  */
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 54f85ab01f..660d3c7433 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -426,6 +426,10 @@ EXPERIMENTAL {
 	# added in 22.11
 	rte_bus_name;
 	rte_driver_name;
+	rte_dev_bus;
+	rte_dev_driver;
+	rte_dev_name;
+	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index e9574f646f..2197525315 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = rte_driver_name(dev->device->driver)
+ * driver_name = rte_driver_name(rte_dev_driver(dev->device));
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v2 v2 29/29] dev: hide device object
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (27 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 28/29] dev: introduce device accessors David Marchand
@ 2022-07-09  8:26   ` David Marchand
  2022-07-09 16:30   ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 Stephen Hemminger
  2022-07-11  8:38   ` Bruce Richardson
  30 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-09  8:26 UTC (permalink / raw)
  To: dev; +Cc: Maxime Coquelin, Chenbo Xia

Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/eal/common/eal_private.h |  2 +-
 lib/eal/include/dev_driver.h | 14 ++++++++++++++
 lib/eal/include/rte_dev.h    | 13 +------------
 lib/vhost/vdpa.c             |  1 +
 4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..01c3e30994 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -12,6 +12,8 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_dev.h>
 
+struct rte_devargs;
+
 /**
  * A structure describing a device driver.
  */
@@ -21,6 +23,18 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index a80447a645..3077cf3f0f 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -25,6 +25,7 @@ extern "C" {
 
 struct rte_bus;
 struct rte_driver;
+struct rte_device;
 
 /**
  * The device event type.
@@ -127,18 +128,6 @@ __rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index bdebcbe565..aaf3f267e9 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-07-09  8:16             ` David Marchand
@ 2022-07-09 16:28               ` Stephen Hemminger
  2022-09-23  8:49                 ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Stephen Hemminger @ 2022-07-09 16:28 UTC (permalink / raw)
  To: David Marchand
  Cc: Tyler Retzlaff, dev, Thomas Monjalon, Bruce Richardson,
	Kevin Laatz, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Rosen Xu, Stephen Hemminger, Long Li,
	Chas Williams, Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Sat, 9 Jul 2022 10:16:43 +0200
David Marchand <david.marchand@redhat.com> wrote:

> On Tue, Jun 28, 2022 at 8:23 PM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > On Tue, Jun 28, 2022 at 10:38:27AM -0700, Stephen Hemminger wrote:  
> > > On Tue, 28 Jun 2022 10:07:12 -0700
> > > Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> > >  
> > > > > > to avoid people tripping over mishandling pointers in/out of the api
> > > > > > surface taking the opaque object you could declare opaque handle for the
> > > > > > api to operate on instead. it would force the use of a cast in the
> > > > > > implementation but would avoid accidental void * of the wrong thing that
> > > > > > got cached being passed in. if the cast was really undesirable just
> > > > > > whack it under an inline / internal function.  
> > > > >
> > > > > I don't like that because it least to dangerous casts in the internal code.
> > > > > Better to keep the the type of the object. As long as the API only passes
> > > > > around an pointer to a struct, without exposing the contents of the struct;
> > > > > it is safer and easier to debug.  
> > > >
> > > > as i mentioned you can use an inline/internal function or even a macro
> > > > to hide the cast, you could provide some additional integrity checks
> > > > here if desired as a value add.
> > > >
> > > > the fact that you expose that it is a struct is an internal
> > > > implementation detail, if truly opaque tomorrow you could convert it
> > > > to a simple integer that indexes or enumerates something and prevents
> > > > any meaningful interpretation in the application.
> > > >
> > > > when you say it is safer to debug i think you mean for dpdk devs not the
> > > > application developer because unless the app developer does something
> > > > really gross/dangerous casting they really can't "mishandle" the opaque
> > > > object except to use one that isn't initialized at all which we
> > > > can detect and handle internally in a general way.
> > > >
> > > > i will however concede there would be slightly more finger work when
> > > > debugging dpdk itself since gdb / debugger doesn't automatically infer
> > > > type so you end up having to tell gdb what is in the uintptr_t.
> > > >
> > > > anyway just drawing from experience in the driver frameworks we maintain
> > > > in windows, i think one of our regrets is that we didn't do this from
> > > > day 1 and subsequentl that we initially only used one opaque type
> > > > instead of defining separate (not implicitly convertable) types to each
> > > > opaque type.  
> > >
> > > It seems to be a difference in style/taste.  
> >
> > it's not i've sited at least one example of a mistake that becomes a
> > compile time failure where application code is incorrectly authored
> > where use of a pointer offers no such protection.
> >  
> > > The Linux/Unix side prefers opaque structure pointers.
> > > Windows (and LLVM) uses numeric handles.
> > >
> > > At this point DPDK should follow the Linux bus.  
> >
> > dpdk is multi-platform and unix does not necessarily standardize on
> > pointer to struct for opaque objects. freebsd has many apis notably
> > bus_space that does uses handles and as previously mentioned posix
> > threads uses handles.
> >
> > i understand that linux is an important platform but it isn't the only
> > platform dpdk targets and just because it is important doesn't mean it
> > should always enjoy being the defacto standard.
> >
> > anyway, i'll leave it for the patch author to decide. i still like the
> > patch series either way. i just think this would make applications more
> > robust.  
> 
> Thanks for this feedback Tyler.
> I would lean towards Stephen opinion atm, but I am not decided yet.
> 
> For now, I'll post a v2, extending the series to other internal objects.
> We can conclude on this topic during 22.11.

If you get chance to deconstruct API, switching to a numeric index
is safest similar to what Tyler suggested.  Think of ethdev port number
and Posix file descriptor model. The advantage of an index is that
it can be validated more easily by the code that is called.

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v2 v2 00/29] Bus and device cleanup for 22.11
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (28 preceding siblings ...)
  2022-07-09  8:26   ` [RFC v2 v2 29/29] dev: hide device object David Marchand
@ 2022-07-09 16:30   ` Stephen Hemminger
  2022-07-11  8:38   ` Bruce Richardson
  30 siblings, 0 replies; 231+ messages in thread
From: Stephen Hemminger @ 2022-07-09 16:30 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Sat,  9 Jul 2022 10:26:15 +0200
David Marchand <david.marchand@redhat.com> wrote:

> This is a PoC for hiding the rte_bus, rte_driver and rte_device objects.
> And mark associated driver only API as internal.
> 
> A good amount of the patches are preparation work on rte_bus.h,
> rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
> between them. This is something I had in store for some time, maybe I
> should have dropped it from the PoC, but I think those cleanups are
> worth it in any case.
> 
> Then PCI bus specific handling are moved from unit tests and examples,
> though there is still a special case left in testpmd that may require a
> new API, to be discussed.
> 
> After this series, driver-only API headers for registering to buses are
> not exported anymore, unless the enable_driver_sdk meson option is
> selected.
> 
> New accessors for rte_bus, rte_driver and rte_device have been added,
> marked with an experimental tag though we may declare them as stable
> right away so that users can switch to them directly. That's also
> something to agree on.
> 
> I simplified my series and switched to only update "external" users,
> like app/ and examples/ files.
> We need some checkpatch new checks to be sure we won't get some
> driver-only headers included in these areas. That's something I'll work
> on in the non RFC series.
> 
> "Internal" users are simply using the internal headers. That helps
> greatly reducing the size of the changes.
> 
> Disclaimer: again, in this v2, this series is a bit rushed (I brute forced
> compilation tests in GHA so that it passes between patches, but there still
> may be something broken...).
> Not surprisingly, the ABI check in the CI is expected to fail.
> 
> 
> Comments welcome.

Looks good to me, lots of work but will the separation internal
and external API's will help in future.

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v2 v2 00/29] Bus and device cleanup for 22.11
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
                     ` (29 preceding siblings ...)
  2022-07-09 16:30   ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 Stephen Hemminger
@ 2022-07-11  8:38   ` Bruce Richardson
  30 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-11  8:38 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Sat, Jul 09, 2022 at 10:26:15AM +0200, David Marchand wrote:
> This is a PoC for hiding the rte_bus, rte_driver and rte_device objects.
> And mark associated driver only API as internal.
> 
> A good amount of the patches are preparation work on rte_bus.h,
> rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
> between them. This is something I had in store for some time, maybe I
> should have dropped it from the PoC, but I think those cleanups are
> worth it in any case.
> 
> Then PCI bus specific handling are moved from unit tests and examples,
> though there is still a special case left in testpmd that may require a
> new API, to be discussed.
> 
> After this series, driver-only API headers for registering to buses are
> not exported anymore, unless the enable_driver_sdk meson option is
> selected.
> 
> New accessors for rte_bus, rte_driver and rte_device have been added,
> marked with an experimental tag though we may declare them as stable
> right away so that users can switch to them directly. That's also
> something to agree on.
> 
Yes, I think we need to make them stable.

> I simplified my series and switched to only update "external" users,
> like app/ and examples/ files.
> We need some checkpatch new checks to be sure we won't get some
> driver-only headers included in these areas. That's something I'll work
> on in the non RFC series.
> 
> "Internal" users are simply using the internal headers. That helps
> greatly reducing the size of the changes.
> 
> Disclaimer: again, in this v2, this series is a bit rushed (I brute forced
> compilation tests in GHA so that it passes between patches, but there still
> may be something broken...).
> Not surprisingly, the ABI check in the CI is expected to fail.
> 
> 
> Comments welcome.
>
This is great cleanup. Thanks for all the work on it.

/Bruce 

^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (11 preceding siblings ...)
  2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
@ 2022-07-28 15:26 ` David Marchand
  2022-07-28 15:26   ` [RFC v3 01/26] devtools: forbid inclusions of driver only headers David Marchand
                     ` (26 more replies)
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                   ` (3 subsequent siblings)
  16 siblings, 27 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev

This is a PoC for hiding the rte_bus, rte_driver and rte_device objects.
And mark associated driver only API as internal.

A good amount of the patches are preparation work on rte_bus.h,
rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
between them.

PCI bus specific handling are removed from testpmd, unit tests and
examples.

After this series, driver-only API headers for registering to buses are
not exported anymore, unless the enable_driver_sdk meson option is
selected.

New accessors for rte_bus, rte_driver and rte_device have been added,
marked with an experimental tag first when introducing them, and later
in the series marked as stable since external users will want to use
those drop-in replacements right away.

A check is added to ensure we won't pollute app/ and examples/ again,
though some unit tests are left intentionnally untouched as they test
some internals of DPDK.

Comments welcome.

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (26):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  dev: move unrelated macros from header
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide Bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   3 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 doc/guides/rel_notes/deprecation.rst          |  16 -
 doc/guides/rel_notes/release_22_11.rst        |  15 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 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 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  21 +-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   1 +
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |   4 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   1 +
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   1 +
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   2 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 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             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   1 +
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   1 +
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  15 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |   4 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |   2 +
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |   2 +-
 lib/dmadev/rte_dmadev.c                       |   1 +
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_common.h                  |  11 +
 lib/eal/include/rte_dev.h                     | 108 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |   1 +
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   3 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       |   1 +
 lib/ethdev/rte_ethdev.h                       |   2 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |   2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |   2 +-
 lib/eventdev/rte_eventdev.c                   |   2 +-
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   3 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |   2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |   1 +
 lib/security/rte_security.c                   |   3 +-
 lib/vhost/vdpa.c                              |   2 +
 364 files changed, 1700 insertions(+), 2215 deletions(-)
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 01/26] devtools: forbid inclusions of driver only headers
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:23     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 02/26] common/mlx5: rework check on driver registration David Marchand
                     ` (25 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Thomas Monjalon

Let's be good citizens and enforce not using driver only headers in our
own examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 1edc5810ad..0e82c01947 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -142,6 +142,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid inclusion of driver specific headers in apps and examples
+	awk -v FOLDERS='app examples' \
+		-v EXPRESSIONS='include.*_driver\\.h include.*_pmd\\.h' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using driver specific headers in applications' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# SVG must be included with wildcard extension to allow conversion
 	awk -v FOLDERS='doc' \
 		-v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 02/26] common/mlx5: rework check on driver registration
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
  2022-07-28 15:26   ` [RFC v3 01/26] devtools: forbid inclusions of driver only headers David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 15:26   ` [RFC v3 03/26] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (24 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Matan Azrad, Viacheslav Ovsiienko

Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@ static struct rte_auxiliary_driver mlx5_auxiliary_driver = {
 	.dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-	if (mlx5_auxiliary_driver.bus == NULL)
+	if (!mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_register(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = true;
+	}
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-	if (mlx5_auxiliary_driver.bus != NULL)
+	if (mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = false;
+	}
 }
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 03/26] raw/ifpga: remove PCI bus accessor
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
  2022-07-28 15:26   ` [RFC v3 01/26] devtools: forbid inclusions of driver only headers David Marchand
  2022-07-28 15:26   ` [RFC v3 02/26] common/mlx5: rework check on driver registration David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-29  2:36     ` Xu, Rosen
  2022-07-28 15:26   ` [RFC v3 04/26] app/testpmd: drop PCI register commands David Marchand
                     ` (23 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Ray Kinsella, Rosen Xu, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * raw/dpaa2_cmdif: The ``dpaa2_cmdif`` rawdev driver will be deprecated
   in DPDK 22.11, as it is no longer in use, no active user known.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 04/26] app/testpmd: drop PCI register commands
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (2 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 03/26] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:26     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 05/26] kni: stop populating PCI info in examples David Marchand
                     ` (22 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Aman Singh, Yuying Zhang

Those commands date back to the early stages of DPDK when only PCI
devices were supported.
At the time, developers may have used those commands to help in
debugging their buggy^Wwork in progress drivers.

Removing them, we can drop the dependency on the PCI bus and library and
make testpmd bus agnostic.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/cmdline.c                      | 339 +-------------------
 app/test-pmd/config.c                       | 195 -----------
 app/test-pmd/csumonly.c                     |   1 -
 app/test-pmd/flowgen.c                      |   1 -
 app/test-pmd/iofwd.c                        |   1 -
 app/test-pmd/macfwd.c                       |   1 -
 app/test-pmd/macswap.c                      |   1 -
 app/test-pmd/meson.build                    |   2 +-
 app/test-pmd/parameters.c                   |   1 -
 app/test-pmd/rxonly.c                       |   1 -
 app/test-pmd/testpmd.c                      |   1 -
 app/test-pmd/testpmd.h                      |  72 +----
 app/test-pmd/txonly.c                       |   1 -
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  81 -----
 14 files changed, 4 insertions(+), 694 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b4fe9dfb17..4697b7c494 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -28,7 +28,6 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -89,7 +88,6 @@ static void cmd_help_brief_parsed(__rte_unused void *parsed_result,
 		"information.\n"
 		"    help config                     : Configuration information.\n"
 		"    help ports                      : Configuring ports.\n"
-		"    help registers                  : Reading and setting port registers.\n"
 		"    help filters                    : Filters configuration help.\n"
 		"    help traffic_management         : Traffic Management commands.\n"
 		"    help devices                    : Device related commands.\n"
@@ -799,34 +797,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 		);
 	}
 
-	if (show_all || !strcmp(res->section, "registers")) {
-
-		cmdline_printf(
-			cl,
-			"\n"
-			"Registers:\n"
-			"----------\n\n"
-
-			"read reg (port_id) (address)\n"
-			"    Display value of a port register.\n\n"
-
-			"read regfield (port_id) (address) (bit_x) (bit_y)\n"
-			"    Display a port register bit field.\n\n"
-
-			"read regbit (port_id) (address) (bit_x)\n"
-			"    Display a single port register bit.\n\n"
-
-			"write reg (port_id) (address) (value)\n"
-			"    Set value of a port register.\n\n"
-
-			"write regfield (port_id) (address) (bit_x) (bit_y)"
-			" (value)\n"
-			"    Set bit field of a port register.\n\n"
-
-			"write regbit (port_id) (address) (bit_x) (value)\n"
-			"    Set single bit value of a port register.\n\n"
-		);
-	}
 	if (show_all || !strcmp(res->section, "filters")) {
 
 		cmdline_printf(
@@ -1077,13 +1047,13 @@ static cmdline_parse_token_string_t cmd_help_long_help =
 
 static cmdline_parse_token_string_t cmd_help_long_section =
 	TOKEN_STRING_INITIALIZER(struct cmd_help_long_result, section,
-		"all#control#display#config#ports#registers#"
+		"all#control#display#config#ports#"
 		"filters#traffic_management#devices#drivers");
 
 static cmdline_parse_inst_t cmd_help_long = {
 	.f = cmd_help_long_parsed,
 	.data = NULL,
-	.help_str = "help all|control|display|config|ports|register|"
+	.help_str = "help all|control|display|config|ports|"
 		"filters|traffic_management|devices|drivers: "
 		"Show help",
 	.tokens = {
@@ -7390,305 +7360,6 @@ static cmdline_parse_inst_t cmd_showfwdall = {
 	},
 };
 
-/* *** READ PORT REGISTER *** */
-struct cmd_read_reg_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-};
-
-static void
-cmd_read_reg_parsed(void *parsed_result,
-		    __rte_unused struct cmdline *cl,
-		    __rte_unused void *data)
-{
-	struct cmd_read_reg_result *res = parsed_result;
-	port_reg_display(res->port_id, res->reg_off);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_read_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, reg_off, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_read_reg = {
-	.f = cmd_read_reg_parsed,
-	.data = NULL,
-	.help_str = "read reg <port_id> <reg_off>",
-	.tokens = {
-		(void *)&cmd_read_reg_read,
-		(void *)&cmd_read_reg_reg,
-		(void *)&cmd_read_reg_port_id,
-		(void *)&cmd_read_reg_reg_off,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT FIELD *** */
-struct cmd_read_reg_bit_field_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-};
-
-static void
-cmd_read_reg_bit_field_parsed(void *parsed_result,
-			      __rte_unused struct cmdline *cl,
-			      __rte_unused void *data)
-{
-	struct cmd_read_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_display(res->port_id, res->reg_off,
-				   res->bit1_pos, res->bit2_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result, read,
-				 "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit_field = {
-	.f = cmd_read_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "read regfield <port_id> <reg_off> <bit_x> <bit_y>: "
-	"Read register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_field_read,
-		(void *)&cmd_read_reg_bit_field_regfield,
-		(void *)&cmd_read_reg_bit_field_port_id,
-		(void *)&cmd_read_reg_bit_field_reg_off,
-		(void *)&cmd_read_reg_bit_field_bit1_pos,
-		(void *)&cmd_read_reg_bit_field_bit2_pos,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT *** */
-struct cmd_read_reg_bit_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-};
-
-static void
-cmd_read_reg_bit_parsed(void *parsed_result,
-			__rte_unused struct cmdline *cl,
-			__rte_unused void *data)
-{
-	struct cmd_read_reg_bit_result *res = parsed_result;
-	port_reg_bit_display(res->port_id, res->reg_off, res->bit_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_read_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit = {
-	.f = cmd_read_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "read regbit <port_id> <reg_off> <bit_x>: 0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_read,
-		(void *)&cmd_read_reg_bit_regbit,
-		(void *)&cmd_read_reg_bit_port_id,
-		(void *)&cmd_read_reg_bit_reg_off,
-		(void *)&cmd_read_reg_bit_bit_pos,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER *** */
-struct cmd_write_reg_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_parsed(void *parsed_result,
-		     __rte_unused struct cmdline *cl,
-		     __rte_unused void *data)
-{
-	struct cmd_write_reg_result *res = parsed_result;
-	port_reg_set(res->port_id, res->reg_off, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, write, "write");
-static cmdline_parse_token_string_t cmd_write_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_write_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, reg_off, RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, value, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg = {
-	.f = cmd_write_reg_parsed,
-	.data = NULL,
-	.help_str = "write reg <port_id> <reg_off> <reg_value>",
-	.tokens = {
-		(void *)&cmd_write_reg_write,
-		(void *)&cmd_write_reg_reg,
-		(void *)&cmd_write_reg_port_id,
-		(void *)&cmd_write_reg_reg_off,
-		(void *)&cmd_write_reg_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT FIELD *** */
-struct cmd_write_reg_bit_field_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_bit_field_parsed(void *parsed_result,
-			       __rte_unused struct cmdline *cl,
-			       __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_set(res->port_id, res->reg_off,
-			  res->bit1_pos, res->bit2_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, value,
-			      RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg_bit_field = {
-	.f = cmd_write_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "write regfield <port_id> <reg_off> <bit_x> <bit_y> "
-		"<reg_value>: "
-		"Set register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_field_write,
-		(void *)&cmd_write_reg_bit_field_regfield,
-		(void *)&cmd_write_reg_bit_field_port_id,
-		(void *)&cmd_write_reg_bit_field_reg_off,
-		(void *)&cmd_write_reg_bit_field_bit1_pos,
-		(void *)&cmd_write_reg_bit_field_bit2_pos,
-		(void *)&cmd_write_reg_bit_field_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT *** */
-struct cmd_write_reg_bit_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-	uint8_t value;
-};
-
-static void
-cmd_write_reg_bit_parsed(void *parsed_result,
-			 __rte_unused struct cmdline *cl,
-			 __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_result *res = parsed_result;
-	port_reg_bit_set(res->port_id, res->reg_off, res->bit_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_write_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, value,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_write_reg_bit = {
-	.f = cmd_write_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "write regbit <port_id> <reg_off> <bit_x> 0|1: "
-		"0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_write,
-		(void *)&cmd_write_reg_bit_regbit,
-		(void *)&cmd_write_reg_bit_port_id,
-		(void *)&cmd_write_reg_bit_reg_off,
-		(void *)&cmd_write_reg_bit_bit_pos,
-		(void *)&cmd_write_reg_bit_value,
-		NULL,
-	},
-};
-
 /* *** READ A RING DESCRIPTOR OF A PORT RX/TX QUEUE *** */
 struct cmd_read_rxd_txd_result {
 	cmdline_fixed_string_t read;
@@ -14222,12 +13893,6 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_queue_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_config_dcb,
-	(cmdline_parse_inst_t *)&cmd_read_reg,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit,
-	(cmdline_parse_inst_t *)&cmd_write_reg,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit,
 	(cmdline_parse_inst_t *)&cmd_read_rxd_txd,
 	(cmdline_parse_inst_t *)&cmd_stop,
 	(cmdline_parse_inst_t *)&cmd_mac_addr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a2939867c4..3a53b616d8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -31,7 +31,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -1138,200 +1137,6 @@ vlan_id_is_invalid(uint16_t vlan_id)
 	return 1;
 }
 
-static int
-port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	uint64_t pci_len;
-
-	if (reg_off & 0x3) {
-		fprintf(stderr,
-			"Port register offset 0x%X not aligned on a 4-byte boundary\n",
-			(unsigned int)reg_off);
-		return 1;
-	}
-
-	if (!ports[port_id].dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 1;
-	}
-
-	pci_len = pci_dev->mem_resource[0].len;
-	if (reg_off >= pci_len) {
-		fprintf(stderr,
-			"Port %d: register offset %u (0x%X) out of port PCI resource (length=%"PRIu64")\n",
-			port_id, (unsigned int)reg_off, (unsigned int)reg_off,
-			pci_len);
-		return 1;
-	}
-	return 0;
-}
-
-static int
-reg_bit_pos_is_invalid(uint8_t bit_pos)
-{
-	if (bit_pos <= 31)
-		return 0;
-	fprintf(stderr, "Invalid bit position %d (must be <= 31)\n", bit_pos);
-	return 1;
-}
-
-#define display_port_and_reg_off(port_id, reg_off) \
-	printf("port %d PCI register at offset 0x%X: ", (port_id), (reg_off))
-
-static inline void
-display_port_reg_value(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("0x%08X (%u)\n", (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x)
-{
-	uint32_t reg_v;
-
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_x))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bit %d=%d\n", bit_x, (int) ((reg_v & (1 << bit_x)) >> bit_x));
-}
-
-void
-port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-			   uint8_t bit1_pos, uint8_t bit2_pos)
-{
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v >>= l_bit;
-	if (h_bit < 31)
-		reg_v &= ((1 << (h_bit - l_bit + 1)) - 1);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bits[%d, %d]=0x%0*X (%u)\n", l_bit, h_bit,
-	       ((h_bit - l_bit) / 4) + 1, (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_display(portid_t port_id, uint32_t reg_off)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		 uint8_t bit_v)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_pos))
-		return;
-	if (bit_v > 1) {
-		fprintf(stderr, "Invalid bit value %d (must be 0 or 1)\n",
-			(int) bit_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	if (bit_v == 0)
-		reg_v &= ~(1 << bit_pos);
-	else
-		reg_v |= (1 << bit_pos);
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-		       uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value)
-{
-	uint32_t max_v;
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	if ((h_bit - l_bit) < 31)
-		max_v = (1 << (h_bit - l_bit + 1)) - 1;
-	else
-		max_v = 0xFFFFFFFF;
-
-	if (value > max_v) {
-		fprintf(stderr, "Invalid value %u (0x%x) must be < %u (0x%x)\n",
-				(unsigned)value, (unsigned)value,
-				(unsigned)max_v, (unsigned)max_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v &= ~(max_v << l_bit); /* Keep unchanged bits */
-	reg_v |= (value << l_bit); /* Set changed bits */
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
 static uint32_t
 eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
 {
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 1a3fd9ce8a..144f28819c 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 1e01120ae9..fd6abc0f41 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c
index 71849aaf96..8fafdec548 100644
--- a/app/test-pmd/iofwd.c
+++ b/app/test-pmd/iofwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index 79c9241d00..beb220fbb4 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index acb0fd7fb4..4f8deb3382 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 74399178dd..8488efc138 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON')
     ext_deps += jansson_dep
 endif
 
-deps += ['ethdev', 'cmdline', 'bus_pci']
+deps += ['ethdev', 'cmdline']
 if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
     deps += 'crypto_scheduler'
 endif
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e3c9757f3f..c77624302f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -33,7 +33,6 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 04457010f4..d528d4f34e 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index addcbcac85..ee686393c5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -42,7 +42,6 @@
 #include <rte_mbuf.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_dev.h>
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index fb2f5195d3..e4ba7147a3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -7,8 +7,6 @@
 
 #include <stdbool.h>
 
-#include <rte_pci.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
@@ -267,7 +265,7 @@ struct port_txqueue {
  * The data structure associated with each port.
  */
 struct rte_port {
-	struct rte_eth_dev_info dev_info;   /**< PCI info + driver name */
+	struct rte_eth_dev_info dev_info;   /**< Device info + driver name */
 	struct rte_eth_conf     dev_conf;   /**< Port configuration. */
 	struct rte_ether_addr       eth_addr;   /**< Port ethernet address */
 	struct rte_eth_stats    stats;      /**< Last port statistics */
@@ -801,65 +799,6 @@ mbuf_pool_find(unsigned int sock_id, uint16_t idx)
 	return rte_mempool_lookup((const char *)pool_name);
 }
 
-/**
- * Read/Write operations on a PCI register of a port.
- */
-static inline uint32_t
-port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-	uint32_t reg_v;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 0;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	reg_v = *((volatile uint32_t *)reg_addr);
-	return rte_le_to_cpu_32(reg_v);
-}
-
-#define port_id_pci_reg_read(pt_id, reg_off) \
-	port_pci_reg_read(&ports[(pt_id)], (reg_off))
-
-static inline void
-port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
-}
-
-#define port_id_pci_reg_write(pt_id, reg_off, reg_value) \
-	port_pci_reg_write(&ports[(pt_id)], (reg_off), (reg_value))
-
 static inline void
 get_start_cycles(uint64_t *start_tsc)
 {
@@ -922,15 +861,6 @@ void update_fwd_ports(portid_t new_pid);
 void set_fwd_eth_peer(portid_t port_id, char *peer_addr);
 
 void port_mtu_set(portid_t port_id, uint16_t mtu);
-void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos);
-void port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		      uint8_t bit_v);
-void port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-				uint8_t bit1_pos, uint8_t bit2_pos);
-void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-			    uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
-void port_reg_display(portid_t port_id, uint32_t reg_off);
-void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
 int port_action_handle_create(portid_t port_id, uint32_t id,
 			      const struct rte_flow_indir_action_conf *conf,
 			      const struct rte_flow_action *action);
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index e1bc78b73d..021624952d 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 330e34427d..7dacd6fb04 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -55,7 +55,6 @@ These are divided into sections and can be accessed using help, help section or
            help display                    : Displaying port, stats and config information.
            help config                     : Configuration information.
            help ports                      : Configuring ports.
-           help registers                  : Reading and setting port registers.
            help filters                    : Filters configuration help.
            help traffic_management         : Traffic Management commands.
            help devices                    : Device related commands.
@@ -2356,86 +2355,6 @@ manage link bonding devices from within testpmd interactive prompt.
 
 See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information.
 
-Register Functions
-------------------
-
-The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
-This is mainly useful for debugging purposes.
-Reference should be made to the appropriate datasheet for the network card for details on the register addresses
-and fields that can be accessed.
-
-read reg
-~~~~~~~~
-
-Display the value of a port register::
-
-   testpmd> read reg (port_id) (address)
-
-For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
-
-   testpmd> read reg 0 0xEE00
-   port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
-
-read regfield
-~~~~~~~~~~~~~
-
-Display a port register bit field::
-
-   testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
-
-For example, reading the lowest two bits from the register in the example above::
-
-   testpmd> read regfield 0 0xEE00 0 1
-   port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
-
-read regbit
-~~~~~~~~~~~
-
-Display a single port register bit::
-
-   testpmd> read regbit (port_id) (address) (bit_x)
-
-For example, reading the lowest bit from the register in the example above::
-
-   testpmd> read regbit 0 0xEE00 0
-   port 0 PCI register at offset 0xEE00: bit 0=1
-
-write reg
-~~~~~~~~~
-
-Set the value of a port register::
-
-   testpmd> write reg (port_id) (address) (value)
-
-For example, to clear a register::
-
-   testpmd> write reg 0 0xEE00 0x0
-   port 0 PCI register at offset 0xEE00: 0x00000000 (0)
-
-write regfield
-~~~~~~~~~~~~~~
-
-Set bit field of a port register::
-
-   testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
-
-For example, writing to the register cleared in the example above::
-
-   testpmd> write regfield 0 0xEE00 0 1 2
-   port 0 PCI register at offset 0xEE00: 0x00000002 (2)
-
-write regbit
-~~~~~~~~~~~~
-
-Set single bit value of a port register::
-
-   testpmd> write regbit (port_id) (address) (bit_x) (value)
-
-For example, to set the high bit in the register from the example above::
-
-   testpmd> write regbit 0 0xEE00 31 1
-   port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
-
 Traffic Metering and Policing
 -----------------------------
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 05/26] kni: stop populating PCI info in examples
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (3 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 04/26] app/testpmd: drop PCI register commands David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:30     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 06/26] examples/ethtool: prefer device name David Marchand
                     ` (21 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Cristian Dumitrescu

addr and id fields are deprecated and are not used in the kni library.
Stop populating them in the in-tree examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_kni.c        | 30 ------------------------------
 examples/ip_pipeline/kni.c | 10 ----------
 2 files changed, 40 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 622315c8b1..4039da0b08 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -25,7 +25,6 @@ test_kni(void)
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
@@ -426,8 +425,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 
 	if (!mp)
 		return -1;
@@ -443,13 +440,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
 
 	/* core id 1 configured for kernel thread */
@@ -545,8 +535,6 @@ test_kni(void)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
 	FILE *fd;
 	DIR *dir;
 	char buf[16];
@@ -645,15 +633,6 @@ test_kni(void)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
@@ -689,15 +668,6 @@ test_kni(void)
 		goto fail;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index a2d3331cb0..cd02c39478 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_string_fns.h>
 
 #include "kni.h"
@@ -107,8 +106,6 @@ kni_create(const char *name, struct kni_params *params)
 	struct mempool *mempool;
 	struct link *link;
 	struct rte_kni *k;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int ret;
 
 	/* Check input params */
@@ -134,13 +131,6 @@ kni_create(const char *name, struct kni_params *params)
 	kni_conf.core_id = params->thread_id;
 	kni_conf.group_id = link->port_id;
 	kni_conf.mbuf_size = mempool->buffer_size;
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		kni_conf.addr = pci_dev->addr;
-		kni_conf.id = pci_dev->id;
-	}
 
 	memset(&kni_ops, 0, sizeof(kni_ops));
 	kni_ops.port_id = link->port_id;
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 06/26] examples/ethtool: prefer device name
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (4 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 05/26] kni: stop populating PCI info in examples David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:32     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 07/26] dev: hide debug messages in device iterator David Marchand
                     ` (20 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev

Rely on the generic device name rather than restrict to only supporting
PCI devices.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/ethtool/lib/rte_ethtool.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index ffaad96498..88dc917b73 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -8,7 +8,6 @@
 #include <rte_version.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_NET_IXGBE
 #include <rte_pmd_ixgbe.h>
 #endif
@@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 {
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int n;
 	int ret;
 
@@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	/* TODO: replace bus_info by rte_devargs.name */
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
-			"%04x:%02x:%02x.%x",
-			pci_dev->addr.domain, pci_dev->addr.bus,
-			pci_dev->addr.devid, pci_dev->addr.function);
-	} else {
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
-	}
+	strlcpy(drvinfo->bus_info, dev_info.device->name,
+		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
 	rte_eth_dev_get_reg_info(port_id, &reg_info);
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 07/26] dev: hide debug messages in device iterator
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (5 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 06/26] examples/ethtool: prefer device name David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:33     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 08/26] dev: move unrelated macros from header David Marchand
                     ` (19 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Aman Singh, Yuying Zhang

For any bus that does not support device iteration, rte_dev_iterator_init
both returned an error code and logged an error message.
An application (like testpmd) that only wants to list devices, would have
no choice but to inspect a bus object to avoid spewing error logs.

Make those log messages debug level, and remove the check in testpmd.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/config.c           | 4 ----
 lib/eal/common/eal_common_dev.c | 7 +++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3a53b616d8..bc73819183 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -641,10 +641,6 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		/* Skip buses that don't have iterate method */
-		if (!next->dev_iterate)
-			continue;
-
 		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 9d913e5478..b6f0392f30 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -592,18 +592,17 @@ rte_dev_iterator_init(struct rte_dev_iterator *it,
 	 * one layer specified.
 	 */
 	if (bus == NULL && cls == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Either bus or class must be specified.\n");
+		RTE_LOG(DEBUG, EAL, "Either bus or class must be specified.\n");
 		rte_errno = EINVAL;
 		goto get_out;
 	}
 	if (bus != NULL && bus->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Bus %s not supported\n", bus->name);
+		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", bus->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
 	if (cls != NULL && cls->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Class %s not supported\n", cls->name);
+		RTE_LOG(DEBUG, EAL, "Class %s not supported\n", cls->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 08/26] dev: move unrelated macros from header
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (6 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 07/26] dev: hide debug messages in device iterator David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:38     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 09/26] devargs: remove dependency on bus header David Marchand
                     ` (18 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Chengwen Feng, Kevin Laatz,
	Bruce Richardson, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz, Ori Kam, Akhil Goyal,
	Maxime Coquelin, Chenbo Xia

RTE_FUNC_PTR_OR_* macros have nothing to do with the rte_device object
and associated API.
Move them to rte_common.h and include it where needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/qat/qat_device.c                    |  1 +
 drivers/compress/qat/qat_comp_pmd.c                |  1 +
 drivers/crypto/scheduler/rte_cryptodev_scheduler.c |  1 +
 drivers/net/ixgbe/rte_pmd_ixgbe.c                  |  1 +
 drivers/net/liquidio/lio_ethdev.c                  |  1 +
 lib/compressdev/rte_compressdev.c                  |  1 +
 lib/dmadev/rte_dmadev.c                            |  1 +
 lib/eal/include/rte_common.h                       | 11 +++++++++++
 lib/eal/include/rte_dev.h                          | 11 -----------
 lib/ethdev/ethdev_driver.c                         |  1 +
 lib/ethdev/ethdev_pci.h                            |  1 +
 lib/mempool/rte_mempool_ops.c                      |  1 +
 lib/regexdev/rte_regexdev.c                        |  1 +
 lib/security/rte_security.c                        |  1 +
 lib/vhost/vdpa.c                                   |  1 +
 15 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index db4b087d2b..6583cf0554 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2018-2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_devargs.h>
 #include <ctype.h>
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index dc8db84a68..e4cac159be 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2015-2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_malloc.h>
 
 #include "qat_comp.h"
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 1e0c4fe464..88c9b21cd8 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Intel Corporation
  */
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_reorder.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f8575f..8ae4d9b39a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2017 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <ethdev_driver.h>
 
 #include "base/ixgbe_api.h"
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 90ffe31b9f..ccbd0ff849 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017 Cavium, Inc
  */
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 22c438f2dd..12469042f7 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <inttypes.h>
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_eal.h>
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..e199b888c8 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -5,6 +5,7 @@
 
 #include <inttypes.h>
 
+#include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index a96cc2a138..e2d1271c53 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -861,6 +861,17 @@ rte_log2_u64(uint64_t v)
 /** Number of elements in the array. */
 #define	RTE_DIM(a)	(sizeof (a) / sizeof ((a)[0]))
 
+/** Macros to check for invalid function pointers. */
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+	if ((func) == NULL) \
+		return retval; \
+} while (0)
+
+#define RTE_FUNC_PTR_OR_RET(func) do { \
+	if ((func) == NULL) \
+		return; \
+} while (0)
+
 /**
  * Converts a numeric string to the equivalent uint64_t value.
  * As well as straight number conversion, also recognises the suffixes
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index e6ff1218f9..24f9122558 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -36,17 +36,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					enum rte_dev_event_type event,
 					void *cb_arg);
 
-/* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
-	if ((func) == NULL) \
-		return retval; \
-} while (0)
-
-#define RTE_FUNC_PTR_OR_RET(func) do { \
-	if ((func) == NULL) \
-		return; \
-} while (0)
-
 /**
  * Device policies.
  */
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
index a285f213f0..86f5a37874 100644
--- a/lib/ethdev/ethdev_driver.c
+++ b/lib/ethdev/ethdev_driver.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2022 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 0549842709..b4bb460dcb 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -10,6 +10,7 @@
 extern "C" {
 #endif
 
+#include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 2d36dee8f0..d60235a7e3 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
index 02a388bc5d..aa57ab5bfa 100644
--- a/lib/regexdev/rte_regexdev.c
+++ b/lib/regexdev/rte_regexdev.c
@@ -5,6 +5,7 @@
 
 #include <string.h>
 
+#include <rte_common.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
 
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..046b6496d2 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -4,6 +4,7 @@
  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
  */
 
+#include <rte_common.h>
 #include <rte_cryptodev.h>
 #include <rte_dev.h>
 #include <rte_telemetry.h>
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index b2a2919fc0..bdebcbe565 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <rte_common.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 09/26] devargs: remove dependency on bus header
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (7 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 08/26] dev: move unrelated macros from header David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:40     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 10/26] build: export drivers headers David Marchand
                     ` (17 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev

We don't need to include rte_bus.h in rte_devargs.h.
Only a forward declaration of rte_bus and an inclusion of rte_dev.h are
needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_vdev.c          | 1 +
 lib/eal/include/rte_devargs.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 720722c363..5eeff3106d 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/lib/eal/include/rte_devargs.h b/lib/eal/include/rte_devargs.h
index 37a0f042ab..38dee2f288 100644
--- a/lib/eal/include/rte_devargs.h
+++ b/lib/eal/include/rte_devargs.h
@@ -22,7 +22,9 @@ extern "C" {
 
 #include <stdio.h>
 #include <rte_compat.h>
-#include <rte_bus.h>
+#include <rte_dev.h>
+
+struct rte_bus;
 
 /**
  * Bus type key in global devargs syntax.
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 10/26] build: export drivers headers
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (8 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 09/26] devargs: remove dependency on bus header David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:41     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 11/26] bus/auxiliary: make driver-only headers private David Marchand
                     ` (16 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev

Same as for device classes, external DPDK users may need to include some
bus headers for their out of tree drivers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/meson.build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/meson.build b/drivers/meson.build
index b22c2adda7..7449643fa9 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -89,6 +89,7 @@ foreach subpath:subdirs
         name = drv
         sources = []
         headers = []
+        driver_sdk_headers = [] # public headers included by drivers
         objs = []
         cflags = default_cflags
         includes = [include_directories(drv_path)]
@@ -158,6 +159,9 @@ foreach subpath:subdirs
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         install_headers(headers)
+        if get_option('enable_driver_sdk')
+            install_headers(driver_sdk_headers)
+        endif
 
         # generate pmdinfo sources by building a temporary
         # lib and then running pmdinfogen on the contents of
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 11/26] bus/auxiliary: make driver-only headers private
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (9 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 10/26] build: export drivers headers David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 15:26   ` [RFC v3 12/26] bus/dpaa: " David Marchand
                     ` (15 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Parav Pandit, Xueming Li, Ray Kinsella, Matan Azrad,
	Viacheslav Ovsiienko

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 <david.marchand@redhat.com>
---
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 3cea3aa8eb..7247acebd2 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* 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 <rte_devargs.h>
 
 #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 <rte_kvargs.h>
 
 #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 <stdint.h>
 #include <inttypes.h>
 
+#include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 
 #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 <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <eal_filesystem.h>
 
-#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 <stdio.h>
 #include <sys/queue.h>
 
-#include "rte_bus_auxiliary.h"
+#include <rte_bus.h>
+
+#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 <rte_malloc.h>
 #include <rte_errno.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #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 <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <rte_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <ethdev_pci.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 12/26] bus/dpaa: make driver-only headers private
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (10 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 11/26] bus/auxiliary: make driver-only headers private David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 15:26   ` [RFC v3 13/26] bus/fslmc: " David Marchand
                     ` (14 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Sachin Saxena, Gagandeep Singh

The dpaa 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.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 drivers/bus/dpaa/base/qbman/qman.c            |  2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     | 25 ++++++-------------
 drivers/bus/dpaa/dpaa_bus.c                   | 20 +++++++--------
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |  2 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |  2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |  2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |  2 +-
 10 files changed, 26 insertions(+), 35 deletions(-)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 447c091770..3949bf8712 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -7,7 +7,7 @@
 
 #include "qman.h"
 #include <rte_branch_prediction.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_eventdev.h>
 #include <rte_byteorder.h>
 
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/bus_dpaa_driver.h
similarity index 92%
rename from drivers/bus/dpaa/rte_dpaa_bus.h
rename to drivers/bus/dpaa/bus_dpaa_driver.h
index 1f04d9ebd3..cf66fc0c53 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -3,12 +3,14 @@
  *   Copyright 2017-2022 NXP
  *
  */
-#ifndef __RTE_DPAA_BUS_H__
-#define __RTE_DPAA_BUS_H__
+#ifndef BUS_DPAA_DRIVER_H
+#define BUS_DPAA_DRIVER_H
 
-#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
+
 #include <dpaax_iova_table.h>
 
 #include <dpaa_of.h>
@@ -73,24 +75,12 @@ extern unsigned int dpaa_svr_family;
 struct rte_dpaa_device;
 struct rte_dpaa_driver;
 
-/* DPAA Device and Driver lists for DPAA bus */
-TAILQ_HEAD(rte_dpaa_device_list, rte_dpaa_device);
-TAILQ_HEAD(rte_dpaa_driver_list, rte_dpaa_driver);
-
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
 	FSL_DPAA_QDMA
 };
 
-struct rte_dpaa_bus {
-	struct rte_bus bus;
-	struct rte_dpaa_device_list device_list;
-	struct rte_dpaa_driver_list driver_list;
-	int device_count;
-	int detected;
-};
-
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
@@ -119,7 +109,6 @@ typedef int (*rte_dpaa_remove_t)(struct rte_dpaa_device *dpaa_dev);
 struct rte_dpaa_driver {
 	TAILQ_ENTRY(rte_dpaa_driver) next;
 	struct rte_driver driver;
-	struct rte_dpaa_bus *dpaa_bus;
 	enum rte_dpaa_type drv_type;
 	rte_dpaa_probe_t probe;
 	rte_dpaa_remove_t remove;
@@ -166,6 +155,7 @@ extern struct dpaa_memseg_list rte_dpaa_memsegs;
 /* Either iterate over the list of internal memseg references or fallback to
  * EAL memseg based iova2virt.
  */
+__rte_internal
 static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 {
 	struct dpaa_memseg *ms;
@@ -192,6 +182,7 @@ static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 	return va;
 }
 
+__rte_internal
 static inline rte_iova_t
 rte_dpaa_mem_vtop(void *vaddr)
 {
@@ -263,4 +254,4 @@ struct fm_eth_port_cfg *dpaa_get_eth_port_cfg(int dev_id);
 }
 #endif
 
-#endif /* __RTE_DPAA_BUS_H__ */
+#endif /* BUS_DPAA_DRIVER_H */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e442bc4c33..1ac6aa314f 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,7 +34,7 @@
 #include <rte_mbuf_dyn.h>
 
 #include <dpaa_of.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaax_iova_table.h>
 
@@ -43,6 +43,14 @@
 #include <fsl_bman.h>
 #include <netcfg.h>
 
+struct rte_dpaa_bus {
+	struct rte_bus bus;
+	TAILQ_HEAD(, rte_dpaa_device) device_list;
+	TAILQ_HEAD(, rte_dpaa_driver) driver_list;
+	int device_count;
+	int detected;
+};
+
 static struct rte_dpaa_bus rte_dpaa_bus;
 struct netcfg_info *dpaa_netcfg;
 
@@ -520,23 +528,15 @@ rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
 	BUS_INIT_FUNC_TRACE();
 
 	TAILQ_INSERT_TAIL(&rte_dpaa_bus.driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = &rte_dpaa_bus;
 }
 
 /* un-register a dpaa bus based dpaa driver */
 void
 rte_dpaa_driver_unregister(struct rte_dpaa_driver *driver)
 {
-	struct rte_dpaa_bus *dpaa_bus;
-
 	BUS_INIT_FUNC_TRACE();
 
-	dpaa_bus = driver->dpaa_bus;
-
-	TAILQ_REMOVE(&dpaa_bus->driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = NULL;
+	TAILQ_REMOVE(&rte_dpaa_bus.driver_list, driver, next);
 }
 
 static int
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 05415dbf3b..7e554cb2b1 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -41,7 +41,7 @@
 #include <desc/pdcp.h>
 #include <desc/sdap.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_event.h>
 #include <dpaa_sec_log.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d081953e26..29c5935739 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -15,7 +15,7 @@
 #include <desc/algo.h>
 #include <desc/ipsec.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_log.h>
 
diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c
index 9386fe5698..10e65ef1d7 100644
--- a/drivers/dma/dpaa/dpaa_qdma.c
+++ b/drivers/dma/dpaa/dpaa_qdma.c
@@ -2,7 +2,7 @@
  * Copyright 2021 NXP
  */
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dmadev_pmd.h>
 
 #include "dpaa_qdma.h"
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index ff6cc0be18..aa403f9e06 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -29,7 +29,7 @@
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_event_eth_tx_adapter.h>
 #include <cryptodev_pmd.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h
index dc0058e6dd..3f0eafa7dd 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.h
+++ b/drivers/mempool/dpaa/dpaa_mempool.h
@@ -14,7 +14,7 @@
 
 #include <rte_mempool.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 
 #include <fsl_usd.h>
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index e5a072cf49..f21cbba0d9 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -33,7 +33,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaa_mempool.h>
 
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 956fe946fa..20b75efb63 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -37,7 +37,7 @@
 
 #include "dpaa_ethdev.h"
 #include "dpaa_rxtx.h"
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_mempool.h>
 
 #include <qman.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 13/26] bus/fslmc: make driver-only headers private
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (11 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 12/26] bus/dpaa: " David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 15:26   ` [RFC v3 14/26] bus/ifpga: cleanup exported symbols David Marchand
                     ` (13 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Sachin Saxena, Gagandeep Singh

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.marchand@redhat.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.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 14/26] bus/ifpga: cleanup exported symbols
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (12 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 13/26] bus/fslmc: " David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-29  2:36     ` Xu, Rosen
  2022-07-28 15:26   ` [RFC v3 15/26] bus/ifpga: make driver-only headers private David Marchand
                     ` (12 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Rosen Xu, Ray Kinsella, Tianfei zhang

Remove unused symbols (exposed only in an internal header which
guarantees that no application out there relied on them).

Remove rte_ prefix and inline the rest to avoid having to expose them as
global symbols for a relatively small added value.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/ifpga/ifpga_bus.c    | 13 +++--
 drivers/bus/ifpga/ifpga_common.c | 88 --------------------------------
 drivers/bus/ifpga/ifpga_common.h | 54 ++++++++++++++++----
 drivers/bus/ifpga/meson.build    |  2 +-
 drivers/bus/ifpga/version.map    |  2 -
 drivers/raw/ifpga/ifpga_rawdev.c |  2 +-
 6 files changed, 53 insertions(+), 108 deletions(-)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c

diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index e005f2cb70..b1e9eb7cc4 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -117,9 +117,9 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-		&rte_ifpga_get_integer32_arg, &afu_pr_conf.afu_id.port) < 0) {
-			IFPGA_BUS_ERR("error to parse %s",
-				     IFPGA_ARG_PORT);
+				ifpga_get_integer32_arg,
+				&afu_pr_conf.afu_id.port) < 0) {
+			IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_PORT);
 			goto end;
 		}
 	} else {
@@ -130,9 +130,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_AFU_BTS) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_AFU_BTS,
-				       &rte_ifpga_get_string_arg, &path) < 0) {
-			IFPGA_BUS_ERR("Failed to parse %s",
-				     IFPGA_AFU_BTS);
+				ifpga_get_string_arg, &path) < 0) {
+			IFPGA_BUS_ERR("Failed to parse %s", IFPGA_AFU_BTS);
 			goto end;
 		}
 		afu_pr_conf.pr_enable = 1;
@@ -228,7 +227,7 @@ ifpga_scan(void)
 
 		if (rte_kvargs_count(kvlist, IFPGA_ARG_NAME) == 1) {
 			if (rte_kvargs_process(kvlist, IFPGA_ARG_NAME,
-				       &rte_ifpga_get_string_arg, &name) < 0) {
+					ifpga_get_string_arg, &name) < 0) {
 				IFPGA_BUS_ERR("error to parse %s",
 				     IFPGA_ARG_NAME);
 				goto end;
diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c
deleted file mode 100644
index 78e2eaee4e..0000000000
--- a/drivers/bus/ifpga/ifpga_common.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2018 Intel Corporation
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/queue.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <rte_errno.h>
-#include <rte_bus.h>
-#include <rte_per_lcore.h>
-#include <rte_memory.h>
-#include <rte_memzone.h>
-#include <rte_eal.h>
-#include <rte_common.h>
-
-#include <rte_devargs.h>
-#include <rte_kvargs.h>
-#include <rte_alarm.h>
-
-#include "rte_bus_ifpga.h"
-#include "ifpga_logs.h"
-#include "ifpga_common.h"
-
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(char **)extra_args = strdup(value);
-
-	if (!*(char **)extra_args)
-		return -ENOMEM;
-
-	return 0;
-}
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(int *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_unsigned_long(const char *str, int base)
-{
-	unsigned long num;
-	char *end = NULL;
-
-	errno = 0;
-
-	num = strtoul(str, &end, base);
-	if ((str[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0))
-		return -1;
-
-	return num;
-}
-
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1)
-{
-	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
-		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
-		(afu_id0->port == afu_id1->port)) {
-		return 0;
-	} else
-		return 1;
-}
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index f9254b9d5d..bb6524030f 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -5,14 +5,50 @@
 #ifndef _IFPGA_COMMON_H_
 #define _IFPGA_COMMON_H_
 
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_unsigned_long(const char *str, int base);
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1);
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_bus_ifpga.h>
+#include <rte_common.h>
+
+static inline int
+ifpga_get_string_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(char **)extra_args = strdup(value);
+
+	if (!*(char **)extra_args)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static inline int
+ifpga_get_integer32_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(int *)extra_args = strtoull(value, NULL, 0);
+
+	return 0;
+}
+
+static inline int
+ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
+	const struct rte_afu_id *afu_id1)
+{
+	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
+		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
+		(afu_id0->port == afu_id1->port)) {
+		return 0;
+	} else
+		return 1;
+}
 
 #endif /* _IFPGA_COMMON_H_ */
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index cc5047e3ce..9d56a4bb2b 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -9,4 +9,4 @@ endif
 
 deps += ['pci', 'kvargs', 'rawdev']
 headers = files('rte_bus_ifpga.h')
-sources = files('ifpga_common.c', 'ifpga_bus.c')
+sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index c0a1eecae8..da7f92c2a0 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -4,8 +4,6 @@ DPDK_23 {
 	rte_ifpga_driver_register;
 	rte_ifpga_driver_unregister;
 	rte_ifpga_find_afu_by_name;
-	rte_ifpga_get_integer32_arg;
-	rte_ifpga_get_string_arg;
 
 	local: *;
 };
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 78a7123528..93a7e74959 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1752,7 +1752,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-			&rte_ifpga_get_integer32_arg, &port) < 0) {
+				ifpga_get_integer32_arg, &port) < 0) {
 			IFPGA_RAWDEV_PMD_ERR("error to parse %s",
 				IFPGA_ARG_PORT);
 			goto end;
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 15/26] bus/ifpga: make driver-only headers private
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (13 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 14/26] bus/ifpga: cleanup exported symbols David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-29  2:37     ` Xu, Rosen
  2022-07-28 15:26   ` [RFC v3 16/26] bus/pci: " David Marchand
                     ` (11 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Rosen Xu, Ray Kinsella, Tianfei zhang

The ifpga bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- 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 <david.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst         |  2 +-
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}    | 18 ++++++++----------
 drivers/bus/ifpga/ifpga_bus.c                  |  6 +++---
 drivers/bus/ifpga/ifpga_common.h               |  2 +-
 drivers/bus/ifpga/meson.build                  |  2 +-
 drivers/bus/ifpga/version.map                  |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c             |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h             |  2 +-
 drivers/net/ipn3ke/ipn3ke_flow.c               |  2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c        |  2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                 |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h               |  2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c             |  2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c              |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c               |  2 +-
 17 files changed, 26 insertions(+), 28 deletions(-)
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 7247acebd2..8aae628d71 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,7 +84,7 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
-* drivers: Registering a driver on the ``auxiliary``,
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``
   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).
diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/bus_ifpga_driver.h
similarity index 91%
rename from drivers/bus/ifpga/rte_bus_ifpga.h
rename to drivers/bus/ifpga/bus_ifpga_driver.h
index 007ad19875..7b75c2ddbc 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -2,8 +2,8 @@
  * Copyright(c) 2010-2018 Intel Corporation
  */
 
-#ifndef _RTE_BUS_IFPGA_H_
-#define _RTE_BUS_IFPGA_H_
+#ifndef BUS_IFPGA_DRIVER_H
+#define BUS_IFPGA_DRIVER_H
 
 /**
  * @file
@@ -15,23 +15,17 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#include <rte_bus.h>
+#include <rte_compat.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
 
-/** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
 
 /* Forward declarations */
 struct rte_afu_device;
 struct rte_afu_driver;
 
-/** Double linked list of Intel FPGA AFU device. */
-RTE_TAILQ_HEAD(ifpga_afu_dev_list, rte_afu_device);
-/** Double linked list of Intel FPGA AFU device drivers. */
-RTE_TAILQ_HEAD(ifpga_afu_drv_list, rte_afu_driver);
-
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
 struct rte_afu_uuid {
@@ -112,6 +106,7 @@ struct rte_afu_driver {
 	const struct rte_afu_uuid *id_table;    /**< AFU uuid within FPGA. */
 };
 
+__rte_internal
 static inline const char *
 rte_ifpga_device_name(const struct rte_afu_device *afu)
 {
@@ -126,6 +121,7 @@ rte_ifpga_device_name(const struct rte_afu_device *afu)
  * @param name
  *   A pointer to AFU name string.
  */
+__rte_internal
 struct rte_afu_device *
 rte_ifpga_find_afu_by_name(const char *name);
 
@@ -136,6 +132,7 @@ rte_ifpga_find_afu_by_name(const char *name);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be registered.
  */
+__rte_internal
 void rte_ifpga_driver_register(struct rte_afu_driver *driver);
 
 /**
@@ -145,6 +142,7 @@ void rte_ifpga_driver_register(struct rte_afu_driver *driver);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be unregistered.
  */
+__rte_internal
 void rte_ifpga_driver_unregister(struct rte_afu_driver *driver);
 
 #define RTE_PMD_REGISTER_AFU(nm, afudrv)\
@@ -164,4 +162,4 @@ static const char *afudrvinit_ ## nm ## _alias = RTE_STR(alias)
 }
 #endif /* __cplusplus */
 
-#endif /* _RTE_BUS_IFPGA_H_ */
+#endif /* BUS_IFPGA_DRIVER_H */
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index b1e9eb7cc4..27e2de7072 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -28,7 +28,7 @@
 
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_logs.h"
 #include "ifpga_common.h"
 
@@ -37,9 +37,9 @@
  */
 static struct rte_bus rte_ifpga_bus;
 
-static struct ifpga_afu_dev_list ifpga_afu_dev_list =
+static TAILQ_HEAD(, rte_afu_device) ifpga_afu_dev_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_dev_list);
-static struct ifpga_afu_drv_list ifpga_afu_drv_list =
+static TAILQ_HEAD(, rte_afu_driver) ifpga_afu_drv_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_drv_list);
 
 
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index bb6524030f..a41a1628f5 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_common.h>
 
 static inline int
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index 9d56a4bb2b..dedc94db2d 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -8,5 +8,5 @@ if is_windows
 endif
 
 deps += ['pci', 'kvargs', 'rawdev']
-headers = files('rte_bus_ifpga.h')
+driver_sdk_headers += files('bus_ifpga_driver.h')
 sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index da7f92c2a0..3d1943afe4 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -1,4 +1,4 @@
-DPDK_23 {
+INTERNAL {
 	global:
 
 	rte_ifpga_driver_register;
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 550a8b0466..2e39113941 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 58fcc50c57..dbf57f9ba8 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -24,7 +24,7 @@
 #include <rte_spinlock.h>
 
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_tm_driver.h>
 
 #define IPN3KE_TM_SCRATCH_RW 0
diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c
index 66ae31a5a9..5b57ee9341 100644
--- a/drivers/net/ipn3ke/ipn3ke_flow.c
+++ b/drivers/net/ipn3ke/ipn3ke_flow.c
@@ -20,7 +20,7 @@
 #include <rte_tailq.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index abbecfdf2e..2f088d767f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 6a9b98fd7f..2f242b678a 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/raw/ifpga/afu_pmd_core.h b/drivers/raw/ifpga/afu_pmd_core.h
index 91118a19ab..ab5a228147 100644
--- a/drivers/raw/ifpga/afu_pmd_core.h
+++ b/drivers/raw/ifpga/afu_pmd_core.h
@@ -15,7 +15,7 @@ extern "C" {
 
 #include <rte_spinlock.h>
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "ifpga_rawdev.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index 102de50812..eca1edc270 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index 8b2c85b5f8..da0aba6e00 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 0f57a03b0e..3c41aa9ee8 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 5120df5f77..b7438bd372 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 93a7e74959..bd9966a6c3 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -35,7 +35,7 @@
 #include "base/ifpga_api.h"
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_common.h"
 #include "ifpga_logs.h"
 #include "ifpga_rawdev.h"
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 16/26] bus/pci: make driver-only headers private
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (14 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 15/26] bus/ifpga: make driver-only headers private David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:46     ` Bruce Richardson
  2022-07-29  2:41     ` Xu, Rosen
  2022-07-28 15:26   ` [RFC v3 17/26] bus/vdev: " David Marchand
                     ` (10 subsequent siblings)
  26 siblings, 2 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Nicolas Chautru, Ray Kinsella, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Matan Azrad, Viacheslav Ovsiienko,
	Fan Zhang, Andrew Rybchenko, Ashish Gupta, Chandubabu Namburu,
	Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Nagadheeraj Rottela, Srikanth Jampala, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru, Chengwen Feng,
	Bruce Richardson, Kevin Laatz, Conor Walsh, Timothy McDaniel,
	Jerin Jacob, Pavan Nikhilesh, Elena Agostini, Ashwin Sekhar T K,
	Harman Kalra, Shepard Siegel, Ed Czeck, John Miller,
	Steven Webster, Matt Peters, Rasesh Mody, Shahed Shaikh,
	Ajit Khaparde, Somnath Kotur, Chas Williams, Min Hu (Connor),
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Dongdong Liu, Yisen Zhuang, Yuying Zhang,
	Beilei Xing, Junfeng Guo, Andrew Boyer, Rosen Xu, Qiming Yang,
	Stephen Hemminger, Long Li, Jiawen Wu, Devendra Singh Rawat,
	Maciej Czekaj, Jian Wang, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Tianfei zhang,
	Jingjing Wu, Ori Kam, Xiao Wang, Vijay Kumar Srivastava,
	Thomas Monjalon, Ferruh Yigit

The pci 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 <david.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 app/test/virtual_pmd.c                        |   2 +-
 doc/guides/rel_notes/release_22_11.rst        |   2 +-
 drivers/baseband/acc100/rte_acc100_pmd.c      |   2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   2 +-
 drivers/bus/pci/bsd/pci.c                     |   3 -
 drivers/bus/pci/bus_pci_driver.h              | 200 +++++++++++++++++
 drivers/bus/pci/linux/pci.c                   |   3 -
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |   2 -
 drivers/bus/pci/private.h                     |  19 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +-----------------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   1 +
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/common/cnxk/roc_platform.h            |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |   2 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   2 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   2 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   2 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   2 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   2 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   3 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/netvsc/hn_vf.c                    |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   2 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   2 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 lib/ethdev/ethdev_pci.h                       |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 128 files changed, 350 insertions(+), 331 deletions(-)
 create mode 100644 drivers/bus/pci/bus_pci_driver.h

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index cd4611ab48..2b55c85fd8 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8aae628d71..79ec128533 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,7 +84,7 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
-* drivers: Registering a driver on the ``auxiliary``, ``ifpga``
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``
   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).
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index a8482bd411..801e8920df 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -14,7 +14,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_hexdump.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
 #endif
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 82ae6ba678..c1d877c87f 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 21d35292a3..f16814e241 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 9a11f99ae3..bc560a2a56 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -28,7 +28,6 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
@@ -48,8 +47,6 @@
  * PCI probing under BSD.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /* Map pci device */
 int
 rte_pci_map_device(struct rte_pci_device *dev)
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
new file mode 100644
index 0000000000..b5c7dee617
--- /dev/null
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -0,0 +1,200 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2015 Intel Corporation.
+ * Copyright 2013-2014 6WIND S.A.
+ */
+
+#ifndef BUS_PCI_DRIVER_H
+#define BUS_PCI_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_pci.h>
+#include <rte_dev.h>
+#include <rte_compat.h>
+
+/** Pathname of PCI devices directory. */
+__rte_internal
+const char *rte_pci_get_sysfs_path(void);
+
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* no attached driver */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
+};
+
+/**
+ * A structure describing a PCI device.
+ */
+struct rte_pci_device {
+	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
+	struct rte_device device;           /**< Inherit core device */
+	struct rte_pci_addr addr;           /**< PCI location. */
+	struct rte_pci_id id;               /**< PCI ID. */
+	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
+					    /**< PCI Memory Resource */
+	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
+	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
+	uint16_t max_vfs;                   /**< sriov enable if not zero */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
+	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	struct rte_intr_handle *vfio_req_intr_handle;
+				/**< Handler of VFIO request interrupt */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_pci_device.
+ */
+#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
+
+#define RTE_DEV_TO_PCI_CONST(ptr) \
+	container_of(ptr, const struct rte_pci_device, device)
+
+#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
+
+#ifdef __cplusplus
+/** C++ macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev) \
+	RTE_CLASS_ANY_ID,         \
+	(vend),                   \
+	(dev),                    \
+	RTE_PCI_ANY_ID,           \
+	RTE_PCI_ANY_ID
+#else
+/** Macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev)          \
+	.class_id = RTE_CLASS_ANY_ID,      \
+	.vendor_id = (vend),               \
+	.device_id = (dev),                \
+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
+	.subsystem_device_id = RTE_PCI_ANY_ID
+#endif
+
+/**
+ * Initialisation function for the driver called during PCI probing.
+ */
+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
+
+/**
+ * Uninitialisation function for the driver called during hotplugging.
+ */
+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A structure describing a PCI driver.
+ */
+struct rte_pci_driver {
+	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
+	struct rte_driver driver;          /**< Inherit core driver. */
+	rte_pci_probe_t *probe;            /**< Device probe function. */
+	rte_pci_remove_t *remove;          /**< Device remove function. */
+	pci_dma_map_t *dma_map;		   /**< device dma map function. */
+	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
+	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
+	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
+};
+
+/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
+#define RTE_PCI_DRV_NEED_MAPPING 0x0001
+/** Device needs PCI BAR mapping with enabled write combining (wc) */
+#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
+/** Device already probed can be probed again to check for new ports. */
+#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
+/** Device driver supports link state interrupt */
+#define RTE_PCI_DRV_INTR_LSC	0x0008
+/** Device driver supports device removal interrupt */
+#define RTE_PCI_DRV_INTR_RMV 0x0010
+/** Device driver needs to keep mapped resources if unsupported dev detected */
+#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
+
+/**
+ * Register a PCI driver.
+ *
+ * @param driver
+ *   A pointer to a rte_pci_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_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) \
+{\
+	(pci_drv).driver.name = RTE_STR(nm);\
+	rte_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.
+ */
+__rte_internal
+void rte_pci_unregister(struct rte_pci_driver *driver);
+
+/*
+ * A structure used to access io resources for a pci device.
+ * rte_pci_ioport is arch, os, driver specific, and should not be used outside
+ * of pci ioport api.
+ */
+struct rte_pci_ioport {
+	struct rte_pci_device *dev;
+	uint64_t base;
+	uint64_t len; /* only filled for memory mapped ports */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_PCI_DRIVER_H */
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index e521459870..fa5d5e131d 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -6,7 +6,6 @@
 #include <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_malloc.h>
@@ -24,8 +23,6 @@
  * PCI probing using Linux sysfs.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 static int
 pci_get_kernel_driver_by_path(const char *filename, char *dri_name,
 			      size_t len)
diff --git a/drivers/bus/pci/meson.build b/drivers/bus/pci/meson.build
index 81c7e94c00..f50f039a68 100644
--- a/drivers/bus/pci/meson.build
+++ b/drivers/bus/pci/meson.build
@@ -3,6 +3,7 @@
 
 deps += ['pci']
 headers = files('rte_bus_pci.h')
+driver_sdk_headers = files('bus_pci_driver.h')
 sources = files('pci_common.c',
     'pci_params.c')
 if is_linux
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 37ab879779..0d61d49287 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -443,7 +443,6 @@ void
 rte_pci_register(struct rte_pci_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = &rte_pci_bus;
 }
 
 /* unregister a driver */
@@ -451,7 +450,6 @@ void
 rte_pci_unregister(struct rte_pci_driver *driver)
 {
 	TAILQ_REMOVE(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to PCI bus */
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 0fbef8e1d8..4e40a2ed85 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,12 +8,29 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
+/**
+ * Structure describing the PCI bus
+ */
+struct rte_pci_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_pci_device) device_list; /**< List of PCI devices */
+	RTE_TAILQ_HEAD(, rte_pci_driver) driver_list; /**< List of PCI drivers */
+};
+
 extern struct rte_pci_bus rte_pci_bus;
 
+/* PCI Bus iterators */
+#define FOREACH_DEVICE_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+
 struct rte_pci_driver;
 struct rte_pci_device;
 
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1c6a8fdd7b..60e50ca875 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -24,176 +24,15 @@ extern "C" {
 
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 
-/** Pathname of PCI devices directory. */
-const char *rte_pci_get_sysfs_path(void);
-
 /* Forward declarations */
 struct rte_pci_device;
 struct rte_pci_driver;
-
-/** List of PCI devices */
-RTE_TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
-/** List of PCI drivers */
-RTE_TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
-
-/* PCI Bus iterators */
-#define FOREACH_DEVICE_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+struct rte_pci_ioport;
 
 struct rte_devargs;
 
-enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
-	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
-	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
-	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
-	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
-	RTE_PCI_KDRV_NONE,         /* no attached driver */
-	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
-};
-
-/**
- * A structure describing a PCI device.
- */
-struct rte_pci_device {
-	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
-	struct rte_device device;           /**< Inherit core device */
-	struct rte_pci_addr addr;           /**< PCI location. */
-	struct rte_pci_id id;               /**< PCI ID. */
-	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
-					    /**< PCI Memory Resource */
-	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
-	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
-	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
-	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
-	struct rte_intr_handle *vfio_req_intr_handle;
-				/**< Handler of VFIO request interrupt */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_pci_device.
- */
-#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
-
-#define RTE_DEV_TO_PCI_CONST(ptr) \
-	container_of(ptr, const struct rte_pci_device, device)
-
-#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
-
-#ifdef __cplusplus
-/** C++ macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev) \
-	RTE_CLASS_ANY_ID,         \
-	(vend),                   \
-	(dev),                    \
-	RTE_PCI_ANY_ID,           \
-	RTE_PCI_ANY_ID
-#else
-/** Macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev)          \
-	.class_id = RTE_CLASS_ANY_ID,      \
-	.vendor_id = (vend),               \
-	.device_id = (dev),                \
-	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
-	.subsystem_device_id = RTE_PCI_ANY_ID
-#endif
-
-/**
- * Initialisation function for the driver called during PCI probing.
- */
-typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
-
-/**
- * Uninitialisation function for the driver called during hotplugging.
- */
-typedef int (rte_pci_remove_t)(struct rte_pci_device *);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A structure describing a PCI driver.
- */
-struct rte_pci_driver {
-	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
-	struct rte_driver driver;          /**< Inherit core driver. */
-	struct rte_pci_bus *bus;           /**< PCI bus reference. */
-	rte_pci_probe_t *probe;            /**< Device probe function. */
-	rte_pci_remove_t *remove;          /**< Device remove function. */
-	pci_dma_map_t *dma_map;		   /**< device dma map function. */
-	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
-	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
-	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
-};
-
-/**
- * Structure describing the PCI bus
- */
-struct rte_pci_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_pci_device_list device_list;  /**< List of PCI devices */
-	struct rte_pci_driver_list driver_list;  /**< List of PCI drivers */
-};
-
-/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
-#define RTE_PCI_DRV_NEED_MAPPING 0x0001
-/** Device needs PCI BAR mapping with enabled write combining (wc) */
-#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
-/** Device already probed can be probed again to check for new ports. */
-#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
-/** Device driver supports link state interrupt */
-#define RTE_PCI_DRV_INTR_LSC	0x0008
-/** Device driver supports device removal interrupt */
-#define RTE_PCI_DRV_INTR_RMV 0x0010
-/** Device driver needs to keep mapped resources if unsupported dev detected */
-#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
-
 /**
  * Map the PCI device resources in user space virtual memory address
  *
@@ -261,33 +100,6 @@ off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap);
 __rte_experimental
 int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable);
 
-/**
- * Register a PCI driver.
- *
- * @param driver
- *   A pointer to a rte_pci_driver structure describing the driver
- *   to be registered.
- */
-void rte_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) \
-{\
-	(pci_drv).driver.name = RTE_STR(nm);\
-	rte_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_pci_unregister(struct rte_pci_driver *driver);
-
 /**
  * Read PCI config space.
  *
@@ -322,17 +134,6 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 int rte_pci_write_config(const struct rte_pci_device *device,
 		const void *buf, size_t len, off_t offset);
 
-/**
- * A structure used to access io resources for a pci device.
- * rte_pci_ioport is arch, os, driver specific, and should not be used outside
- * of pci ioport api.
- */
-struct rte_pci_ioport {
-	struct rte_pci_device *dev;
-	uint64_t base;
-	uint64_t len; /* only filled for memory mapped ports */
-};
-
 /**
  * Initialize a rte_pci_ioport object for a pci device io resource.
  *
diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map
index 3d5c2f3068..161ab86d3b 100644
--- a/drivers/bus/pci/version.map
+++ b/drivers/bus/pci/version.map
@@ -2,16 +2,13 @@ DPDK_23 {
 	global:
 
 	rte_pci_dump;
-	rte_pci_get_sysfs_path;
 	rte_pci_ioport_map;
 	rte_pci_ioport_read;
 	rte_pci_ioport_unmap;
 	rte_pci_ioport_write;
 	rte_pci_map_device;
 	rte_pci_read_config;
-	rte_pci_register;
 	rte_pci_unmap_device;
-	rte_pci_unregister;
 	rte_pci_write_config;
 
 	local: *;
@@ -25,3 +22,11 @@ EXPERIMENTAL {
 	# added in 21.08
 	rte_pci_set_bus_master;
 };
+
+INTERNAL {
+	global:
+
+	rte_pci_get_sysfs_path;
+	rte_pci_register;
+	rte_pci_unregister;
+};
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 7bf091158b..f013b743b3 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -9,6 +9,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_bus_pci.h>
 
 #include "private.h"
 #include "pci_netuio.h"
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index 5460399eea..314bbcf547 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 #include <rte_log.h>
 #include <rte_eal.h>
+#include <rte_bus_pci.h>
 
 #ifdef __MINGW32__
 #include <ddk/ndisguid.h>
diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h
index 502f243a81..a7cbe444ae 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -7,7 +7,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bitmap.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c
index b42102e84c..aafff60eeb 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -15,7 +15,7 @@
 
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 
 #include "mlx5_common.h"
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h
index 479bb3c7cb..81702b8768 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.h
+++ b/drivers/common/mlx5/linux/mlx5_common_os.h
@@ -9,7 +9,7 @@
 #include <malloc.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_log.h>
diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
index 63f31437da..629a639a81 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -8,7 +8,7 @@
 #include <stdio.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_rwlock.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 66626953f1..e82cb881bf 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,8 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
 #include "mlx5_common_private.h"
diff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c
index f2fc7cd494..2b6058eb3e 100644
--- a/drivers/common/mlx5/windows/mlx5_common_os.c
+++ b/drivers/common/mlx5/windows/mlx5_common_os.c
@@ -7,7 +7,7 @@
 #include <stdio.h>
 
 #include <rte_mempool.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_errno.h>
 
diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h
index e1a32a7e87..d1512f3b89 100644
--- a/drivers/common/qat/qat_device.h
+++ b/drivers/common/qat/qat_device.h
@@ -4,7 +4,7 @@
 #ifndef _QAT_DEVICE_H_
 #define _QAT_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "qat_common.h"
 #include "qat_logs.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 08ac91eac4..4a1be35b47 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
diff --git a/drivers/common/sfc_efx/sfc_efx.h b/drivers/common/sfc_efx/sfc_efx.h
index c16eca60f3..d3ea586cb8 100644
--- a/drivers/common/sfc_efx/sfc_efx.h
+++ b/drivers/common/sfc_efx/sfc_efx.h
@@ -10,7 +10,7 @@
 #ifndef _SFC_EFX_H_
 #define _SFC_EFX_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "efx.h"
 #include "efsys.h"
diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c
index d64a628c74..3d2c45fcee 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -5,7 +5,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h
index 46c80c8dc2..cdef8cc6cb 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -7,7 +7,7 @@
 
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
 #include <rte_compressdev_pmd.h>
diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index e8f57c3cc4..fe4a4999c6 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_hexdump.h>
 #include <rte_comp.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_memcpy.h>
 #include <rte_common.h>
diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h
index 2a205cd446..9deaae7980 100644
--- a/drivers/crypto/ccp/ccp_dev.h
+++ b/drivers/crypto/ccp/ccp_dev.h
@@ -10,7 +10,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_byteorder.h>
 #include <rte_io.h>
diff --git a/drivers/crypto/ccp/ccp_pci.h b/drivers/crypto/ccp/ccp_pci.h
index 7ed3bac406..6736bf8ad3 100644
--- a/drivers/crypto/ccp/ccp_pci.h
+++ b/drivers/crypto/ccp/ccp_pci.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
 #define PROC_MODULES "/proc/modules"
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a35a8cd775..4957f11e97 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_bus_vdev.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 1e0a7b91c9..3fd9f3c426 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index 54cd77e575..bd425f95ff 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index eb7616257e..dc8e291f50 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -7,7 +7,7 @@
 #include <rte_eal_paging.h>
 #include <rte_errno.h>
 #include <rte_log.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/crypto/nitrox/nitrox_device.h b/drivers/crypto/nitrox/nitrox_device.h
index 6b8095f42b..1ff7c59b63 100644
--- a/drivers/crypto/nitrox/nitrox_device.h
+++ b/drivers/crypto/nitrox/nitrox_device.h
@@ -5,7 +5,7 @@
 #ifndef _NITROX_DEVICE_H_
 #define _NITROX_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 struct nitrox_sym_device;
diff --git a/drivers/crypto/octeontx/otx_cryptodev.c b/drivers/crypto/octeontx/otx_cryptodev.c
index 337d06aab8..b5ab937c3a 100644
--- a/drivers/crypto/octeontx/otx_cryptodev.c
+++ b/drivers/crypto/octeontx/otx_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium, Inc
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_log.h>
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 7aee67ab09..11840f5ecf 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eventdev.h>
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index db6316fbe9..f3a99ae15c 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -7,7 +7,7 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_crypto_sym.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 
 #include "qat_sym.h"
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index ed64866758..21bd996064 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eal.h>
diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c
index ae069794a6..95a43c8801 100644
--- a/drivers/crypto/virtio/virtio_pci.c
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -10,7 +10,6 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
 
 #include "virtio_pci.h"
 #include "virtqueue.h"
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
index 0a7ea1bb64..41949c3d13 100644
--- a/drivers/crypto/virtio/virtio_pci.h
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 
 #include <rte_eal_paging.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 #include "virtio_crypto.h"
diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c
index 2824c1b44f..9f0de60861 100644
--- a/drivers/dma/cnxk/cnxk_dmadev.c
+++ b/drivers/dma/cnxk/cnxk_dmadev.c
@@ -5,8 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index 9494b60779..0e11ca14cc 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c
index 2f8ec06d9e..781fa02db3 100644
--- a/drivers/dma/idxd/idxd_pci.c
+++ b/drivers/dma/idxd/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_devargs.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
index a230496b11..5906eb45aa 100644
--- a/drivers/dma/ioat/ioat_dmadev.c
+++ b/drivers/dma/ioat/ioat_dmadev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
 #include <rte_prefetch.h>
diff --git a/drivers/event/dlb2/pf/dlb2_main.h b/drivers/event/dlb2/pf/dlb2_main.h
index 9eeda482a3..5aa51b1616 100644
--- a/drivers/event/dlb2/pf/dlb2_main.h
+++ b/drivers/event/dlb2/pf/dlb2_main.h
@@ -9,7 +9,7 @@
 #include <rte_log.h>
 #include <rte_spinlock.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include "base/dlb2_hw_types.h"
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index dd3f2b8ece..9f8c6cd8b8 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -25,7 +25,7 @@
 #include <rte_cycles.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
 #include <eventdev_pmd_pci.h>
diff --git a/drivers/event/octeontx/ssovf_probe.c b/drivers/event/octeontx/ssovf_probe.c
index 4da7d1ae45..2c9601a8ff 100644
--- a/drivers/event/octeontx/ssovf_probe.c
+++ b/drivers/event/octeontx/ssovf_probe.c
@@ -7,7 +7,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "octeontx_mbox.h"
 #include "ssovf_evdev.h"
diff --git a/drivers/event/octeontx/timvf_probe.c b/drivers/event/octeontx/timvf_probe.c
index 59bba31e8e..7ce3eddd7e 100644
--- a/drivers/event/octeontx/timvf_probe.c
+++ b/drivers/event/octeontx/timvf_probe.c
@@ -5,7 +5,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <octeontx_mbox.h>
 
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 664605d9fb..2be7b8d2df 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -6,7 +6,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_dev.h>
 
diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index 54a1a7d3ae..78caf987d0 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_atomic.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 8fd9edced2..1513c632c6 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -13,7 +13,7 @@
 
 #include <rte_atomic.h>
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index e8e4092be6..c654a229f7 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7ac55584ff..7c0cb666fb 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index d7e1729e68..89414ac88a 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -16,7 +16,7 @@
 
 #include <rte_byteorder.h>
 #include <rte_spinlock.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_io.h>
 
 #include "bnx2x_osal.h"
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e86e51e1fa..c9aa45ed3b 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 5406e1c934..1a86eb3c00 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,8 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index 1c016a7115..16cbc1a345 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -8,7 +8,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index cf9a2fdc19..fd71a50a58 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_tailq.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 794496abfc..409de50083 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index cea5b490ba..d48fd52404 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -18,7 +18,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a9c18b27e8..43979992d3 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 3f3fd0d61e..c7588ea57e 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -10,7 +10,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 0db0918b43..4709675af8 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -12,7 +12,7 @@
 #include <ethdev_pci.h>
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_timer.h>
 #include <rte_dev.h>
 #include <rte_net.h>
diff --git a/drivers/net/enic/base/vnic_dev.h b/drivers/net/enic/base/vnic_dev.h
index 4b9f75b65f..44ca5c739f 100644
--- a/drivers/net/enic/base/vnic_dev.h
+++ b/drivers/net/enic/base/vnic_dev.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "enic_compat.h"
 #include "vnic_resource.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index a8d470e8ac..998436e5e8 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9f351de72e..19a99a82c5 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 1ad6ad3dfb..7312c411bd 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c
index 5eb022297e..818698dcb3 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwdev.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c
@@ -3,7 +3,7 @@
  */
 
 #include<ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index 26fa1e27d4..2d3f192b21 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_csr.h"
diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index ad5db9f1de..4aa3fa6adc 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
-#include<rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_pmd_hwdev.h"
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 35788f46eb..7aa5e7d8e9 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 424205356e..e8e5aa2c86 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_kvargs.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
 
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6b1d1a5fb1..144daf1636 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 
 #include "hns3_ethdev.h"
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 95f711e7eb..cd0c91f3a3 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018-2021 HiSilicon Limited.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 67d79de08d..7bdc453ec1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 7f8e81858e..cc0f992453 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Intel Corporation.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 7f221a5d34..e3727b7b41 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -7,7 +7,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h
index 49b90d1b7c..a55202b178 100644
--- a/drivers/net/ionic/ionic.h
+++ b/drivers/net/ionic/ionic.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "ionic_dev.h"
 #include "ionic_if.h"
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 28280c5377..d72033c32c 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 2e39113941..70a06a3b15 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -4,7 +4,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 2f088d767f..2ef96a984a 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 2f242b678a..0260227900 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f31bbb7895..552e41692c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index cc6049a66a..ff34fd1515 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index ce74c51ce2..bb1dd33e7c 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -32,7 +32,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_ether.h>
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index aaf636aa0d..661d362dc0 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -25,7 +25,7 @@
 #include <time.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index c9ed38ef7c..efb262e368 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,8 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 998846adbe..30923b0732 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 05c919ed39..a5c7ca8c52 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -11,7 +11,7 @@
 #include <errno.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index bee9363515..e122b39cb3 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -15,7 +15,7 @@
 #include <rte_flow_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ip.h>
 #include <rte_gre.h>
 #include <rte_vxlan.h>
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 0140f8b3b2..9150ced72d 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -13,7 +13,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal_paging.h>
 
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 62948bf889..cce0a79edb 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h
index bf1fa30312..8783fce4dd 100644
--- a/drivers/net/ngbe/base/ngbe_osdep.h
+++ b/drivers/net/ngbe/base/ngbe_osdep.h
@@ -19,7 +19,7 @@
 #include <rte_config.h>
 #include <rte_io.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../ngbe_logs.h"
 
diff --git a/drivers/net/ngbe/ngbe_pf.c b/drivers/net/ngbe/ngbe_pf.c
index 12a18de31d..947ae7fe94 100644
--- a/drivers/net/ngbe/ngbe_pf.c
+++ b/drivers/net/ngbe/ngbe_pf.c
@@ -6,7 +6,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/ngbe.h"
 #include "ngbe_ethdev.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c
index 0ddff54886..6a48a22de6 100644
--- a/drivers/net/octeontx/base/octeontx_pkivf.c
+++ b/drivers/net/octeontx/base/octeontx_pkivf.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../octeontx_logs.h"
 #include "octeontx_io.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c
index bf28bc7992..5d445dfb49 100644
--- a/drivers/net/octeontx/base/octeontx_pkovf.c
+++ b/drivers/net/octeontx/base/octeontx_pkovf.c
@@ -10,7 +10,7 @@
 #include <rte_cycles.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 
 #include "../octeontx_logs.h"
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 9ea579bfc8..67e7f759fe 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -20,7 +20,7 @@
 #include <rte_ether.h>
 #include <rte_io.h>
 #include <rte_version.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 /* Forward declaration */
 struct ecore_dev;
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index a0979618be..0a1e224fa2 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -13,7 +13,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 39f85e8b84..506c62a726 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_ether.h>
diff --git a/drivers/net/sfc/sfc_sriov.c b/drivers/net/sfc/sfc_sriov.c
index 385b172e2e..009b884d8d 100644
--- a/drivers/net/sfc/sfc_sriov.c
+++ b/drivers/net/sfc/sfc_sriov.c
@@ -8,7 +8,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc.h"
 #include "sfc_log.h"
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 262c024560..28183ec740 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -32,7 +32,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index 262dbb5e38..6fb22ca7d9 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_ethdev_core.h>
 #include <rte_hash.h>
 #include <rte_hash_crc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index d0093c0163..f19bdf36dc 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -4,7 +4,7 @@
  */
 
 #include <sys/queue.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c
index 0b82fb1a88..176f79005c 100644
--- a/drivers/net/txgbe/txgbe_pf.c
+++ b/drivers/net/txgbe/txgbe_pf.c
@@ -20,7 +20,7 @@
 #include <rte_memcpy.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/txgbe.h"
 #include "txgbe_ethdev.h"
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 11e25a0142..6d4a8712c2 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 
 #include "virtio.h"
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 1f6bdeddda..2b9e35cef5 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 
 #include <rte_memory.h>
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 2af67dc0a3..101b1cb500 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index 349d551839..db029cbf34 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_eal.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
index 26def43564..2d8466ef91 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
index bbe7f74def..b424d6127d 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index eca1edc270..859f28dcc1 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index da0aba6e00..c7c5cda48c 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 3c41aa9ee8..a1db533eeb 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -17,7 +17,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index b7438bd372..67b3941265 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index bd9966a6c3..d6106dd5da 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -16,7 +16,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 #include <rte_alarm.h>
 #include <rte_interrupts.h>
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 1ca248123b..a47d5a0350 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 #include "rte_pmd_ifpga.h"
diff --git a/drivers/raw/ioat/idxd_pci.c b/drivers/raw/ioat/idxd_pci.c
index 13515dbc6c..90ec0222e6 100644
--- a/drivers/raw/ioat/idxd_pci.c
+++ b/drivers/raw/ioat/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_devargs.h>
 
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 11341fcf5d..f58006bbda 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index f5e773c53b..76e98fe515 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_mbuf.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_memcpy.h>
 #include <rte_rawdev.h>
diff --git a/drivers/raw/ntb/ntb_hw_intel.c b/drivers/raw/ntb/ntb_hw_intel.c
index 20cdb761a3..9b4465176a 100644
--- a/drivers/raw/ntb/ntb_hw_intel.c
+++ b/drivers/raw/ntb/ntb_hw_intel.c
@@ -8,7 +8,7 @@
 #include <rte_io.h>
 #include <rte_eal.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index 9f79c6907c..4c20daac94 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -9,7 +9,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_common_mr.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c
index 9a2db7e43f..0a8c83fe14 100644
--- a/drivers/regex/mlx5/mlx5_regex_fastpath.c
+++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c
@@ -10,7 +10,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_regexdev_driver.h>
 #include <rte_mbuf.h>
diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h
index 3d567695cc..6444d7f72c 100644
--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h
+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h
@@ -10,7 +10,7 @@
 
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_io.h>
 
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index ac42de9c79..d5ac583589 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -14,7 +14,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_vhost.h>
 #include <rte_vdpa.h>
 #include <vdpa_driver.h>
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index 91af792a3a..026daa3f24 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/vdpa/sfc/sfc_vdpa.h b/drivers/vdpa/sfc/sfc_vdpa.h
index daeb27d4cd..b25eb3a5fe 100644
--- a/drivers/vdpa/sfc/sfc_vdpa.h
+++ b/drivers/vdpa/sfc/sfc_vdpa.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc_efx.h"
 #include "sfc_efx_mcdi.h"
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index b4bb460dcb..b3ac509f36 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -13,7 +13,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_config.h>
 #include <ethdev_driver.h>
 
diff --git a/lib/eventdev/eventdev_pmd_pci.h b/lib/eventdev/eventdev_pmd_pci.h
index 24b56faaa9..7bbec40c71 100644
--- a/lib/eventdev/eventdev_pmd_pci.h
+++ b/lib/eventdev/eventdev_pmd_pci.h
@@ -23,7 +23,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 17/26] bus/vdev: make driver-only headers private
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (15 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 16/26] bus/pci: " David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-29  2:38     ` Xu, Rosen
  2022-07-28 15:26   ` [RFC v3 18/26] bus/vmbus: " David Marchand
                     ` (9 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Gagandeep Singh, Hemant Agrawal, Nicolas Chautru, Ray Kinsella,
	Lee Daly, Fan Zhang, Ashish Gupta, Sunila Sahu, Ruifeng Wang,
	Ajit Khaparde, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Pablo de Lara, Michael Shamis, Liron Himi,
	Chengwen Feng, Kevin Laatz, Bruce Richardson, Sachin Saxena,
	Jerin Jacob, Liang Ma, Peter Mccarthy, Harry van Haaren,
	John W. Linville, Ciara Loftus, Qi Zhang, Chas Williams,
	Min Hu (Connor),
	Gaetan Rivet, Rosen Xu, Jakub Grajciar, Zyta Szpak,
	Tetsuya Mukawa, Harman Kalra, Jasvinder Singh,
	Cristian Dumitrescu, Matan Azrad, Maxime Coquelin, Chenbo Xia,
	Jakub Palider, Tomasz Duszynski, Tianfei zhang, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko

The vdev 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 <david.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 app/test/test_vdev.c                          |   2 +-
 doc/guides/rel_notes/release_22_11.rst        |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++++++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 ----------------
 drivers/bus/vdev/vdev.c                       |   8 +-
 drivers/bus/vdev/vdev_params.c                |   1 -
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_evdev.c          |   2 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   2 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   2 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   2 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   2 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |   2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   2 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 63 files changed, 221 insertions(+), 200 deletions(-)
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 5eeff3106d..3cc3abe70b 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_bus.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "test.h"
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 79ec128533..f726a901e6 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,8 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
-* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``
-  buses has been marked as an internal API.
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
+  ``vdev`` 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).
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 4d1bd16751..f0927d9fca 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -10,7 +10,7 @@
 #include <dirent.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 248e12987f..e76ef2313f 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index af7bc416f9..e8d0c43e6f 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
new file mode 100644
index 0000000000..36748cdfae
--- /dev/null
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -0,0 +1,151 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ */
+
+#ifndef BUS_VDEV_DRIVER_H
+#define BUS_VDEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vdev.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
+	struct rte_device device;               /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+	container_of(ptr, struct rte_vdev_device, device)
+
+#define RTE_DEV_TO_VDEV_CONST(ptr) \
+	container_of(ptr, const struct rte_vdev_device, device)
+
+#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.name)
+		return dev->device.name;
+	return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.devargs)
+		return dev->device.devargs->args;
+	return "";
+}
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+	struct rte_driver driver;        /**< Inherited general driver. */
+	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
+	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
+	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
+	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
+	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
+};
+
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+static const char *vdrvinit_ ## nm ## _alias;\
+RTE_INIT(vdrvinitfn_ ##vdrv)\
+{\
+	(vdrv).driver.name = RTE_STR(nm);\
+	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+	rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VDEV_DRIVER_H */
diff --git a/drivers/bus/vdev/meson.build b/drivers/bus/vdev/meson.build
index 8adf674530..1532ed4f35 100644
--- a/drivers/bus/vdev/meson.build
+++ b/drivers/bus/vdev/meson.build
@@ -6,5 +6,6 @@ sources = files(
         'vdev_params.c',
 )
 headers = files('rte_bus_vdev.h')
+driver_sdk_headers = files('bus_vdev_driver.h')
 
 deps += ['kvargs']
diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
index 5af6be009f..f48dd24e5e 100644
--- a/drivers/bus/vdev/rte_bus_vdev.h
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -15,140 +15,6 @@
 extern "C" {
 #endif
 
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
-	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
-	struct rte_device device;               /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
-	container_of(ptr, struct rte_vdev_device, device)
-
-#define RTE_DEV_TO_VDEV_CONST(ptr) \
-	container_of(ptr, const struct rte_vdev_device, device)
-
-#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.name)
-		return dev->device.name;
-	return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.devargs)
-		return dev->device.devargs->args;
-	return "";
-}
-
-/** Double linked list of virtual device drivers. */
-RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
-	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
-	struct rte_driver driver;        /**< Inherited general driver. */
-	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
-	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
-	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
-	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
-	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
-};
-
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-static const char *vdrvinit_ ## nm ## _alias;\
-RTE_INIT(vdrvinitfn_ ##vdrv)\
-{\
-	(vdrv).driver.name = RTE_STR(nm);\
-	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
-	rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
 typedef void (*rte_vdev_scan_callback)(void *user_arg);
 
 /**
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index a8d8b2327e..7d78cf93bc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -21,7 +21,7 @@
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 
-#include "rte_bus_vdev.h"
+#include "bus_vdev_driver.h"
 #include "vdev_logs.h"
 #include "vdev_private.h"
 
@@ -30,16 +30,14 @@
 /* Forward declare to access virtual bus name */
 static struct rte_bus rte_vdev_bus;
 
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
 
-static struct vdev_device_list vdev_device_list =
+static TAILQ_HEAD(, rte_vdev_device) vdev_device_list =
 	TAILQ_HEAD_INITIALIZER(vdev_device_list);
 /* The lock needs to be recursive because a vdev can manage another vdev. */
 static rte_spinlock_recursive_t vdev_device_list_lock =
 	RTE_SPINLOCK_RECURSIVE_INITIALIZER;
 
-static struct vdev_driver_list vdev_driver_list =
+static TAILQ_HEAD(, rte_vdev_driver) vdev_driver_list =
 	TAILQ_HEAD_INITIALIZER(vdev_driver_list);
 
 struct vdev_custom_scan {
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 3969faf16d..2c72614776 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -5,7 +5,6 @@
 #include <string.h>
 
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vdev/version.map b/drivers/bus/vdev/version.map
index 7cc3098a50..594c48c3db 100644
--- a/drivers/bus/vdev/version.map
+++ b/drivers/bus/vdev/version.map
@@ -3,10 +3,15 @@ DPDK_23 {
 
 	rte_vdev_add_custom_scan;
 	rte_vdev_init;
-	rte_vdev_register;
 	rte_vdev_remove_custom_scan;
 	rte_vdev_uninit;
-	rte_vdev_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vdev_register;
+	rte_vdev_unregister;
+};
diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index b7ba61c434..cb23e929ed 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -3,7 +3,7 @@
  */
 #include <isa-l.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_malloc.h>
diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zlib_pmd.c
index 0220c6d038..98abd41013 100644
--- a/drivers/compress/zlib/zlib_pmd.c
+++ b/drivers/compress/zlib/zlib_pmd.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium Networks
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 
 #include "zlib_pmd_private.h"
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 32127a874c..5c060e71a3 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -8,7 +8,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_device.h b/drivers/crypto/bcmfs/bcmfs_device.h
index 4901a6cfd9..610454dd5e 100644
--- a/drivers/crypto/bcmfs/bcmfs_device.h
+++ b/drivers/crypto/bcmfs/bcmfs_device.h
@@ -9,7 +9,7 @@
 #include <sys/queue.h>
 
 #include <rte_spinlock.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "bcmfs_logs.h"
 #include "bcmfs_qp.h"
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8e9cfe73d8..8c0b4909cf 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -12,7 +12,7 @@
 #include <cryptodev_pmd.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_security_driver.h>
 #include <rte_hexdump.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 4957f11e97..6c3e45e333 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_string_fns.h>
 #include <bus_pci_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.c b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
index aab42c360c..2e7347fa79 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index e2c240dfc0..d0d4258ee1 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -7,7 +7,7 @@
 
 #include <intel-ipsec-mb.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #if defined(RTE_LIB_SECURITY)
 #define IPSEC_MB_DOCSIS_SEC_ENABLED 1
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index c9d4f9d0ae..fba10b8cf4 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2016-2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 04efd9aaa8..c35876c8b4 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_security_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 9ecb434fd0..eab74ad45f 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 
 #include "null_crypto_pmd_private.h"
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index e01dacc98d..ed6d215f1b 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index dd198080bf..a15c02b4d8 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 82b4661323..09068a9521 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -4,7 +4,7 @@
 
 #include <inttypes.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 5de3e9e5f5..08df6e223a 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -23,7 +23,7 @@
 #include <rte_memcpy.h>
 #include <rte_memory.h>
 #include <rte_pci.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
index 941fb8fc43..427aff4b11 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index 9e14e35d10..fe157c59d5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -16,7 +16,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "ssovf_evdev.h"
 #include "timvf_evdev.h"
diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c
index b55523632a..3dbf31efa9 100644
--- a/drivers/event/octeontx/ssovf_evdev_selftest.c
+++ b/drivers/event/octeontx/ssovf_evdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 #include "ssovf_evdev.h"
diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c
index 8b6890b220..368e5a9657 100644
--- a/drivers/event/opdl/opdl_evdev.c
+++ b/drivers/event/opdl/opdl_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memzone.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/opdl/opdl_evdev_init.c b/drivers/event/opdl/opdl_evdev_init.c
index 15aae47524..be3437fc2f 100644
--- a/drivers/event/opdl/opdl_evdev_init.c
+++ b/drivers/event/opdl/opdl_evdev_init.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_errno.h>
 #include <rte_cycles.h>
 #include <rte_memzone.h>
diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 24b92df476..50c12a18b0 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -19,7 +19,7 @@
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
 #include <rte_eventdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_pause.h>
 
 #include "opdl_evdev.h"
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index bf3b01ebc8..6bd8fec6d4 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "skeleton_eventdev.h"
 
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index f93313b31b..22cba1e74b 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_ring.h>
 #include <rte_errno.h>
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index cb97a4d615..59bcdf5734 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -21,7 +21,7 @@
 #include <rte_pause.h>
 #include <rte_service.h>
 #include <rte_service_component.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "sw_evdev.h"
 
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 1396f32c3d..e2771e6765 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -12,7 +12,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <errno.h>
 #include <linux/if_ether.h>
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fce649c2a1..fd7be47311 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -20,7 +20,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 4ac191c468..b44dd219cb 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_tcp.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 73e6972035..cd80a0af46 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -15,7 +15,7 @@
 #include <rte_ip_frag.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 05cf533896..5d4d52c341 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,8 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <rte_bus.h>
+#include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
 
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index dbf57f9ba8..4b93d2649e 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -19,7 +19,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index 0532de5315..c0e1f8db40 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -12,7 +12,7 @@
 #include <rte_kni.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 /* Only single queue supported */
 #define KNI_MAX_QUEUE_PER_PORT 1
diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 7886644412..4700ce2e77 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -17,7 +17,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index dd951b8296..a574bce49e 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -21,7 +21,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index eef016aa0b..6a0dd6091d 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_string_fns.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <stdio.h>
 #include <fcntl.h>
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 735efb6cfc..310e3e5acf 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -9,7 +9,7 @@
 #include <rte_kvargs.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <fcntl.h>
 #include <linux/ethtool.h>
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index bb89c1abc4..a517376d40 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -8,7 +8,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3aca53fb98..9ada22e2ff 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -12,7 +12,7 @@
 #include <eventdev_pmd.h>
 #include <rte_alarm.h>
 #include <rte_branch_prediction.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
 #include <rte_dev.h>
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index ec29fd6bc5..7fb4abb20b 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_os_shim.h>
 
 #include "pcap_osdep.h"
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index c2991ab1cc..0352a57950 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/epoll.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_ether.h>
 #include <dpaa_of.h>
 
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cfb81da5fe..37e7ccfda0 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 8c098cad5b..fa89940735 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -9,7 +9,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 #include <rte_ring.h>
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 9e1032fe72..d047489e94 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -10,7 +10,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_net.h>
 #include <rte_debug.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 2587195168..65043a04eb 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -25,7 +25,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bus.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7e512d94bf..6c81967c6f 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_net.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_vhost.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index a7d7063c2a..3edfd7439e 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 
diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c
index d759ed82d4..e2907c18b5 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.c
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/stat.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_lcore.h>
diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index c7bddbc6cc..aeee4ac289 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -6,7 +6,7 @@
 #include <errno.h>
 #include <stdint.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_atomic.h>
 #include <rte_interrupts.h>
 #include <rte_branch_prediction.h>
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index d6106dd5da..07e2252a07 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -26,7 +26,7 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_pmd_i40e.h>
 
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 16ecae3d92..19b523a815 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index 693b24c415..fc257c5f44 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -8,7 +8,7 @@
 #include <rte_memcpy.h>
 #include <rte_dev.h>
 #include <rte_rawdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 /* Using relative path as skeleton_rawdev is not part of exported headers */
diff --git a/lib/ethdev/ethdev_vdev.h b/lib/ethdev/ethdev_vdev.h
index f5f536ce64..364f140f91 100644
--- a/lib/ethdev/ethdev_vdev.h
+++ b/lib/ethdev/ethdev_vdev.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_config.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd_vdev.h b/lib/eventdev/eventdev_pmd_vdev.h
index 77904910a2..cf2333cf41 100644
--- a/lib/eventdev/eventdev_pmd_vdev.h
+++ b/lib/eventdev/eventdev_pmd_vdev.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_config.h>
 #include <rte_debug.h>
 #include <rte_eal.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 18/26] bus/vmbus: make driver-only headers private
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (16 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 17/26] bus/vdev: " David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 15:26   ` [RFC v3 19/26] bus: move IOVA definition from header David Marchand
                     ` (8 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Long Li, Ray Kinsella

The vmbus 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 <david.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst |   2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h   | 106 +++++++++++++++++++++++++
 drivers/bus/vmbus/linux/vmbus_uio.c    |   1 -
 drivers/bus/vmbus/meson.build          |   1 +
 drivers/bus/vmbus/private.h            |  20 ++++-
 drivers/bus/vmbus/rte_bus_vmbus.h      | 104 ------------------------
 drivers/bus/vmbus/version.map          |   9 ++-
 drivers/bus/vmbus/vmbus_bufring.c      |   1 -
 drivers/bus/vmbus/vmbus_channel.c      |   1 -
 drivers/bus/vmbus/vmbus_common.c       |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c   |   1 -
 drivers/net/netvsc/hn_ethdev.c         |   3 +-
 drivers/net/netvsc/hn_nvs.c            |   2 +-
 drivers/net/netvsc/hn_rndis.c          |   2 +-
 drivers/net/netvsc/hn_rxtx.c           |   2 +-
 drivers/net/netvsc/hn_vf.c             |   2 +-
 16 files changed, 140 insertions(+), 120 deletions(-)
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index f726a901e6..c55ee19bc2 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -85,7 +85,7 @@ API Changes
    =======================================================
 
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
-  ``vdev`` buses has been marked as an internal API.
+  ``vdev``, ``vmbus`` 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).
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
new file mode 100644
index 0000000000..3424e791c9
--- /dev/null
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018, Microsoft Corporation.
+ * All Rights Reserved.
+ */
+
+#ifndef BUS_VMBUS_DRIVER_H
+#define BUS_VMBUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vmbus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+
+struct vmbus_channel;
+struct vmbus_mon_page;
+
+/** Maximum number of VMBUS resources. */
+enum hv_uio_map {
+	HV_TXRX_RING_MAP = 0,
+	HV_INT_PAGE_MAP,
+	HV_MON_PAGE_MAP,
+	HV_RECV_BUF_MAP,
+	HV_SEND_BUF_MAP
+};
+#define VMBUS_MAX_RESOURCE 5
+
+/**
+ * A structure describing a VMBUS device.
+ */
+struct rte_vmbus_device {
+	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
+	const struct rte_vmbus_driver *driver; /**< Associated driver */
+	struct rte_device device;              /**< Inherit core device */
+	rte_uuid_t device_id;		       /**< VMBUS device id */
+	rte_uuid_t class_id;		       /**< VMBUS device type */
+	uint32_t relid;			       /**< id for primary */
+	uint8_t monitor_id;		       /**< monitor page */
+	int uio_num;			       /**< UIO device number */
+	uint32_t *int_page;		       /**< VMBUS interrupt page */
+	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
+	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
+
+	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
+	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
+};
+
+/**
+ * Initialization function for the driver called during VMBUS probing.
+ */
+typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
+			    struct rte_vmbus_device *);
+
+/**
+ * Initialization function for the driver called during hot plugging.
+ */
+typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
+
+/**
+ * A structure describing a VMBUS driver.
+ */
+struct rte_vmbus_driver {
+	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
+	struct rte_driver driver;
+	vmbus_probe_t *probe;               /**< Device Probe function. */
+	vmbus_remove_t *remove;             /**< Device Remove function. */
+
+	const rte_uuid_t *id_table;	    /**< ID table. */
+};
+
+/**
+ * Register a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vmbus_register(struct rte_vmbus_driver *driver);
+
+/**
+ * Unregister a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
+
+/** Helper for VMBUS device registration from driver instance */
+#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
+	RTE_INIT(vmbusinitfn_ ##nm)			\
+	{						\
+		(vmbus_drv).driver.name = RTE_STR(nm);	\
+		rte_vmbus_register(&vmbus_drv);		\
+	}						\
+	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VMBUS_DRIVER_H */
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5db70f8e0d..26edef342d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -13,7 +13,6 @@
 
 #include <rte_eal.h>
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_memory.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
diff --git a/drivers/bus/vmbus/meson.build b/drivers/bus/vmbus/meson.build
index 3892cbf67f..34988d1d84 100644
--- a/drivers/bus/vmbus/meson.build
+++ b/drivers/bus/vmbus/meson.build
@@ -8,6 +8,7 @@ endif
 
 
 headers = files('rte_bus_vmbus.h','rte_vmbus_reg.h')
+driver_sdk_headers = files('bus_vmbus_driver.h')
 
 sources = files(
         'vmbus_bufring.c',
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 658303bc27..3d233fa83c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -8,13 +8,31 @@
 
 #include <stdbool.h>
 #include <sys/uio.h>
+
+#include <rte_bus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
-#include <rte_bus_vmbus.h>
+
+/**
+ * Structure describing the VM bus
+ */
+struct rte_vmbus_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_vmbus_device) device_list; /**< List of devices */
+	RTE_TAILQ_HEAD(, rte_vmbus_driver) driver_list; /**< List of drivers */
+};
 
 extern struct rte_vmbus_bus rte_vmbus_bus;
 
+/* VMBus iterators */
+#define FOREACH_DEVICE_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
+
 extern int vmbus_logtype_bus;
 #define VMBUS_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index a24bad831d..03894a5d46 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -27,89 +27,12 @@ extern "C" {
 #include <rte_uuid.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
 #include <rte_vmbus_reg.h>
 
 /* Forward declarations */
 struct rte_vmbus_device;
 struct rte_vmbus_driver;
-struct rte_vmbus_bus;
 struct vmbus_channel;
-struct vmbus_mon_page;
-
-RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
-RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
-
-/* VMBus iterators */
-#define FOREACH_DEVICE_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
-
-/** Maximum number of VMBUS resources. */
-enum hv_uio_map {
-	HV_TXRX_RING_MAP = 0,
-	HV_INT_PAGE_MAP,
-	HV_MON_PAGE_MAP,
-	HV_RECV_BUF_MAP,
-	HV_SEND_BUF_MAP
-};
-#define VMBUS_MAX_RESOURCE 5
-
-/**
- * A structure describing a VMBUS device.
- */
-struct rte_vmbus_device {
-	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
-	const struct rte_vmbus_driver *driver; /**< Associated driver */
-	struct rte_device device;              /**< Inherit core device */
-	rte_uuid_t device_id;		       /**< VMBUS device id */
-	rte_uuid_t class_id;		       /**< VMBUS device type */
-	uint32_t relid;			       /**< id for primary */
-	uint8_t monitor_id;		       /**< monitor page */
-	int uio_num;			       /**< UIO device number */
-	uint32_t *int_page;		       /**< VMBUS interrupt page */
-	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
-	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
-
-	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
-	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
-};
-
-/**
- * Initialization function for the driver called during VMBUS probing.
- */
-typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
-			    struct rte_vmbus_device *);
-
-/**
- * Initialization function for the driver called during hot plugging.
- */
-typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
-
-/**
- * A structure describing a VMBUS driver.
- */
-struct rte_vmbus_driver {
-	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
-	struct rte_driver driver;
-	struct rte_vmbus_bus *bus;          /**< VM bus reference. */
-	vmbus_probe_t *probe;               /**< Device Probe function. */
-	vmbus_remove_t *remove;             /**< Device Remove function. */
-
-	const rte_uuid_t *id_table;	    /**< ID table. */
-};
-
-
-/**
- * Structure describing the VM bus
- */
-struct rte_vmbus_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_vmbus_device_list device_list;  /**< List of devices */
-	struct rte_vmbus_driver_list driver_list;  /**< List of drivers */
-};
 
 /**
  * Scan the content of the VMBUS bus, and the devices in the devices
@@ -378,15 +301,6 @@ void rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
 			   const struct vmbus_channel *chan,
 			   uint32_t latency);
 
-/**
- * Register a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be registered.
- */
-void rte_vmbus_register(struct rte_vmbus_driver *driver);
-
 /**
  * For debug dump contents of ring buffer.
  *
@@ -395,24 +309,6 @@ void rte_vmbus_register(struct rte_vmbus_driver *driver);
  */
 void rte_vmbus_chan_dump(FILE *f, const struct vmbus_channel *chan);
 
-/**
- * Unregister a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
-
-/** Helper for VMBUS device registration from driver instance */
-#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
-	RTE_INIT(vmbusinitfn_ ##nm)			\
-	{						\
-		(vmbus_drv).driver.name = RTE_STR(nm);	\
-		rte_vmbus_register(&vmbus_drv);		\
-	}						\
-	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/drivers/bus/vmbus/version.map b/drivers/bus/vmbus/version.map
index 84db31b6e9..430781b29b 100644
--- a/drivers/bus/vmbus/version.map
+++ b/drivers/bus/vmbus/version.map
@@ -16,13 +16,18 @@ DPDK_23 {
 	rte_vmbus_map_device;
 	rte_vmbus_max_channels;
 	rte_vmbus_probe;
-	rte_vmbus_register;
 	rte_vmbus_scan;
 	rte_vmbus_set_latency;
 	rte_vmbus_sub_channel_index;
 	rte_vmbus_subchan_open;
 	rte_vmbus_unmap_device;
-	rte_vmbus_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vmbus_register;
+	rte_vmbus_unregister;
+};
diff --git a/drivers/bus/vmbus/vmbus_bufring.c b/drivers/bus/vmbus/vmbus_bufring.c
index c4aa07b307..c78619dc44 100644
--- a/drivers/bus/vmbus/vmbus_bufring.c
+++ b/drivers/bus/vmbus/vmbus_bufring.c
@@ -15,7 +15,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_pause.h>
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 9bd01679c3..5549fd0944 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -12,7 +12,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..03b39c82b7 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -11,7 +11,6 @@
 #include <sys/mman.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
@@ -235,7 +234,6 @@ rte_vmbus_register(struct rte_vmbus_driver *driver)
 		"Registered driver %s", driver->driver.name);
 
 	TAILQ_INSERT_TAIL(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = &rte_vmbus_bus;
 }
 
 /* unregister vmbus driver */
@@ -243,7 +241,6 @@ void
 rte_vmbus_unregister(struct rte_vmbus_driver *driver)
 {
 	TAILQ_REMOVE(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to VMBUS bus */
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 882a24f869..4d4613513c 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -13,7 +13,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_bus_vmbus.h>
 
 #include "private.h"
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 787139c0b2..188d92ffac 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,8 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <rte_bus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index b90280c9ff..817fb06dfb 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -29,7 +29,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 1b63b27e0c..20f75a17b0 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -27,7 +27,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 909c07a4ab..61cf374224 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -27,7 +27,7 @@
 #include <rte_eal.h>
 #include <rte_dev.h>
 #include <rte_net.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index cce0a79edb..40981706d5 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_log.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 19/26] bus: move IOVA definition from header
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (17 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 18/26] bus/vmbus: " David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:48     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 20/26] bus: introduce accessors David Marchand
                     ` (7 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Aman Singh, Yuying Zhang, Sunila Sahu, Fan Zhang, Ashish Gupta,
	Gaetan Rivet, Anatoly Burakov, Akhil Goyal, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Reshma Pattan,
	Stephen Hemminger

iova enum definition does not need to be defined as part of the bus API.
Move it to rte_eal.h.
With this step, rte_eal.h does not depend on rte_bus.h and rte_dev.h.
Fix existing code that was relying on these implicit inclusions.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-compress-perf/comp_perf_options.h   |  2 ++
 app/test-pmd/config.c                        |  1 +
 app/test-pmd/testpmd.c                       |  1 +
 drivers/compress/zlib/zlib_pmd_ops.c         |  1 +
 drivers/net/failsafe/failsafe_eal.c          |  1 +
 examples/multi_process/hotplug_mp/commands.c |  2 ++
 lib/compressdev/rte_compressdev.c            |  1 +
 lib/compressdev/rte_compressdev_pmd.c        |  1 +
 lib/cryptodev/cryptodev_pmd.c                |  2 ++
 lib/eal/common/eal_thread.h                  |  1 +
 lib/eal/common/hotplug_mp.c                  |  1 +
 lib/eal/include/rte_bus.h                    | 18 ++----------------
 lib/eal/include/rte_eal.h                    | 15 ++++++++++++++-
 lib/eal/include/rte_lcore.h                  |  2 ++
 lib/eal/windows/eal.c                        |  1 +
 lib/ethdev/rte_ethdev.c                      |  1 +
 lib/pcapng/rte_pcapng.c                      |  1 +
 17 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0b777521c5..57dd146330 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -5,6 +5,8 @@
 #ifndef _COMP_PERF_OPS_
 #define _COMP_PERF_OPS_
 
+#include <rte_dev.h>
+
 #define MAX_LIST		32
 #define MIN_COMPRESSED_BUF_SIZE 8
 #define EXPANSE_RATIO 1.1
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index bc73819183..d988429f24 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -24,6 +24,7 @@
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
 #include <rte_launch.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index ee686393c5..510e0be624 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -32,6 +32,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_launch.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_alarm.h>
 #include <rte_per_lcore.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 0a73aed949..7d657d81bc 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_dev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index cb4a2abc02..130344dce2 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,6 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
+#include <rte_bus.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index 41ea265e45..da8b5e5924 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -8,6 +8,8 @@
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
 #include <cmdline.h>
+
+#include <rte_bus.h>
 #include <rte_ethdev.h>
 
 /**********************************************************/
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 12469042f7..7f6dedbc52 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -9,6 +9,7 @@
 #include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 7f500d76d4..9bfae077db 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,6 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 1903ade388..75d0075b86 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -3,6 +3,8 @@
  */
 
 #include <sys/queue.h>
+
+#include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/eal/common/eal_thread.h b/lib/eal/common/eal_thread.h
index ca3378d463..e0240ccc60 100644
--- a/lib/eal/common/eal_thread.h
+++ b/lib/eal/common/eal_thread.h
@@ -5,6 +5,7 @@
 #ifndef EAL_THREAD_H
 #define EAL_THREAD_H
 
+#include <rte_common.h>
 #include <rte_lcore.h>
 
 /**
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index bde0de196e..1614a57752 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,6 +3,7 @@
  */
 #include <string.h>
 
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index bbbb6efd28..17edaa37c9 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,27 +20,13 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_log.h>
 #include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_log.h>
 
 /** Double linked list of buses */
 RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
 
-
-/**
- * IOVA mapping mode.
- *
- * IOVA mapping mode is iommu programming mode of a device.
- * That device (for example: IOMMU backed DMA device) based
- * on rte_iova_mode will generate physical or virtual address.
- *
- */
-enum rte_iova_mode {
-	RTE_IOVA_DC = 0,	/* Don't care mode */
-	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
-	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
-};
-
 /**
  * Bus specific scan for devices attached on the bus.
  * For each bus object, the scan would be responsible for finding devices and
diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h
index 5dfc50e987..fd3d7c1da8 100644
--- a/lib/eal/include/rte_eal.h
+++ b/lib/eal/include/rte_eal.h
@@ -17,7 +17,6 @@
 #include <rte_config.h>
 #include <rte_compat.h>
 #include <rte_per_lcore.h>
-#include <rte_bus.h>
 #include <rte_uuid.h>
 
 #include <rte_pci_dev_feature_defs.h>
@@ -458,6 +457,20 @@ static inline int rte_gettid(void)
 __rte_internal
 uint64_t rte_eal_get_baseaddr(void);
 
+/**
+ * IOVA mapping mode.
+ *
+ * IOVA mapping mode is iommu programming mode of a device.
+ * That device (for example: IOMMU backed DMA device) based
+ * on rte_iova_mode will generate physical or virtual address.
+ *
+ */
+enum rte_iova_mode {
+	RTE_IOVA_DC = 0,	/* Don't care mode */
+	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
+	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
+};
+
 /**
  * Get the iova mode
  *
diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h
index b598e1b9ec..4d3978512c 100644
--- a/lib/eal/include/rte_lcore.h
+++ b/lib/eal/include/rte_lcore.h
@@ -11,6 +11,8 @@
  * API for lcore and socket manipulation
  *
  */
+#include <stdio.h>
+
 #include <rte_config.h>
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index 122de2a319..79322d2ce9 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 
 #include <rte_debug.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <eal_memcfg.h>
 #include <rte_errno.h>
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0850..ebbe8cca3d 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
+#include <rte_bus.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 06ad712bd1..5b079cd14a 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,6 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <rte_bus.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 20/26] bus: introduce accessors
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (18 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 19/26] bus: move IOVA definition from header David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:51     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 21/26] bus: hide bus object David Marchand
                     ` (6 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Aman Singh, Yuying Zhang, Anatoly Burakov, Ray Kinsella

Add helpers to get a rte_bus object details.
This will be used externally.
Internal users may still dereference a rte_bus object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v1:
- changed approach: only external users are updated,

---
 app/test-pmd/config.c                        |  4 +--
 app/test-pmd/testpmd.c                       |  4 +--
 app/test/test_devargs.c                      |  4 +--
 examples/multi_process/hotplug_mp/commands.c |  4 +--
 lib/eal/common/eal_common_bus.c              | 26 ++++++++++++--------
 lib/eal/include/rte_bus.h                    | 14 +++++++++++
 lib/eal/version.map                          |  3 +++
 7 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d988429f24..7bd28ee3e8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -642,7 +642,7 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
+		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
 			if (!dev->driver)
@@ -653,7 +653,7 @@ device_infos_display(const char *identifier)
 				continue;
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
-			printf("Bus name: %s", dev->bus->name);
+			printf("Bus name: %s", rte_bus_name(dev->bus));
 			printf("\nDriver name: %s", dev->driver->name);
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 510e0be624..c7d1fa2719 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3507,9 +3507,9 @@ detach_devargs(char *identifier)
 		}
 	}
 
-	if (rte_eal_hotplug_remove(da.bus->name, da.name) != 0) {
+	if (rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name) != 0) {
 		TESTPMD_LOG(ERR, "Failed to detach device %s(%s)\n",
-			    da.name, da.bus->name);
+			    da.name, rte_bus_name(da.bus));
 		rte_devargs_reset(&da);
 		return;
 	}
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 16621285d2..ac5bc34c18 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -98,9 +98,9 @@ test_valid_devargs_cases(const struct devargs_case *list, size_t n)
 			      list[i].bus_kv) != 0)
 			goto fail;
 		if (list[i].bus != NULL &&
-		    strcmp(da.bus->name, list[i].bus) != 0) {
+		    strcmp(rte_bus_name(da.bus), list[i].bus) != 0) {
 			printf("rte_devargs_parse(%s) bus name (%s) not expected (%s)\n",
-			       list[i].devargs, da.bus->name, list[i].bus);
+			       list[i].devargs, rte_bus_name(da.bus), list[i].bus);
 			goto fail;
 		}
 		if ((list[i].class_kv > 0 || list[i].class != NULL) &&
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index da8b5e5924..88f44e00a0 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -126,7 +126,7 @@ static void cmd_dev_attach_parsed(void *parsed_result,
 		return;
 	}
 
-	if (!rte_eal_hotplug_add(da.bus->name, da.name, da.args))
+	if (!rte_eal_hotplug_add(rte_bus_name(da.bus), da.name, da.args))
 		cmdline_printf(cl, "attached device %s\n", da.name);
 	else
 		cmdline_printf(cl, "failed to attached device %s\n",
@@ -173,7 +173,7 @@ static void cmd_dev_detach_parsed(void *parsed_result,
 	}
 
 	printf("detaching...\n");
-	if (!rte_eal_hotplug_remove(da.bus->name, da.name))
+	if (!rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name))
 		cmdline_printf(cl, "detached device %s\n",
 			da.name);
 	else
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index baa5b532af..cbf382f967 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -16,11 +16,17 @@
 static struct rte_bus_list rte_bus_list =
 	TAILQ_HEAD_INITIALIZER(rte_bus_list);
 
+const char *
+rte_bus_name(const struct rte_bus *bus)
+{
+	return bus->name;
+}
+
 void
 rte_bus_register(struct rte_bus *bus)
 {
 	RTE_VERIFY(bus);
-	RTE_VERIFY(bus->name && strlen(bus->name));
+	RTE_VERIFY(rte_bus_name(bus) && strlen(rte_bus_name(bus)));
 	/* A bus should mandatorily have the scan implemented */
 	RTE_VERIFY(bus->scan);
 	RTE_VERIFY(bus->probe);
@@ -29,14 +35,14 @@ rte_bus_register(struct rte_bus *bus)
 	RTE_VERIFY(!bus->plug || bus->unplug);
 
 	TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", rte_bus_name(bus));
 }
 
 void
 rte_bus_unregister(struct rte_bus *bus)
 {
 	TAILQ_REMOVE(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", rte_bus_name(bus));
 }
 
 /* Scan all the buses for registered devices */
@@ -50,7 +56,7 @@ rte_bus_scan(void)
 		ret = bus->scan();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	return 0;
@@ -64,7 +70,7 @@ rte_bus_probe(void)
 	struct rte_bus *bus, *vbus = NULL;
 
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
-		if (!strcmp(bus->name, "vdev")) {
+		if (!strcmp(rte_bus_name(bus), "vdev")) {
 			vbus = bus;
 			continue;
 		}
@@ -72,14 +78,14 @@ rte_bus_probe(void)
 		ret = bus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				vbus->name);
+				rte_bus_name(vbus));
 	}
 
 	return 0;
@@ -92,7 +98,7 @@ bus_dump_one(FILE *f, struct rte_bus *bus)
 	int ret;
 
 	/* For now, dump only the bus name */
-	ret = fprintf(f, " %s\n", bus->name);
+	ret = fprintf(f, " %s\n", rte_bus_name(bus));
 
 	/* Error in case of inability in writing to stream */
 	if (ret < 0)
@@ -163,7 +169,7 @@ cmp_bus_name(const struct rte_bus *bus, const void *_name)
 {
 	const char *name = _name;
 
-	return strcmp(bus->name, name);
+	return strcmp(rte_bus_name(bus), name);
 }
 
 struct rte_bus *
@@ -213,7 +219,7 @@ rte_bus_get_iommu_class(void)
 
 		bus_iova_mode = bus->get_iommu_class();
 		RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n",
-			bus->name,
+			rte_bus_name(bus),
 			bus_iova_mode == RTE_IOVA_DC ? "DC" :
 			(bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA"));
 		if (bus_iova_mode == RTE_IOVA_PA)
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 17edaa37c9..3848b44db0 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -266,6 +266,20 @@ struct rte_bus {
 
 };
 
+/**
+ * Retrieve a bus name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure.
+ * @return
+ *   A pointer to the bus name string.
+ */
+__rte_experimental
+const char *rte_bus_name(const struct rte_bus *bus);
+
 /**
  * Register a Bus handler.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..aa53064db1 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_bus_name;
 };
 
 INTERNAL {
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 21/26] bus: hide bus object
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (19 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 20/26] bus: introduce accessors David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:56     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 22/26] dev: introduce driver accessors David Marchand
                     ` (5 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Rosen Xu, Anatoly Burakov, Stephen Hemminger,
	Long Li, Matan Azrad, Viacheslav Ovsiienko, Bruce Richardson,
	Kevin Laatz, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_bus objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

Changes since RFC v1:
- update all existing users of the public header to use the internal one,

---
 app/test/test_devargs.c                  |   2 +-
 app/test/test_vdev.c                     |   2 +-
 doc/guides/rel_notes/deprecation.rst     |   6 -
 doc/guides/rel_notes/release_22_11.rst   |   6 +
 drivers/bus/auxiliary/auxiliary_common.c |   2 +-
 drivers/bus/auxiliary/auxiliary_params.c |   2 +-
 drivers/bus/auxiliary/private.h          |   2 +-
 drivers/bus/dpaa/dpaa_bus.c              |   2 +-
 drivers/bus/fslmc/fslmc_bus.c            |   2 +-
 drivers/bus/fslmc/private.h              |   2 +-
 drivers/bus/ifpga/ifpga_bus.c            |   2 +-
 drivers/bus/pci/linux/pci_vfio.c         |   2 +-
 drivers/bus/pci/pci_common.c             |   2 +-
 drivers/bus/pci/pci_params.c             |   2 +-
 drivers/bus/pci/private.h                |   2 +-
 drivers/bus/vdev/vdev.c                  |   2 +-
 drivers/bus/vmbus/private.h              |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c    |   2 +-
 drivers/dma/idxd/idxd_bus.c              |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c  |   2 +-
 drivers/net/failsafe/failsafe.c          |   2 +-
 drivers/net/failsafe/failsafe_eal.c      |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c         |   2 +-
 drivers/net/netvsc/hn_ethdev.c           |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c    |   2 +-
 drivers/net/virtio/virtio_pci.c          |   2 +-
 drivers/raw/ioat/idxd_bus.c              |   2 +-
 lib/eal/common/eal_common_bus.c          |   2 +-
 lib/eal/common/eal_common_dev.c          |   2 +-
 lib/eal/common/eal_common_devargs.c      |   2 +-
 lib/eal/common/hotplug_mp.c              |   2 +-
 lib/eal/include/bus_driver.h             | 296 +++++++++++++++++++++++
 lib/eal/include/meson.build              |   4 +
 lib/eal/include/rte_bus.h                | 278 +--------------------
 lib/eal/linux/eal_dev.c                  |   2 +-
 lib/eal/version.map                      |   8 +-
 lib/ethdev/rte_ethdev.c                  |   2 +-
 lib/pcapng/rte_pcapng.c                  |   2 +-
 38 files changed, 343 insertions(+), 319 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..0a4c34a1ad 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 3cc3abe70b..c3a8ad64bb 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "test.h"
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index dba252067c..3512f01539 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -43,12 +43,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* bus: The ``rte_bus`` object will be made opaque in DPDK 22.11.
-  The goal is to remove it from the public ABI and make this object extendable.
-  As a side effect, registering a bus will be marked as an internal API:
-  external users may still register their bus using a new driver header
-  (see ``enable_driver_sdk`` meson option).
-
 * drivers: As a follow-up of the work on the ``rte_bus`` object,
   the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
   their bus-specific counterparts) will be made opaque in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index c55ee19bc2..46bb35ad09 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,12 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* bus: Registering a bus has been marked as an internal API.
+  External users may still register their bus using the ``bus_driver.h``
+  driver header (see ``enable_driver_sdk`` meson option).
+  The ``rte_bus`` object is now opaque and must be manipulated through added
+  accessors.
+
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 6cf6c170ec..259ff152c4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -12,7 +12,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 0289777922..a889e392c6 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 3f49f62493..3dee13e1d1 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "bus_auxiliary_driver.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 1ac6aa314f..682427ba2c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -29,7 +29,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index b9b0981329..8503004e3d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 60d68155e1..6f14085d98 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef BUS_FSLMC_PRIVATE_H
 #define BUS_FSLMC_PRIVATE_H
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 27e2de7072..bb943b58b5 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index cd0d0b1670..fab3483d9f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_vfio.h>
 #include <rte_eal.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 0d61d49287..c26aacd364 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_lcore.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 61a868707f..39d702a418 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 4e40a2ed85..fddf49251d 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7d78cf93bc..809a8bb08f 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 3d233fa83c..e33424675c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e82cb881bf..73178ce0f3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 1a86eb3c00..6553166f5c 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 5d4d52c341..32811403b4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..d71b512f81 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,7 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index efb262e368..4f0a6f4d55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 188d92ffac..ccc06bdda6 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 65043a04eb..dc90569df1 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..9cf4d760b4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -9,7 +9,7 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "virtio_pci.h"
 #include "virtio_logs.h"
diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 539f51b1b1..f32d811055 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include "ioat_private.h"
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..62a598957c 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..03e6e59baf 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..5202bd5658 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..d2e615a736
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,296 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_devargs;
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+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);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_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 */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 3848b44db0..dfe756fb11 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,284 +20,21 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-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);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_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 */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * Retrieve a bus name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param bus
  *   A pointer to a rte_bus structure.
  * @return
  *   A pointer to the bus name string.
  */
-__rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -387,17 +124,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..098a2c3076 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -13,7 +13,7 @@
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index aa53064db1..6ec15f1147 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -12,10 +12,9 @@ DPDK_23 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
+	rte_bus_name;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -424,14 +423,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_bus_name;
 };
 
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index ebbe8cca3d..9eba97f2d2 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..72aabd4dd0 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 22/26] dev: introduce driver accessors
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (20 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 21/26] bus: hide bus object David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 16:59     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 23/26] dev: hide driver object David Marchand
                     ` (4 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Aman Singh, Yuying Zhang, Ray Kinsella, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko

Prepare for making the driver object opaque by adding accessors.
Update existing "external" users.
Internal users may still dereference a rte_driver object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/config.c           |  2 +-
 lib/eal/common/eal_common_dev.c |  6 ++++++
 lib/eal/include/rte_dev.h       | 15 +++++++++++++++
 lib/eal/version.map             |  3 +++
 lib/ethdev/rte_ethdev.h         |  2 +-
 5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7bd28ee3e8..6510f29c76 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,7 +654,7 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
 			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", dev->driver->name);
+			printf("\nDriver name: %s", rte_driver_name(dev->driver));
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
 			printf("\nConnect to socket: %d", dev->numa_node);
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 62a598957c..16c5aef1d8 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -19,6 +19,12 @@
 #include "eal_private.h"
 #include "hotplug_mp.h"
 
+const char *
+rte_driver_name(const struct rte_driver *driver)
+{
+	return driver->name;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 24f9122558..fedf67fba1 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -62,6 +62,21 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * Retrieve a driver name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param driver
+ *   A pointer to a driver structure.
+ * @return
+ *   A pointer to the driver name string.
+ */
+__rte_experimental
+const char *
+rte_driver_name(const struct rte_driver *driver);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 6ec15f1147..d10fd89458 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -423,6 +423,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index de9e970d4d..e9574f646f 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = dev->device->driver->name
+ * driver_name = rte_driver_name(dev->device->driver)
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 23/26] dev: hide driver object
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (21 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 22/26] dev: introduce driver accessors David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 17:00     ` Bruce Richardson
  2022-08-01  7:06     ` Jayatheerthan, Jay
  2022-07-28 15:26   ` [RFC v3 24/26] dev: introduce device accessors David Marchand
                     ` (3 subsequent siblings)
  26 siblings, 2 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Ajit Khaparde, Raveendra Padasalagi,
	Vikas Gupta, Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph,
	Tejasree Kondoj, Gagandeep Singh, Bruce Richardson, Kevin Laatz,
	Timothy McDaniel, Jerin Jacob, Elena Agostini, Ciara Loftus,
	Qi Zhang, Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Gaetan Rivet, Xiao Wang,
	Yuying Zhang, Beilei Xing, Jingjing Wu, Qiming Yang, Matan Azrad,
	Viacheslav Ovsiienko, Chaoyong He, Niklas Soderlund,
	Harman Kalra, Devendra Singh Rawat, Andrew Rybchenko,
	Maciej Czekaj, Maxime Coquelin, Chenbo Xia, Jochen Behrens,
	Jakub Palider, Tomasz Duszynski, Ori Kam, Akhil Goyal,
	Chengwen Feng, Ray Kinsella, Thomas Monjalon, Ferruh Yigit,
	Abhinandan Gujjar, Jay Jayatheerthan, Olivier Matz,
	Reshma Pattan

Make rte_driver opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_driver definition.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_driver objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/release_22_11.rst        |  2 ++
 drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
 drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
 drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
 drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
 drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
 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/pci/bus_pci_driver.h              |  2 +-
 drivers/bus/pci/pci_params.c                  |  2 +-
 drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
 drivers/bus/vdev/vdev.c                       |  2 +-
 drivers/bus/vdev/vdev_params.c                |  2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
 drivers/common/qat/qat_qp.c                   |  2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
 drivers/dma/idxd/idxd_bus.c                   |  1 +
 drivers/event/dlb2/dlb2.c                     |  2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
 drivers/event/octeontx/ssovf_evdev.c          |  2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
 drivers/gpu/cuda/cuda.c                       |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
 drivers/net/ark/ark_global.h                  |  2 +-
 drivers/net/avp/avp_ethdev.c                  |  2 +-
 drivers/net/axgbe/axgbe_common.h              |  2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
 drivers/net/cxgbe/base/t4_hw.c                |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                |  2 +-
 drivers/net/cxgbe/sge.c                       |  2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
 drivers/net/e1000/em_ethdev.c                 |  2 +-
 drivers/net/e1000/igb_ethdev.c                |  2 +-
 drivers/net/e1000/igb_flow.c                  |  2 +-
 drivers/net/ena/ena_ethdev.h                  |  2 +-
 drivers/net/enic/enic_ethdev.c                |  2 +-
 drivers/net/enic/enic_vf_representor.c        |  2 +-
 drivers/net/failsafe/failsafe_private.h       |  2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
 drivers/net/i40e/i40e_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_vchnl.c                 |  2 +-
 drivers/net/ice/ice_dcf.c                     |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
 drivers/net/mlx4/mlx4.c                       |  2 +-
 drivers/net/netvsc/hn_ethdev.c                |  2 +-
 drivers/net/netvsc/hn_nvs.c                   |  2 +-
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/netvsc/hn_rxtx.c                  |  2 +-
 drivers/net/nfp/nfp_common.c                  |  2 +-
 drivers/net/nfp/nfp_ethdev.c                  |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
 drivers/net/qede/qede_ethdev.h                |  2 +-
 drivers/net/sfc/sfc_ethdev.c                  |  2 +-
 drivers/net/sfc/sfc_sw_stats.c                |  2 +-
 drivers/net/sfc/sfc_sw_stats.h                |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
 lib/compressdev/rte_compressdev.c             |  2 +-
 lib/compressdev/rte_compressdev_pmd.c         |  2 +-
 lib/compressdev/rte_compressdev_pmd.h         |  1 +
 lib/cryptodev/cryptodev_pmd.c                 |  2 +-
 lib/cryptodev/cryptodev_pmd.h                 |  1 +
 lib/cryptodev/rte_cryptodev.c                 |  2 +-
 lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
 lib/eal/common/eal_common_dev.c               |  2 +-
 lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
 lib/eal/include/meson.build                   |  1 +
 lib/eal/include/rte_dev.h                     | 15 ++--------
 lib/eal/version.map                           |  4 +--
 lib/ethdev/ethdev_driver.h                    |  1 +
 lib/eventdev/eventdev_pmd.h                   |  2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
 lib/eventdev/rte_eventdev.c                   |  2 +-
 lib/gpudev/gpudev_driver.h                    |  2 +-
 lib/mempool/rte_mempool_ops.c                 |  2 +-
 lib/pcapng/rte_pcapng.c                       |  2 +-
 lib/rawdev/rte_rawdev.c                       |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
 lib/security/rte_security.c                   |  2 +-
 115 files changed, 144 insertions(+), 122 deletions(-)
 create mode 100644 lib/eal/include/dev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 46bb35ad09..ff1a2d6543 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -94,6 +94,8 @@ API Changes
   ``vdev``, ``vmbus`` 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).
+  The ``rte_driver`` object is now opaque and must be manipulated through added
+  accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 801e8920df..e2d9409185 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_byteorder.h>
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index c1d877c87f..51dd090c1b 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index f16814e241..036579e3ec 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a889e392c6..e4c7ee0c3b 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <bus_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1c2d2c04af..58fb7c7f69 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -25,7 +25,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index cf66fc0c53..26a83b2cdf 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -7,7 +7,7 @@
 #define BUS_DPAA_DRIVER_H
 
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 798ddebf3a..7ac5fe6ff1 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -29,7 +29,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8604e43947..5966776a85 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -28,7 +28,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index cfe4280f87..d7f6e45b7d 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -18,7 +18,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_pool_ops.h>
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index b7d81b518c..07256ed7ec 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <fslmc_logs.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 071b0d297d..4aec7b2cd8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -30,7 +30,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index 223e34bcba..65e2d799c3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "private.h"
 #include <fslmc_logs.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b5c7dee617..0f2f9b5101 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_compat.h>
 
 /** Pathname of PCI devices directory. */
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 39d702a418..d24cc201b8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -6,7 +6,7 @@
 
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 36748cdfae..bc7e30d7c6 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 
 #include <rte_bus_vdev.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 809a8bb08f..b176b658fc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 2c72614776..2d10a1e8ad 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index 3424e791c9..e2475a642d 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_bus_vmbus.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 struct vmbus_channel;
 struct vmbus_mon_page;
diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
index 7ffde5f4c8..85d6ddfcf4 100644
--- a/drivers/common/qat/dev/qat_dev_gen4.c
+++ b/drivers/common/qat/dev/qat_dev_gen4.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "qat_device.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 4a1be35b47..e58e4ceec0 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 7d657d81bc..445a3baa67 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
index 61d457f4e0..d1ede5e990 100644
--- a/drivers/crypto/bcmfs/bcmfs_qp.c
+++ b/drivers/crypto/bcmfs/bcmfs_qp.c
@@ -8,7 +8,7 @@
 #include <rte_atomic.h>
 #include <rte_bitmap.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_prefetch.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
index bc7fb67218..78272d616c 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
@@ -4,7 +4,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 6c3e45e333..013f3be1e6 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 
 #include "ccp_crypto.h"
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 3fd9f3c426..db11ac7444 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn10k_cryptodev.h"
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index bd425f95ff..4cfc1f2150 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn9k_cryptodev.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0cce861899..3b13578de0 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_common.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7e554cb2b1..c6bd785262 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -19,7 +19,7 @@
 #include <rte_security_driver.h>
 #endif
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index f3a1bd626c..971f82897c 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -5,7 +5,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index e30dcfc281..9b7b16c6e3 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -9,6 +9,7 @@
 #include <libgen.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 5a443acff8..759578378f 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -17,7 +17,7 @@
 #include <rte_config.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 9f8c6cd8b8..71ac141b66 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -15,7 +15,7 @@
 
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
 #include <rte_ring.h>
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index aa403f9e06..8e470584ea 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 08df6e223a..1001297cda 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <bus_fslmc_driver.h>
 #include <rte_lcore.h>
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 3882a9cf1d..a68d3ac154 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index fe157c59d5..99fa326ad5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <ethdev_driver.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 6bd8fec6d4..8513b9a013 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -12,7 +12,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 2be7b8d2df..a552aabeb8 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -8,7 +8,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <gpudev_driver.h>
 
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 56c629c681..84371d5d1a 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -20,7 +20,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include "rte_dpaa2_mempool.h"
 
 #include "fslmc_vfio.h"
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fd7be47311..9957de2314 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -24,7 +24,7 @@
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 748db590c1..71d0b53e03 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_version.h>
 
 #include "ark_pktdir.h"
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7c0cb666fb..b2a08f5635 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_cycles.h>
 #include <rte_spinlock.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index b9ebf64fb8..a5d11c5832 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -33,7 +33,7 @@
 #include <rte_memzone.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_pci.h>
 #include <rte_common.h>
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f36ad30e17..4448cf2de2 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -9,7 +9,7 @@
 #include "bnx2x_rxtx.h"
 
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53f..1460dce2ab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef04c..fd1506ddd4 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -7,7 +7,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 384080e6d3..bed755f5d9 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -18,7 +18,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_byteorder.h>
 
 #include "common.h"
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index fd71a50a58..45bbeaef0c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -31,7 +31,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "cxgbe.h"
 #include "cxgbe_pfvf.h"
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3c02c98b3d..f8dd833032 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -31,7 +31,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "base/common.h"
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5d91355c9a..5b13cb5c94 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -30,7 +30,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 9509f6e8a3..4d33b51fea 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <dpaa2_pmd_logs.h>
 #include <dpaa2_hw_pvt.h>
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index f876f4790c..37a8b43114 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 #include "rte_dpaa2_mempool.h"
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 932570c6e0..fbfdf360d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -14,7 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7b9c528d13..9436a95ac8 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hexdump.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
index ba0d500f74..63463c4fbf 100644
--- a/drivers/net/dpaa2/dpaa2_sparser.c
+++ b/drivers/net/dpaa2/dpaa2_sparser.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <fslmc_vfio.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 409de50083..8ee9be12ad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 43979992d3..d6bcc5bf58 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index e46697b6a1..b775310651 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -21,7 +21,7 @@
 #include <rte_eal.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 4709675af8..4d27fba585 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -14,7 +14,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_timer.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 
 #include "ena_com.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 998436e5e8..cdf0915591 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 7312c411bd..46f85964e9 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -7,7 +7,7 @@
 
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index a80f5e2caf..53a451c1b1 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -11,7 +11,7 @@
 #include <pthread.h>
 
 #include <rte_atomic.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_devargs.h>
 #include <rte_flow.h>
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8bbd8b445d..7adb20bff9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_spinlock.h>
 #include <rte_kvargs.h>
 #include <rte_vect.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bdc453ec1..67111ac251 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -23,7 +23,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_alarm.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_hash_crc.h>
 #include <rte_bitmap.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..ef2ab06475 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,7 +24,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 21bd1e2193..15f695682d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,7 +19,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..1c3d22ae0f 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -21,7 +21,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "ice_dcf.h"
 #include "ice_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 0da267db1f..dee712af98 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -18,7 +18,7 @@
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <iavf_devids.h>
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 552e41692c..04c9ce78a2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..67373a7b78 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -27,7 +27,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 910b76a92c..7e7e1824ef 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ccc06bdda6..d0bbc0a4c0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -30,7 +30,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 817fb06dfb..7db82af9f3 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -28,7 +28,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 20f75a17b0..e6f1f28768 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -26,7 +26,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 61cf374224..bc6f60c64a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -25,7 +25,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 #include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c792..eaafe11fb9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -19,7 +19,7 @@
 #include <rte_debug.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e588..47359501bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_common.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9ada22e2ff..0eee191566 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -15,7 +15,7 @@
 #include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index a38b701183..b781bcdcfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -13,7 +13,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ip.h>
 
 /* ecore includes */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 506c62a726..2ec743ebce 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -7,7 +7,7 @@
  * for Solarflare) and Solarflare Communications, Inc.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 81f5aa3cc4..3ae5023b6f 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2021 Xilinx, Inc.
  */
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_bitmap.h>
 
 #include "sfc.h"
diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
index 1abded8018..d9738e5214 100644
--- a/drivers/net/sfc/sfc_sw_stats.h
+++ b/drivers/net/sfc/sfc_sw_stats.h
@@ -5,7 +5,7 @@
 #ifndef _SFC_SW_STATS_H
 #define _SFC_SW_STATS_H
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "sfc.h"
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 28183ec740..9f57cb1a20 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index dc90569df1..c3e045d892 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -27,7 +27,7 @@
 #include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d180162abd..edf3becd32 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -24,7 +24,7 @@
 #include <rte_memory.h>
 #include <rte_eal_paging.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 2b9e35cef5..abc63b0935 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -16,7 +16,7 @@
 
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "virtio.h"
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 101b1cb500..fd946dec5c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/vmxnet3_defs.h"
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index db029cbf34..909fb8faab 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -3,7 +3,7 @@
  */
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 19b523a815..a06b724866 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index fc257c5f44..8ef7a6b127 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_rawdev.h>
 #include <bus_vdev_driver.h>
 #include <rte_test.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 6ab62a12fc..92cf5f495e 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -11,7 +11,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_glue.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 7f6dedbc52..639a0d66ca 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 9bfae077db..41f1415bea 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
index 9fabc399c5..72e52f876f 100644
--- a/lib/compressdev/rte_compressdev_pmd.h
+++ b/lib/compressdev/rte_compressdev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 
 #include "rte_compressdev.h"
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 75d0075b86..f07b92dfd7 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..96d7e225b0 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..1dad092317 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -13,7 +13,7 @@
 
 #include <rte_log.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index 82ab7a8cc7..acd7f71cd1 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -14,7 +14,7 @@
  * by any application.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_dmadev.h"
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 16c5aef1d8..98f3c78795 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -9,7 +9,7 @@
 
 #include <bus_driver.h>
 #include <rte_class.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_errno.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
new file mode 100644
index 0000000000..015188abd5
--- /dev/null
+++ b/lib/eal/include/dev_driver.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef DEV_DRIVER_H
+#define DEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include <rte_dev.h>
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+	const char *name;                   /**< Driver name. */
+	const char *alias;              /**< Driver alias. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEV_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index 77d8621a51..cfcd40aaed 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -57,6 +57,7 @@ headers += files(
 
 driver_sdk_headers = files(
         'bus_driver.h',
+        'dev_driver.h',
 )
 
 # special case install the generic headers, since they go in a subdir
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index fedf67fba1..38057cc0ef 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -23,6 +23,8 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_driver;
+
 /**
  * The device event type.
  */
@@ -53,27 +55,14 @@ struct rte_mem_resource {
 	void *addr;         /**< Virtual address, NULL when not mapped. */
 };
 
-/**
- * A structure describing a device driver.
- */
-struct rte_driver {
-	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
-	const char *name;                   /**< Driver name. */
-	const char *alias;              /**< Driver alias. */
-};
-
 /**
  * Retrieve a driver name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param driver
  *   A pointer to a driver structure.
  * @return
  *   A pointer to the driver name string.
  */
-__rte_experimental
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index d10fd89458..8b53a1d258 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -37,6 +37,7 @@ DPDK_23 {
 	rte_devargs_parsef;
 	rte_devargs_remove;
 	rte_devargs_type_count;
+	rte_driver_name;
 	rte_dump_physmem_layout;
 	rte_dump_stack;
 	rte_dump_tailq;
@@ -423,9 +424,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..47a55a419e 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -19,6 +19,7 @@ extern "C" {
  *
  */
 
+#include <dev_driver.h>
 #include <rte_ethdev.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..def6cd0876 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7c695176f4..5bc10312fc 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bf8741d2ea..4f4efdae9f 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -9,7 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_log.h>
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 1dc4f966be..54abee2b3f 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 0e55b00bfe..23972b3dbd 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_gpudev.h"
 
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index d60235a7e3..058ad147a5 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -10,7 +10,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_mempool_trace.h"
 
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 72aabd4dd0..af2b814251 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -14,7 +14,7 @@
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index 2f0a4f132e..bc51258143 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_telemetry.h>
diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 3b7be57d3e..a51944c8ff 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -19,7 +19,7 @@ extern "C" {
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 046b6496d2..d036ed33f6 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_cryptodev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_telemetry.h>
 #include "rte_security.h"
 #include "rte_security_driver.h"
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 24/26] dev: introduce device accessors
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (22 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 23/26] dev: hide driver object David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 17:01     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 25/26] dev: provide Bus specific information David Marchand
                     ` (2 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev
  Cc: Maryam Tahhan, Reshma Pattan, Aman Singh, Yuying Zhang,
	Maxime Coquelin, Chenbo Xia, Ray Kinsella, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko

Prepare for making the device object opaque by adding accessors.
Update existing "external" users.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v2:
- added rte_dev_devargs,
- updated testpmd,

---
 app/proc-info/main.c               |  6 +--
 app/test-pmd/config.c              | 18 +++----
 app/test-pmd/testpmd.c             |  6 +--
 examples/ethtool/lib/rte_ethtool.c |  2 +-
 examples/l3fwd/l3fwd_em.c          |  4 +-
 examples/l3fwd/l3fwd_fib.c         |  8 +--
 examples/l3fwd/l3fwd_lpm.c         |  4 +-
 examples/vdpa/main.c               | 16 +++---
 lib/eal/common/eal_common_dev.c    | 30 ++++++++++++
 lib/eal/include/rte_dev.h          | 78 ++++++++++++++++++++++++++++++
 lib/eal/version.map                |  7 +++
 lib/ethdev/rte_ethdev.h            |  2 +-
 12 files changed, 148 insertions(+), 33 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 1bfba5f60d..d52ac8a038 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -755,7 +755,7 @@ show_port(void)
 		}
 
 		printf("\t  -- driver %s device %s socket %d\n",
-		       dev_info.driver_name, dev_info.device->name,
+		       dev_info.driver_name, rte_dev_name(dev_info.device),
 		       rte_eth_dev_socket_id(i));
 
 		ret = rte_eth_dev_owner_get(i, &owner);
@@ -1254,7 +1254,7 @@ show_crypto(void)
 		       rte_cryptodev_name_get(i),
 		       dev_info.driver_name,
 		       dev_info.driver_id,
-		       dev_info.device->numa_node,
+		       rte_dev_numa_node(dev_info.device),
 		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
@@ -1466,7 +1466,7 @@ dump_regs(char *file_prefix)
 			else
 				printf("Device (%s) regs dumped successfully, "
 					"driver:%s version:0X%08X\n",
-					dev_info.device->name,
+					rte_dev_name(dev_info.device),
 					dev_info.driver_name, reg_info.version);
 
 			fclose(fp_regs);
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 6510f29c76..de74690f06 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -645,19 +645,19 @@ device_infos_display(const char *identifier)
 		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
-			if (!dev->driver)
+			if (rte_dev_driver(dev) == NULL)
 				continue;
 			/* Check for matching device if identifier is present */
 			if (identifier &&
-			    strncmp(da.name, dev->name, strlen(dev->name)))
+			    strncmp(da.name, rte_dev_name(dev), strlen(rte_dev_name(dev))))
 				continue;
 			printf("\n%s Infos for device %s %s\n",
-			       info_border, dev->name, info_border);
-			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", rte_driver_name(dev->driver));
+			       info_border, rte_dev_name(dev), info_border);
+			printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev)));
+			printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev)));
 			printf("\nDevargs: %s",
-			       dev->devargs ? dev->devargs->args : "");
-			printf("\nConnect to socket: %d", dev->numa_node);
+			       rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : "");
+			printf("\nConnect to socket: %d", rte_dev_numa_node(dev));
 			printf("\n");
 
 			/* List ports with matching device name */
@@ -802,8 +802,8 @@ port_infos_display(portid_t port_id)
 	else
 		printf("\nFirmware-version: %s", "not available");
 
-	if (dev_info.device->devargs && dev_info.device->devargs->args)
-		printf("\nDevargs: %s", dev_info.device->devargs->args);
+	if (rte_dev_devargs(dev_info.device) && rte_dev_devargs(dev_info.device)->args)
+		printf("\nDevargs: %s", rte_dev_devargs(dev_info.device)->args);
 	printf("\nConnect to socket: %u", port->socket_id);
 
 	if (port_numa[port_id] != NUMA_NO_CONFIG) {
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c7d1fa2719..a399193e53 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1057,7 +1057,7 @@ dma_unmap_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
 			TESTPMD_LOG(DEBUG,
 				    "unable to DMA unmap addr 0x%p "
 				    "for device %s\n",
-				    memhdr->addr, dev_info.device->name);
+				    memhdr->addr, rte_dev_name(dev_info.device));
 		}
 	}
 	ret = rte_extmem_unregister(memhdr->addr, memhdr->len);
@@ -1098,7 +1098,7 @@ dma_map_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
 			TESTPMD_LOG(DEBUG,
 				    "unable to DMA map addr 0x%p "
 				    "for device %s\n",
-				    memhdr->addr, dev_info.device->name);
+				    memhdr->addr, rte_dev_name(dev_info.device));
 		}
 	}
 }
@@ -3441,7 +3441,7 @@ detach_device(struct rte_device *dev)
 	}
 
 	if (rte_dev_remove(dev) < 0) {
-		TESTPMD_LOG(ERR, "Failed to detach device %s\n", dev->name);
+		TESTPMD_LOG(ERR, "Failed to detach device %s\n", rte_dev_name(dev));
 		return;
 	}
 	remove_invalid_ports();
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 88dc917b73..33acc5e3cc 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -49,7 +49,7 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	strlcpy(drvinfo->bus_info, dev_info.device->name,
+	strlcpy(drvinfo->bus_info, rte_dev_name(dev_info.device),
 		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index 10be24c61d..0531282a1f 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -403,7 +403,7 @@ populate_ipv4_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v4[i].v4_key.port_dst,
 			   em_route_base_v4[i].v4_key.port_src,
 			   em_route_base_v4[i].v4_key.proto,
-		       em_route_base_v4[i].if_out, dev_info.device->name);
+		       em_route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 " keys\n",
 		(uint64_t)route_num_v4);
@@ -455,7 +455,7 @@ populate_ipv6_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v6[i].v6_key.port_dst,
 			   em_route_base_v6[i].v6_key.port_src,
 			   em_route_base_v6[i].v6_key.proto,
-		       em_route_base_v6[i].if_out, dev_info.device->name);
+		       em_route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 "keys\n",
 		(uint64_t)route_num_v6);
diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index e02e4b3f5a..b82e0c0354 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -640,11 +640,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v4[i].depth,
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv4 route added to port %d [%s]\n",
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 	/* >8 End of setup fib. */
@@ -695,11 +695,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v6[i].depth,
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv6 route added to port %d [%s]\n",
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 }
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index d1b850dd5b..22d7f61a42 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -598,7 +598,7 @@ setup_lpm(const int socketid)
 		printf("LPM: Adding route %s / %d (%d) [%s]\n",
 		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 		       route_base_v4[i].depth,
-		       route_base_v4[i].if_out, dev_info.device->name);
+		       route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 
 	/* create the LPM6 table */
@@ -642,7 +642,7 @@ setup_lpm(const int socketid)
 		       inet_ntop(AF_INET6, route_base_v6[i].ip_8, abuf,
 				 sizeof(abuf)),
 		       route_base_v6[i].depth,
-		       route_base_v6[i].if_out, dev_info.device->name);
+		       route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 }
 
diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 7e11ef4e26..ee240dd15a 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -119,7 +119,7 @@ new_device(int vid)
 				"Failed to get generic device for port %d\n", i);
 			continue;
 		}
-		printf("\nnew port %s, device : %s\n", ifname, dev->name);
+		printf("\nnew port %s, device : %s\n", ifname, rte_dev_name(dev));
 		vports[i].vid = vid;
 		break;
 	}
@@ -149,7 +149,7 @@ destroy_device(int vid)
 			continue;
 		}
 
-		printf("\ndestroy port %s, device: %s\n", ifname, dev->name);
+		printf("\ndestroy port %s, device: %s\n", ifname, rte_dev_name(dev));
 		break;
 	}
 }
@@ -353,23 +353,23 @@ static void cmd_list_vdpa_devices_parsed(
 
 	cmdline_printf(cl, "device name\tqueue num\tsupported features\n");
 	RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-		vdev = rte_vdpa_find_device_by_name(dev->name);
+		vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 		if (!vdev)
 			continue;
 		if (rte_vdpa_get_queue_num(vdev, &queue_num) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa queue number "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		if (rte_vdpa_get_features(vdev, &features) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa features "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		cmdline_printf(cl, "%s\t\t%" PRIu32 "\t\t0x%" PRIx64 "\n",
-			dev->name, queue_num, features);
+			rte_dev_name(dev), queue_num, features);
 	}
 }
 
@@ -606,10 +606,10 @@ main(int argc, char *argv[])
 		cmdline_stdin_exit(cl);
 	} else {
 		RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-			vdev = rte_vdpa_find_device_by_name(dev->name);
+			vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 			if (vdev == NULL) {
 				rte_panic("Failed to find vDPA dev for %s\n",
-						dev->name);
+						rte_dev_name(dev));
 			}
 			vports[devcnt].dev = vdev;
 			snprintf(vports[devcnt].ifname, MAX_PATH_LEN, "%s%d",
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 98f3c78795..7b12d6e531 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -25,6 +25,36 @@ rte_driver_name(const struct rte_driver *driver)
 	return driver->name;
 }
 
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev)
+{
+	return dev->bus;
+}
+
+const struct rte_devargs *
+rte_dev_devargs(const struct rte_device *dev)
+{
+	return dev->devargs;
+}
+
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev)
+{
+	return dev->driver;
+}
+
+const char *
+rte_dev_name(const struct rte_device *dev)
+{
+	return dev->name;
+}
+
+int
+rte_dev_numa_node(const struct rte_device *dev)
+{
+	return dev->numa_node;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 38057cc0ef..5f671a05f7 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -23,6 +23,9 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_bus;
+struct rte_devargs;
+struct rte_device;
 struct rte_driver;
 
 /**
@@ -66,6 +69,81 @@ struct rte_mem_resource {
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
+/**
+ * Retrieve a device bus.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device bus.
+ */
+__rte_experimental
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev);
+
+/**
+ * Retrieve a device arguments.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device devargs.
+ */
+__rte_experimental
+const struct rte_devargs *
+rte_dev_devargs(const struct rte_device *dev);
+
+/**
+ * Retrieve a device driver.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device driver.
+ */
+__rte_experimental
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev);
+
+/**
+ * Retrieve a device name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device name.
+ */
+__rte_experimental
+const char *
+rte_dev_name(const struct rte_device *dev);
+
+/**
+ * Retrieve a device numa node.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device numa node.
+ */
+__rte_experimental
+int
+rte_dev_numa_node(const struct rte_device *dev);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 8b53a1d258..719789b8d1 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_dev_bus;
+	rte_dev_devargs;
+	rte_dev_driver;
+	rte_dev_name;
+	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index e9574f646f..2197525315 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = rte_driver_name(dev->device->driver)
+ * driver_name = rte_driver_name(rte_dev_driver(dev->device));
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 25/26] dev: provide Bus specific information
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (23 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 24/26] dev: introduce device accessors David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 17:03     ` Bruce Richardson
  2022-07-28 15:26   ` [RFC v3 26/26] dev: hide device object David Marchand
  2022-08-04 23:19   ` [RFC v3 00/26] Bus and device cleanup for 22.11 Harris, James R
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Aman Singh, Yuying Zhang, Ray Kinsella

For diagnostic, it may be useful to provide a description of the device
with Bus specific information like, for PCI, the vendor and device ID.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/config.c            |  2 ++
 drivers/bus/pci/bsd/pci.c        |  8 ++++----
 drivers/bus/pci/bus_pci_driver.h |  1 +
 drivers/bus/pci/linux/pci.c      | 24 ++++++++++++------------
 drivers/bus/pci/pci_common.c     | 17 +++++++++++++++--
 drivers/bus/pci/private.h        | 10 ++++++++--
 drivers/bus/pci/windows/pci.c    |  6 +++---
 lib/eal/common/eal_common_dev.c  |  6 ++++++
 lib/eal/include/rte_dev.h        | 16 ++++++++++++++++
 lib/eal/version.map              |  1 +
 10 files changed, 68 insertions(+), 23 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index de74690f06..d3e1714af5 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,6 +654,8 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, rte_dev_name(dev), info_border);
 			printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev)));
+			printf("\nBus information: %s",
+				rte_dev_bus_info(dev) ?  rte_dev_bus_info(dev) : "");
 			printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev)));
 			printf("\nDevargs: %s",
 			       rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : "");
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index bc560a2a56..844d145fed 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -248,7 +248,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	/* FreeBSD has no NUMA support (yet) */
 	dev->device.numa_node = 0;
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	/* FreeBSD has only one pass through driver */
 	dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
@@ -299,11 +299,11 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 			} else { /* already registered */
 				dev2->kdrv = dev->kdrv;
 				dev2->max_vfs = dev->max_vfs;
-				pci_name_set(dev2);
+				pci_common_set(dev2);
 				memmove(dev2->mem_resource,
 					dev->mem_resource,
 					sizeof(dev->mem_resource));
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
@@ -313,7 +313,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	return 0;
 
 skipdev:
-	free(dev);
+	pci_free(dev);
 	return 0;
 }
 
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index 0f2f9b5101..be32263a82 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -43,6 +43,7 @@ struct rte_pci_device {
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
 	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	char *bus_info;                     /**< PCI bus specific info */
 	struct rte_intr_handle *vfio_req_intr_handle;
 				/**< Handler of VFIO request interrupt */
 };
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index fa5d5e131d..c8703d52f3 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -226,7 +226,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* get vendor id */
 	snprintf(filename, sizeof(filename), "%s/vendor", dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.vendor_id = (uint16_t)tmp;
@@ -234,7 +234,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* get device id */
 	snprintf(filename, sizeof(filename), "%s/device", dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.device_id = (uint16_t)tmp;
@@ -243,7 +243,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/subsystem_vendor",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.subsystem_vendor_id = (uint16_t)tmp;
@@ -252,7 +252,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/subsystem_device",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.subsystem_device_id = (uint16_t)tmp;
@@ -261,7 +261,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/class",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	/* the least 24 bits are valid: class, subclass, program interface */
@@ -295,13 +295,13 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		dev->device.numa_node = 0;
 	}
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	/* parse resources */
 	snprintf(filename, sizeof(filename), "%s/resource", dirname);
 	if (pci_parse_sysfs_resource(filename, dev) < 0) {
 		RTE_LOG(ERR, EAL, "%s(): cannot parse resource\n", __func__);
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 
@@ -310,7 +310,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	ret = pci_get_kernel_driver_by_path(filename, driver, sizeof(driver));
 	if (ret < 0) {
 		RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 
@@ -324,7 +324,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		else
 			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
-		free(dev);
+		pci_free(dev);
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
@@ -346,7 +346,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 					dev2->kdrv = dev->kdrv;
 					dev2->max_vfs = dev->max_vfs;
 					dev2->id = dev->id;
-					pci_name_set(dev2);
+					pci_common_set(dev2);
 					memmove(dev2->mem_resource,
 						dev->mem_resource,
 						sizeof(dev->mem_resource));
@@ -376,10 +376,10 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 					else if (dev2->device.devargs !=
 						 dev->device.devargs) {
 						rte_devargs_remove(dev2->device.devargs);
-						pci_name_set(dev2);
+						pci_common_set(dev2);
 					}
 				}
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index c26aacd364..0f344d46aa 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -59,7 +59,7 @@ pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
 }
 
 void
-pci_name_set(struct rte_pci_device *dev)
+pci_common_set(struct rte_pci_device *dev)
 {
 	struct rte_devargs *devargs;
 
@@ -80,6 +80,19 @@ pci_name_set(struct rte_pci_device *dev)
 	else
 		/* Otherwise, it uses the internal, canonical form. */
 		dev->device.name = dev->name;
+
+	if (asprintf(&dev->bus_info, "vendor_id=%"PRIx16", device_id=%"PRIx16,
+			dev->id.vendor_id, dev->id.device_id) != -1)
+		dev->device.bus_info = dev->bus_info;
+}
+
+void
+pci_free(struct rte_pci_device *dev)
+{
+	if (dev == NULL)
+		return;
+	free(dev->bus_info);
+	free(dev);
 }
 
 /* map a particular resource from a file */
@@ -604,7 +617,7 @@ pci_unplug(struct rte_device *dev)
 	if (ret == 0) {
 		rte_pci_remove_device(pdev);
 		rte_devargs_remove(dev->devargs);
-		free(pdev);
+		pci_free(pdev);
 	}
 	return ret;
 }
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index fddf49251d..c8161a1074 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -44,10 +44,16 @@ struct rte_pci_device;
 int rte_pci_scan(void);
 
 /**
- * Find the name of a PCI device.
+ * Set common internal information for a PCI device.
  */
 void
-pci_name_set(struct rte_pci_device *dev);
+pci_common_set(struct rte_pci_device *dev);
+
+/**
+ * Free a PCI device.
+ */
+void
+pci_free(struct rte_pci_device *dev);
 
 /**
  * Validate whether a device with given PCI address should be ignored or not.
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index f013b743b3..3f7a8b9432 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -382,7 +382,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 	dev->id = pci_id;
 	dev->max_vfs = 0; /* TODO: get max_vfs */
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	set_kernel_driver_type(device_info_data, dev);
 
@@ -410,7 +410,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 				dev2->max_vfs = dev->max_vfs;
 				memmove(dev2->mem_resource, dev->mem_resource,
 					sizeof(dev->mem_resource));
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
@@ -419,7 +419,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 
 	return 0;
 end:
-	free(dev);
+	pci_free(dev);
 	return ret;
 }
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 7b12d6e531..a190bd37af 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -31,6 +31,12 @@ rte_dev_bus(const struct rte_device *dev)
 	return dev->bus;
 }
 
+const char *
+rte_dev_bus_info(const struct rte_device *dev)
+{
+	return dev->bus_info;
+}
+
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev)
 {
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 5f671a05f7..be8bbe79ee 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -84,6 +84,21 @@ __rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
+/**
+ * Retrieve bus specific information for a device.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A string describing this device or NULL if none is available.
+ */
+__rte_experimental
+const char *
+rte_dev_bus_info(const struct rte_device *dev);
+
 /**
  * Retrieve a device arguments.
  *
@@ -156,6 +171,7 @@ rte_dev_numa_node(const struct rte_device *dev);
 struct rte_device {
 	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
 	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
 	const struct rte_driver *driver; /**< Driver assigned after probing */
 	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
 	int numa_node;                /**< NUMA node connection */
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 719789b8d1..0cf321605e 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -427,6 +427,7 @@ EXPERIMENTAL {
 
 	# added in 22.11
 	rte_dev_bus;
+	rte_dev_bus_info;
 	rte_dev_devargs;
 	rte_dev_driver;
 	rte_dev_name;
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [RFC v3 26/26] dev: hide device object
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (24 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 25/26] dev: provide Bus specific information David Marchand
@ 2022-07-28 15:26   ` David Marchand
  2022-07-28 17:04     ` Bruce Richardson
  2022-08-04 23:19   ` [RFC v3 00/26] Bus and device cleanup for 22.11 Harris, James R
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 15:26 UTC (permalink / raw)
  To: dev; +Cc: Ray Kinsella, Maxime Coquelin, Chenbo Xia

Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Some applications may have been dereferencing rte_device objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/deprecation.rst   |  7 -----
 doc/guides/rel_notes/release_22_11.rst |  4 +--
 lib/eal/common/eal_private.h           |  2 +-
 lib/eal/include/dev_driver.h           | 13 +++++++++
 lib/eal/include/rte_dev.h              | 37 --------------------------
 lib/eal/version.map                    | 14 +++++-----
 lib/vhost/vdpa.c                       |  1 +
 7 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 3512f01539..429ef298c5 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -43,13 +43,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* drivers: As a follow-up of the work on the ``rte_bus`` object,
-  the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
-  their bus-specific counterparts) will be made opaque in DPDK 22.11.
-  Registering a driver on a bus will be marked as an internal API:
-  external users may still register their drivers using the bus-specific
-  driver header (see ``enable_driver_sdk`` meson option).
-
 * bus: The ``dev->device.numa_node`` field is set by each bus driver for
   every device it manages to indicate on which NUMA node this device lies.
   When this information is unknown, the assigned value is not consistent
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index ff1a2d6543..cff2667f39 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -94,8 +94,8 @@ API Changes
   ``vdev``, ``vmbus`` 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).
-  The ``rte_driver`` object is now opaque and must be manipulated through added
-  accessors.
+  The ``rte_driver`` and ``rte_device`` objects are now opaque and must be
+  manipulated through added accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..5efa8c437e 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -21,6 +21,19 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index be8bbe79ee..b58cbd2236 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -72,90 +72,66 @@ rte_driver_name(const struct rte_driver *driver);
 /**
  * Retrieve a device bus.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device bus.
  */
-__rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
 /**
  * Retrieve bus specific information for a device.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A string describing this device or NULL if none is available.
  */
-__rte_experimental
 const char *
 rte_dev_bus_info(const struct rte_device *dev);
 
 /**
  * Retrieve a device arguments.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device devargs.
  */
-__rte_experimental
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev);
 
 /**
  * Retrieve a device driver.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device driver.
  */
-__rte_experimental
 const struct rte_driver *
 rte_dev_driver(const struct rte_device *dev);
 
 /**
  * Retrieve a device name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device name.
  */
-__rte_experimental
 const char *
 rte_dev_name(const struct rte_device *dev);
 
 /**
  * Retrieve a device numa node.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device numa node.
  */
-__rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
@@ -165,19 +141,6 @@ rte_dev_numa_node(const struct rte_device *dev);
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const char *bus_info;         /**< Device bus specific information */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 0cf321605e..3c14cf2724 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -26,7 +26,13 @@ DPDK_23 {
 	rte_delay_us_block;
 	rte_delay_us_callback_register;
 	rte_delay_us_sleep;
+	rte_dev_bus;
+	rte_dev_bus_info;
+	rte_dev_devargs;
+	rte_dev_driver;
 	rte_dev_is_probed;
+	rte_dev_name;
+	rte_dev_numa_node;
 	rte_dev_probe;
 	rte_dev_remove;
 	rte_devargs_add;
@@ -424,14 +430,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_dev_bus;
-	rte_dev_bus_info;
-	rte_dev_devargs;
-	rte_dev_driver;
-	rte_dev_name;
-	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index bdebcbe565..aaf3f267e9 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
-- 
2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 01/26] devtools: forbid inclusions of driver only headers
  2022-07-28 15:26   ` [RFC v3 01/26] devtools: forbid inclusions of driver only headers David Marchand
@ 2022-07-28 16:23     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:23 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Thomas Monjalon

On Thu, Jul 28, 2022 at 05:26:15PM +0200, David Marchand wrote:
> Let's be good citizens and enforce not using driver only headers in our
> own examples.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 04/26] app/testpmd: drop PCI register commands
  2022-07-28 15:26   ` [RFC v3 04/26] app/testpmd: drop PCI register commands David Marchand
@ 2022-07-28 16:26     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:26 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Aman Singh, Yuying Zhang

On Thu, Jul 28, 2022 at 05:26:18PM +0200, David Marchand wrote:
> Those commands date back to the early stages of DPDK when only PCI
> devices were supported.
> At the time, developers may have used those commands to help in
> debugging their buggy^Wwork in progress drivers.
> 
> Removing them, we can drop the dependency on the PCI bus and library and
> make testpmd bus agnostic.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

This should really have been flagged in a deprecation notice in advance, I
think, but there is no rule that mandates a deprecation process for testpmd
changes. Therefore:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 05/26] kni: stop populating PCI info in examples
  2022-07-28 15:26   ` [RFC v3 05/26] kni: stop populating PCI info in examples David Marchand
@ 2022-07-28 16:30     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:30 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Cristian Dumitrescu

On Thu, Jul 28, 2022 at 05:26:19PM +0200, David Marchand wrote:
> addr and id fields are deprecated and are not used in the kni library.
> Stop populating them in the in-tree examples.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 06/26] examples/ethtool: prefer device name
  2022-07-28 15:26   ` [RFC v3 06/26] examples/ethtool: prefer device name David Marchand
@ 2022-07-28 16:32     ` Bruce Richardson
  2022-07-28 19:27       ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:32 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Thu, Jul 28, 2022 at 05:26:20PM +0200, David Marchand wrote:
> Rely on the generic device name rather than restrict to only supporting
> PCI devices.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  examples/ethtool/lib/rte_ethtool.c | 17 ++---------------
>  1 file changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
> index ffaad96498..88dc917b73 100644
> --- a/examples/ethtool/lib/rte_ethtool.c
> +++ b/examples/ethtool/lib/rte_ethtool.c
> @@ -8,7 +8,6 @@
>  #include <rte_version.h>
>  #include <rte_ethdev.h>
>  #include <rte_ether.h>
> -#include <rte_bus_pci.h>
>  #ifdef RTE_NET_IXGBE
>  #include <rte_pmd_ixgbe.h>
>  #endif
> @@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
>  {
>  	struct rte_eth_dev_info dev_info;
>  	struct rte_dev_reg_info reg_info;
> -	const struct rte_pci_device *pci_dev;
> -	const struct rte_bus *bus = NULL;
>  	int n;
>  	int ret;
>  
> @@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
>  	strlcpy(drvinfo->driver, dev_info.driver_name,
>  		sizeof(drvinfo->driver));
>  	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
> -	/* TODO: replace bus_info by rte_devargs.name */
> -	if (dev_info.device)
> -		bus = rte_bus_find_by_device(dev_info.device);
> -	if (bus && !strcmp(bus->name, "pci")) {
> -		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
> -		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
> -			"%04x:%02x:%02x.%x",
> -			pci_dev->addr.domain, pci_dev->addr.bus,
> -			pci_dev->addr.devid, pci_dev->addr.function);
> -	} else {
> -		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
> -	}
> +	strlcpy(drvinfo->bus_info, dev_info.device->name,
> +		sizeof(drvinfo->bus_info));
>

Does the bus_info field need to be renamed now? It seems strange coping a
device name to a bus info field.

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 07/26] dev: hide debug messages in device iterator
  2022-07-28 15:26   ` [RFC v3 07/26] dev: hide debug messages in device iterator David Marchand
@ 2022-07-28 16:33     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:33 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Aman Singh, Yuying Zhang

On Thu, Jul 28, 2022 at 05:26:21PM +0200, David Marchand wrote:
> For any bus that does not support device iteration, rte_dev_iterator_init
> both returned an error code and logged an error message.
> An application (like testpmd) that only wants to list devices, would have
> no choice but to inspect a bus object to avoid spewing error logs.
> 
> Make those log messages debug level, and remove the check in testpmd.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 08/26] dev: move unrelated macros from header
  2022-07-28 15:26   ` [RFC v3 08/26] dev: move unrelated macros from header David Marchand
@ 2022-07-28 16:38     ` Bruce Richardson
  2022-07-28 19:32       ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:38 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu,
	Shijith Thotton, Srisivasubramanian Srinivasan, Chengwen Feng,
	Kevin Laatz, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Olivier Matz, Ori Kam, Akhil Goyal, Maxime Coquelin, Chenbo Xia

On Thu, Jul 28, 2022 at 05:26:22PM +0200, David Marchand wrote:
> RTE_FUNC_PTR_OR_* macros have nothing to do with the rte_device object
> and associated API.
> Move them to rte_common.h and include it where needed.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

Personally, I really don't like these macros at all. I think having the
check explicitly in the code would be far more readable, and would only be
one line of code longer than the macro call. Is there some private header
file we could move these to instead of rte_common.h so we can drop their
use in future if we decide to?


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 09/26] devargs: remove dependency on bus header
  2022-07-28 15:26   ` [RFC v3 09/26] devargs: remove dependency on bus header David Marchand
@ 2022-07-28 16:40     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:40 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Thu, Jul 28, 2022 at 05:26:23PM +0200, David Marchand wrote:
> We don't need to include rte_bus.h in rte_devargs.h.
> Only a forward declaration of rte_bus and an inclusion of rte_dev.h are
> needed.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 10/26] build: export drivers headers
  2022-07-28 15:26   ` [RFC v3 10/26] build: export drivers headers David Marchand
@ 2022-07-28 16:41     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:41 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Thu, Jul 28, 2022 at 05:26:24PM +0200, David Marchand wrote:
> Same as for device classes, external DPDK users may need to include some
> bus headers for their out of tree drivers.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 16/26] bus/pci: make driver-only headers private
  2022-07-28 15:26   ` [RFC v3 16/26] bus/pci: " David Marchand
@ 2022-07-28 16:46     ` Bruce Richardson
  2022-07-28 16:52       ` Ajit Khaparde
  2022-07-29  2:41     ` Xu, Rosen
  1 sibling, 1 reply; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:46 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Nicolas Chautru, Ray Kinsella, Nithin Dabilpuram,
	Kiran Kumar K, Sunil Kumar Kori, Satha Rao, Matan Azrad,
	Viacheslav Ovsiienko, Fan Zhang, Andrew Rybchenko, Ashish Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Nagadheeraj Rottela, Srikanth Jampala, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru, Chengwen Feng,
	Kevin Laatz, Conor Walsh, Timothy McDaniel, Jerin Jacob,
	Pavan Nikhilesh, Elena Agostini, Ashwin Sekhar T K, Harman Kalra,
	Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Min Hu (Connor),
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Dongdong Liu, Yisen Zhuang, Yuying Zhang,
	Beilei Xing, Junfeng Guo, Andrew Boyer, Rosen Xu, Qiming Yang,
	Stephen Hemminger, Long Li, Jiawen Wu, Devendra Singh Rawat,
	Maciej Czekaj, Jian Wang, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Tianfei zhang,
	Jingjing Wu, Ori Kam, Xiao Wang, Vijay Kumar Srivastava,
	Thomas Monjalon, Ferruh Yigit

On Thu, Jul 28, 2022 at 05:26:30PM +0200, David Marchand wrote:
> The pci 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 <david.marchand@redhat.com>
> ---
> Changes since RFC v2:                                                           
> - squashed cleanup for this bus code from other patches,
> - updated release notes,
>
It's a bit harder to review squashed IMHO, but the changes probably do
belong together.

Acked-by: Bruce Richardson <bruce.richardson@intel.com> 

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 19/26] bus: move IOVA definition from header
  2022-07-28 15:26   ` [RFC v3 19/26] bus: move IOVA definition from header David Marchand
@ 2022-07-28 16:48     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:48 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Aman Singh, Yuying Zhang, Sunila Sahu, Fan Zhang,
	Ashish Gupta, Gaetan Rivet, Anatoly Burakov, Akhil Goyal,
	Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy,
	Pallavi Kadam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Reshma Pattan, Stephen Hemminger

On Thu, Jul 28, 2022 at 05:26:33PM +0200, David Marchand wrote:
> iova enum definition does not need to be defined as part of the bus API.
> Move it to rte_eal.h.
> With this step, rte_eal.h does not depend on rte_bus.h and rte_dev.h.
> Fix existing code that was relying on these implicit inclusions.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 20/26] bus: introduce accessors
  2022-07-28 15:26   ` [RFC v3 20/26] bus: introduce accessors David Marchand
@ 2022-07-28 16:51     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:51 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Aman Singh, Yuying Zhang, Anatoly Burakov, Ray Kinsella

On Thu, Jul 28, 2022 at 05:26:34PM +0200, David Marchand wrote:
> Add helpers to get a rte_bus object details.
> This will be used externally.
> Internal users may still dereference a rte_bus object.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> Changes since RFC v1:
> - changed approach: only external users are updated,
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 16/26] bus/pci: make driver-only headers private
  2022-07-28 16:46     ` Bruce Richardson
@ 2022-07-28 16:52       ` Ajit Khaparde
  0 siblings, 0 replies; 231+ messages in thread
From: Ajit Khaparde @ 2022-07-28 16:52 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: David Marchand, dpdk-dev, Nicolas Chautru, Ray Kinsella,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Matan Azrad, Viacheslav Ovsiienko, Fan Zhang, Andrew Rybchenko,
	Ashish Gupta, Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph,
	Tejasree Kondoj, Nagadheeraj Rottela, Srikanth Jampala, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru, Chengwen Feng,
	Kevin Laatz, Conor Walsh, Timothy McDaniel, Jerin Jacob,
	Pavan Nikhilesh, Elena Agostini, Ashwin Sekhar T K, Harman Kalra,
	Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Chas Williams, Min Hu (Connor),
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Dongdong Liu, Yisen Zhuang, Yuying Zhang,
	Beilei Xing, Junfeng Guo, Andrew Boyer, Rosen Xu, Qiming Yang,
	Stephen Hemminger, Long Li, Jiawen Wu, Devendra Singh Rawat,
	Maciej Czekaj, Jian Wang, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Tianfei zhang,
	Jingjing Wu, Ori Kam, Xiao Wang, Vijay Kumar Srivastava,
	Thomas Monjalon, Ferruh Yigit

[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]

On Thu, Jul 28, 2022 at 9:47 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Thu, Jul 28, 2022 at 05:26:30PM +0200, David Marchand wrote:
> > The pci 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 <david.marchand@redhat.com>
> > ---
> > Changes since RFC v2:
> > - squashed cleanup for this bus code from other patches,
> > - updated release notes,
> >
> It's a bit harder to review squashed IMHO, but the changes probably do
> belong together.
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 21/26] bus: hide bus object
  2022-07-28 15:26   ` [RFC v3 21/26] bus: hide bus object David Marchand
@ 2022-07-28 16:56     ` Bruce Richardson
  2022-07-28 19:26       ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:56 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Rosen Xu, Anatoly Burakov, Stephen Hemminger,
	Long Li, Matan Azrad, Viacheslav Ovsiienko, Kevin Laatz,
	Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

On Thu, Jul 28, 2022 at 05:26:35PM +0200, David Marchand wrote:
> Make rte_bus opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Introduce a new driver header and move rte_bus definition and helpers.
> Update drivers and library to use the internal header.
> 
> Some applications may have been dereferencing rte_bus objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> Changes since RFC v2:
> - updated release notes,
> - marked accessors as stable,
> 
> Changes since RFC v1:
> - update all existing users of the public header to use the internal one,
> 

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

One small comment below...

> ---
>  app/test/test_devargs.c                  |   2 +-
<snip>
>  lib/pcapng/rte_pcapng.c                  |   2 +-
>  38 files changed, 343 insertions(+), 319 deletions(-)
>  create mode 100644 lib/eal/include/bus_driver.h
> 
> diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
> index ac5bc34c18..0a4c34a1ad 100644
> --- a/app/test/test_devargs.c
> +++ b/app/test/test_devargs.c
> @@ -9,7 +9,7 @@
>  #include <rte_common.h>
>  #include <rte_devargs.h>
>  #include <rte_kvargs.h>
> -#include <rte_bus.h>
> +#include <bus_driver.h>
>  #include <rte_class.h>
>  

This seems a strange file to need to access bus internals. Maybe something
to investigate in future.


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 22/26] dev: introduce driver accessors
  2022-07-28 15:26   ` [RFC v3 22/26] dev: introduce driver accessors David Marchand
@ 2022-07-28 16:59     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 16:59 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Aman Singh, Yuying Zhang, Ray Kinsella, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko

On Thu, Jul 28, 2022 at 05:26:36PM +0200, David Marchand wrote:
> Prepare for making the driver object opaque by adding accessors.
> Update existing "external" users.
> Internal users may still dereference a rte_driver object.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 23/26] dev: hide driver object
  2022-07-28 15:26   ` [RFC v3 23/26] dev: hide driver object David Marchand
@ 2022-07-28 17:00     ` Bruce Richardson
  2022-08-01 17:18       ` Ajit Khaparde
  2022-08-01  7:06     ` Jayatheerthan, Jay
  1 sibling, 1 reply; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 17:00 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Ajit Khaparde, Raveendra Padasalagi,
	Vikas Gupta, Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph,
	Tejasree Kondoj, Gagandeep Singh, Kevin Laatz, Timothy McDaniel,
	Jerin Jacob, Elena Agostini, Ciara Loftus, Qi Zhang,
	Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Gaetan Rivet, Xiao Wang,
	Yuying Zhang, Beilei Xing, Jingjing Wu, Qiming Yang, Matan Azrad,
	Viacheslav Ovsiienko, Chaoyong He, Niklas Soderlund,
	Harman Kalra, Devendra Singh Rawat, Andrew Rybchenko,
	Maciej Czekaj, Maxime Coquelin, Chenbo Xia, Jochen Behrens,
	Jakub Palider, Tomasz Duszynski, Ori Kam, Akhil Goyal,
	Chengwen Feng, Ray Kinsella, Thomas Monjalon, Ferruh Yigit,
	Abhinandan Gujjar, Jay Jayatheerthan, Olivier Matz,
	Reshma Pattan

On Thu, Jul 28, 2022 at 05:26:37PM +0200, David Marchand wrote:
> Make rte_driver opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Introduce a new driver header and move rte_driver definition.
> Update drivers and library to use the internal header.
> 
> Some applications may have been dereferencing rte_driver objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 24/26] dev: introduce device accessors
  2022-07-28 15:26   ` [RFC v3 24/26] dev: introduce device accessors David Marchand
@ 2022-07-28 17:01     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 17:01 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Maryam Tahhan, Reshma Pattan, Aman Singh, Yuying Zhang,
	Maxime Coquelin, Chenbo Xia, Ray Kinsella, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko

On Thu, Jul 28, 2022 at 05:26:38PM +0200, David Marchand wrote:
> Prepare for making the device object opaque by adding accessors.
> Update existing "external" users.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> Changes since RFC v2:
> - added rte_dev_devargs,
> - updated testpmd,
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com> 

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 25/26] dev: provide Bus specific information
  2022-07-28 15:26   ` [RFC v3 25/26] dev: provide Bus specific information David Marchand
@ 2022-07-28 17:03     ` Bruce Richardson
  2022-07-28 19:45       ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 17:03 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Aman Singh, Yuying Zhang, Ray Kinsella

On Thu, Jul 28, 2022 at 05:26:39PM +0200, David Marchand wrote:
> For diagnostic, it may be useful to provide a description of the device
> with Bus specific information like, for PCI, the vendor and device ID.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Good idea.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 26/26] dev: hide device object
  2022-07-28 15:26   ` [RFC v3 26/26] dev: hide device object David Marchand
@ 2022-07-28 17:04     ` Bruce Richardson
  0 siblings, 0 replies; 231+ messages in thread
From: Bruce Richardson @ 2022-07-28 17:04 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Ray Kinsella, Maxime Coquelin, Chenbo Xia

On Thu, Jul 28, 2022 at 05:26:40PM +0200, David Marchand wrote:
> Make rte_device opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Some applications may have been dereferencing rte_device objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 21/26] bus: hide bus object
  2022-07-28 16:56     ` Bruce Richardson
@ 2022-07-28 19:26       ` David Marchand
  2022-07-29 10:01         ` Bruce Richardson
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 19:26 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Rosen Xu, Anatoly Burakov, Stephen Hemminger,
	Long Li, Matan Azrad, Viacheslav Ovsiienko, Kevin Laatz,
	Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

On Thu, Jul 28, 2022 at 6:57 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Thu, Jul 28, 2022 at 05:26:35PM +0200, David Marchand wrote:
> > Make rte_bus opaque for non internal users.
> > This will make extending this object possible without breaking the ABI.
> >
> > Introduce a new driver header and move rte_bus definition and helpers.
> > Update drivers and library to use the internal header.
> >
> > Some applications may have been dereferencing rte_bus objects, mark
> > this object's accessors as stable.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> > Changes since RFC v2:
> > - updated release notes,
> > - marked accessors as stable,
> >
> > Changes since RFC v1:
> > - update all existing users of the public header to use the internal one,
> >
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>
> One small comment below...
>
> > ---
> >  app/test/test_devargs.c                  |   2 +-
> <snip>
> >  lib/pcapng/rte_pcapng.c                  |   2 +-
> >  38 files changed, 343 insertions(+), 319 deletions(-)
> >  create mode 100644 lib/eal/include/bus_driver.h
> >
> > diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
> > index ac5bc34c18..0a4c34a1ad 100644
> > --- a/app/test/test_devargs.c
> > +++ b/app/test/test_devargs.c
> > @@ -9,7 +9,7 @@
> >  #include <rte_common.h>
> >  #include <rte_devargs.h>
> >  #include <rte_kvargs.h>
> > -#include <rte_bus.h>
> > +#include <bus_driver.h>
> >  #include <rte_class.h>
> >
>
> This seems a strange file to need to access bus internals. Maybe something
> to investigate in future.

Yeah... I am not sure it is worth fixing.

This code dereferences a bus object to check the ring driver
registered (by calling vdev_bus->parse()).
We could make it possible to list the drivers (maybe per bus, or even globally).
Or we may expose something like bus_can_parse() / rte_bus_find_by_device_name().

But I did not find applications needing this so I let the code as is.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 06/26] examples/ethtool: prefer device name
  2022-07-28 16:32     ` Bruce Richardson
@ 2022-07-28 19:27       ` David Marchand
  0 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 19:27 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Thu, Jul 28, 2022 at 6:32 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Thu, Jul 28, 2022 at 05:26:20PM +0200, David Marchand wrote:
> > Rely on the generic device name rather than restrict to only supporting
> > PCI devices.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> >  examples/ethtool/lib/rte_ethtool.c | 17 ++---------------
> >  1 file changed, 2 insertions(+), 15 deletions(-)
> >
> > diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
> > index ffaad96498..88dc917b73 100644
> > --- a/examples/ethtool/lib/rte_ethtool.c
> > +++ b/examples/ethtool/lib/rte_ethtool.c
> > @@ -8,7 +8,6 @@
> >  #include <rte_version.h>
> >  #include <rte_ethdev.h>
> >  #include <rte_ether.h>
> > -#include <rte_bus_pci.h>
> >  #ifdef RTE_NET_IXGBE
> >  #include <rte_pmd_ixgbe.h>
> >  #endif
> > @@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
> >  {
> >       struct rte_eth_dev_info dev_info;
> >       struct rte_dev_reg_info reg_info;
> > -     const struct rte_pci_device *pci_dev;
> > -     const struct rte_bus *bus = NULL;
> >       int n;
> >       int ret;
> >
> > @@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
> >       strlcpy(drvinfo->driver, dev_info.driver_name,
> >               sizeof(drvinfo->driver));
> >       strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
> > -     /* TODO: replace bus_info by rte_devargs.name */
> > -     if (dev_info.device)
> > -             bus = rte_bus_find_by_device(dev_info.device);
> > -     if (bus && !strcmp(bus->name, "pci")) {
> > -             pci_dev = RTE_DEV_TO_PCI(dev_info.device);
> > -             snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
> > -                     "%04x:%02x:%02x.%x",
> > -                     pci_dev->addr.domain, pci_dev->addr.bus,
> > -                     pci_dev->addr.devid, pci_dev->addr.function);
> > -     } else {
> > -             snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
> > -     }
> > +     strlcpy(drvinfo->bus_info, dev_info.device->name,
> > +             sizeof(drvinfo->bus_info));
> >
>
> Does the bus_info field need to be renamed now? It seems strange coping a
> device name to a bus info field.

This bus_info name in the example is copied from ethtool.

So maybe it is the other way, and I should rename the new field I
added in rte_device..


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 08/26] dev: move unrelated macros from header
  2022-07-28 16:38     ` Bruce Richardson
@ 2022-07-28 19:32       ` David Marchand
  2022-07-29  9:58         ` Bruce Richardson
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-28 19:32 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu,
	Shijith Thotton, Srisivasubramanian Srinivasan, Chengwen Feng,
	Kevin Laatz, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Olivier Matz, Ori Kam, Akhil Goyal, Maxime Coquelin, Chenbo Xia

On Thu, Jul 28, 2022 at 6:38 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Thu, Jul 28, 2022 at 05:26:22PM +0200, David Marchand wrote:
> > RTE_FUNC_PTR_OR_* macros have nothing to do with the rte_device object
> > and associated API.
> > Move them to rte_common.h and include it where needed.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
>
> Personally, I really don't like these macros at all. I think having the
> check explicitly in the code would be far more readable, and would only be
> one line of code longer than the macro call. Is there some private header
> file we could move these to instead of rte_common.h so we can drop their
> use in future if we decide to?

I don't like them either.
Not sure where to put them though...

My "grep-all" shows no user in the projects consuming DPDK I track.
We could mark those macros deprecated, fix our code and drop them later.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 25/26] dev: provide Bus specific information
  2022-07-28 17:03     ` Bruce Richardson
@ 2022-07-28 19:45       ` David Marchand
  0 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-28 19:45 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Aman Singh, Yuying Zhang, Ray Kinsella

On Thu, Jul 28, 2022 at 7:03 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Thu, Jul 28, 2022 at 05:26:39PM +0200, David Marchand wrote:
> > For diagnostic, it may be useful to provide a description of the device
> > with Bus specific information like, for PCI, the vendor and device ID.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> Good idea.

The idea came from OVS, which provides some PCI specific info in the
port status.
https://github.com/openvswitch/ovs/blob/master/lib/netdev-dpdk.c#L3655
https://github.com/openvswitch/ovs/blob/master/lib/netdev-dpdk.c#L3690


This is a pretty dumb API (returning a simple string).
Maybe something more flexible like returning some TLV-ish structure or
a map of strings (like OVS smap) would be better...
The function name could be more generic rte_dev_info(), in this case.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [RFC v3 03/26] raw/ifpga: remove PCI bus accessor
  2022-07-28 15:26   ` [RFC v3 03/26] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-07-29  2:36     ` Xu, Rosen
  0 siblings, 0 replies; 231+ messages in thread
From: Xu, Rosen @ 2022-07-29  2:36 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: Ray Kinsella, Zhang, Tianfei, Huang, Wei

Hi,

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, July 28, 2022 23:26
> To: dev@dpdk.org
> Cc: Ray Kinsella <mdr@ashroe.eu>; Xu, Rosen <rosen.xu@intel.com>; Zhang,
> Tianfei <tianfei.zhang@intel.com>
> Subject: [RFC v3 03/26] raw/ifpga: remove PCI bus accessor
> 
> There is no in-tree user for this accessor that returns the PCI bus object.
> On the other hand, a bus object can be retrieved by name using
> rte_bus_find_by_name.
> We can remove this driver specific API.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> Changes since RFC v2:
> - updated release notes,
> 
> ---
>  doc/guides/rel_notes/deprecation.rst   |  3 ---
>  doc/guides/rel_notes/release_22_11.rst |  2 ++
>  drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
>  drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
>  drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
>  drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
>  drivers/raw/ifpga/version.map          |  1 -
>  7 files changed, 3 insertions(+), 27 deletions(-)
> 


Acked-by: Rosen Xu <rosen.xu@intel.com>



^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [RFC v3 14/26] bus/ifpga: cleanup exported symbols
  2022-07-28 15:26   ` [RFC v3 14/26] bus/ifpga: cleanup exported symbols David Marchand
@ 2022-07-29  2:36     ` Xu, Rosen
  0 siblings, 0 replies; 231+ messages in thread
From: Xu, Rosen @ 2022-07-29  2:36 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: Ray Kinsella, Zhang, Tianfei, Huang, Wei

Hi,

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, July 28, 2022 23:26
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Zhang,
> Tianfei <tianfei.zhang@intel.com>
> Subject: [RFC v3 14/26] bus/ifpga: cleanup exported symbols
> 
> Remove unused symbols (exposed only in an internal header which
> guarantees that no application out there relied on them).
> 
> Remove rte_ prefix and inline the rest to avoid having to expose them as
> global symbols for a relatively small added value.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/bus/ifpga/ifpga_bus.c    | 13 +++--
>  drivers/bus/ifpga/ifpga_common.c | 88 --------------------------------
> drivers/bus/ifpga/ifpga_common.h | 54 ++++++++++++++++----
>  drivers/bus/ifpga/meson.build    |  2 +-
>  drivers/bus/ifpga/version.map    |  2 -
>  drivers/raw/ifpga/ifpga_rawdev.c |  2 +-
>  6 files changed, 53 insertions(+), 108 deletions(-)  delete mode 100644
> drivers/bus/ifpga/ifpga_common.c
> 

Acked-by: Rosen Xu <rosen.xu@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [RFC v3 15/26] bus/ifpga: make driver-only headers private
  2022-07-28 15:26   ` [RFC v3 15/26] bus/ifpga: make driver-only headers private David Marchand
@ 2022-07-29  2:37     ` Xu, Rosen
  0 siblings, 0 replies; 231+ messages in thread
From: Xu, Rosen @ 2022-07-29  2:37 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: Ray Kinsella, Zhang, Tianfei, Huang, Wei

Hi,

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, July 28, 2022 23:26
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Zhang,
> Tianfei <tianfei.zhang@intel.com>
> Subject: [RFC v3 15/26] bus/ifpga: make driver-only headers private
> 
> The ifpga bus interface is for drivers only.
> Mark as internal and move the header in the driver headers list.
> 
> While at it, cleanup the code:
> - 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 <david.marchand@redhat.com>
> ---
> Changes since RFC v2:
> - squashed cleanup for this bus code from other patches,
> - updated release notes,
> 
> ---
>  doc/guides/rel_notes/release_22_11.rst         |  2 +-
>  .../{rte_bus_ifpga.h => bus_ifpga_driver.h}    | 18 ++++++++----------
>  drivers/bus/ifpga/ifpga_bus.c                  |  6 +++---
>  drivers/bus/ifpga/ifpga_common.h               |  2 +-
>  drivers/bus/ifpga/meson.build                  |  2 +-
>  drivers/bus/ifpga/version.map                  |  2 +-
>  drivers/net/ipn3ke/ipn3ke_ethdev.c             |  2 +-
>  drivers/net/ipn3ke/ipn3ke_ethdev.h             |  2 +-
>  drivers/net/ipn3ke/ipn3ke_flow.c               |  2 +-
>  drivers/net/ipn3ke/ipn3ke_representor.c        |  2 +-
>  drivers/net/ipn3ke/ipn3ke_tm.c                 |  2 +-
>  drivers/raw/ifpga/afu_pmd_core.h               |  2 +-
>  drivers/raw/ifpga/afu_pmd_he_hssi.c            |  2 +-
>  drivers/raw/ifpga/afu_pmd_he_lpbk.c            |  2 +-
>  drivers/raw/ifpga/afu_pmd_he_mem.c             |  2 +-
>  drivers/raw/ifpga/afu_pmd_n3000.c              |  2 +-
>  drivers/raw/ifpga/ifpga_rawdev.c               |  2 +-
>  17 files changed, 26 insertions(+), 28 deletions(-)  rename
> drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
> 

Acked-by: Rosen Xu <rosen.xu@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [RFC v3 17/26] bus/vdev: make driver-only headers private
  2022-07-28 15:26   ` [RFC v3 17/26] bus/vdev: " David Marchand
@ 2022-07-29  2:38     ` Xu, Rosen
  0 siblings, 0 replies; 231+ messages in thread
From: Xu, Rosen @ 2022-07-29  2:38 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Gagandeep Singh, Hemant Agrawal, Chautru, Nicolas, Ray Kinsella,
	Daly, Lee, Zhang, Roy Fan, Ashish Gupta, Sunila Sahu,
	Ruifeng Wang, Ajit Khaparde, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, De Lara Guarch, Pablo, Michael Shamis,
	Liron Himi, Chengwen Feng, Laatz, Kevin, Richardson, Bruce,
	Sachin Saxena, Jerin Jacob, Liang Ma, Mccarthy,  Peter,
	Van Haaren, Harry, John W. Linville, Loftus, Ciara, Zhang, Qi Z,
	Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Jakub Grajciar, Zyta Szpak, Tetsuya Mukawa,
	Harman Kalra, Singh, Jasvinder, Dumitrescu, Cristian,
	Matan Azrad, Maxime Coquelin, Xia, Chenbo, Jakub Palider,
	Tomasz Duszynski, Zhang, Tianfei, Thomas Monjalon, Huang, Wei,
	Ferruh Yigit, Andrew Rybchenko

Hi,

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, July 28, 2022 23:27
> To: dev@dpdk.org
> Cc: Gagandeep Singh <g.singh@nxp.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Chautru, Nicolas <nicolas.chautru@intel.com>;
> Ray Kinsella <mdr@ashroe.eu>; Daly, Lee <lee.daly@intel.com>; Zhang, Roy
> Fan <roy.fan.zhang@intel.com>; Ashish Gupta <ashish.gupta@marvell.com>;
> Sunila Sahu <ssahu@marvell.com>; Ruifeng Wang <ruifeng.wang@arm.com>;
> Ajit Khaparde <ajit.khaparde@broadcom.com>; Raveendra Padasalagi
> <raveendra.padasalagi@broadcom.com>; Vikas Gupta
> <vikas.gupta@broadcom.com>; Chandubabu Namburu <chandu@amd.com>;
> De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Michael Shamis
> <michaelsh@marvell.com>; Liron Himi <lironh@marvell.com>; Chengwen
> Feng <fengchengwen@huawei.com>; Laatz, Kevin <kevin.laatz@intel.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Sachin Saxena
> <sachin.saxena@oss.nxp.com>; Jerin Jacob <jerinj@marvell.com>; Liang Ma
> <liangma@liangbit.com>; Mccarthy, Peter <peter.mccarthy@intel.com>; Van
> Haaren, Harry <harry.van.haaren@intel.com>; John W. Linville
> <linville@tuxdriver.com>; Loftus, Ciara <ciara.loftus@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Chas Williams <chas3@att.com>; Min Hu (Connor)
> <humin29@huawei.com>; Gaetan Rivet <grive@u256.net>; Xu, Rosen
> <rosen.xu@intel.com>; Jakub Grajciar <jgrajcia@cisco.com>; Zyta Szpak
> <zr@semihalf.com>; Tetsuya Mukawa <mtetsuyah@gmail.com>; Harman
> Kalra <hkalra@marvell.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Matan Azrad
> <matan@nvidia.com>; Maxime Coquelin <maxime.coquelin@redhat.com>;
> Xia, Chenbo <chenbo.xia@intel.com>; Jakub Palider <jpalider@marvell.com>;
> Tomasz Duszynski <tduszynski@marvell.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Thomas Monjalon <thomas@monjalon.net>;
> Ferruh Yigit <ferruh.yigit@xilinx.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>
> Subject: [RFC v3 17/26] bus/vdev: make driver-only headers private
> 
> The vdev 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 <david.marchand@redhat.com>
> ---
> Changes since RFC v2:
> - squashed cleanup for this bus code from other patches,
> - updated release notes,
> 
> ---
>  app/test/test_vdev.c                          |   2 +-
>  doc/guides/rel_notes/release_22_11.rst        |   4 +-
>  drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
>  drivers/baseband/null/bbdev_null.c            |   2 +-
>  .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
>  drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++++++++++++
>  drivers/bus/vdev/meson.build                  |   1 +
>  drivers/bus/vdev/rte_bus_vdev.h               | 134 ----------------
>  drivers/bus/vdev/vdev.c                       |   8 +-
>  drivers/bus/vdev/vdev_params.c                |   1 -
>  drivers/bus/vdev/version.map                  |   9 +-
>  drivers/compress/isal/isal_compress_pmd.c     |   2 +-
>  drivers/compress/zlib/zlib_pmd.c              |   2 +-
>  drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
>  drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
>  drivers/crypto/caam_jr/caam_jr.c              |   2 +-
>  drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
>  drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
>  drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
>  drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
>  drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
>  drivers/crypto/null/null_crypto_pmd.c         |   2 +-
>  drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
>  drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
>  drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
>  drivers/event/dpaa2/dpaa2_eventdev.c          |   2 +-
>  drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   2 +-
>  drivers/event/octeontx/ssovf_evdev.c          |   2 +-
>  drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
>  drivers/event/opdl/opdl_evdev.c               |   2 +-
>  drivers/event/opdl/opdl_evdev_init.c          |   2 +-
>  drivers/event/opdl/opdl_test.c                |   2 +-
>  drivers/event/skeleton/skeleton_eventdev.c    |   2 +-
>  drivers/event/sw/sw_evdev.c                   |   2 +-
>  drivers/event/sw/sw_evdev_selftest.c          |   2 +-
>  drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
>  drivers/net/af_xdp/rte_eth_af_xdp.c           |   2 +-
>  drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
>  drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
>  drivers/net/failsafe/failsafe.c               |   3 +-
>  drivers/net/ipn3ke/ipn3ke_ethdev.h            |   2 +-
>  drivers/net/kni/rte_eth_kni.c                 |   2 +-
>  drivers/net/memif/memif_socket.c              |   2 +-
>  drivers/net/memif/rte_eth_memif.c             |   2 +-
>  drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
>  drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
>  drivers/net/null/rte_eth_null.c               |   2 +-
>  drivers/net/octeontx/octeontx_ethdev.c        |   2 +-
>  drivers/net/pcap/pcap_ethdev.c                |   2 +-
>  drivers/net/pfe/pfe_ethdev.c                  |   2 +-
>  drivers/net/ring/rte_eth_ring.c               |   2 +-
>  drivers/net/softnic/rte_eth_softnic.c         |   2 +-
>  drivers/net/tap/rte_eth_tap.c                 |   2 +-
>  drivers/net/vdev_netvsc/vdev_netvsc.c         |   2 +-
>  drivers/net/vhost/rte_eth_vhost.c             |   2 +-
>  drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
>  drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
>  drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
>  drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
>  drivers/raw/skeleton/skeleton_rawdev.c        |   2 +-
>  drivers/raw/skeleton/skeleton_rawdev_test.c   |   2 +-
>  lib/ethdev/ethdev_vdev.h                      |   2 +-
>  lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
>  63 files changed, 221 insertions(+), 200 deletions(-)  create mode 100644
> drivers/bus/vdev/bus_vdev_driver.h

Acked-by: Rosen Xu <rosen.xu@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [RFC v3 16/26] bus/pci: make driver-only headers private
  2022-07-28 15:26   ` [RFC v3 16/26] bus/pci: " David Marchand
  2022-07-28 16:46     ` Bruce Richardson
@ 2022-07-29  2:41     ` Xu, Rosen
  1 sibling, 0 replies; 231+ messages in thread
From: Xu, Rosen @ 2022-07-29  2:41 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Chautru, Nicolas, Ray Kinsella, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Matan Azrad, Viacheslav Ovsiienko,
	Zhang, Roy Fan, Andrew Rybchenko, Ashish Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Nagadheeraj Rottela, Srikanth Jampala, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru, Chengwen Feng,
	Richardson, Bruce, Laatz, Kevin, Walsh,  Conor, McDaniel,
	Timothy, Jerin Jacob, Pavan Nikhilesh, Elena Agostini,
	Ashwin Sekhar T K, Harman Kalra, Shepard Siegel, Ed Czeck,
	John Miller, Webster, Steven, Peters, Matt, Rasesh Mody,
	Shahed Shaikh, Ajit Khaparde, Somnath Kotur, Chas Williams,
	Min Hu (Connor),
	Rahul Lakkireddy, Su, Simei, Wu, Wenjun1, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	Daley, John, Hyong Youb Kim, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Dongdong Liu, Yisen Zhuang, Zhang, Yuying, Xing,
	Beilei, Guo, Junfeng, Andrew Boyer, Yang, Qiming,
	Stephen Hemminger, Long Li, Jiawen Wu, Devendra Singh Rawat,
	Maciej Czekaj, Jian Wang, Maxime Coquelin, Xia, Chenbo,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Zhang, Tianfei,
	Wu, Jingjing, Ori Kam, Wang, Xiao W, Vijay Kumar Srivastava,
	Thomas Monjalon, Ferruh Yigit

Hi,

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, July 28, 2022 23:27
> To: dev@dpdk.org
> Cc: Chautru, Nicolas <nicolas.chautru@intel.com>; Ray Kinsella
> <mdr@ashroe.eu>; Nithin Dabilpuram <ndabilpuram@marvell.com>; Kiran
> Kumar K <kirankumark@marvell.com>; Sunil Kumar Kori
> <skori@marvell.com>; Satha Rao <skoteshwar@marvell.com>; Matan Azrad
> <matan@nvidia.com>; Viacheslav Ovsiienko <viacheslavo@nvidia.com>;
> Zhang, Roy Fan <roy.fan.zhang@intel.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Ashish Gupta
> <ashish.gupta@marvell.com>; Chandubabu Namburu <chandu@amd.com>;
> Ankur Dwivedi <adwivedi@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; Tejasree Kondoj <ktejasree@marvell.com>;
> Nagadheeraj Rottela <rnagadheeraj@marvell.com>; Srikanth Jampala
> <jsrikanth@marvell.com>; Jay Zhou <jianjay.zhou@huawei.com>; Radha
> Mohan Chintakuntla <radhac@marvell.com>; Veerasenareddy Burru
> <vburru@marvell.com>; Chengwen Feng <fengchengwen@huawei.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Laatz, Kevin
> <kevin.laatz@intel.com>; Walsh, Conor <conor.walsh@intel.com>; McDaniel,
> Timothy <timothy.mcdaniel@intel.com>; Jerin Jacob <jerinj@marvell.com>;
> Pavan Nikhilesh <pbhagavatula@marvell.com>; Elena Agostini
> <eagostini@nvidia.com>; Ashwin Sekhar T K <asekhar@marvell.com>;
> Harman Kalra <hkalra@marvell.com>; Shepard Siegel
> <shepard.siegel@atomicrules.com>; Ed Czeck <ed.czeck@atomicrules.com>;
> John Miller <john.miller@atomicrules.com>; Webster, Steven
> <steven.webster@windriver.com>; Peters, Matt
> <matt.peters@windriver.com>; Rasesh Mody <rmody@marvell.com>;
> Shahed Shaikh <shshaikh@marvell.com>; Ajit Khaparde
> <ajit.khaparde@broadcom.com>; Somnath Kotur
> <somnath.kotur@broadcom.com>; Chas Williams <chas3@att.com>; Min Hu
> (Connor) <humin29@huawei.com>; Rahul Lakkireddy
> <rahul.lakkireddy@chelsio.com>; Su, Simei <simei.su@intel.com>; Wu,
> Wenjun1 <wenjun1.wu@intel.com>; Marcin Wojtas <mw@semihalf.com>;
> Michal Krawczyk <mk@semihalf.com>; Shai Brandes
> <shaibran@amazon.com>; Evgeny Schemeilin <evgenys@amazon.com>;
> Igor Chauskin <igorch@amazon.com>; Daley, John <johndale@cisco.com>;
> Hyong Youb Kim <hyonkim@cisco.com>; Ziyang Xuan
> <xuanziyang2@huawei.com>; Xiaoyun Wang
> <cloud.wangxiaoyun@huawei.com>; Guoyang Zhou
> <zhouguoyang@huawei.com>; Dongdong Liu <liudongdong3@huawei.com>;
> Yisen Zhuang <yisen.zhuang@huawei.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Guo,
> Junfeng <junfeng.guo@intel.com>; Andrew Boyer <aboyer@pensando.io>;
> Xu, Rosen <rosen.xu@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
> Stephen Hemminger <sthemmin@microsoft.com>; Long Li
> <longli@microsoft.com>; Jiawen Wu <jiawenwu@trustnetic.com>; Devendra
> Singh Rawat <dsinghrawat@marvell.com>; Maciej Czekaj
> <mczekaj@marvell.com>; Jian Wang <jianwang@trustnetic.com>; Maxime
> Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo
> <chenbo.xia@intel.com>; Jochen Behrens <jbehrens@vmware.com>; Jakub
> Palider <jpalider@marvell.com>; Tomasz Duszynski
> <tduszynski@marvell.com>; Zhang, Tianfei <tianfei.zhang@intel.com>; Wu,
> Jingjing <jingjing.wu@intel.com>; Ori Kam <orika@nvidia.com>; Wang, Xiao
> W <xiao.w.wang@intel.com>; Vijay Kumar Srivastava <vsrivast@xilinx.com>;
> Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit
> <ferruh.yigit@xilinx.com>
> Subject: [RFC v3 16/26] bus/pci: make driver-only headers private
> 
> The pci 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 <david.marchand@redhat.com>
> ---
> Changes since RFC v2:
> - squashed cleanup for this bus code from other patches,
> - updated release notes,
> 
Acked-by: Rosen Xu <rosen.xu@intel.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 08/26] dev: move unrelated macros from header
  2022-07-28 19:32       ` David Marchand
@ 2022-07-29  9:58         ` Bruce Richardson
  2022-07-29 13:22           ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Bruce Richardson @ 2022-07-29  9:58 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu,
	Shijith Thotton, Srisivasubramanian Srinivasan, Chengwen Feng,
	Kevin Laatz, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Olivier Matz, Ori Kam, Akhil Goyal, Maxime Coquelin, Chenbo Xia

On Thu, Jul 28, 2022 at 09:32:38PM +0200, David Marchand wrote:
> On Thu, Jul 28, 2022 at 6:38 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > On Thu, Jul 28, 2022 at 05:26:22PM +0200, David Marchand wrote:
> > > RTE_FUNC_PTR_OR_* macros have nothing to do with the rte_device object
> > > and associated API.
> > > Move them to rte_common.h and include it where needed.
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---
> >
> > Personally, I really don't like these macros at all. I think having the
> > check explicitly in the code would be far more readable, and would only be
> > one line of code longer than the macro call. Is there some private header
> > file we could move these to instead of rte_common.h so we can drop their
> > use in future if we decide to?
> 
> I don't like them either.
> Not sure where to put them though...
> 
> My "grep-all" shows no user in the projects consuming DPDK I track.
> We could mark those macros deprecated, fix our code and drop them later.
> 
+1 to that.
Can they be marked as deprecated as part of the move perhaps (assuming we
get agreement to kill them?)

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 21/26] bus: hide bus object
  2022-07-28 19:26       ` David Marchand
@ 2022-07-29 10:01         ` Bruce Richardson
  2022-07-29 11:14           ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Bruce Richardson @ 2022-07-29 10:01 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Rosen Xu, Anatoly Burakov, Stephen Hemminger,
	Long Li, Matan Azrad, Viacheslav Ovsiienko, Kevin Laatz,
	Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

On Thu, Jul 28, 2022 at 09:26:16PM +0200, David Marchand wrote:
> On Thu, Jul 28, 2022 at 6:57 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > On Thu, Jul 28, 2022 at 05:26:35PM +0200, David Marchand wrote:
> > > Make rte_bus opaque for non internal users.
> > > This will make extending this object possible without breaking the ABI.
> > >
> > > Introduce a new driver header and move rte_bus definition and helpers.
> > > Update drivers and library to use the internal header.
> > >
> > > Some applications may have been dereferencing rte_bus objects, mark
> > > this object's accessors as stable.
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---
> > > Changes since RFC v2:
> > > - updated release notes,
> > > - marked accessors as stable,
> > >
> > > Changes since RFC v1:
> > > - update all existing users of the public header to use the internal one,
> > >
> >
> > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> >
> > One small comment below...
> >
> > > ---
> > >  app/test/test_devargs.c                  |   2 +-
> > <snip>
> > >  lib/pcapng/rte_pcapng.c                  |   2 +-
> > >  38 files changed, 343 insertions(+), 319 deletions(-)
> > >  create mode 100644 lib/eal/include/bus_driver.h
> > >
> > > diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
> > > index ac5bc34c18..0a4c34a1ad 100644
> > > --- a/app/test/test_devargs.c
> > > +++ b/app/test/test_devargs.c
> > > @@ -9,7 +9,7 @@
> > >  #include <rte_common.h>
> > >  #include <rte_devargs.h>
> > >  #include <rte_kvargs.h>
> > > -#include <rte_bus.h>
> > > +#include <bus_driver.h>
> > >  #include <rte_class.h>
> > >
> >
> > This seems a strange file to need to access bus internals. Maybe something
> > to investigate in future.
> 
> Yeah... I am not sure it is worth fixing.
> 
> This code dereferences a bus object to check the ring driver
> registered (by calling vdev_bus->parse()).
> We could make it possible to list the drivers (maybe per bus, or even globally).
> Or we may expose something like bus_can_parse() / rte_bus_find_by_device_name().
> 
> But I did not find applications needing this so I let the code as is.
> 
Agree it may not be worth fixing.

However, if we do look to fix, how about just dropping the runtime check
completely and just using a build-time one for the RTE_NET_RING macro. I
don't consider it valid for the tests to run with some of the built drivers
deleted. If it was enabled in the build, I think the tests are ok to assume
it is present at runtime.

/Bruce

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 21/26] bus: hide bus object
  2022-07-29 10:01         ` Bruce Richardson
@ 2022-07-29 11:14           ` David Marchand
  0 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-07-29 11:14 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Ray Kinsella, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Rosen Xu, Anatoly Burakov, Stephen Hemminger,
	Long Li, Matan Azrad, Viacheslav Ovsiienko, Kevin Laatz,
	Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko, Reshma Pattan

On Fri, Jul 29, 2022 at 12:02 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> However, if we do look to fix, how about just dropping the runtime check
> completely and just using a build-time one for the RTE_NET_RING macro. I
> don't consider it valid for the tests to run with some of the built drivers
> deleted. If it was enabled in the build, I think the tests are ok to assume
> it is present at runtime.

The build time check is likely enough, added to my todolist..


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 08/26] dev: move unrelated macros from header
  2022-07-29  9:58         ` Bruce Richardson
@ 2022-07-29 13:22           ` David Marchand
  2022-08-24  6:50             ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-07-29 13:22 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu,
	Shijith Thotton, Srisivasubramanian Srinivasan, Chengwen Feng,
	Kevin Laatz, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Olivier Matz, Ori Kam, Akhil Goyal, Maxime Coquelin, Chenbo Xia

On Fri, Jul 29, 2022 at 11:59 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> > > Personally, I really don't like these macros at all. I think having the
> > > check explicitly in the code would be far more readable, and would only be
> > > one line of code longer than the macro call. Is there some private header
> > > file we could move these to instead of rte_common.h so we can drop their
> > > use in future if we decide to?
> >
> > I don't like them either.
> > Not sure where to put them though...
> >
> > My "grep-all" shows no user in the projects consuming DPDK I track.
> > We could mark those macros deprecated, fix our code and drop them later.
> >
> +1 to that.
> Can they be marked as deprecated as part of the move perhaps (assuming we
> get agreement to kill them?)

Yes.
I'll wait for others to chime in, which means this will wait for after
my days off :-).


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [RFC v3 23/26] dev: hide driver object
  2022-07-28 15:26   ` [RFC v3 23/26] dev: hide driver object David Marchand
  2022-07-28 17:00     ` Bruce Richardson
@ 2022-08-01  7:06     ` Jayatheerthan, Jay
  1 sibling, 0 replies; 231+ messages in thread
From: Jayatheerthan, Jay @ 2022-08-01  7:06 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Chautru, Nicolas, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Zhang, Roy Fan,
	Sunila Sahu, Ashish Gupta, Ajit Khaparde, Raveendra Padasalagi,
	Vikas Gupta, Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph,
	Tejasree Kondoj, Gagandeep Singh, Richardson, Bruce, Laatz,
	Kevin, McDaniel, Timothy, Jerin Jacob, Elena Agostini, Loftus,
	Ciara, Zhang, Qi Z, Shepard Siegel, Ed Czeck, John Miller,
	Webster, Steven, Peters, Matt, Rasesh Mody, Shahed Shaikh,
	Somnath Kotur, Rahul Lakkireddy, Su, Simei, Wu, Wenjun1,
	Marcin Wojtas, Michal Krawczyk, Shai Brandes, Evgeny Schemeilin,
	Igor Chauskin, Daley, John, Hyong Youb Kim, Gaetan Rivet, Wang,
	Xiao W, Zhang, Yuying, Xing, Beilei, Wu, Jingjing, Yang, Qiming,
	Matan Azrad, Viacheslav Ovsiienko, Chaoyong He, Niklas Soderlund,
	Harman Kalra, Devendra Singh Rawat, Andrew Rybchenko,
	Maciej Czekaj, Maxime Coquelin, Xia, Chenbo, Jochen Behrens,
	Jakub Palider, Tomasz Duszynski, Ori Kam, Akhil Goyal,
	Chengwen Feng, Ray Kinsella, Thomas Monjalon, Ferruh Yigit,
	Gujjar, Abhinandan S, Matz, Olivier, Pattan, Reshma

Looks good to me.

Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, July 28, 2022 8:57 PM
> To: dev@dpdk.org
> Cc: Chautru, Nicolas <nicolas.chautru@intel.com>; Parav Pandit <parav@nvidia.com>; Xueming Li <xuemingl@nvidia.com>; Hemant
> Agrawal <hemant.agrawal@nxp.com>; Sachin Saxena <sachin.saxena@oss.nxp.com>; Stephen Hemminger <sthemmin@microsoft.com>;
> Long Li <longli@microsoft.com>; Zhang, Roy Fan <roy.fan.zhang@intel.com>; Sunila Sahu <ssahu@marvell.com>; Ashish Gupta
> <ashish.gupta@marvell.com>; Ajit Khaparde <ajit.khaparde@broadcom.com>; Raveendra Padasalagi
> <raveendra.padasalagi@broadcom.com>; Vikas Gupta <vikas.gupta@broadcom.com>; Chandubabu Namburu <chandu@amd.com>;
> Ankur Dwivedi <adwivedi@marvell.com>; Anoob Joseph <anoobj@marvell.com>; Tejasree Kondoj <ktejasree@marvell.com>;
> Gagandeep Singh <g.singh@nxp.com>; Richardson, Bruce <bruce.richardson@intel.com>; Laatz, Kevin <kevin.laatz@intel.com>;
> McDaniel, Timothy <timothy.mcdaniel@intel.com>; Jerin Jacob <jerinj@marvell.com>; Elena Agostini <eagostini@nvidia.com>; Loftus,
> Ciara <ciara.loftus@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Shepard Siegel <shepard.siegel@atomicrules.com>; Ed Czeck
> <ed.czeck@atomicrules.com>; John Miller <john.miller@atomicrules.com>; Webster, Steven <steven.webster@windriver.com>; Peters,
> Matt <matt.peters@windriver.com>; Rasesh Mody <rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>; Somnath Kotur
> <somnath.kotur@broadcom.com>; Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>; Su, Simei <simei.su@intel.com>; Wu, Wenjun1
> <wenjun1.wu@intel.com>; Marcin Wojtas <mw@semihalf.com>; Michal Krawczyk <mk@semihalf.com>; Shai Brandes
> <shaibran@amazon.com>; Evgeny Schemeilin <evgenys@amazon.com>; Igor Chauskin <igorch@amazon.com>; Daley, John
> <johndale@cisco.com>; Hyong Youb Kim <hyonkim@cisco.com>; Gaetan Rivet <grive@u256.net>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Matan Azrad <matan@nvidia.com>; Viacheslav Ovsiienko
> <viacheslavo@nvidia.com>; Chaoyong He <chaoyong.he@corigine.com>; Niklas Soderlund <niklas.soderlund@corigine.com>; Harman
> Kalra <hkalra@marvell.com>; Devendra Singh Rawat <dsinghrawat@marvell.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Maciej Czekaj <mczekaj@marvell.com>; Maxime Coquelin <maxime.coquelin@redhat.com>; Xia,
> Chenbo <chenbo.xia@intel.com>; Jochen Behrens <jbehrens@vmware.com>; Jakub Palider <jpalider@marvell.com>; Tomasz Duszynski
> <tduszynski@marvell.com>; Ori Kam <orika@nvidia.com>; Akhil Goyal <gakhil@marvell.com>; Chengwen Feng
> <fengchengwen@huawei.com>; Ray Kinsella <mdr@ashroe.eu>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit
> <ferruh.yigit@xilinx.com>; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>;
> Matz, Olivier <olivier.matz@6wind.com>; Pattan, Reshma <reshma.pattan@intel.com>
> Subject: [RFC v3 23/26] dev: hide driver object
> 
> Make rte_driver opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Introduce a new driver header and move rte_driver definition.
> Update drivers and library to use the internal header.
> 
> Some applications may have been dereferencing rte_driver objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> Changes since RFC v2:
> - updated release notes,
> - marked accessors as stable,
> 
> ---
>  doc/guides/rel_notes/release_22_11.rst        |  2 ++
>  drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
>  .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
>  drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
>  drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
>  drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
>  drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
>  drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
>  drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
>  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/pci/bus_pci_driver.h              |  2 +-
>  drivers/bus/pci/pci_params.c                  |  2 +-
>  drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
>  drivers/bus/vdev/vdev.c                       |  2 +-
>  drivers/bus/vdev/vdev_params.c                |  2 +-
>  drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
>  drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
>  drivers/common/qat/qat_qp.c                   |  2 +-
>  drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
>  drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
>  drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
>  drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
>  drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
>  drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
>  drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
>  drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
>  drivers/dma/idxd/idxd_bus.c                   |  1 +
>  drivers/event/dlb2/dlb2.c                     |  2 +-
>  drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
>  drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
>  drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
>  drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
>  drivers/event/octeontx/ssovf_evdev.c          |  2 +-
>  drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
>  drivers/gpu/cuda/cuda.c                       |  2 +-
>  drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
>  drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
>  drivers/net/ark/ark_global.h                  |  2 +-
>  drivers/net/avp/avp_ethdev.c                  |  2 +-
>  drivers/net/axgbe/axgbe_common.h              |  2 +-
>  drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
>  drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
>  drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
>  drivers/net/cxgbe/base/t4_hw.c                |  2 +-
>  drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
>  drivers/net/cxgbe/cxgbe_main.c                |  2 +-
>  drivers/net/cxgbe/sge.c                       |  2 +-
>  drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
>  drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
>  drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
>  drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
>  drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
>  drivers/net/e1000/em_ethdev.c                 |  2 +-
>  drivers/net/e1000/igb_ethdev.c                |  2 +-
>  drivers/net/e1000/igb_flow.c                  |  2 +-
>  drivers/net/ena/ena_ethdev.h                  |  2 +-
>  drivers/net/enic/enic_ethdev.c                |  2 +-
>  drivers/net/enic/enic_vf_representor.c        |  2 +-
>  drivers/net/failsafe/failsafe_private.h       |  2 +-
>  drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
>  drivers/net/i40e/i40e_ethdev.c                |  2 +-
>  drivers/net/iavf/iavf_ethdev.c                |  2 +-
>  drivers/net/iavf/iavf_vchnl.c                 |  2 +-
>  drivers/net/ice/ice_dcf.c                     |  2 +-
>  drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
>  drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
>  drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
>  drivers/net/mlx4/mlx4.c                       |  2 +-
>  drivers/net/netvsc/hn_ethdev.c                |  2 +-
>  drivers/net/netvsc/hn_nvs.c                   |  2 +-
>  drivers/net/netvsc/hn_rndis.c                 |  2 +-
>  drivers/net/netvsc/hn_rxtx.c                  |  2 +-
>  drivers/net/nfp/nfp_common.c                  |  2 +-
>  drivers/net/nfp/nfp_ethdev.c                  |  2 +-
>  drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
>  drivers/net/qede/qede_ethdev.h                |  2 +-
>  drivers/net/sfc/sfc_ethdev.c                  |  2 +-
>  drivers/net/sfc/sfc_sw_stats.c                |  2 +-
>  drivers/net/sfc/sfc_sw_stats.h                |  2 +-
>  drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
>  drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
>  drivers/net/virtio/virtio_ethdev.c            |  2 +-
>  drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
>  drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
>  drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
>  drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
>  drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
>  drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
>  lib/compressdev/rte_compressdev.c             |  2 +-
>  lib/compressdev/rte_compressdev_pmd.c         |  2 +-
>  lib/compressdev/rte_compressdev_pmd.h         |  1 +
>  lib/cryptodev/cryptodev_pmd.c                 |  2 +-
>  lib/cryptodev/cryptodev_pmd.h                 |  1 +
>  lib/cryptodev/rte_cryptodev.c                 |  2 +-
>  lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
>  lib/eal/common/eal_common_dev.c               |  2 +-
>  lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
>  lib/eal/include/meson.build                   |  1 +
>  lib/eal/include/rte_dev.h                     | 15 ++--------
>  lib/eal/version.map                           |  4 +--
>  lib/ethdev/ethdev_driver.h                    |  1 +
>  lib/eventdev/eventdev_pmd.h                   |  2 +-
>  lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
>  lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
>  lib/eventdev/rte_eventdev.c                   |  2 +-
>  lib/gpudev/gpudev_driver.h                    |  2 +-
>  lib/mempool/rte_mempool_ops.c                 |  2 +-
>  lib/pcapng/rte_pcapng.c                       |  2 +-
>  lib/rawdev/rte_rawdev.c                       |  2 +-
>  lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
>  lib/security/rte_security.c                   |  2 +-
>  115 files changed, 144 insertions(+), 122 deletions(-)
>  create mode 100644 lib/eal/include/dev_driver.h
> 
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 46bb35ad09..ff1a2d6543 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -94,6 +94,8 @@ API Changes
>    ``vdev``, ``vmbus`` 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).
> +  The ``rte_driver`` object is now opaque and must be manipulated through added
> +  accessors.
> 
>  * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
> 
> diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
> index 801e8920df..e2d9409185 100644
> --- a/drivers/baseband/acc100/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_byteorder.h>
> diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> index c1d877c87f..51dd090c1b 100644
> --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> index f16814e241..036579e3ec 100644
> --- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> +++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
> index a889e392c6..e4c7ee0c3b 100644
> --- a/drivers/bus/auxiliary/auxiliary_params.c
> +++ b/drivers/bus/auxiliary/auxiliary_params.c
> @@ -5,7 +5,7 @@
>  #include <string.h>
> 
>  #include <bus_driver.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_kvargs.h>
> 
> diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> index 1c2d2c04af..58fb7c7f69 100644
> --- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
> +++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> @@ -25,7 +25,7 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_debug.h>
>  #include <rte_interrupts.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #define RTE_BUS_AUXILIARY_NAME "auxiliary"
> diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
> index cf66fc0c53..26a83b2cdf 100644
> --- a/drivers/bus/dpaa/bus_dpaa_driver.h
> +++ b/drivers/bus/dpaa/bus_dpaa_driver.h
> @@ -7,7 +7,7 @@
>  #define BUS_DPAA_DRIVER_H
> 
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_mbuf_dyn.h>
>  #include <rte_mempool.h>
> 
> diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
> index 798ddebf3a..7ac5fe6ff1 100644
> --- a/drivers/bus/fslmc/bus_fslmc_driver.h
> +++ b/drivers/bus/fslmc/bus_fslmc_driver.h
> @@ -29,7 +29,7 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_debug.h>
>  #include <rte_interrupts.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_tailq.h>
>  #include <rte_devargs.h>
>  #include <rte_mbuf.h>
> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
> index 8604e43947..5966776a85 100644
> --- a/drivers/bus/fslmc/fslmc_vfio.c
> +++ b/drivers/bus/fslmc/fslmc_vfio.c
> @@ -28,7 +28,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal_memconfig.h>
> 
>  #include "private.h"
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> index cfe4280f87..d7f6e45b7d 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> @@ -18,7 +18,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_mbuf_pool_ops.h>
> 
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> index b7d81b518c..07256ed7ec 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
> 
>  #include <fslmc_logs.h>
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> index 071b0d297d..4aec7b2cd8 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> @@ -30,7 +30,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <fslmc_logs.h>
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> index 223e34bcba..65e2d799c3 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> @@ -10,7 +10,7 @@
>  #include <errno.h>
> 
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "private.h"
>  #include <fslmc_logs.h>
> diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
> index b5c7dee617..0f2f9b5101 100644
> --- a/drivers/bus/pci/bus_pci_driver.h
> +++ b/drivers/bus/pci/bus_pci_driver.h
> @@ -11,7 +11,7 @@ extern "C" {
>  #endif
> 
>  #include <rte_bus_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_compat.h>
> 
>  /** Pathname of PCI devices directory. */
> diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
> index 39d702a418..d24cc201b8 100644
> --- a/drivers/bus/pci/pci_params.c
> +++ b/drivers/bus/pci/pci_params.c
> @@ -6,7 +6,7 @@
> 
>  #include <bus_driver.h>
>  #include <rte_bus_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_kvargs.h>
>  #include <rte_devargs.h>
> diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
> index 36748cdfae..bc7e30d7c6 100644
> --- a/drivers/bus/vdev/bus_vdev_driver.h
> +++ b/drivers/bus/vdev/bus_vdev_driver.h
> @@ -11,7 +11,7 @@ extern "C" {
> 
>  #include <rte_bus_vdev.h>
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
> 
>  struct rte_vdev_device {
> diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
> index 809a8bb08f..b176b658fc 100644
> --- a/drivers/bus/vdev/vdev.c
> +++ b/drivers/bus/vdev/vdev.c
> @@ -11,7 +11,7 @@
>  #include <sys/queue.h>
> 
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_driver.h>
>  #include <rte_common.h>
>  #include <rte_devargs.h>
> diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
> index 2c72614776..2d10a1e8ad 100644
> --- a/drivers/bus/vdev/vdev_params.c
> +++ b/drivers/bus/vdev/vdev_params.c
> @@ -4,7 +4,7 @@
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
>  #include <rte_errno.h>
> 
> diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
> index 3424e791c9..e2475a642d 100644
> --- a/drivers/bus/vmbus/bus_vmbus_driver.h
> +++ b/drivers/bus/vmbus/bus_vmbus_driver.h
> @@ -12,7 +12,7 @@ extern "C" {
> 
>  #include <rte_bus_vmbus.h>
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  struct vmbus_channel;
>  struct vmbus_mon_page;
> diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
> index 7ffde5f4c8..85d6ddfcf4 100644
> --- a/drivers/common/qat/dev/qat_dev_gen4.c
> +++ b/drivers/common/qat/dev/qat_dev_gen4.c
> @@ -2,7 +2,7 @@
>   * Copyright(c) 2021 Intel Corporation
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "qat_device.h"
> diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
> index 4a1be35b47..e58e4ceec0 100644
> --- a/drivers/common/qat/qat_qp.c
> +++ b/drivers/common/qat/qat_qp.c
> @@ -4,7 +4,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_pci.h>
> diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
> index 7d657d81bc..445a3baa67 100644
> --- a/drivers/compress/zlib/zlib_pmd_ops.c
> +++ b/drivers/compress/zlib/zlib_pmd_ops.c
> @@ -4,7 +4,7 @@
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_common.h>
>  #include <rte_malloc.h>
> 
> diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
> index 61d457f4e0..d1ede5e990 100644
> --- a/drivers/crypto/bcmfs/bcmfs_qp.c
> +++ b/drivers/crypto/bcmfs/bcmfs_qp.c
> @@ -8,7 +8,7 @@
>  #include <rte_atomic.h>
>  #include <rte_bitmap.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_prefetch.h>
> diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> index bc7fb67218..78272d616c 100644
> --- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> +++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> @@ -4,7 +4,7 @@
>   */
> 
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_malloc.h>
>  #include <cryptodev_pmd.h>
> diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
> index 6c3e45e333..013f3be1e6 100644
> --- a/drivers/crypto/ccp/rte_ccp_pmd.c
> +++ b/drivers/crypto/ccp/rte_ccp_pmd.c
> @@ -9,7 +9,7 @@
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
> 
>  #include "ccp_crypto.h"
> diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
> index 3fd9f3c426..db11ac7444 100644
> --- a/drivers/crypto/cnxk/cn10k_cryptodev.c
> +++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
> @@ -7,7 +7,7 @@
>  #include <rte_crypto.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "cn10k_cryptodev.h"
> diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
> index bd425f95ff..4cfc1f2150 100644
> --- a/drivers/crypto/cnxk/cn9k_cryptodev.c
> +++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
> @@ -7,7 +7,7 @@
>  #include <rte_crypto.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "cn9k_cryptodev.h"
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 0cce861899..3b13578de0 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_common.h>
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
> index 7e554cb2b1..c6bd785262 100644
> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c
> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
> @@ -19,7 +19,7 @@
>  #include <rte_security_driver.h>
>  #endif
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_io.h>
>  #include <rte_ip.h>
>  #include <rte_kvargs.h>
> diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> index f3a1bd626c..971f82897c 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> @@ -5,7 +5,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_reorder.h>
> diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
> index e30dcfc281..9b7b16c6e3 100644
> --- a/drivers/dma/idxd/idxd_bus.c
> +++ b/drivers/dma/idxd/idxd_bus.c
> @@ -9,6 +9,7 @@
>  #include <libgen.h>
> 
>  #include <bus_driver.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_eal.h>
>  #include <rte_log.h>
> diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
> index 5a443acff8..759578378f 100644
> --- a/drivers/event/dlb2/dlb2.c
> +++ b/drivers/event/dlb2/dlb2.c
> @@ -17,7 +17,7 @@
>  #include <rte_config.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_eventdev.h>
>  #include <eventdev_pmd.h>
> diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
> index 9f8c6cd8b8..71ac141b66 100644
> --- a/drivers/event/dlb2/pf/dlb2_pf.c
> +++ b/drivers/event/dlb2/pf/dlb2_pf.c
> @@ -15,7 +15,7 @@
> 
>  #include <rte_debug.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_mbuf.h>
>  #include <rte_ring.h>
> diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
> index aa403f9e06..8e470584ea 100644
> --- a/drivers/event/dpaa/dpaa_eventdev.c
> +++ b/drivers/event/dpaa/dpaa_eventdev.c
> @@ -14,7 +14,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_lcore.h>
>  #include <rte_log.h>
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 08df6e223a..1001297cda 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -14,7 +14,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_lcore.h>
> diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> index 3882a9cf1d..a68d3ac154 100644
> --- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> +++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
> 
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
> index fe157c59d5..99fa326ad5 100644
> --- a/drivers/event/octeontx/ssovf_evdev.c
> +++ b/drivers/event/octeontx/ssovf_evdev.c
> @@ -7,7 +7,7 @@
>  #include <rte_common.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <ethdev_driver.h>
>  #include <rte_event_eth_rx_adapter.h>
> diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
> index 6bd8fec6d4..8513b9a013 100644
> --- a/drivers/event/skeleton/skeleton_eventdev.c
> +++ b/drivers/event/skeleton/skeleton_eventdev.c
> @@ -12,7 +12,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_log.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
> index 2be7b8d2df..a552aabeb8 100644
> --- a/drivers/gpu/cuda/cuda.c
> +++ b/drivers/gpu/cuda/cuda.c
> @@ -8,7 +8,7 @@
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <rte_byteorder.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <gpudev_driver.h>
> 
> diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> index 56c629c681..84371d5d1a 100644
> --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> @@ -20,7 +20,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include "rte_dpaa2_mempool.h"
> 
>  #include "fslmc_vfio.h"
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index fd7be47311..9957de2314 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -24,7 +24,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_branch_prediction.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_ether.h>
>  #include <rte_lcore.h>
> diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
> index 748db590c1..71d0b53e03 100644
> --- a/drivers/net/ark/ark_global.h
> +++ b/drivers/net/ark/ark_global.h
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_version.h>
> 
>  #include "ark_pktdir.h"
> diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
> index 7c0cb666fb..b2a08f5635 100644
> --- a/drivers/net/avp/avp_ethdev.c
> +++ b/drivers/net/avp/avp_ethdev.c
> @@ -22,7 +22,7 @@
>  #include <rte_cycles.h>
>  #include <rte_spinlock.h>
>  #include <rte_byteorder.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_io.h>
> diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
> index b9ebf64fb8..a5d11c5832 100644
> --- a/drivers/net/axgbe/axgbe_common.h
> +++ b/drivers/net/axgbe/axgbe_common.h
> @@ -33,7 +33,7 @@
>  #include <rte_memzone.h>
>  #include <rte_ether.h>
>  #include <rte_ethdev.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_pci.h>
>  #include <rte_common.h>
> diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
> index f36ad30e17..4448cf2de2 100644
> --- a/drivers/net/bnx2x/bnx2x_ethdev.c
> +++ b/drivers/net/bnx2x/bnx2x_ethdev.c
> @@ -9,7 +9,7 @@
>  #include "bnx2x_rxtx.h"
> 
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_alarm.h>
> 
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index e275d3a53f..1460dce2ab 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -6,7 +6,7 @@
>  #include <inttypes.h>
>  #include <stdbool.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
> index 77ecbef04c..fd1506ddd4 100644
> --- a/drivers/net/bnxt/rte_pmd_bnxt.c
> +++ b/drivers/net/bnxt/rte_pmd_bnxt.c
> @@ -7,7 +7,7 @@
>  #include <stdbool.h>
>  #include <unistd.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_cycles.h>
> diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
> index 384080e6d3..bed755f5d9 100644
> --- a/drivers/net/cxgbe/base/t4_hw.c
> +++ b/drivers/net/cxgbe/base/t4_hw.c
> @@ -18,7 +18,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_byteorder.h>
> 
>  #include "common.h"
> diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
> index fd71a50a58..45bbeaef0c 100644
> --- a/drivers/net/cxgbe/cxgbe_ethdev.c
> +++ b/drivers/net/cxgbe/cxgbe_ethdev.c
> @@ -31,7 +31,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "cxgbe.h"
>  #include "cxgbe_pfvf.h"
> diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
> index 3c02c98b3d..f8dd833032 100644
> --- a/drivers/net/cxgbe/cxgbe_main.c
> +++ b/drivers/net/cxgbe/cxgbe_main.c
> @@ -31,7 +31,7 @@
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #include "base/common.h"
> diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
> index 5d91355c9a..5b13cb5c94 100644
> --- a/drivers/net/cxgbe/sge.c
> +++ b/drivers/net/cxgbe/sge.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "base/common.h"
>  #include "base/t4_regs.h"
> diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> index 9509f6e8a3..4d33b51fea 100644
> --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <dpaa2_pmd_logs.h>
>  #include <dpaa2_hw_pvt.h>
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
> index f876f4790c..37a8b43114 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_flow_driver.h>
>  #include "rte_dpaa2_mempool.h"
> diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
> index 932570c6e0..fbfdf360d1 100644
> --- a/drivers/net/dpaa2/dpaa2_recycle.c
> +++ b/drivers/net/dpaa2/dpaa2_recycle.c
> @@ -14,7 +14,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_flow_driver.h>
> 
> diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
> index 7b9c528d13..9436a95ac8 100644
> --- a/drivers/net/dpaa2/dpaa2_rxtx.c
> +++ b/drivers/net/dpaa2/dpaa2_rxtx.c
> @@ -13,7 +13,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hexdump.h>
> 
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
> index ba0d500f74..63463c4fbf 100644
> --- a/drivers/net/dpaa2/dpaa2_sparser.c
> +++ b/drivers/net/dpaa2/dpaa2_sparser.c
> @@ -7,7 +7,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <fslmc_logs.h>
>  #include <fslmc_vfio.h>
> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
> index 409de50083..8ee9be12ad 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -20,7 +20,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "e1000_logs.h"
>  #include "base/e1000_api.h"
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index 43979992d3..d6bcc5bf58 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -22,7 +22,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "e1000_logs.h"
>  #include "base/e1000_api.h"
> diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
> index e46697b6a1..b775310651 100644
> --- a/drivers/net/e1000/igb_flow.c
> +++ b/drivers/net/e1000/igb_flow.c
> @@ -21,7 +21,7 @@
>  #include <rte_eal.h>
>  #include <rte_atomic.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_flow.h>
>  #include <rte_flow_driver.h>
> 
> diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
> index 4709675af8..4d27fba585 100644
> --- a/drivers/net/ena/ena_ethdev.h
> +++ b/drivers/net/ena/ena_ethdev.h
> @@ -14,7 +14,7 @@
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <rte_timer.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_net.h>
> 
>  #include "ena_com.h"
> diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
> index 998436e5e8..cdf0915591 100644
> --- a/drivers/net/enic/enic_ethdev.c
> +++ b/drivers/net/enic/enic_ethdev.c
> @@ -6,7 +6,7 @@
>  #include <stdio.h>
>  #include <stdint.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <ethdev_driver.h>
> diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
> index 7312c411bd..46f85964e9 100644
> --- a/drivers/net/enic/enic_vf_representor.c
> +++ b/drivers/net/enic/enic_vf_representor.c
> @@ -7,7 +7,7 @@
> 
>  #include <bus_pci_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_flow_driver.h>
> diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
> index a80f5e2caf..53a451c1b1 100644
> --- a/drivers/net/failsafe/failsafe_private.h
> +++ b/drivers/net/failsafe/failsafe_private.h
> @@ -11,7 +11,7 @@
>  #include <pthread.h>
> 
>  #include <rte_atomic.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_flow.h>
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
> index 8bbd8b445d..7adb20bff9 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -7,7 +7,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_spinlock.h>
>  #include <rte_kvargs.h>
>  #include <rte_vect.h>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 7bdc453ec1..67111ac251 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -23,7 +23,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_alarm.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_tailq.h>
>  #include <rte_hash_crc.h>
>  #include <rte_bitmap.h>
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 506fcff6e3..ef2ab06475 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -24,7 +24,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "iavf.h"
>  #include "iavf_rxtx.h"
> diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
> index 21bd1e2193..15f695682d 100644
> --- a/drivers/net/iavf/iavf_vchnl.c
> +++ b/drivers/net/iavf/iavf_vchnl.c
> @@ -19,7 +19,7 @@
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "iavf.h"
>  #include "iavf_rxtx.h"
> diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
> index 885d58c0f4..1c3d22ae0f 100644
> --- a/drivers/net/ice/ice_dcf.c
> +++ b/drivers/net/ice/ice_dcf.c
> @@ -21,7 +21,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "ice_dcf.h"
>  #include "ice_rxtx.h"
> diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
> index 0da267db1f..dee712af98 100644
> --- a/drivers/net/ice/ice_dcf_ethdev.c
> +++ b/drivers/net/ice/ice_dcf_ethdev.c
> @@ -18,7 +18,7 @@
>  #include <rte_kvargs.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <iavf_devids.h>
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 552e41692c..04c9ce78a2 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hash_crc.h>
>  #ifdef RTE_LIB_SECURITY
>  #include <rte_security_driver.h>
> diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
> index 368342872a..67373a7b78 100644
> --- a/drivers/net/ixgbe/ixgbe_flow.c
> +++ b/drivers/net/ixgbe/ixgbe_flow.c
> @@ -27,7 +27,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hash_crc.h>
>  #include <rte_flow.h>
>  #include <rte_flow_driver.h>
> diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
> index 910b76a92c..7e7e1824ef 100644
> --- a/drivers/net/mlx4/mlx4.c
> +++ b/drivers/net/mlx4/mlx4.c
> @@ -31,7 +31,7 @@
>  #endif
> 
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
> index ccc06bdda6..d0bbc0a4c0 100644
> --- a/drivers/net/netvsc/hn_ethdev.c
> +++ b/drivers/net/netvsc/hn_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <rte_errno.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_driver.h>
>  #include <bus_vmbus_driver.h>
>  #include <rte_alarm.h>
> diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
> index 817fb06dfb..7db82af9f3 100644
> --- a/drivers/net/netvsc/hn_nvs.c
> +++ b/drivers/net/netvsc/hn_nvs.c
> @@ -28,7 +28,7 @@
>  #include <rte_cycles.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_vmbus_driver.h>
> 
>  #include "hn_logs.h"
> diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
> index 20f75a17b0..e6f1f28768 100644
> --- a/drivers/net/netvsc/hn_rndis.c
> +++ b/drivers/net/netvsc/hn_rndis.c
> @@ -26,7 +26,7 @@
>  #include <rte_cycles.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_vmbus_driver.h>
> 
>  #include "hn_logs.h"
> diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
> index 61cf374224..bc6f60c64a 100644
> --- a/drivers/net/netvsc/hn_rxtx.c
> +++ b/drivers/net/netvsc/hn_rxtx.c
> @@ -25,7 +25,7 @@
>  #include <rte_errno.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_net.h>
>  #include <bus_vmbus_driver.h>
>  #include <rte_spinlock.h>
> diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
> index 0e55f0c792..eaafe11fb9 100644
> --- a/drivers/net/nfp/nfp_common.c
> +++ b/drivers/net/nfp/nfp_common.c
> @@ -19,7 +19,7 @@
>  #include <rte_debug.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ether.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
> index 5cdd34e588..47359501bc 100644
> --- a/drivers/net/nfp/nfp_ethdev.c
> +++ b/drivers/net/nfp/nfp_ethdev.c
> @@ -16,7 +16,7 @@
>  #include <rte_common.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ether.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
> index 9ada22e2ff..0eee191566 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -15,7 +15,7 @@
>  #include <bus_vdev_driver.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_kvargs.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
> index a38b701183..b781bcdcfd 100644
> --- a/drivers/net/qede/qede_ethdev.h
> +++ b/drivers/net/qede/qede_ethdev.h
> @@ -13,7 +13,7 @@
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ip.h>
> 
>  /* ecore includes */
> diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
> index 506c62a726..2ec743ebce 100644
> --- a/drivers/net/sfc/sfc_ethdev.c
> +++ b/drivers/net/sfc/sfc_ethdev.c
> @@ -7,7 +7,7 @@
>   * for Solarflare) and Solarflare Communications, Inc.
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_pci.h>
> diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
> index 81f5aa3cc4..3ae5023b6f 100644
> --- a/drivers/net/sfc/sfc_sw_stats.c
> +++ b/drivers/net/sfc/sfc_sw_stats.c
> @@ -2,7 +2,7 @@
>   *
>   * Copyright(c) 2021 Xilinx, Inc.
>   */
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_bitmap.h>
> 
>  #include "sfc.h"
> diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
> index 1abded8018..d9738e5214 100644
> --- a/drivers/net/sfc/sfc_sw_stats.h
> +++ b/drivers/net/sfc/sfc_sw_stats.h
> @@ -5,7 +5,7 @@
>  #ifndef _SFC_SW_STATS_H
>  #define _SFC_SW_STATS_H
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "sfc.h"
> 
> diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
> index 28183ec740..9f57cb1a20 100644
> --- a/drivers/net/thunderx/nicvf_ethdev.c
> +++ b/drivers/net/thunderx/nicvf_ethdev.c
> @@ -20,7 +20,7 @@
>  #include <rte_common.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
> diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
> index dc90569df1..c3e045d892 100644
> --- a/drivers/net/vdev_netvsc/vdev_netvsc.c
> +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
> @@ -27,7 +27,7 @@
>  #include <bus_driver.h>
>  #include <bus_vdev_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_ethdev.h>
>  #include <rte_ether.h>
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index d180162abd..edf3becd32 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -24,7 +24,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal_paging.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> 
> diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
> index 2b9e35cef5..abc63b0935 100644
> --- a/drivers/net/virtio/virtio_pci_ethdev.c
> +++ b/drivers/net/virtio/virtio_pci_ethdev.c
> @@ -16,7 +16,7 @@
> 
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #include "virtio.h"
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> index 101b1cb500..fd946dec5c 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "base/vmxnet3_defs.h"
> 
> diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
> index db029cbf34..909fb8faab 100644
> --- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
> +++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
> @@ -3,7 +3,7 @@
>   */
>  #include <bus_pci_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_lcore.h>
>  #include <rte_pci.h>
> diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
> index 19b523a815..a06b724866 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev.c
> @@ -13,7 +13,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_kvargs.h>
>  #include <rte_log.h>
> diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
> index fc257c5f44..8ef7a6b127 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev_test.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
> @@ -6,7 +6,7 @@
>  #include <rte_mbuf.h>
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_rawdev.h>
>  #include <bus_vdev_driver.h>
>  #include <rte_test.h>
> diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
> index 6ab62a12fc..92cf5f495e 100644
> --- a/drivers/regex/mlx5/mlx5_regex_control.c
> +++ b/drivers/regex/mlx5/mlx5_regex_control.c
> @@ -11,7 +11,7 @@
>  #include <rte_regexdev.h>
>  #include <rte_regexdev_core.h>
>  #include <rte_regexdev_driver.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <mlx5_common.h>
>  #include <mlx5_glue.h>
> diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
> index 7f6dedbc52..639a0d66ca 100644
> --- a/lib/compressdev/rte_compressdev.c
> +++ b/lib/compressdev/rte_compressdev.c
> @@ -9,7 +9,7 @@
>  #include <rte_common.h>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_memzone.h>
> 
> diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
> index 9bfae077db..41f1415bea 100644
> --- a/lib/compressdev/rte_compressdev_pmd.c
> +++ b/lib/compressdev/rte_compressdev_pmd.c
> @@ -5,7 +5,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
> 
>  #include "rte_compressdev_internal.h"
> diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
> index 9fabc399c5..72e52f876f 100644
> --- a/lib/compressdev/rte_compressdev_pmd.h
> +++ b/lib/compressdev/rte_compressdev_pmd.h
> @@ -19,6 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> +#include <dev_driver.h>
> 
>  #include "rte_compressdev.h"
>  #include "rte_compressdev_internal.h"
> diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
> index 75d0075b86..f07b92dfd7 100644
> --- a/lib/cryptodev/cryptodev_pmd.c
> +++ b/lib/cryptodev/cryptodev_pmd.c
> @@ -4,7 +4,7 @@
> 
>  #include <sys/queue.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
> index 3dcc3cb7ed..96d7e225b0 100644
> --- a/lib/cryptodev/cryptodev_pmd.h
> +++ b/lib/cryptodev/cryptodev_pmd.h
> @@ -19,6 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_log.h>
>  #include <rte_common.h>
> diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
> index 42f3221052..1dad092317 100644
> --- a/lib/cryptodev/rte_cryptodev.c
> +++ b/lib/cryptodev/rte_cryptodev.c
> @@ -13,7 +13,7 @@
> 
>  #include <rte_log.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memory.h>
>  #include <rte_memcpy.h>
>  #include <rte_memzone.h>
> diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
> index 82ab7a8cc7..acd7f71cd1 100644
> --- a/lib/dmadev/rte_dmadev_pmd.h
> +++ b/lib/dmadev/rte_dmadev_pmd.h
> @@ -14,7 +14,7 @@
>   * by any application.
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_dmadev.h"
> 
> diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
> index 16c5aef1d8..98f3c78795 100644
> --- a/lib/eal/common/eal_common_dev.c
> +++ b/lib/eal/common/eal_common_dev.c
> @@ -9,7 +9,7 @@
> 
>  #include <bus_driver.h>
>  #include <rte_class.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_errno.h>
>  #include <rte_log.h>
> diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
> new file mode 100644
> index 0000000000..015188abd5
> --- /dev/null
> +++ b/lib/eal/include/dev_driver.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Red Hat, Inc.
> + */
> +
> +#ifndef DEV_DRIVER_H
> +#define DEV_DRIVER_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +#include <rte_dev.h>
> +
> +/**
> + * A structure describing a device driver.
> + */
> +struct rte_driver {
> +	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
> +	const char *name;                   /**< Driver name. */
> +	const char *alias;              /**< Driver alias. */
> +};
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* DEV_DRIVER_H */
> diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
> index 77d8621a51..cfcd40aaed 100644
> --- a/lib/eal/include/meson.build
> +++ b/lib/eal/include/meson.build
> @@ -57,6 +57,7 @@ headers += files(
> 
>  driver_sdk_headers = files(
>          'bus_driver.h',
> +        'dev_driver.h',
>  )
> 
>  # special case install the generic headers, since they go in a subdir
> diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
> index fedf67fba1..38057cc0ef 100644
> --- a/lib/eal/include/rte_dev.h
> +++ b/lib/eal/include/rte_dev.h
> @@ -23,6 +23,8 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_log.h>
> 
> +struct rte_driver;
> +
>  /**
>   * The device event type.
>   */
> @@ -53,27 +55,14 @@ struct rte_mem_resource {
>  	void *addr;         /**< Virtual address, NULL when not mapped. */
>  };
> 
> -/**
> - * A structure describing a device driver.
> - */
> -struct rte_driver {
> -	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
> -	const char *name;                   /**< Driver name. */
> -	const char *alias;              /**< Driver alias. */
> -};
> -
>  /**
>   * Retrieve a driver name.
>   *
> - * @warning
> - * @b EXPERIMENTAL: this API may change without prior notice
> - *
>   * @param driver
>   *   A pointer to a driver structure.
>   * @return
>   *   A pointer to the driver name string.
>   */
> -__rte_experimental
>  const char *
>  rte_driver_name(const struct rte_driver *driver);
> 
> diff --git a/lib/eal/version.map b/lib/eal/version.map
> index d10fd89458..8b53a1d258 100644
> --- a/lib/eal/version.map
> +++ b/lib/eal/version.map
> @@ -37,6 +37,7 @@ DPDK_23 {
>  	rte_devargs_parsef;
>  	rte_devargs_remove;
>  	rte_devargs_type_count;
> +	rte_driver_name;
>  	rte_dump_physmem_layout;
>  	rte_dump_stack;
>  	rte_dump_tailq;
> @@ -423,9 +424,6 @@ EXPERIMENTAL {
>  	rte_thread_self;
>  	rte_thread_set_affinity_by_id;
>  	rte_thread_set_priority;
> -
> -	# added in 22.11
> -	rte_driver_name;
>  };
> 
>  INTERNAL {
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 5101868ea7..47a55a419e 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -19,6 +19,7 @@ extern "C" {
>   *
>   */
> 
> +#include <dev_driver.h>
>  #include <rte_ethdev.h>
> 
>  /**
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index 69402668d8..def6cd0876 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -22,7 +22,7 @@ extern "C" {
>  #include <rte_common.h>
>  #include <rte_compat.h>
>  #include <rte_config.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_log.h>
>  #include <rte_malloc.h>
>  #include <rte_mbuf.h>
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
> index 7c695176f4..5bc10312fc 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -6,7 +6,7 @@
>  #include <string.h>
>  #include <stdbool.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index bf8741d2ea..4f4efdae9f 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -9,7 +9,7 @@
> 
>  #include <rte_cycles.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_driver.h>
>  #include <rte_log.h>
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 1dc4f966be..54abee2b3f 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -12,7 +12,7 @@
> 
>  #include <rte_string_fns.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memzone.h>
>  #include <rte_eal.h>
>  #include <rte_common.h>
> diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
> index 0e55b00bfe..23972b3dbd 100644
> --- a/lib/gpudev/gpudev_driver.h
> +++ b/lib/gpudev/gpudev_driver.h
> @@ -14,7 +14,7 @@
>  #include <stdint.h>
>  #include <sys/queue.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_gpudev.h"
> 
> diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
> index d60235a7e3..058ad147a5 100644
> --- a/lib/mempool/rte_mempool_ops.c
> +++ b/lib/mempool/rte_mempool_ops.c
> @@ -10,7 +10,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_mempool_trace.h"
> 
> diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
> index 72aabd4dd0..af2b814251 100644
> --- a/lib/pcapng/rte_pcapng.c
> +++ b/lib/pcapng/rte_pcapng.c
> @@ -14,7 +14,7 @@
>  #include <bus_driver.h>
>  #include <rte_common.h>
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_ethdev.h>
>  #include <rte_ether.h>
> diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
> index 2f0a4f132e..bc51258143 100644
> --- a/lib/rawdev/rte_rawdev.c
> +++ b/lib/rawdev/rte_rawdev.c
> @@ -12,7 +12,7 @@
> 
>  #include <rte_string_fns.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_common.h>
>  #include <rte_malloc.h>
>  #include <rte_telemetry.h>
> diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
> index 3b7be57d3e..a51944c8ff 100644
> --- a/lib/rawdev/rte_rawdev_pmd.h
> +++ b/lib/rawdev/rte_rawdev_pmd.h
> @@ -19,7 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_log.h>
>  #include <rte_common.h>
> diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
> index 046b6496d2..d036ed33f6 100644
> --- a/lib/security/rte_security.c
> +++ b/lib/security/rte_security.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_cryptodev.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_telemetry.h>
>  #include "rte_security.h"
>  #include "rte_security_driver.h"
> --
> 2.36.1


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 23/26] dev: hide driver object
  2022-07-28 17:00     ` Bruce Richardson
@ 2022-08-01 17:18       ` Ajit Khaparde
  0 siblings, 0 replies; 231+ messages in thread
From: Ajit Khaparde @ 2022-08-01 17:18 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: David Marchand, dpdk-dev, Nicolas Chautru, Parav Pandit,
	Xueming Li, Hemant Agrawal, Sachin Saxena, Stephen Hemminger,
	Long Li, Fan Zhang, Sunila Sahu, Ashish Gupta,
	Raveendra Padasalagi, Vikas Gupta, Chandubabu Namburu,
	Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj, Gagandeep Singh,
	Kevin Laatz, Timothy McDaniel, Jerin Jacob, Elena Agostini,
	Ciara Loftus, Qi Zhang, Shepard Siegel, Ed Czeck, John Miller,
	Steven Webster, Matt Peters, Rasesh Mody, Shahed Shaikh,
	Somnath Kotur, Rahul Lakkireddy, Simei Su, Wenjun Wu,
	Marcin Wojtas, Michal Krawczyk, Shai Brandes, Evgeny Schemeilin,
	Igor Chauskin, John Daley, Hyong Youb Kim, Gaetan Rivet,
	Xiao Wang, Yuying Zhang, Beilei Xing, Jingjing Wu, Qiming Yang,
	Matan Azrad, Viacheslav Ovsiienko, Chaoyong He, Niklas Soderlund,
	Harman Kalra, Devendra Singh Rawat, Andrew Rybchenko,
	Maciej Czekaj, Maxime Coquelin, Chenbo Xia, Jochen Behrens,
	Jakub Palider, Tomasz Duszynski, Ori Kam, Akhil Goyal,
	Chengwen Feng, Ray Kinsella, Thomas Monjalon, Ferruh Yigit,
	Abhinandan Gujjar, Jay Jayatheerthan, Olivier Matz,
	Reshma Pattan

[-- Attachment #1: Type: text/plain, Size: 713 bytes --]

On Thu, Jul 28, 2022 at 10:00 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Thu, Jul 28, 2022 at 05:26:37PM +0200, David Marchand wrote:
> > Make rte_driver opaque for non internal users.
> > This will make extending this object possible without breaking the ABI.
> >
> > Introduce a new driver header and move rte_driver definition.
> > Update drivers and library to use the internal header.
> >
> > Some applications may have been dereferencing rte_driver objects, mark
> > this object's accessors as stable.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
                     ` (25 preceding siblings ...)
  2022-07-28 15:26   ` [RFC v3 26/26] dev: hide device object David Marchand
@ 2022-08-04 23:19   ` Harris, James R
  2022-08-25  9:31     ` David Marchand
  26 siblings, 1 reply; 231+ messages in thread
From: Harris, James R @ 2022-08-04 23:19 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Walker, Benjamin, Liu, Changpeng, Alexey Marchuk, Shuhei Matsumoto



> On Jul 28, 2022, at 8:26 AM, David Marchand <david.marchand@redhat.com> wrote:
> 
> This is a PoC for hiding the rte_bus, rte_driver and rte_device objects.
> And mark associated driver only API as internal.
> 
> A good amount of the patches are preparation work on rte_bus.h,
> rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
> between them.
> 
> PCI bus specific handling are removed from testpmd, unit tests and
> examples.
> 
> After this series, driver-only API headers for registering to buses are
> not exported anymore, unless the enable_driver_sdk meson option is
> selected.
> 
> New accessors for rte_bus, rte_driver and rte_device have been added,
> marked with an experimental tag first when introducing them, and later
> in the series marked as stable since external users will want to use
> those drop-in replacements right away.
> 
> A check is added to ensure we won't pollute app/ and examples/ again,
> though some unit tests are left intentionnally untouched as they test
> some internals of DPDK.
> 
> Comments welcome.

Hi David,

I certainly understand wanting to hide those objects to avoid ABI
maintenance.  SPDK is using fields directly from some of those structures
today, but I think all of them could be replaced with associated helper
functions.  This was discussed a bit late last year related to Chenbo’s
earlier patch set:

https://www.mail-archive.com/dev@dpdk.org/msg222560.html

It looks like SPDK never got back to the DPDK project on exactly what APIs
we would need, to see if DPDK could still support a minimal API without
requiring the enable_driver_sdk flag.  I’m generating an exact list, but it
would be rendered moot depending on the next question...

Can we keep rte_pci_register(), or a new variation of it that keeps the
rte_pci_driver structure hidden?  Hiding rte_pci_register() would mean
SPDK can no longer work with a packaged DPDK.  Or the DPDK packages
would need to set enable_driver_sdk which I suspect is not the intent.

If you’re open to this, we (SPDK) can make a proposal on exactly what we
would need to keep SPDK working with a standard DPDK build.

Thanks,

Jim
 


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 08/26] dev: move unrelated macros from header
  2022-07-29 13:22           ` David Marchand
@ 2022-08-24  6:50             ` David Marchand
  2022-08-24  7:39               ` Thomas Monjalon
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-08-24  6:50 UTC (permalink / raw)
  To: Bruce Richardson, techboard
  Cc: dev, Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu,
	Shijith Thotton, Srisivasubramanian Srinivasan, Chengwen Feng,
	Kevin Laatz, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Olivier Matz, Ori Kam, Akhil Goyal, Maxime Coquelin, Chenbo Xia

On Fri, Jul 29, 2022 at 3:22 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Fri, Jul 29, 2022 at 11:59 AM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> > > > Personally, I really don't like these macros at all. I think having the
> > > > check explicitly in the code would be far more readable, and would only be
> > > > one line of code longer than the macro call. Is there some private header
> > > > file we could move these to instead of rte_common.h so we can drop their
> > > > use in future if we decide to?
> > >
> > > I don't like them either.
> > > Not sure where to put them though...
> > >
> > > My "grep-all" shows no user in the projects consuming DPDK I track.
> > > We could mark those macros deprecated, fix our code and drop them later.
> > >
> > +1 to that.
> > Can they be marked as deprecated as part of the move perhaps (assuming we
> > get agreement to kill them?)

Let's see if techboard members have an opinion.

>
> Yes.
> I'll wait for others to chime in, which means this will wait for after
> my days off :-).


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 08/26] dev: move unrelated macros from header
  2022-08-24  6:50             ` David Marchand
@ 2022-08-24  7:39               ` Thomas Monjalon
  2022-08-24 11:52                 ` Morten Brørup
  0 siblings, 1 reply; 231+ messages in thread
From: Thomas Monjalon @ 2022-08-24  7:39 UTC (permalink / raw)
  To: Bruce Richardson, techboard, David Marchand
  Cc: dev, Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu,
	Shijith Thotton, Srisivasubramanian Srinivasan, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Olivier Matz,
	Ori Kam, Akhil Goyal, Maxime Coquelin, Chenbo Xia

24/08/2022 08:50, David Marchand:
> On Fri, Jul 29, 2022 at 3:22 PM David Marchand
> <david.marchand@redhat.com> wrote:
> >
> > On Fri, Jul 29, 2022 at 11:59 AM Bruce Richardson
> > <bruce.richardson@intel.com> wrote:
> > > > > Personally, I really don't like these macros at all. I think having the
> > > > > check explicitly in the code would be far more readable, and would only be
> > > > > one line of code longer than the macro call. Is there some private header
> > > > > file we could move these to instead of rte_common.h so we can drop their
> > > > > use in future if we decide to?
> > > >
> > > > I don't like them either.
> > > > Not sure where to put them though...
> > > >
> > > > My "grep-all" shows no user in the projects consuming DPDK I track.
> > > > We could mark those macros deprecated, fix our code and drop them later.
> > > >
> > > +1 to that.
> > > Can they be marked as deprecated as part of the move perhaps (assuming we
> > > get agreement to kill them?)
> 
> Let's see if techboard members have an opinion.

These macros have no added value for an external user.
I think it is OK to mark them deprecated and plan for a future removal.

Copy of the code for the context:

/** Macros to check for invalid function pointers. */
#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
       if ((func) == NULL) \
               return retval; \
} while (0)

#define RTE_FUNC_PTR_OR_RET(func) do { \
       if ((func) == NULL) \
               return; \
} while (0)




^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [RFC v3 08/26] dev: move unrelated macros from header
  2022-08-24  7:39               ` Thomas Monjalon
@ 2022-08-24 11:52                 ` Morten Brørup
  2022-08-24 12:53                   ` Thomas Monjalon
  0 siblings, 1 reply; 231+ messages in thread
From: Morten Brørup @ 2022-08-24 11:52 UTC (permalink / raw)
  To: Thomas Monjalon, Bruce Richardson, techboard, David Marchand
  Cc: dev, Fan Zhang, Ashish Gupta, Qiming Yang, Wenjun Wu,
	Shijith Thotton, Srisivasubramanian Srinivasan, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Olivier Matz,
	Ori Kam, Akhil Goyal, Maxime Coquelin, Chenbo Xia

> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, 24 August 2022 09.39
> 
> 24/08/2022 08:50, David Marchand:
> > On Fri, Jul 29, 2022 at 3:22 PM David Marchand
> > <david.marchand@redhat.com> wrote:
> > >
> > > On Fri, Jul 29, 2022 at 11:59 AM Bruce Richardson
> > > <bruce.richardson@intel.com> wrote:
> > > > > > Personally, I really don't like these macros at all. I think
> having the
> > > > > > check explicitly in the code would be far more readable, and
> would only be
> > > > > > one line of code longer than the macro call. Is there some
> private header
> > > > > > file we could move these to instead of rte_common.h so we can
> drop their
> > > > > > use in future if we decide to?
> > > > >
> > > > > I don't like them either.
> > > > > Not sure where to put them though...
> > > > >
> > > > > My "grep-all" shows no user in the projects consuming DPDK I
> track.
> > > > > We could mark those macros deprecated, fix our code and drop
> them later.
> > > > >
> > > > +1 to that.
> > > > Can they be marked as deprecated as part of the move perhaps
> (assuming we
> > > > get agreement to kill them?)
> >
> > Let's see if techboard members have an opinion.
> 
> These macros have no added value for an external user.
> I think it is OK to mark them deprecated and plan for a future removal.

+1 from a community member :-)

> 
> Copy of the code for the context:
> 
> /** Macros to check for invalid function pointers. */
> #define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
>        if ((func) == NULL) \
>                return retval; \
> } while (0)
> 
> #define RTE_FUNC_PTR_OR_RET(func) do { \
>        if ((func) == NULL) \
>                return; \
> } while (0)
> 
> 
> 


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 08/26] dev: move unrelated macros from header
  2022-08-24 11:52                 ` Morten Brørup
@ 2022-08-24 12:53                   ` Thomas Monjalon
  0 siblings, 0 replies; 231+ messages in thread
From: Thomas Monjalon @ 2022-08-24 12:53 UTC (permalink / raw)
  To: Morten Brørup
  Cc: Bruce Richardson, techboard, David Marchand, dev, Fan Zhang,
	Ashish Gupta, Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Chengwen Feng, Kevin Laatz,
	Ferruh Yigit, Andrew Rybchenko, Olivier Matz, Ori Kam,
	Akhil Goyal, Maxime Coquelin, Chenbo Xia

24/08/2022 13:52, Morten Brørup:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 24/08/2022 08:50, David Marchand:
> > > On Fri, Jul 29, 2022 at 3:22 PM David Marchand
> > > <david.marchand@redhat.com> wrote:
> > > > > > I don't like them either.
> > > > > > Not sure where to put them though...
> > > > > >
> > > > > > My "grep-all" shows no user in the projects consuming DPDK I
> > track.
> > > > > > We could mark those macros deprecated, fix our code and drop
> > them later.
> > > > > >
> > > > > +1 to that.
> > > > > Can they be marked as deprecated as part of the move perhaps
> > (assuming we
> > > > > get agreement to kill them?)
> > >
> > > Let's see if techboard members have an opinion.
> > 
> > These macros have no added value for an external user.
> > I think it is OK to mark them deprecated and plan for a future removal.
> 
> +1 from a community member :-)

As usual, your voice is very valuable Morten :)



^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-08-04 23:19   ` [RFC v3 00/26] Bus and device cleanup for 22.11 Harris, James R
@ 2022-08-25  9:31     ` David Marchand
  2022-08-29 17:12       ` Walker, Benjamin
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-08-25  9:31 UTC (permalink / raw)
  To: Harris, James R
  Cc: dev, Walker, Benjamin, Liu, Changpeng, Alexey Marchuk, Shuhei Matsumoto

Hello,

On Fri, Aug 5, 2022 at 1:19 AM Harris, James R <james.r.harris@intel.com> wrote:
> Can we keep rte_pci_register(), or a new variation of it that keeps the
> rte_pci_driver structure hidden?  Hiding rte_pci_register() would mean
> SPDK can no longer work with a packaged DPDK.  Or the DPDK packages
> would need to set enable_driver_sdk which I suspect is not the intent.

What do you think if SPDK maintains a copy of the internal headers?

The internal API are not supposed to change that often, but we (DPDK)
won't guarantee it.
This would still put some maintenance burden on SPDK but I think it is
a good compromise.

I did a PoC this morning and put patches in my forked repo:
https://github.com/david-marchand/spdk/commits/master


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 00/27] Bus and device cleanup for 22.11
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (12 preceding siblings ...)
  2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
@ 2022-08-26 12:41 ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 01/27] devtools: forbid inclusions of driver only headers David Marchand
                     ` (26 more replies)
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
                   ` (2 subsequent siblings)
  16 siblings, 27 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

The rte_bus, rte_driver and rte_device objects are part of the public
ABI and this has proved to be a problem when needing to extend them.
This series hides them, and mark associated driver only API as internal.

A good amount of the patches are preparation work on rte_bus.h,
rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
between them.

PCI bus specific handling are removed from testpmd, unit tests and
examples.

After this series, driver-only API headers for registering to buses are
not exported anymore, unless the enable_driver_sdk meson option is
selected.

New accessors for rte_bus, rte_driver and rte_device have been added,
marked with an experimental tag first when introducing them, and later
in the series marked as stable since external users will want to use
those drop-in replacements right away.

A check is added to ensure we won't pollute app/ and examples/ again,
though some unit tests are left intentionnally untouched as they test
some internals of DPDK.

Changes since RFC v3:
- marked the series as non-RFC,
- rebased on v22.11-rc0,
- marked RTE_FUNC_PTR_* macros as deprecated,
- split the bus specific patch in two patches,

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (27):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  eal: deprecate RTE_FUNC_PTR_* macros
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide bus specific information
  bus/pci: fill bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   3 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |  20 +-
 doc/guides/rel_notes/release_22_11.rst        |  19 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 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 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  21 +-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |  35 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   8 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 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             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  21 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  25 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |  48 ++-
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |  45 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_dev.h                     | 104 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       | 277 +++++++++-----
 lib/ethdev/rte_ethdev.h                       |  11 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  12 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  15 +-
 lib/eventdev/rte_eventdev.c                   |  64 ++--
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   5 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |  77 ++--
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |  59 +--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   8 +-
 lib/vhost/vdpa.c                              |  10 +-
 lib/vhost/vhost_user.c                        |   6 +-
 367 files changed, 2193 insertions(+), 2489 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 01/27] devtools: forbid inclusions of driver only headers
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 02/27] common/mlx5: rework check on driver registration David Marchand
                     ` (25 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Let's be good citizens and enforce not using driver only headers in our
own examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 1edc5810ad..0e82c01947 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -142,6 +142,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid inclusion of driver specific headers in apps and examples
+	awk -v FOLDERS='app examples' \
+		-v EXPRESSIONS='include.*_driver\\.h include.*_pmd\\.h' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using driver specific headers in applications' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# SVG must be included with wildcard extension to allow conversion
 	awk -v FOLDERS='doc' \
 		-v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 02/27] common/mlx5: rework check on driver registration
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
  2022-08-26 12:41   ` [PATCH v4 01/27] devtools: forbid inclusions of driver only headers David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (24 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Matan Azrad, Viacheslav Ovsiienko

Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@ static struct rte_auxiliary_driver mlx5_auxiliary_driver = {
 	.dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-	if (mlx5_auxiliary_driver.bus == NULL)
+	if (!mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_register(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = true;
+	}
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-	if (mlx5_auxiliary_driver.bus != NULL)
+	if (mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = false;
+	}
 }
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
  2022-08-26 12:41   ` [PATCH v4 01/27] devtools: forbid inclusions of driver only headers David Marchand
  2022-08-26 12:41   ` [PATCH v4 02/27] common/mlx5: rework check on driver registration David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 04/27] app/testpmd: drop PCI register commands David Marchand
                     ` (23 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * raw/dpaa2_cmdif: The ``dpaa2_cmdif`` rawdev driver will be deprecated
   in DPDK 22.11, as it is no longer in use, no active user known.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 04/27] app/testpmd: drop PCI register commands
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (2 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 05/27] kni: stop populating PCI info in examples David Marchand
                     ` (22 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang

Those commands date back to the early stages of DPDK when only PCI
devices were supported.
At the time, developers may have used those commands to help in
debugging their buggy^Wwork in progress drivers.

Removing them, we can drop the dependency on the PCI bus and library and
make testpmd bus agnostic.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/cmdline.c                      | 339 +-------------------
 app/test-pmd/config.c                       | 195 -----------
 app/test-pmd/csumonly.c                     |   1 -
 app/test-pmd/flowgen.c                      |   1 -
 app/test-pmd/iofwd.c                        |   1 -
 app/test-pmd/macfwd.c                       |   1 -
 app/test-pmd/macswap.c                      |   1 -
 app/test-pmd/meson.build                    |   2 +-
 app/test-pmd/parameters.c                   |   1 -
 app/test-pmd/rxonly.c                       |   1 -
 app/test-pmd/testpmd.c                      |   1 -
 app/test-pmd/testpmd.h                      |  72 +----
 app/test-pmd/txonly.c                       |   1 -
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  81 -----
 14 files changed, 4 insertions(+), 694 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b4fe9dfb17..4697b7c494 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -28,7 +28,6 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -89,7 +88,6 @@ static void cmd_help_brief_parsed(__rte_unused void *parsed_result,
 		"information.\n"
 		"    help config                     : Configuration information.\n"
 		"    help ports                      : Configuring ports.\n"
-		"    help registers                  : Reading and setting port registers.\n"
 		"    help filters                    : Filters configuration help.\n"
 		"    help traffic_management         : Traffic Management commands.\n"
 		"    help devices                    : Device related commands.\n"
@@ -799,34 +797,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 		);
 	}
 
-	if (show_all || !strcmp(res->section, "registers")) {
-
-		cmdline_printf(
-			cl,
-			"\n"
-			"Registers:\n"
-			"----------\n\n"
-
-			"read reg (port_id) (address)\n"
-			"    Display value of a port register.\n\n"
-
-			"read regfield (port_id) (address) (bit_x) (bit_y)\n"
-			"    Display a port register bit field.\n\n"
-
-			"read regbit (port_id) (address) (bit_x)\n"
-			"    Display a single port register bit.\n\n"
-
-			"write reg (port_id) (address) (value)\n"
-			"    Set value of a port register.\n\n"
-
-			"write regfield (port_id) (address) (bit_x) (bit_y)"
-			" (value)\n"
-			"    Set bit field of a port register.\n\n"
-
-			"write regbit (port_id) (address) (bit_x) (value)\n"
-			"    Set single bit value of a port register.\n\n"
-		);
-	}
 	if (show_all || !strcmp(res->section, "filters")) {
 
 		cmdline_printf(
@@ -1077,13 +1047,13 @@ static cmdline_parse_token_string_t cmd_help_long_help =
 
 static cmdline_parse_token_string_t cmd_help_long_section =
 	TOKEN_STRING_INITIALIZER(struct cmd_help_long_result, section,
-		"all#control#display#config#ports#registers#"
+		"all#control#display#config#ports#"
 		"filters#traffic_management#devices#drivers");
 
 static cmdline_parse_inst_t cmd_help_long = {
 	.f = cmd_help_long_parsed,
 	.data = NULL,
-	.help_str = "help all|control|display|config|ports|register|"
+	.help_str = "help all|control|display|config|ports|"
 		"filters|traffic_management|devices|drivers: "
 		"Show help",
 	.tokens = {
@@ -7390,305 +7360,6 @@ static cmdline_parse_inst_t cmd_showfwdall = {
 	},
 };
 
-/* *** READ PORT REGISTER *** */
-struct cmd_read_reg_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-};
-
-static void
-cmd_read_reg_parsed(void *parsed_result,
-		    __rte_unused struct cmdline *cl,
-		    __rte_unused void *data)
-{
-	struct cmd_read_reg_result *res = parsed_result;
-	port_reg_display(res->port_id, res->reg_off);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_read_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, reg_off, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_read_reg = {
-	.f = cmd_read_reg_parsed,
-	.data = NULL,
-	.help_str = "read reg <port_id> <reg_off>",
-	.tokens = {
-		(void *)&cmd_read_reg_read,
-		(void *)&cmd_read_reg_reg,
-		(void *)&cmd_read_reg_port_id,
-		(void *)&cmd_read_reg_reg_off,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT FIELD *** */
-struct cmd_read_reg_bit_field_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-};
-
-static void
-cmd_read_reg_bit_field_parsed(void *parsed_result,
-			      __rte_unused struct cmdline *cl,
-			      __rte_unused void *data)
-{
-	struct cmd_read_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_display(res->port_id, res->reg_off,
-				   res->bit1_pos, res->bit2_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result, read,
-				 "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit_field = {
-	.f = cmd_read_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "read regfield <port_id> <reg_off> <bit_x> <bit_y>: "
-	"Read register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_field_read,
-		(void *)&cmd_read_reg_bit_field_regfield,
-		(void *)&cmd_read_reg_bit_field_port_id,
-		(void *)&cmd_read_reg_bit_field_reg_off,
-		(void *)&cmd_read_reg_bit_field_bit1_pos,
-		(void *)&cmd_read_reg_bit_field_bit2_pos,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT *** */
-struct cmd_read_reg_bit_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-};
-
-static void
-cmd_read_reg_bit_parsed(void *parsed_result,
-			__rte_unused struct cmdline *cl,
-			__rte_unused void *data)
-{
-	struct cmd_read_reg_bit_result *res = parsed_result;
-	port_reg_bit_display(res->port_id, res->reg_off, res->bit_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_read_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit = {
-	.f = cmd_read_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "read regbit <port_id> <reg_off> <bit_x>: 0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_read,
-		(void *)&cmd_read_reg_bit_regbit,
-		(void *)&cmd_read_reg_bit_port_id,
-		(void *)&cmd_read_reg_bit_reg_off,
-		(void *)&cmd_read_reg_bit_bit_pos,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER *** */
-struct cmd_write_reg_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_parsed(void *parsed_result,
-		     __rte_unused struct cmdline *cl,
-		     __rte_unused void *data)
-{
-	struct cmd_write_reg_result *res = parsed_result;
-	port_reg_set(res->port_id, res->reg_off, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, write, "write");
-static cmdline_parse_token_string_t cmd_write_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_write_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, reg_off, RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, value, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg = {
-	.f = cmd_write_reg_parsed,
-	.data = NULL,
-	.help_str = "write reg <port_id> <reg_off> <reg_value>",
-	.tokens = {
-		(void *)&cmd_write_reg_write,
-		(void *)&cmd_write_reg_reg,
-		(void *)&cmd_write_reg_port_id,
-		(void *)&cmd_write_reg_reg_off,
-		(void *)&cmd_write_reg_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT FIELD *** */
-struct cmd_write_reg_bit_field_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_bit_field_parsed(void *parsed_result,
-			       __rte_unused struct cmdline *cl,
-			       __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_set(res->port_id, res->reg_off,
-			  res->bit1_pos, res->bit2_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, value,
-			      RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg_bit_field = {
-	.f = cmd_write_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "write regfield <port_id> <reg_off> <bit_x> <bit_y> "
-		"<reg_value>: "
-		"Set register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_field_write,
-		(void *)&cmd_write_reg_bit_field_regfield,
-		(void *)&cmd_write_reg_bit_field_port_id,
-		(void *)&cmd_write_reg_bit_field_reg_off,
-		(void *)&cmd_write_reg_bit_field_bit1_pos,
-		(void *)&cmd_write_reg_bit_field_bit2_pos,
-		(void *)&cmd_write_reg_bit_field_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT *** */
-struct cmd_write_reg_bit_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-	uint8_t value;
-};
-
-static void
-cmd_write_reg_bit_parsed(void *parsed_result,
-			 __rte_unused struct cmdline *cl,
-			 __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_result *res = parsed_result;
-	port_reg_bit_set(res->port_id, res->reg_off, res->bit_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_write_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, value,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_write_reg_bit = {
-	.f = cmd_write_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "write regbit <port_id> <reg_off> <bit_x> 0|1: "
-		"0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_write,
-		(void *)&cmd_write_reg_bit_regbit,
-		(void *)&cmd_write_reg_bit_port_id,
-		(void *)&cmd_write_reg_bit_reg_off,
-		(void *)&cmd_write_reg_bit_bit_pos,
-		(void *)&cmd_write_reg_bit_value,
-		NULL,
-	},
-};
-
 /* *** READ A RING DESCRIPTOR OF A PORT RX/TX QUEUE *** */
 struct cmd_read_rxd_txd_result {
 	cmdline_fixed_string_t read;
@@ -14222,12 +13893,6 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_queue_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_config_dcb,
-	(cmdline_parse_inst_t *)&cmd_read_reg,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit,
-	(cmdline_parse_inst_t *)&cmd_write_reg,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit,
 	(cmdline_parse_inst_t *)&cmd_read_rxd_txd,
 	(cmdline_parse_inst_t *)&cmd_stop,
 	(cmdline_parse_inst_t *)&cmd_mac_addr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a2939867c4..3a53b616d8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -31,7 +31,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -1138,200 +1137,6 @@ vlan_id_is_invalid(uint16_t vlan_id)
 	return 1;
 }
 
-static int
-port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	uint64_t pci_len;
-
-	if (reg_off & 0x3) {
-		fprintf(stderr,
-			"Port register offset 0x%X not aligned on a 4-byte boundary\n",
-			(unsigned int)reg_off);
-		return 1;
-	}
-
-	if (!ports[port_id].dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 1;
-	}
-
-	pci_len = pci_dev->mem_resource[0].len;
-	if (reg_off >= pci_len) {
-		fprintf(stderr,
-			"Port %d: register offset %u (0x%X) out of port PCI resource (length=%"PRIu64")\n",
-			port_id, (unsigned int)reg_off, (unsigned int)reg_off,
-			pci_len);
-		return 1;
-	}
-	return 0;
-}
-
-static int
-reg_bit_pos_is_invalid(uint8_t bit_pos)
-{
-	if (bit_pos <= 31)
-		return 0;
-	fprintf(stderr, "Invalid bit position %d (must be <= 31)\n", bit_pos);
-	return 1;
-}
-
-#define display_port_and_reg_off(port_id, reg_off) \
-	printf("port %d PCI register at offset 0x%X: ", (port_id), (reg_off))
-
-static inline void
-display_port_reg_value(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("0x%08X (%u)\n", (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x)
-{
-	uint32_t reg_v;
-
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_x))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bit %d=%d\n", bit_x, (int) ((reg_v & (1 << bit_x)) >> bit_x));
-}
-
-void
-port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-			   uint8_t bit1_pos, uint8_t bit2_pos)
-{
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v >>= l_bit;
-	if (h_bit < 31)
-		reg_v &= ((1 << (h_bit - l_bit + 1)) - 1);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bits[%d, %d]=0x%0*X (%u)\n", l_bit, h_bit,
-	       ((h_bit - l_bit) / 4) + 1, (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_display(portid_t port_id, uint32_t reg_off)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		 uint8_t bit_v)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_pos))
-		return;
-	if (bit_v > 1) {
-		fprintf(stderr, "Invalid bit value %d (must be 0 or 1)\n",
-			(int) bit_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	if (bit_v == 0)
-		reg_v &= ~(1 << bit_pos);
-	else
-		reg_v |= (1 << bit_pos);
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-		       uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value)
-{
-	uint32_t max_v;
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	if ((h_bit - l_bit) < 31)
-		max_v = (1 << (h_bit - l_bit + 1)) - 1;
-	else
-		max_v = 0xFFFFFFFF;
-
-	if (value > max_v) {
-		fprintf(stderr, "Invalid value %u (0x%x) must be < %u (0x%x)\n",
-				(unsigned)value, (unsigned)value,
-				(unsigned)max_v, (unsigned)max_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v &= ~(max_v << l_bit); /* Keep unchanged bits */
-	reg_v |= (value << l_bit); /* Set changed bits */
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
 static uint32_t
 eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
 {
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 1a3fd9ce8a..144f28819c 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 1e01120ae9..fd6abc0f41 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c
index 71849aaf96..8fafdec548 100644
--- a/app/test-pmd/iofwd.c
+++ b/app/test-pmd/iofwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index 79c9241d00..beb220fbb4 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index acb0fd7fb4..4f8deb3382 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 74399178dd..8488efc138 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON')
     ext_deps += jansson_dep
 endif
 
-deps += ['ethdev', 'cmdline', 'bus_pci']
+deps += ['ethdev', 'cmdline']
 if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
     deps += 'crypto_scheduler'
 endif
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e3c9757f3f..c77624302f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -33,7 +33,6 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 04457010f4..d528d4f34e 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index addcbcac85..ee686393c5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -42,7 +42,6 @@
 #include <rte_mbuf.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_dev.h>
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index fb2f5195d3..e4ba7147a3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -7,8 +7,6 @@
 
 #include <stdbool.h>
 
-#include <rte_pci.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
@@ -267,7 +265,7 @@ struct port_txqueue {
  * The data structure associated with each port.
  */
 struct rte_port {
-	struct rte_eth_dev_info dev_info;   /**< PCI info + driver name */
+	struct rte_eth_dev_info dev_info;   /**< Device info + driver name */
 	struct rte_eth_conf     dev_conf;   /**< Port configuration. */
 	struct rte_ether_addr       eth_addr;   /**< Port ethernet address */
 	struct rte_eth_stats    stats;      /**< Last port statistics */
@@ -801,65 +799,6 @@ mbuf_pool_find(unsigned int sock_id, uint16_t idx)
 	return rte_mempool_lookup((const char *)pool_name);
 }
 
-/**
- * Read/Write operations on a PCI register of a port.
- */
-static inline uint32_t
-port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-	uint32_t reg_v;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 0;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	reg_v = *((volatile uint32_t *)reg_addr);
-	return rte_le_to_cpu_32(reg_v);
-}
-
-#define port_id_pci_reg_read(pt_id, reg_off) \
-	port_pci_reg_read(&ports[(pt_id)], (reg_off))
-
-static inline void
-port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
-}
-
-#define port_id_pci_reg_write(pt_id, reg_off, reg_value) \
-	port_pci_reg_write(&ports[(pt_id)], (reg_off), (reg_value))
-
 static inline void
 get_start_cycles(uint64_t *start_tsc)
 {
@@ -922,15 +861,6 @@ void update_fwd_ports(portid_t new_pid);
 void set_fwd_eth_peer(portid_t port_id, char *peer_addr);
 
 void port_mtu_set(portid_t port_id, uint16_t mtu);
-void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos);
-void port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		      uint8_t bit_v);
-void port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-				uint8_t bit1_pos, uint8_t bit2_pos);
-void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-			    uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
-void port_reg_display(portid_t port_id, uint32_t reg_off);
-void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
 int port_action_handle_create(portid_t port_id, uint32_t id,
 			      const struct rte_flow_indir_action_conf *conf,
 			      const struct rte_flow_action *action);
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index e1bc78b73d..021624952d 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 330e34427d..7dacd6fb04 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -55,7 +55,6 @@ These are divided into sections and can be accessed using help, help section or
            help display                    : Displaying port, stats and config information.
            help config                     : Configuration information.
            help ports                      : Configuring ports.
-           help registers                  : Reading and setting port registers.
            help filters                    : Filters configuration help.
            help traffic_management         : Traffic Management commands.
            help devices                    : Device related commands.
@@ -2356,86 +2355,6 @@ manage link bonding devices from within testpmd interactive prompt.
 
 See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information.
 
-Register Functions
-------------------
-
-The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
-This is mainly useful for debugging purposes.
-Reference should be made to the appropriate datasheet for the network card for details on the register addresses
-and fields that can be accessed.
-
-read reg
-~~~~~~~~
-
-Display the value of a port register::
-
-   testpmd> read reg (port_id) (address)
-
-For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
-
-   testpmd> read reg 0 0xEE00
-   port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
-
-read regfield
-~~~~~~~~~~~~~
-
-Display a port register bit field::
-
-   testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
-
-For example, reading the lowest two bits from the register in the example above::
-
-   testpmd> read regfield 0 0xEE00 0 1
-   port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
-
-read regbit
-~~~~~~~~~~~
-
-Display a single port register bit::
-
-   testpmd> read regbit (port_id) (address) (bit_x)
-
-For example, reading the lowest bit from the register in the example above::
-
-   testpmd> read regbit 0 0xEE00 0
-   port 0 PCI register at offset 0xEE00: bit 0=1
-
-write reg
-~~~~~~~~~
-
-Set the value of a port register::
-
-   testpmd> write reg (port_id) (address) (value)
-
-For example, to clear a register::
-
-   testpmd> write reg 0 0xEE00 0x0
-   port 0 PCI register at offset 0xEE00: 0x00000000 (0)
-
-write regfield
-~~~~~~~~~~~~~~
-
-Set bit field of a port register::
-
-   testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
-
-For example, writing to the register cleared in the example above::
-
-   testpmd> write regfield 0 0xEE00 0 1 2
-   port 0 PCI register at offset 0xEE00: 0x00000002 (2)
-
-write regbit
-~~~~~~~~~~~~
-
-Set single bit value of a port register::
-
-   testpmd> write regbit (port_id) (address) (bit_x) (value)
-
-For example, to set the high bit in the register from the example above::
-
-   testpmd> write regbit 0 0xEE00 31 1
-   port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
-
 Traffic Metering and Policing
 -----------------------------
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 05/27] kni: stop populating PCI info in examples
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (3 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 04/27] app/testpmd: drop PCI register commands David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 06/27] examples/ethtool: prefer device name David Marchand
                     ` (21 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Cristian Dumitrescu

addr and id fields are deprecated and are not used in the kni library.
Stop populating them in the in-tree examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_kni.c        | 30 ------------------------------
 examples/ip_pipeline/kni.c | 10 ----------
 2 files changed, 40 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 622315c8b1..4039da0b08 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -25,7 +25,6 @@ test_kni(void)
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
@@ -426,8 +425,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 
 	if (!mp)
 		return -1;
@@ -443,13 +440,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
 
 	/* core id 1 configured for kernel thread */
@@ -545,8 +535,6 @@ test_kni(void)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
 	FILE *fd;
 	DIR *dir;
 	char buf[16];
@@ -645,15 +633,6 @@ test_kni(void)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
@@ -689,15 +668,6 @@ test_kni(void)
 		goto fail;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index a2d3331cb0..cd02c39478 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_string_fns.h>
 
 #include "kni.h"
@@ -107,8 +106,6 @@ kni_create(const char *name, struct kni_params *params)
 	struct mempool *mempool;
 	struct link *link;
 	struct rte_kni *k;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int ret;
 
 	/* Check input params */
@@ -134,13 +131,6 @@ kni_create(const char *name, struct kni_params *params)
 	kni_conf.core_id = params->thread_id;
 	kni_conf.group_id = link->port_id;
 	kni_conf.mbuf_size = mempool->buffer_size;
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		kni_conf.addr = pci_dev->addr;
-		kni_conf.id = pci_dev->id;
-	}
 
 	memset(&kni_ops, 0, sizeof(kni_ops));
 	kni_ops.port_id = link->port_id;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 06/27] examples/ethtool: prefer device name
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (4 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 05/27] kni: stop populating PCI info in examples David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 07/27] dev: hide debug messages in device iterator David Marchand
                     ` (20 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Rely on the generic device name rather than restrict to only supporting
PCI devices.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/ethtool/lib/rte_ethtool.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index ffaad96498..88dc917b73 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -8,7 +8,6 @@
 #include <rte_version.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_NET_IXGBE
 #include <rte_pmd_ixgbe.h>
 #endif
@@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 {
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int n;
 	int ret;
 
@@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	/* TODO: replace bus_info by rte_devargs.name */
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
-			"%04x:%02x:%02x.%x",
-			pci_dev->addr.domain, pci_dev->addr.bus,
-			pci_dev->addr.devid, pci_dev->addr.function);
-	} else {
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
-	}
+	strlcpy(drvinfo->bus_info, dev_info.device->name,
+		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
 	rte_eth_dev_get_reg_info(port_id, &reg_info);
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 07/27] dev: hide debug messages in device iterator
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (5 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 06/27] examples/ethtool: prefer device name David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
                     ` (19 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang

For any bus that does not support device iteration, rte_dev_iterator_init
both returned an error code and logged an error message.
An application (like testpmd) that only wants to list devices, would have
no choice but to inspect a bus object to avoid spewing error logs.

Make those log messages debug level, and remove the check in testpmd.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/config.c           | 4 ----
 lib/eal/common/eal_common_dev.c | 7 +++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3a53b616d8..bc73819183 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -641,10 +641,6 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		/* Skip buses that don't have iterate method */
-		if (!next->dev_iterate)
-			continue;
-
 		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 9d913e5478..b6f0392f30 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -592,18 +592,17 @@ rte_dev_iterator_init(struct rte_dev_iterator *it,
 	 * one layer specified.
 	 */
 	if (bus == NULL && cls == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Either bus or class must be specified.\n");
+		RTE_LOG(DEBUG, EAL, "Either bus or class must be specified.\n");
 		rte_errno = EINVAL;
 		goto get_out;
 	}
 	if (bus != NULL && bus->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Bus %s not supported\n", bus->name);
+		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", bus->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
 	if (cls != NULL && cls->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Class %s not supported\n", cls->name);
+		RTE_LOG(DEBUG, EAL, "Class %s not supported\n", cls->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (6 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 07/27] dev: hide debug messages in device iterator David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 09/27] devargs: remove dependency on bus header David Marchand
                     ` (18 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Fan Zhang, Ashish Gupta,
	Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Rosen Xu, Tianfei zhang,
	Sachin Saxena, Hemant Agrawal, Akhil Goyal, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Abhinandan Gujjar,
	Jerin Jacob, Jay Jayatheerthan, Olivier Matz, Ori Kam,
	Maxime Coquelin, Chenbo Xia

Those macros have no real value and are easily replaced with a simple
if() block.

Existing users have been converted using a new cocci script.
Deprecate them.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |   4 +
 doc/guides/rel_notes/release_22_11.rst        |   4 +
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_qp.c                   |  31 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   6 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   6 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  21 +-
 lib/compressdev/rte_compressdev.c             |  47 +--
 lib/cryptodev/rte_cryptodev.c                 |  43 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/eal/include/rte_dev.h                     |   7 +-
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_pci.h                       |   3 +-
 lib/ethdev/rte_ethdev.c                       | 276 ++++++++++++------
 lib/ethdev/rte_ethdev.h                       |   9 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  10 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  13 +-
 lib/eventdev/rte_eventdev.c                   |  62 ++--
 lib/mempool/rte_mempool_ops.c                 |   3 +-
 lib/rawdev/rte_rawdev.c                       |  75 +++--
 lib/regexdev/rte_regexdev.c                   |  59 ++--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   6 +-
 lib/vhost/vdpa.c                              |   9 +-
 lib/vhost/vhost_user.c                        |   6 +-
 31 files changed, 517 insertions(+), 285 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci

diff --git a/devtools/cocci/func_or_ret.cocci b/devtools/cocci/func_or_ret.cocci
new file mode 100644
index 0000000000..f23d60cc4e
--- /dev/null
+++ b/devtools/cocci/func_or_ret.cocci
@@ -0,0 +1,12 @@
+@@
+expression cond, ret;
+@@
+-RTE_FUNC_PTR_OR_ERR_RET(cond, ret);
++if (cond == NULL)
++	return ret;
+@@
+expression cond;
+@@
+-RTE_FUNC_PTR_OR_RET(cond);
++if (cond == NULL)
++	return;
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index dba252067c..5b4ffc992d 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -14,6 +14,10 @@ Deprecation Notices
 * kvargs: The function ``rte_kvargs_process`` will get a new parameter
   for returning key match count. It will ease handling of no-match case.
 
+* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
+  to update their code.
+
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 3cea3aa8eb..225a380de0 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,10 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
+  to update their code.
+
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
 
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index db4b087d2b..30e5cdb573 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -58,8 +58,8 @@ qat_pci_get_extra_size(enum qat_device_gen qat_dev_gen)
 {
 	struct qat_dev_hw_spec_funcs *ops_hw =
 		qat_dev_hw_spec[qat_dev_gen];
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_get_extra_size,
-		-ENOTSUP);
+	if (ops_hw->qat_dev_get_extra_size == NULL)
+		return -ENOTSUP;
 	return ops_hw->qat_dev_get_extra_size();
 }
 
@@ -381,8 +381,8 @@ static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		return -ENODEV;
 
 	ops_hw = qat_dev_hw_spec[qat_pci_dev->qat_dev_gen];
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_reset_ring_pairs,
-		-ENOTSUP);
+	if (ops_hw->qat_dev_reset_ring_pairs == NULL)
+		return -ENOTSUP;
 	if (ops_hw->qat_dev_reset_ring_pairs(qat_pci_dev)) {
 		QAT_LOG(ERR,
 			"Cannot reset ring pairs, does pf driver supports pf2vf comms?"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 08ac91eac4..8674eccdca 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -370,8 +370,8 @@ adf_queue_arb_enable(struct qat_pci_device *qat_dev, struct qat_queue *txq,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_enable,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_arb_enable == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_arb_enable(txq, base_addr, lock);
 	return 0;
 }
@@ -383,8 +383,8 @@ adf_queue_arb_disable(enum qat_device_gen qat_dev_gen, struct qat_queue *txq,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_disable,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_arb_disable == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_arb_disable(txq, base_addr, lock);
 	return 0;
 }
@@ -396,8 +396,8 @@ qat_qp_build_ring_base(struct qat_pci_device *qat_dev, void *io_addr,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_build_ring_base,
-			-ENOTSUP);
+	if (ops->qat_qp_build_ring_base == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_build_ring_base(io_addr, queue);
 	return 0;
 }
@@ -409,8 +409,8 @@ qat_qps_per_service(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_rings_per_service,
-			-ENOTSUP);
+	if (ops->qat_qp_rings_per_service == NULL)
+		return -ENOTSUP;
 	return ops->qat_qp_rings_per_service(qat_dev, service);
 }
 
@@ -421,7 +421,8 @@ qat_qp_get_hw_data(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_get_hw_data, NULL);
+	if (ops->qat_qp_get_hw_data == NULL)
+		return NULL;
 	return ops->qat_qp_get_hw_data(qat_dev, service, qp_id);
 }
 
@@ -431,8 +432,8 @@ qat_read_qp_config(struct qat_pci_device *qat_dev)
 	struct qat_dev_hw_spec_funcs *ops_hw =
 		qat_dev_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_read_config,
-			-ENOTSUP);
+	if (ops_hw->qat_dev_read_config == NULL)
+		return -ENOTSUP;
 	return ops_hw->qat_dev_read_config(qat_dev);
 }
 
@@ -442,8 +443,8 @@ adf_configure_queues(struct qat_qp *qp, enum qat_device_gen qat_dev_gen)
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_configure_queues,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_configure_queues == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_configure_queues(qp);
 	return 0;
 }
@@ -483,8 +484,8 @@ qat_qp_csr_setup(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_csr_setup,
-			-ENOTSUP);
+	if (ops->qat_qp_csr_setup == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_csr_setup(qat_dev, io_addr, qp);
 	return 0;
 }
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index dc8db84a68..6fb8cf69be 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -25,8 +25,8 @@ qat_comp_capabilities_info qat_comp_get_capa_info(
 
 	if (qat_dev_gen >= QAT_N_GENS)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(qat_comp_gen_dev_ops[qat_dev_gen]
-			.qat_comp_get_capabilities, ret);
+	if (qat_comp_gen_dev_ops[qat_dev_gen].qat_comp_get_capabilities == NULL)
+		return ret;
 	return qat_comp_gen_dev_ops[qat_dev_gen]
 			.qat_comp_get_capabilities(qat_dev);
 }
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 1e0c4fe464..258d6f8c43 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -541,7 +541,8 @@ rte_cryptodev_scheduler_option_set(uint8_t scheduler_id,
 
 	sched_ctx = dev->data->dev_private;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_set, -ENOTSUP);
+	if (*sched_ctx->ops.option_set == NULL)
+		return -ENOTSUP;
 
 	return (*sched_ctx->ops.option_set)(dev, option_type, option);
 }
@@ -571,7 +572,8 @@ rte_cryptodev_scheduler_option_get(uint8_t scheduler_id,
 
 	sched_ctx = dev->data->dev_private;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_get, -ENOTSUP);
+	if (*sched_ctx->ops.option_get == NULL)
+		return -ENOTSUP;
 
 	return (*sched_ctx->ops.option_get)(dev, option_type, option);
 }
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index f3a1bd626c..83ae6b6be9 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -160,7 +160,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
 		return -1;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.worker_attach, -ENOTSUP);
+	if (*sched_ctx->ops.worker_attach == NULL)
+		return -ENOTSUP;
 
 	for (i = 0; i < sched_ctx->nb_workers; i++) {
 		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
@@ -171,7 +172,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.scheduler_start, -ENOTSUP);
+	if (*sched_ctx->ops.scheduler_start == NULL)
+		return -ENOTSUP;
 
 	if ((*sched_ctx->ops.scheduler_start)(dev) < 0) {
 		CR_SCHED_LOG(ERR, "Scheduler start failed");
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f8575f..89fe3a828a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -291,7 +291,8 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 	if (on > 1)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
+		return -ENOTSUP;
 
 	/* The PF has 128 queue pairs and in SRIOV configuration
 	 * those queues will be assigned to VF's, so RXDCTL
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 90ffe31b9f..ebcfbb1a5c 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -281,7 +281,8 @@ lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
 	}
 
 	/* clear stored per queue stats */
-	RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
+	if (*eth_dev->dev_ops->stats_reset == NULL)
+		return 0;
 	return (*eth_dev->dev_ops->stats_reset)(eth_dev);
 }
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 78a7123528..3b616c45ff 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -713,7 +713,8 @@ ifpga_rawdev_configure(const struct rte_rawdev *dev,
 {
 	IFPGA_RAWDEV_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	return config ? 0 : 1;
 }
@@ -726,7 +727,8 @@ ifpga_rawdev_start(struct rte_rawdev *dev)
 
 	IFPGA_RAWDEV_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	adapter = ifpga_rawdev_get_priv(dev);
 	if (!adapter)
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 16ecae3d92..72d3b69d75 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -76,7 +76,8 @@ static int skeleton_rawdev_configure(const struct rte_rawdev *dev,
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	if (config == NULL || config_size != sizeof(*skeldev_conf)) {
 		SKELETON_PMD_ERR("Invalid configuration");
@@ -106,7 +107,8 @@ static int skeleton_rawdev_start(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -169,7 +171,8 @@ static int skeleton_rawdev_close(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -212,7 +215,8 @@ static int skeleton_rawdev_reset(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -295,7 +299,8 @@ static int skeleton_rawdev_queue_release(struct rte_rawdev *dev,
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -317,7 +322,8 @@ static uint16_t skeleton_rawdev_queue_count(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 	return skeldev->num_queues;
@@ -468,7 +474,8 @@ static int skeleton_rawdev_firmware_status_get(struct rte_rawdev *dev,
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	if (status_info)
 		memcpy(status_info, &skeldev->fw.firmware_state,
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 22c438f2dd..5ddbc3f9c0 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -315,7 +315,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
 
 	memset(&dev_info, 0, sizeof(struct rte_compressdev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
 	if ((dev_info.max_nb_queue_pairs != 0) &&
@@ -344,8 +345,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
 
 		qp = dev->data->queue_pairs;
 
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+		if (*dev->dev_ops->queue_pair_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_qpairs; i < old_nb_queues; i++) {
 			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -395,8 +396,8 @@ rte_compressdev_queue_pairs_release(struct rte_compressdev *dev)
 	COMPRESSDEV_LOG(DEBUG, "Free %d queues pairs on device %u",
 			dev->data->nb_queue_pairs, dev->data->dev_id);
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+	if (*dev->dev_ops->queue_pair_release == NULL)
+		return -ENOTSUP;
 
 	for (i = 0; i < num_qps; i++) {
 		ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -430,7 +431,8 @@ rte_compressdev_configure(uint8_t dev_id, struct rte_compressdev_config *config)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	/* Setup new number of queue pairs and reconfigure device. */
 	diag = rte_compressdev_queue_pairs_config(dev, config->nb_queue_pairs,
@@ -460,7 +462,8 @@ rte_compressdev_start(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -489,7 +492,8 @@ rte_compressdev_stop(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -527,7 +531,8 @@ rte_compressdev_close(uint8_t dev_id)
 	if (retval < 0)
 		return retval;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	retval = (*dev->dev_ops->dev_close)(dev);
 
 	if (retval < 0)
@@ -565,7 +570,8 @@ rte_compressdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_pair_setup == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id,
 			max_inflight_ops, socket_id);
@@ -611,7 +617,8 @@ rte_compressdev_stats_get(uint8_t dev_id, struct rte_compressdev_stats *stats)
 	dev = &rte_comp_devices[dev_id];
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->stats_get)(dev, stats);
 	return 0;
 }
@@ -628,7 +635,8 @@ rte_compressdev_stats_reset(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return;
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -647,7 +655,8 @@ rte_compressdev_info_get(uint8_t dev_id, struct rte_compressdev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_compressdev_info));
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->driver_name = dev->device->driver->name;
@@ -666,7 +675,8 @@ rte_compressdev_private_xform_create(uint8_t dev_id,
 	if (xform == NULL || priv_xform == NULL || dev == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_create, -ENOTSUP);
+	if (*dev->dev_ops->private_xform_create == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->private_xform_create)(dev, xform, priv_xform);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -689,7 +699,8 @@ rte_compressdev_private_xform_free(uint8_t dev_id, void *priv_xform)
 	if (dev == NULL || priv_xform == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_free, -ENOTSUP);
+	if (*dev->dev_ops->private_xform_free == NULL)
+		return -ENOTSUP;
 	ret = dev->dev_ops->private_xform_free(dev, priv_xform);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -714,7 +725,8 @@ rte_compressdev_stream_create(uint8_t dev_id,
 	if (xform == NULL || dev == NULL || stream == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_create, -ENOTSUP);
+	if (*dev->dev_ops->stream_create == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->stream_create)(dev, xform, stream);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -738,7 +750,8 @@ rte_compressdev_stream_free(uint8_t dev_id, void *stream)
 	if (dev == NULL || stream == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_free, -ENOTSUP);
+	if (*dev->dev_ops->stream_free == NULL)
+		return -ENOTSUP;
 	ret = dev->dev_ops->stream_free(dev, stream);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..6250302f3b 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -978,7 +978,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
 
 	memset(&dev_info, 0, sizeof(struct rte_cryptodev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
 	if (nb_qpairs > (dev_info.max_nb_queue_pairs)) {
@@ -1007,8 +1008,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
 
 		qp = dev->data->queue_pairs;
 
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+		if (*dev->dev_ops->queue_pair_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_qpairs; i < old_nb_queues; i++) {
 			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -1041,7 +1042,8 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	rte_spinlock_lock(&rte_cryptodev_callback_lock);
 	cryptodev_cb_cleanup(dev);
@@ -1083,7 +1085,8 @@ rte_cryptodev_start(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already started",
@@ -1116,7 +1119,8 @@ rte_cryptodev_stop(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already stopped",
@@ -1163,7 +1167,8 @@ rte_cryptodev_close(uint8_t dev_id)
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	retval = (*dev->dev_ops->dev_close)(dev);
 	rte_cryptodev_trace_close(dev_id, retval);
 
@@ -1262,7 +1267,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_pair_setup == NULL)
+		return -ENOTSUP;
 
 	rte_cryptodev_trace_queue_pair_setup(dev_id, queue_pair_id, qp_conf);
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
@@ -1557,7 +1563,8 @@ rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
 	dev = &rte_crypto_devices[dev_id];
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->stats_get)(dev, stats);
 	return 0;
 }
@@ -1574,7 +1581,8 @@ rte_cryptodev_stats_reset(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return;
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -1592,7 +1600,8 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_cryptodev_info));
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->driver_name = dev->device->driver->name;
@@ -1739,7 +1748,8 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 	if (index >= sess->nb_drivers)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
+	if (*dev->dev_ops->sym_session_configure == NULL)
+		return -ENOTSUP;
 
 	if (sess->sess_data[index].refcnt == 0) {
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
@@ -1968,7 +1978,8 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
 	/* Clear device session pointer.*/
 	memset(sess->sess_private_data, 0, session_priv_data_sz + sess->user_data_sz);
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_configure, -ENOTSUP);
+	if (*dev->dev_ops->asym_session_configure == NULL)
+		return -ENOTSUP;
 
 	if (sess->sess_private_data[0] == 0) {
 		ret = dev->dev_ops->asym_session_configure(dev, xforms, sess);
@@ -2007,7 +2018,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
 	if (--sess->sess_data[driver_id].refcnt != 0)
 		return -EBUSY;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
+	if (*dev->dev_ops->sym_session_clear == NULL)
+		return -ENOTSUP;
 
 	dev->dev_ops->sym_session_clear(dev, sess);
 
@@ -2054,7 +2066,8 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
 	if (dev == NULL || sess == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_clear, -ENOTSUP);
+	if (*dev->dev_ops->asym_session_clear == NULL)
+		return -ENOTSUP;
 
 	dev->dev_ops->asym_session_clear(dev, sess);
 
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..d575c14493 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -420,7 +420,8 @@ rte_dma_info_get(int16_t dev_id, struct rte_dma_info *dev_info)
 	if (!rte_dma_is_valid(dev_id) || dev_info == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_info_get == NULL)
+		return -ENOTSUP;
 	memset(dev_info, 0, sizeof(struct rte_dma_info));
 	ret = (*dev->dev_ops->dev_info_get)(dev, dev_info,
 					    sizeof(struct rte_dma_info));
@@ -472,7 +473,8 @@ rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_configure)(dev, dev_conf,
 					     sizeof(struct rte_dma_conf));
 	if (ret == 0)
@@ -555,7 +557,8 @@ rte_dma_close(int16_t dev_id)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_close)(dev);
 	if (ret == 0)
 		dma_release(dev);
@@ -648,7 +651,8 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_setup, -ENOTSUP);
+	if (*dev->dev_ops->vchan_setup == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->vchan_setup)(dev, vchan, conf,
 					sizeof(struct rte_dma_vchan_conf));
 }
@@ -668,7 +672,8 @@ rte_dma_stats_get(int16_t dev_id, uint16_t vchan, struct rte_dma_stats *stats)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	memset(stats, 0, sizeof(struct rte_dma_stats));
 	return (*dev->dev_ops->stats_get)(dev, vchan, stats,
 					  sizeof(struct rte_dma_stats));
@@ -689,7 +694,8 @@ rte_dma_stats_reset(int16_t dev_id, uint16_t vchan)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->stats_reset)(dev, vchan);
 }
 
@@ -706,7 +712,8 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_status, -ENOTSUP);
+	if (*dev->dev_ops->vchan_status == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->vchan_status)(dev, vchan, status);
 }
 
diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
index e7f992b734..e61d71959e 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -860,7 +860,8 @@ rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || length == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy, -ENOTSUP);
+	if (*obj->copy == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->copy)(obj->dev_private, vchan, src, dst, length, flags);
@@ -911,7 +912,8 @@ rte_dma_copy_sg(int16_t dev_id, uint16_t vchan, struct rte_dma_sge *src,
 	if (!rte_dma_is_valid(dev_id) || src == NULL || dst == NULL ||
 	    nb_src == 0 || nb_dst == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy_sg, -ENOTSUP);
+	if (*obj->copy_sg == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->copy_sg)(obj->dev_private, vchan, src, dst, nb_src,
@@ -957,7 +959,8 @@ rte_dma_fill(int16_t dev_id, uint16_t vchan, uint64_t pattern,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || length == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->fill, -ENOTSUP);
+	if (*obj->fill == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->fill)(obj->dev_private, vchan, pattern, dst, length,
@@ -990,7 +993,8 @@ rte_dma_submit(int16_t dev_id, uint16_t vchan)
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id))
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->submit, -ENOTSUP);
+	if (*obj->submit == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->submit)(obj->dev_private, vchan);
@@ -1033,7 +1037,8 @@ rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0)
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed, 0);
+	if (*obj->completed == NULL)
+		return 0;
 #endif
 
 	/* Ensure the pointer values are non-null to simplify drivers.
@@ -1095,7 +1100,8 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0 || status == NULL)
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed_status, 0);
+	if (*obj->completed_status == NULL)
+		return 0;
 #endif
 
 	if (last_idx == NULL)
@@ -1129,7 +1135,8 @@ rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan)
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id))
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->burst_capacity, 0);
+	if (*obj->burst_capacity == NULL)
+		return 0;
 #endif
 	return (*obj->burst_capacity)(obj->dev_private, vchan);
 }
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index e6ff1218f9..2743c09320 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -20,6 +20,7 @@ extern "C" {
 #include <stdio.h>
 
 #include <rte_config.h>
+#include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_log.h>
 
@@ -37,12 +38,14 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					void *cb_arg);
 
 /* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \
+do { \
 	if ((func) == NULL) \
 		return retval; \
 } while (0)
 
-#define RTE_FUNC_PTR_OR_RET(func) do { \
+#define RTE_FUNC_PTR_OR_RET(func) RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET) \
+do { \
 	if ((func) == NULL) \
 		return; \
 } while (0)
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
index a285f213f0..24a3969225 100644
--- a/lib/ethdev/ethdev_driver.c
+++ b/lib/ethdev/ethdev_driver.c
@@ -264,7 +264,8 @@ rte_eth_dev_create(struct rte_device *device, const char *name,
 	struct rte_eth_dev *ethdev;
 	int retval;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_init, -EINVAL);
+	if (*ethdev_init == NULL)
+		return -EINVAL;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		ethdev = rte_eth_dev_allocate(name);
@@ -328,7 +329,8 @@ rte_eth_dev_destroy(struct rte_eth_dev *ethdev,
 	if (!ethdev)
 		return -ENODEV;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_uninit, -EINVAL);
+	if (*ethdev_uninit == NULL)
+		return -EINVAL;
 
 	ret = ethdev_uninit(ethdev);
 	if (ret)
@@ -558,8 +560,8 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[cur_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_bind,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_bind == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_bind)(dev, cur_queue,
 							peer_info, direction);
@@ -573,8 +575,8 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[cur_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_unbind,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_unbind == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_unbind)(dev, cur_queue,
 							  direction);
@@ -594,8 +596,8 @@ rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[peer_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_update,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_update == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_update)(dev, peer_queue,
 					cur_info, peer_info, direction);
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 0549842709..a268507801 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -130,7 +130,8 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
 	if (!eth_dev)
 		return -ENOMEM;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
+	if (*dev_init == NULL)
+		return -EINVAL;
 	ret = dev_init(eth_dev);
 	if (ret)
 		rte_eth_dev_release_port(eth_dev);
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0850..9d6f460726 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -719,7 +719,8 @@ rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_start == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -751,7 +752,8 @@ rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_stop == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -790,7 +792,8 @@ rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_start == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -822,7 +825,8 @@ rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_stop == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1077,7 +1081,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started) {
 		RTE_ETHDEV_LOG(ERR,
@@ -1447,7 +1452,8 @@ rte_eth_dev_start(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1493,7 +1499,8 @@ rte_eth_dev_start(uint16_t port_id)
 	}
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 0);
 	}
 
@@ -1513,7 +1520,8 @@ rte_eth_dev_stop(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started == 0) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1541,7 +1549,8 @@ rte_eth_dev_set_link_up(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
+	if (*dev->dev_ops->dev_set_link_up == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_set_link_up)(dev));
 }
 
@@ -1553,7 +1562,8 @@ rte_eth_dev_set_link_down(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
+	if (*dev->dev_ops->dev_set_link_down == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev));
 }
 
@@ -1579,7 +1589,8 @@ rte_eth_dev_close(uint16_t port_id)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	*lasterr = (*dev->dev_ops->dev_close)(dev);
 	if (*lasterr != 0)
 		lasterr = &binerr;
@@ -1599,7 +1610,8 @@ rte_eth_dev_reset(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_reset == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_stop(port_id);
 	if (ret != 0) {
@@ -1624,7 +1636,8 @@ rte_eth_dev_is_removed(uint16_t port_id)
 	if (dev->state == RTE_ETH_DEV_REMOVED)
 		return 1;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->is_removed, 0);
+	if (*dev->dev_ops->is_removed == NULL)
+		return 0;
 
 	ret = dev->dev_ops->is_removed(dev);
 	if (ret != 0)
@@ -1725,7 +1738,8 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_setup == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
@@ -1928,8 +1942,8 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
 	if (ret != 0)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_hairpin_queue_setup,
-				-ENOTSUP);
+	if (*dev->dev_ops->rx_hairpin_queue_setup == NULL)
+		return -ENOTSUP;
 	/* if nb_rx_desc is zero use max number of desc from the driver. */
 	if (nb_rx_desc == 0)
 		nb_rx_desc = cap.max_nb_desc;
@@ -1990,7 +2004,8 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_setup == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
@@ -2094,8 +2109,8 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
 	if (ret != 0)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_hairpin_queue_setup,
-				-ENOTSUP);
+	if (*dev->dev_ops->tx_hairpin_queue_setup == NULL)
+		return -ENOTSUP;
 	/* if nb_rx_desc is zero use max number of desc from the driver. */
 	if (nb_tx_desc == 0)
 		nb_tx_desc = cap.max_nb_desc;
@@ -2152,7 +2167,8 @@ rte_eth_hairpin_bind(uint16_t tx_port, uint16_t rx_port)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_bind, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_bind == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->hairpin_bind)(dev, rx_port);
 	if (ret != 0)
 		RTE_ETHDEV_LOG(ERR, "Failed to bind hairpin Tx %d"
@@ -2176,7 +2192,8 @@ rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_unbind, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_unbind == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->hairpin_unbind)(dev, rx_port);
 	if (ret != 0)
 		RTE_ETHDEV_LOG(ERR, "Failed to unbind hairpin Tx %d"
@@ -2210,8 +2227,8 @@ rte_eth_hairpin_get_peer_ports(uint16_t port_id, uint16_t *peer_ports,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_get_peer_ports,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_get_peer_ports == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->hairpin_get_peer_ports)(dev, peer_ports,
 						      len, direction);
@@ -2282,7 +2299,8 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_done_cleanup, -ENOTSUP);
+	if (*dev->dev_ops->tx_done_cleanup == NULL)
+		return -ENOTSUP;
 
 	/* Call driver to free pending mbufs. */
 	ret = (*dev->dev_ops->tx_done_cleanup)(dev->data->tx_queues[queue_id],
@@ -2302,7 +2320,8 @@ rte_eth_promiscuous_enable(uint16_t port_id)
 	if (dev->data->promiscuous == 1)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
+	if (*dev->dev_ops->promiscuous_enable == NULL)
+		return -ENOTSUP;
 
 	diag = (*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = (diag == 0) ? 1 : 0;
@@ -2322,7 +2341,8 @@ rte_eth_promiscuous_disable(uint16_t port_id)
 	if (dev->data->promiscuous == 0)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
+	if (*dev->dev_ops->promiscuous_disable == NULL)
+		return -ENOTSUP;
 
 	dev->data->promiscuous = 0;
 	diag = (*dev->dev_ops->promiscuous_disable)(dev);
@@ -2355,7 +2375,8 @@ rte_eth_allmulticast_enable(uint16_t port_id)
 	if (dev->data->all_multicast == 1)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_enable, -ENOTSUP);
+	if (*dev->dev_ops->allmulticast_enable == NULL)
+		return -ENOTSUP;
 	diag = (*dev->dev_ops->allmulticast_enable)(dev);
 	dev->data->all_multicast = (diag == 0) ? 1 : 0;
 
@@ -2374,7 +2395,8 @@ rte_eth_allmulticast_disable(uint16_t port_id)
 	if (dev->data->all_multicast == 0)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_disable, -ENOTSUP);
+	if (*dev->dev_ops->allmulticast_disable == NULL)
+		return -ENOTSUP;
 	dev->data->all_multicast = 0;
 	diag = (*dev->dev_ops->allmulticast_disable)(dev);
 	if (diag != 0)
@@ -2411,7 +2433,8 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link)
 	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
 		rte_eth_linkstatus_get(dev, eth_link);
 	else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 1);
 		*eth_link = dev->data->dev_link;
 	}
@@ -2436,7 +2459,8 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link)
 	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
 		rte_eth_linkstatus_get(dev, eth_link);
 	else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 0);
 		*eth_link = dev->data->dev_link;
 	}
@@ -2513,7 +2537,8 @@ rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats)
 
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
 	return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats));
 }
@@ -2527,7 +2552,8 @@ rte_eth_stats_reset(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->stats_reset)(dev);
 	if (ret != 0)
 		return eth_err(port_id, ret);
@@ -3043,7 +3069,8 @@ eth_dev_set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id,
 	if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+	if (*dev->dev_ops->queue_stats_mapping_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_stats_mapping_set) (dev, queue_id, stat_idx, is_rx);
 }
 
@@ -3080,7 +3107,8 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	if (*dev->dev_ops->fw_version_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fw_version_get)(dev,
 							fw_version, fw_size));
 }
@@ -3121,7 +3149,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
 		RTE_ETHER_CRC_LEN;
 	dev_info->max_mtu = UINT16_MAX;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	diag = (*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	if (diag != 0) {
 		/* Cleanup already filled in device information */
@@ -3182,7 +3211,8 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_supported_ptypes_get, 0);
+	if (*dev->dev_ops->dev_supported_ptypes_get == NULL)
+		return 0;
 	all_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev);
 
 	if (!all_ptypes)
@@ -3360,7 +3390,8 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
+	if (*dev->dev_ops->mtu_set == NULL)
+		return -ENOTSUP;
 
 	/*
 	 * Check if the device supports dev_infos_get, if it does not
@@ -3413,7 +3444,8 @@ rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
 			port_id, vlan_id);
 		return -EINVAL;
 	}
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_filter_set == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
 	if (ret == 0) {
@@ -3448,7 +3480,8 @@ rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on);
 
 	return 0;
@@ -3464,7 +3497,8 @@ rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_tpid_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->vlan_tpid_set)(dev, vlan_type,
 							       tpid));
 }
@@ -3549,7 +3583,8 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_offload_set == NULL)
+		return -ENOTSUP;
 	dev->data->dev_conf.rxmode.offloads = dev_offloads;
 	ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);
 	if (ret) {
@@ -3594,7 +3629,8 @@ rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_pvid_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->vlan_pvid_set)(dev, pvid, on));
 }
 
@@ -3613,7 +3649,8 @@ rte_eth_dev_flow_ctrl_get(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
+	if (*dev->dev_ops->flow_ctrl_get == NULL)
+		return -ENOTSUP;
 	memset(fc_conf, 0, sizeof(*fc_conf));
 	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf));
 }
@@ -3638,7 +3675,8 @@ rte_eth_dev_flow_ctrl_set(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
+	if (*dev->dev_ops->flow_ctrl_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf));
 }
 
@@ -3899,7 +3937,8 @@ rte_eth_dev_rss_reta_update(uint16_t port_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
+	if (*dev->dev_ops->reta_update == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->reta_update)(dev, reta_conf,
 							     reta_size));
 }
@@ -3927,7 +3966,8 @@ rte_eth_dev_rss_reta_query(uint16_t port_id,
 	if (ret < 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
+	if (*dev->dev_ops->reta_query == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->reta_query)(dev, reta_conf,
 							    reta_size));
 }
@@ -3971,7 +4011,8 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
+	if (*dev->dev_ops->rss_hash_update == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
 								 rss_conf));
 }
@@ -3992,7 +4033,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
+	if (*dev->dev_ops->rss_hash_conf_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev,
 								   rss_conf));
 }
@@ -4018,7 +4060,8 @@ rte_eth_dev_udp_tunnel_port_add(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP);
+	if (*dev->dev_ops->udp_tunnel_port_add == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_add)(dev,
 								udp_tunnel));
 }
@@ -4044,7 +4087,8 @@ rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP);
+	if (*dev->dev_ops->udp_tunnel_port_del == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_del)(dev,
 								udp_tunnel));
 }
@@ -4057,7 +4101,8 @@ rte_eth_led_on(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
+	if (*dev->dev_ops->dev_led_on == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_led_on)(dev));
 }
 
@@ -4069,7 +4114,8 @@ rte_eth_led_off(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
+	if (*dev->dev_ops->dev_led_off == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev));
 }
 
@@ -4091,7 +4137,8 @@ rte_eth_fec_get_capability(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get_capability, -ENOTSUP);
+	if (*dev->dev_ops->fec_get_capability == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->fec_get_capability)(dev, speed_fec_capa, num);
 
 	return ret;
@@ -4112,7 +4159,8 @@ rte_eth_fec_get(uint16_t port_id, uint32_t *fec_capa)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get, -ENOTSUP);
+	if (*dev->dev_ops->fec_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fec_get)(dev, fec_capa));
 }
 
@@ -4124,7 +4172,8 @@ rte_eth_fec_set(uint16_t port_id, uint32_t fec_capa)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_set, -ENOTSUP);
+	if (*dev->dev_ops->fec_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fec_set)(dev, fec_capa));
 }
 
@@ -4173,7 +4222,8 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_add == NULL)
+		return -ENOTSUP;
 
 	if (rte_is_zero_ether_addr(addr)) {
 		RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n",
@@ -4231,7 +4281,8 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_remove == NULL)
+		return -ENOTSUP;
 
 	index = eth_dev_get_mac_addr_index(port_id, addr);
 	if (index == 0) {
@@ -4273,7 +4324,8 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)
 	if (!rte_is_valid_assigned_ether_addr(addr))
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_set == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->mac_addr_set)(dev, addr);
 	if (ret < 0)
@@ -4359,7 +4411,8 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr,
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
+	if (*dev->dev_ops->uc_hash_table_set == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
 	if (ret == 0) {
 		/* Update address in NIC data structure */
@@ -4382,7 +4435,8 @@ rte_eth_dev_uc_all_hash_table_set(uint16_t port_id, uint8_t on)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
+	if (*dev->dev_ops->uc_all_hash_table_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->uc_all_hash_table_set)(dev,
 								       on));
 }
@@ -4418,7 +4472,8 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
+	if (*dev->dev_ops->set_queue_rate_limit == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->set_queue_rate_limit)(dev,
 							queue_idx, tx_rate));
 }
@@ -4444,7 +4499,8 @@ int rte_eth_rx_avail_thresh_set(uint16_t port_id, uint16_t queue_id,
 			port_id);
 		return -EINVAL;
 	}
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_set, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_avail_thresh_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_set)(dev,
 							     queue_id, avail_thresh));
 }
@@ -4462,7 +4518,8 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,
 	if (*queue_id >= dev->data->nb_rx_queues)
 		*queue_id = 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_query, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_avail_thresh_query == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_query)(dev,
 							     queue_id, avail_thresh));
 }
@@ -4736,7 +4793,8 @@ rte_eth_dev_rx_intr_enable(uint16_t port_id,
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_intr_enable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id));
 }
 
@@ -4754,7 +4812,8 @@ rte_eth_dev_rx_intr_disable(uint16_t port_id,
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_intr_disable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id));
 }
 
@@ -5018,7 +5077,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+	if (*dev->dev_ops->rxq_info_get == NULL)
+		return -ENOTSUP;
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
@@ -5063,7 +5123,8 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+	if (*dev->dev_ops->txq_info_get == NULL)
+		return -ENOTSUP;
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
@@ -5093,7 +5154,8 @@ rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_burst_mode_get, -ENOTSUP);
+	if (*dev->dev_ops->rx_burst_mode_get == NULL)
+		return -ENOTSUP;
 	memset(mode, 0, sizeof(*mode));
 	return eth_err(port_id,
 		       dev->dev_ops->rx_burst_mode_get(dev, queue_id, mode));
@@ -5120,7 +5182,8 @@ rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_burst_mode_get, -ENOTSUP);
+	if (*dev->dev_ops->tx_burst_mode_get == NULL)
+		return -ENOTSUP;
 	memset(mode, 0, sizeof(*mode));
 	return eth_err(port_id,
 		       dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode));
@@ -5147,7 +5210,8 @@ rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_monitor_addr, -ENOTSUP);
+	if (*dev->dev_ops->get_monitor_addr == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		dev->dev_ops->get_monitor_addr(dev->data->rx_queues[queue_id], pmc));
 }
@@ -5162,7 +5226,8 @@ rte_eth_dev_set_mc_addr_list(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
+	if (*dev->dev_ops->set_mc_addr_list == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, dev->dev_ops->set_mc_addr_list(dev,
 						mc_addr_set, nb_mc_addr));
 }
@@ -5175,7 +5240,8 @@ rte_eth_timesync_enable(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
+	if (*dev->dev_ops->timesync_enable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_enable)(dev));
 }
 
@@ -5187,7 +5253,8 @@ rte_eth_timesync_disable(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
+	if (*dev->dev_ops->timesync_disable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_disable)(dev));
 }
 
@@ -5207,7 +5274,8 @@ rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_rx_timestamp == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_rx_timestamp)
 				(dev, timestamp, flags));
 }
@@ -5228,7 +5296,8 @@ rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_tx_timestamp == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_tx_timestamp)
 				(dev, timestamp));
 }
@@ -5241,7 +5310,8 @@ rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_adjust_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_adjust_time)(dev, delta));
 }
 
@@ -5260,7 +5330,8 @@ rte_eth_timesync_read_time(uint16_t port_id, struct timespec *timestamp)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_time)(dev,
 								timestamp));
 }
@@ -5280,7 +5351,8 @@ rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_write_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_write_time)(dev,
 								timestamp));
 }
@@ -5299,7 +5371,8 @@ rte_eth_read_clock(uint16_t port_id, uint64_t *clock)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->read_clock, -ENOTSUP);
+	if (*dev->dev_ops->read_clock == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->read_clock)(dev, clock));
 }
 
@@ -5318,7 +5391,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
+	if (*dev->dev_ops->get_reg == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_reg)(dev, info));
 }
 
@@ -5330,7 +5404,8 @@ rte_eth_dev_get_eeprom_length(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
+	if (*dev->dev_ops->get_eeprom_length == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_eeprom_length)(dev));
 }
 
@@ -5349,7 +5424,8 @@ rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->get_eeprom == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_eeprom)(dev, info));
 }
 
@@ -5368,7 +5444,8 @@ rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->set_eeprom == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->set_eeprom)(dev, info));
 }
 
@@ -5388,7 +5465,8 @@ rte_eth_dev_get_module_info(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_info, -ENOTSUP);
+	if (*dev->dev_ops->get_module_info == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->get_module_info)(dev, modinfo);
 }
 
@@ -5422,7 +5500,8 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->get_module_eeprom == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->get_module_eeprom)(dev, info);
 }
 
@@ -5444,7 +5523,8 @@ rte_eth_dev_get_dcb_info(uint16_t port_id,
 
 	memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
+	if (*dev->dev_ops->get_dcb_info == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_dcb_info)(dev, dcb_info));
 }
 
@@ -5500,7 +5580,8 @@ rte_eth_dev_hairpin_capability_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_cap_get, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_cap_get == NULL)
+		return -ENOTSUP;
 	memset(cap, 0, sizeof(*cap));
 	return eth_err(port_id, (*dev->dev_ops->hairpin_cap_get)(dev, cap));
 }
@@ -5775,7 +5856,8 @@ rte_eth_representor_info_get(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->representor_info_get, -ENOTSUP);
+	if (*dev->dev_ops->representor_info_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->representor_info_get)(dev, info));
 }
 
@@ -5799,7 +5881,8 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_metadata_negotiate, -ENOTSUP);
+	if (*dev->dev_ops->rx_metadata_negotiate == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		       (*dev->dev_ops->rx_metadata_negotiate)(dev, features));
 }
@@ -5826,8 +5909,8 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_capability_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_capability_get == NULL)
+		return -ENOTSUP;
 	memset(reassembly_capa, 0, sizeof(struct rte_eth_ip_reassembly_params));
 
 	return eth_err(port_id, (*dev->dev_ops->ip_reassembly_capability_get)
@@ -5856,8 +5939,8 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_conf_get == NULL)
+		return -ENOTSUP;
 	memset(conf, 0, sizeof(struct rte_eth_ip_reassembly_params));
 	return eth_err(port_id,
 		       (*dev->dev_ops->ip_reassembly_conf_get)(dev, conf));
@@ -5894,8 +5977,8 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_set,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_conf_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		       (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf));
 }
@@ -5913,7 +5996,8 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP);
+	if (*dev->dev_ops->eth_dev_priv_dump == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file));
 }
 
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index de9e970d4d..41d37e41b5 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -5710,7 +5710,8 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
 	qd = p->rxq.data[queue_id];
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_queue_count, -ENOTSUP);
+	if (*p->rx_queue_count == NULL)
+		return -ENOTSUP;
 	if (qd == NULL)
 		return -EINVAL;
 
@@ -5784,7 +5785,8 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
 	if (qd == NULL)
 		return -ENODEV;
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_descriptor_status, -ENOTSUP);
+	if (*p->rx_descriptor_status == NULL)
+		return -ENOTSUP;
 	return (*p->rx_descriptor_status)(qd, offset);
 }
 
@@ -5854,7 +5856,8 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
 	if (qd == NULL)
 		return -ENODEV;
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*p->tx_descriptor_status, -ENOTSUP);
+	if (*p->tx_descriptor_status == NULL)
+		return -ENOTSUP;
 	return (*p->tx_descriptor_status)(qd, offset);
 }
 
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7c695176f4..4938b4ee07 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -974,9 +974,8 @@ rte_event_crypto_adapter_queue_pair_add(uint8_t id,
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW) ||
 	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->crypto_adapter_queue_pair_add,
-			-ENOTSUP);
+		if (*dev->dev_ops->crypto_adapter_queue_pair_add == NULL)
+			return -ENOTSUP;
 		if (dev_info->qpairs == NULL) {
 			dev_info->qpairs =
 			    rte_zmalloc_socket(adapter->mem_name,
@@ -1076,9 +1075,8 @@ rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id,
 	if ((cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
 	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->crypto_adapter_queue_pair_del,
-			-ENOTSUP);
+		if (*dev->dev_ops->crypto_adapter_queue_pair_del == NULL)
+			return -ENOTSUP;
 		ret = (*dev->dev_ops->crypto_adapter_queue_pair_del)(dev,
 						dev_info->dev,
 						queue_pair_id);
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bf8741d2ea..8e81cf774d 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2655,8 +2655,8 @@ rte_event_eth_rx_adapter_queue_add(uint8_t id,
 	dev_info = &rx_adapter->eth_devices[eth_dev_id];
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_add,
-					-ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_queue_add == NULL)
+			return -ENOTSUP;
 		if (dev_info->rx_queue == NULL) {
 			dev_info->rx_queue =
 			    rte_zmalloc_socket(rx_adapter->mem_name,
@@ -2750,8 +2750,8 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
 	dev_info = &rx_adapter->eth_devices[eth_dev_id];
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_del,
-				 -ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_queue_del == NULL)
+			return -ENOTSUP;
 		ret = (*dev->dev_ops->eth_rx_adapter_queue_del)(dev,
 						&rte_eth_devices[eth_dev_id],
 						rx_queue_id);
@@ -2861,9 +2861,8 @@ rte_event_eth_rx_adapter_vector_limits_get(
 	}
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->eth_rx_adapter_vector_limits_get,
-			-ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_vector_limits_get == NULL)
+			return -ENOTSUP;
 		ret = dev->dev_ops->eth_rx_adapter_vector_limits_get(
 			dev, &rte_eth_devices[eth_port_id], limits);
 	} else {
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 1dc4f966be..79b905e9fc 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -92,7 +92,8 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_event_dev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns;
@@ -216,7 +217,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 
 	if (nb_queues != 0) {
 		queues_cfg = dev->data->queues_cfg;
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+		if (*dev->dev_ops->queue_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
@@ -229,7 +231,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 				sizeof(queues_cfg[0]) * new_qs);
 		}
 	} else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+		if (*dev->dev_ops->queue_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
@@ -254,7 +257,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 			 dev->data->dev_id);
 
 	if (nb_ports != 0) { /* re-config */
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
+		if (*dev->dev_ops->port_release == NULL)
+			return -ENOTSUP;
 
 		ports = dev->data->ports;
 		ports_cfg = dev->data->ports_cfg;
@@ -279,7 +283,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 	} else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
+		if (*dev->dev_ops->port_release == NULL)
+			return -ENOTSUP;
 
 		ports = dev->data->ports;
 		for (i = nb_ports; i < old_nb_ports; i++) {
@@ -303,8 +308,10 @@ rte_event_dev_configure(uint8_t dev_id,
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started) {
 		RTE_EDEV_LOG_ERR(
@@ -509,7 +516,8 @@ rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->queue_def_conf == NULL)
+		return -ENOTSUP;
 	memset(queue_conf, 0, sizeof(struct rte_event_queue_conf));
 	(*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf);
 	return 0;
@@ -595,11 +603,12 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_setup == NULL)
+		return -ENOTSUP;
 
 	if (queue_conf == NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf,
-					-ENOTSUP);
+		if (*dev->dev_ops->queue_def_conf == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->queue_def_conf)(dev, queue_id, &def_conf);
 		queue_conf = &def_conf;
 	}
@@ -635,7 +644,8 @@ rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->port_def_conf == NULL)
+		return -ENOTSUP;
 	memset(port_conf, 0, sizeof(struct rte_event_port_conf));
 	(*dev->dev_ops->port_def_conf)(dev, port_id, port_conf);
 	return 0;
@@ -706,11 +716,12 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_setup, -ENOTSUP);
+	if (*dev->dev_ops->port_setup == NULL)
+		return -ENOTSUP;
 
 	if (port_conf == NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf,
-					-ENOTSUP);
+		if (*dev->dev_ops->port_def_conf == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->port_def_conf)(dev, port_id, &def_conf);
 		port_conf = &def_conf;
 	}
@@ -896,7 +907,8 @@ rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
+	if (*dev->dev_ops->queue_attr_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_attr_set)(dev, queue_id, attr_id,
 					       attr_value);
 }
@@ -1045,7 +1057,8 @@ rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id)
 	 * This allows PMDs which handle unlink synchronously to not implement
 	 * this function at all.
 	 */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_unlinks_in_progress, 0);
+	if (*dev->dev_ops->port_unlinks_in_progress == NULL)
+		return 0;
 
 	return (*dev->dev_ops->port_unlinks_in_progress)(dev,
 			dev->data->ports[port_id]);
@@ -1087,7 +1100,8 @@ rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timeout_ticks, -ENOTSUP);
+	if (*dev->dev_ops->timeout_ticks == NULL)
+		return -ENOTSUP;
 
 	if (timeout_ticks == NULL)
 		return -EINVAL;
@@ -1119,7 +1133,8 @@ rte_event_dev_dump(uint8_t dev_id, FILE *f)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+	if (*dev->dev_ops->dump == NULL)
+		return -ENOTSUP;
 	if (f == NULL)
 		return -EINVAL;
 
@@ -1285,7 +1300,8 @@ rte_event_dev_start(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already started",
@@ -1331,7 +1347,8 @@ rte_event_dev_stop(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already stopped",
@@ -1352,7 +1369,8 @@ rte_event_dev_close(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 
 	/* Device must be stopped before it can be closed */
 	if (dev->data->dev_started == 1) {
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 2d36dee8f0..ac32c4bb72 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -154,7 +154,8 @@ rte_mempool_ops_get_info(const struct rte_mempool *mp,
 
 	ops = rte_mempool_get_ops(mp->ops_index);
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->get_info, -ENOTSUP);
+	if (ops->get_info == NULL)
+		return -ENOTSUP;
 	return ops->get_info(mp, info);
 }
 
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index 2f0a4f132e..e157d65332 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -71,12 +71,14 @@ rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info,
 	int ret = 0;
 
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(dev_info, -EINVAL);
+	if (dev_info == NULL)
+		return -EINVAL;
 
 	rawdev = &rte_rawdevs[dev_id];
 
 	if (dev_info->dev_private != NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*rawdev->dev_ops->dev_info_get, -ENOTSUP);
+		if (*rawdev->dev_ops->dev_info_get == NULL)
+			return -ENOTSUP;
 		ret = (*rawdev->dev_ops->dev_info_get)(rawdev,
 				dev_info->dev_private,
 				dev_private_size);
@@ -97,11 +99,13 @@ rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf,
 	int diag;
 
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(dev_conf, -EINVAL);
+	if (dev_conf == NULL)
+		return -EINVAL;
 
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->started) {
 		RTE_RDEV_ERR(
@@ -131,7 +135,8 @@ rte_rawdev_queue_conf_get(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->queue_def_conf == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf,
 			queue_conf_size);
 }
@@ -147,7 +152,8 @@ rte_rawdev_queue_setup(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_setup == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf,
 			queue_conf_size);
 }
@@ -160,7 +166,8 @@ rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+	if (*dev->dev_ops->queue_release == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_release)(dev, queue_id);
 }
 
@@ -172,7 +179,8 @@ rte_rawdev_queue_count(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_count, -ENOTSUP);
+	if (*dev->dev_ops->queue_count == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_count)(dev);
 }
 
@@ -186,7 +194,8 @@ rte_rawdev_get_attr(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_get, -ENOTSUP);
+	if (*dev->dev_ops->attr_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->attr_get)(dev, attr_name, attr_value);
 }
 
@@ -200,7 +209,8 @@ rte_rawdev_set_attr(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_set, -ENOTSUP);
+	if (*dev->dev_ops->attr_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->attr_set)(dev, attr_name, attr_value);
 }
 
@@ -215,7 +225,8 @@ rte_rawdev_enqueue_buffers(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->enqueue_bufs, -ENOTSUP);
+	if (*dev->dev_ops->enqueue_bufs == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->enqueue_bufs)(dev, buffers, count, context);
 }
 
@@ -230,7 +241,8 @@ rte_rawdev_dequeue_buffers(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dequeue_bufs, -ENOTSUP);
+	if (*dev->dev_ops->dequeue_bufs == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dequeue_bufs)(dev, buffers, count, context);
 }
 
@@ -242,7 +254,8 @@ rte_rawdev_dump(uint16_t dev_id, FILE *f)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+	if (*dev->dev_ops->dump == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dump)(dev, f);
 }
 
@@ -251,7 +264,8 @@ xstats_get_count(uint16_t dev_id)
 {
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_names == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_names)(dev, NULL, 0);
 }
 
@@ -273,7 +287,8 @@ rte_rawdev_xstats_names_get(uint16_t dev_id,
 
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_names == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_names)(dev, xstats_names, size);
 }
 
@@ -287,7 +302,8 @@ rte_rawdev_xstats_get(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
 	const struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get)(dev, ids, values, n);
 }
 
@@ -306,7 +322,8 @@ rte_rawdev_xstats_by_name_get(uint16_t dev_id,
 		id = &temp; /* driver never gets a NULL value */
 
 	/* implemented by driver */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_by_name, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_by_name == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_by_name)(dev, name, id);
 }
 
@@ -317,7 +334,8 @@ rte_rawdev_xstats_reset(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_reset, -ENOTSUP);
+	if (*dev->dev_ops->xstats_reset == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids);
 }
 
@@ -327,7 +345,8 @@ rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_status_get, -ENOTSUP);
+	if (*dev->dev_ops->firmware_status_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_status_get)(dev, status_info);
 }
 
@@ -337,7 +356,8 @@ rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_version_get, -ENOTSUP);
+	if (*dev->dev_ops->firmware_version_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_version_get)(dev, version_info);
 }
 
@@ -350,7 +370,8 @@ rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image)
 	if (!firmware_image)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
+	if (*dev->dev_ops->firmware_load == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_load)(dev, firmware_image);
 }
 
@@ -360,7 +381,8 @@ rte_rawdev_firmware_unload(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
+	if (*dev->dev_ops->firmware_load == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_unload)(dev);
 }
 
@@ -370,7 +392,8 @@ rte_rawdev_selftest(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+	if (*dev->dev_ops->dev_selftest == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_selftest)(dev_id);
 }
 
@@ -435,7 +458,8 @@ rte_rawdev_close(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	/* Device must be stopped before it can be closed */
 	if (dev->started == 1) {
 		RTE_RDEV_ERR("Device %u must be stopped before closing",
@@ -454,7 +478,8 @@ rte_rawdev_reset(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_reset == NULL)
+		return -ENOTSUP;
 	/* Reset is not dependent on state of the device */
 	return (*dev->dev_ops->dev_reset)(dev);
 }
diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
index 02a388bc5d..caec069182 100644
--- a/lib/regexdev/rte_regexdev.c
+++ b/lib/regexdev/rte_regexdev.c
@@ -189,7 +189,8 @@ regexdev_info_get(uint8_t dev_id, struct rte_regexdev_info *dev_info)
 	if (dev_info == NULL)
 		return -EINVAL;
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_info_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_info_get)(dev, dev_info);
 
 }
@@ -211,7 +212,8 @@ rte_regexdev_configure(uint8_t dev_id, const struct rte_regexdev_config *cfg)
 	if (cfg == NULL)
 		return -EINVAL;
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 	if (dev->data->dev_started) {
 		RTE_REGEXDEV_LOG
 			(ERR, "Dev %u must be stopped to allow configuration\n",
@@ -301,7 +303,8 @@ rte_regexdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_qp_setup, -ENOTSUP);
+	if (*dev->dev_ops->dev_qp_setup == NULL)
+		return -ENOTSUP;
 	if (dev->data->dev_started) {
 		RTE_REGEXDEV_LOG
 			(ERR, "Dev %u must be stopped to allow configuration\n",
@@ -332,7 +335,8 @@ rte_regexdev_start(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_start)(dev);
 	if (ret == 0)
 		dev->data->dev_started = 1;
@@ -346,7 +350,8 @@ rte_regexdev_stop(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_stop)(dev);
 	dev->data->dev_started = 0;
 	return 0;
@@ -359,7 +364,8 @@ rte_regexdev_close(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_close)(dev);
 	dev->data->dev_started = 0;
 	dev->state = RTE_REGEXDEV_UNUSED;
@@ -374,7 +380,8 @@ rte_regexdev_attr_get(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_attr_get == NULL)
+		return -ENOTSUP;
 	if (attr_value == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
 				 dev_id);
@@ -391,7 +398,8 @@ rte_regexdev_attr_set(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_set, -ENOTSUP);
+	if (*dev->dev_ops->dev_attr_set == NULL)
+		return -ENOTSUP;
 	if (attr_value == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
 				 dev_id);
@@ -409,7 +417,8 @@ rte_regexdev_rule_db_update(uint8_t dev_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_update, -ENOTSUP);
+	if (*dev->dev_ops->dev_rule_db_update == NULL)
+		return -ENOTSUP;
 	if (rules == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
 				 dev_id);
@@ -425,8 +434,8 @@ rte_regexdev_rule_db_compile_activate(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_compile_activate,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_rule_db_compile_activate == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_rule_db_compile_activate)(dev);
 }
 
@@ -438,8 +447,8 @@ rte_regexdev_rule_db_import(uint8_t dev_id, const char *rule_db,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_import,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_db_import == NULL)
+		return -ENOTSUP;
 	if (rule_db == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
 				 dev_id);
@@ -455,8 +464,8 @@ rte_regexdev_rule_db_export(uint8_t dev_id, char *rule_db)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_export,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_db_export == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_db_export)(dev, rule_db);
 }
 
@@ -468,8 +477,8 @@ rte_regexdev_xstats_names_get(uint8_t dev_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_names_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_names_get == NULL)
+		return -ENOTSUP;
 	if (xstats_map == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d xstats map can't be NULL\n",
 				 dev_id);
@@ -486,7 +495,8 @@ rte_regexdev_xstats_get(uint8_t dev_id, const uint16_t *ids,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_get == NULL)
+		return -ENOTSUP;
 	if (ids == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -506,8 +516,8 @@ rte_regexdev_xstats_by_name_get(uint8_t dev_id, const char *name,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_by_name_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_by_name_get == NULL)
+		return -ENOTSUP;
 	if (name == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d name can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -531,7 +541,8 @@ rte_regexdev_xstats_reset(uint8_t dev_id, const uint16_t *ids,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_reset == NULL)
+		return -ENOTSUP;
 	if (ids == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -546,7 +557,8 @@ rte_regexdev_selftest(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+	if (*dev->dev_ops->dev_selftest == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_selftest)(dev);
 }
 
@@ -557,7 +569,8 @@ rte_regexdev_dump(uint8_t dev_id, FILE *f)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_dump, -ENOTSUP);
+	if (*dev->dev_ops->dev_dump == NULL)
+		return -ENOTSUP;
 	if (f == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d file can't be NULL\n", dev_id);
 		return -EINVAL;
diff --git a/lib/regexdev/rte_regexdev.h b/lib/regexdev/rte_regexdev.h
index 3bce8090f6..6061e648b1 100644
--- a/lib/regexdev/rte_regexdev.h
+++ b/lib/regexdev/rte_regexdev.h
@@ -1473,7 +1473,8 @@ rte_regexdev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
 #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->enqueue, -ENOTSUP);
+	if (*dev->enqueue == NULL)
+		return -ENOTSUP;
 	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
 		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
 		return -EINVAL;
@@ -1532,7 +1533,8 @@ rte_regexdev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
 	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
 #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dequeue, -ENOTSUP);
+	if (*dev->dequeue == NULL)
+		return -ENOTSUP;
 	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
 		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
 		return -EINVAL;
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..1a2a408f0e 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -131,7 +131,8 @@ __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
 	RTE_PTR_OR_ERR_RET(instance, -EINVAL);
 	RTE_PTR_OR_ERR_RET(instance->ops, -EINVAL);
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->set_pkt_metadata, -ENOTSUP);
+	if (*instance->ops->set_pkt_metadata == NULL)
+		return -ENOTSUP;
 	return instance->ops->set_pkt_metadata(instance->device,
 					       sess, m, params);
 }
@@ -145,7 +146,8 @@ __rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md)
 	RTE_PTR_OR_ERR_RET(instance, NULL);
 	RTE_PTR_OR_ERR_RET(instance->ops, NULL);
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_userdata, NULL);
+	if (*instance->ops->get_userdata == NULL)
+		return NULL;
 	if (instance->ops->get_userdata(instance->device, md, &userdata))
 		return NULL;
 
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index b2a2919fc0..a6ca785b29 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -266,7 +266,8 @@ rte_vdpa_get_stats_names(struct rte_vdpa_device *dev,
 	if (!dev)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats_names, -ENOTSUP);
+	if (dev->ops->get_stats_names == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->get_stats_names(dev, stats_names, size);
 }
@@ -278,7 +279,8 @@ rte_vdpa_get_stats(struct rte_vdpa_device *dev, uint16_t qid,
 	if (!dev || !stats || !n)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats, -ENOTSUP);
+	if (dev->ops->get_stats == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->get_stats(dev, qid, stats, n);
 }
@@ -289,7 +291,8 @@ rte_vdpa_reset_stats(struct rte_vdpa_device *dev, uint16_t qid)
 	if (!dev)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->reset_stats, -ENOTSUP);
+	if (dev->ops->reset_stats == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->reset_stats(dev, qid);
 }
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 4ad28bac45..0ae059ad29 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -3381,8 +3381,10 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable)
 		q_last = qid;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_vfio_device_fd, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_notify_area, -ENOTSUP);
+	if (vdpa_dev->ops->get_vfio_device_fd == NULL)
+		return -ENOTSUP;
+	if (vdpa_dev->ops->get_notify_area == NULL)
+		return -ENOTSUP;
 
 	vfio_device_fd = vdpa_dev->ops->get_vfio_device_fd(vid);
 	if (vfio_device_fd < 0)
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 09/27] devargs: remove dependency on bus header
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (7 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 10/27] build: export drivers headers David Marchand
                     ` (17 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

We don't need to include rte_bus.h in rte_devargs.h.
Only a forward declaration of rte_bus and an inclusion of rte_dev.h are
needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_vdev.c          | 1 +
 lib/eal/include/rte_devargs.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 720722c363..5eeff3106d 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/lib/eal/include/rte_devargs.h b/lib/eal/include/rte_devargs.h
index 37a0f042ab..38dee2f288 100644
--- a/lib/eal/include/rte_devargs.h
+++ b/lib/eal/include/rte_devargs.h
@@ -22,7 +22,9 @@ extern "C" {
 
 #include <stdio.h>
 #include <rte_compat.h>
-#include <rte_bus.h>
+#include <rte_dev.h>
+
+struct rte_bus;
 
 /**
  * Bus type key in global devargs syntax.
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 10/27] build: export drivers headers
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (8 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 09/27] devargs: remove dependency on bus header David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 11/27] bus/auxiliary: make driver-only headers private David Marchand
                     ` (16 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Same as for device classes, external DPDK users may need to include some
bus headers for their out of tree drivers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/meson.build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/meson.build b/drivers/meson.build
index b22c2adda7..7449643fa9 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -89,6 +89,7 @@ foreach subpath:subdirs
         name = drv
         sources = []
         headers = []
+        driver_sdk_headers = [] # public headers included by drivers
         objs = []
         cflags = default_cflags
         includes = [include_directories(drv_path)]
@@ -158,6 +159,9 @@ foreach subpath:subdirs
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         install_headers(headers)
+        if get_option('enable_driver_sdk')
+            install_headers(driver_sdk_headers)
+        endif
 
         # generate pmdinfo sources by building a temporary
         # lib and then running pmdinfogen on the contents of
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 11/27] bus/auxiliary: make driver-only headers private
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (9 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 10/27] build: export drivers headers David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 12/27] bus/dpaa: " David Marchand
                     ` (15 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Parav Pandit, Xueming Li, Ray Kinsella,
	Matan Azrad, Viacheslav Ovsiienko

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 <david.marchand@redhat.com>
---
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 <rte_devargs.h>
 
 #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 <rte_kvargs.h>
 
 #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 <stdint.h>
 #include <inttypes.h>
 
+#include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 
 #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 <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <eal_filesystem.h>
 
-#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 <stdio.h>
 #include <sys/queue.h>
 
-#include "rte_bus_auxiliary.h"
+#include <rte_bus.h>
+
+#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 <rte_malloc.h>
 #include <rte_errno.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #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 <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <rte_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <ethdev_pci.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 12/27] bus/dpaa: make driver-only headers private
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (10 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 11/27] bus/auxiliary: make driver-only headers private David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-30  4:50     ` Hemant Agrawal
  2022-08-26 12:41   ` [PATCH v4 13/27] bus/fslmc: " David Marchand
                     ` (14 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Hemant Agrawal, Sachin Saxena, Gagandeep Singh

The dpaa 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.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 drivers/bus/dpaa/base/qbman/qman.c            |  2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     | 25 ++++++-------------
 drivers/bus/dpaa/dpaa_bus.c                   | 20 +++++++--------
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |  2 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |  2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |  2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |  2 +-
 10 files changed, 26 insertions(+), 35 deletions(-)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 447c091770..3949bf8712 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -7,7 +7,7 @@
 
 #include "qman.h"
 #include <rte_branch_prediction.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_eventdev.h>
 #include <rte_byteorder.h>
 
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/bus_dpaa_driver.h
similarity index 92%
rename from drivers/bus/dpaa/rte_dpaa_bus.h
rename to drivers/bus/dpaa/bus_dpaa_driver.h
index 1f04d9ebd3..cf66fc0c53 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -3,12 +3,14 @@
  *   Copyright 2017-2022 NXP
  *
  */
-#ifndef __RTE_DPAA_BUS_H__
-#define __RTE_DPAA_BUS_H__
+#ifndef BUS_DPAA_DRIVER_H
+#define BUS_DPAA_DRIVER_H
 
-#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
+
 #include <dpaax_iova_table.h>
 
 #include <dpaa_of.h>
@@ -73,24 +75,12 @@ extern unsigned int dpaa_svr_family;
 struct rte_dpaa_device;
 struct rte_dpaa_driver;
 
-/* DPAA Device and Driver lists for DPAA bus */
-TAILQ_HEAD(rte_dpaa_device_list, rte_dpaa_device);
-TAILQ_HEAD(rte_dpaa_driver_list, rte_dpaa_driver);
-
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
 	FSL_DPAA_QDMA
 };
 
-struct rte_dpaa_bus {
-	struct rte_bus bus;
-	struct rte_dpaa_device_list device_list;
-	struct rte_dpaa_driver_list driver_list;
-	int device_count;
-	int detected;
-};
-
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
@@ -119,7 +109,6 @@ typedef int (*rte_dpaa_remove_t)(struct rte_dpaa_device *dpaa_dev);
 struct rte_dpaa_driver {
 	TAILQ_ENTRY(rte_dpaa_driver) next;
 	struct rte_driver driver;
-	struct rte_dpaa_bus *dpaa_bus;
 	enum rte_dpaa_type drv_type;
 	rte_dpaa_probe_t probe;
 	rte_dpaa_remove_t remove;
@@ -166,6 +155,7 @@ extern struct dpaa_memseg_list rte_dpaa_memsegs;
 /* Either iterate over the list of internal memseg references or fallback to
  * EAL memseg based iova2virt.
  */
+__rte_internal
 static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 {
 	struct dpaa_memseg *ms;
@@ -192,6 +182,7 @@ static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 	return va;
 }
 
+__rte_internal
 static inline rte_iova_t
 rte_dpaa_mem_vtop(void *vaddr)
 {
@@ -263,4 +254,4 @@ struct fm_eth_port_cfg *dpaa_get_eth_port_cfg(int dev_id);
 }
 #endif
 
-#endif /* __RTE_DPAA_BUS_H__ */
+#endif /* BUS_DPAA_DRIVER_H */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e442bc4c33..1ac6aa314f 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,7 +34,7 @@
 #include <rte_mbuf_dyn.h>
 
 #include <dpaa_of.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaax_iova_table.h>
 
@@ -43,6 +43,14 @@
 #include <fsl_bman.h>
 #include <netcfg.h>
 
+struct rte_dpaa_bus {
+	struct rte_bus bus;
+	TAILQ_HEAD(, rte_dpaa_device) device_list;
+	TAILQ_HEAD(, rte_dpaa_driver) driver_list;
+	int device_count;
+	int detected;
+};
+
 static struct rte_dpaa_bus rte_dpaa_bus;
 struct netcfg_info *dpaa_netcfg;
 
@@ -520,23 +528,15 @@ rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
 	BUS_INIT_FUNC_TRACE();
 
 	TAILQ_INSERT_TAIL(&rte_dpaa_bus.driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = &rte_dpaa_bus;
 }
 
 /* un-register a dpaa bus based dpaa driver */
 void
 rte_dpaa_driver_unregister(struct rte_dpaa_driver *driver)
 {
-	struct rte_dpaa_bus *dpaa_bus;
-
 	BUS_INIT_FUNC_TRACE();
 
-	dpaa_bus = driver->dpaa_bus;
-
-	TAILQ_REMOVE(&dpaa_bus->driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = NULL;
+	TAILQ_REMOVE(&rte_dpaa_bus.driver_list, driver, next);
 }
 
 static int
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 05415dbf3b..7e554cb2b1 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -41,7 +41,7 @@
 #include <desc/pdcp.h>
 #include <desc/sdap.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_event.h>
 #include <dpaa_sec_log.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d081953e26..29c5935739 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -15,7 +15,7 @@
 #include <desc/algo.h>
 #include <desc/ipsec.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_log.h>
 
diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c
index 9386fe5698..10e65ef1d7 100644
--- a/drivers/dma/dpaa/dpaa_qdma.c
+++ b/drivers/dma/dpaa/dpaa_qdma.c
@@ -2,7 +2,7 @@
  * Copyright 2021 NXP
  */
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dmadev_pmd.h>
 
 #include "dpaa_qdma.h"
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index ff6cc0be18..aa403f9e06 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -29,7 +29,7 @@
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_event_eth_tx_adapter.h>
 #include <cryptodev_pmd.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h
index dc0058e6dd..3f0eafa7dd 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.h
+++ b/drivers/mempool/dpaa/dpaa_mempool.h
@@ -14,7 +14,7 @@
 
 #include <rte_mempool.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 
 #include <fsl_usd.h>
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index e5a072cf49..f21cbba0d9 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -33,7 +33,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaa_mempool.h>
 
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 956fe946fa..20b75efb63 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -37,7 +37,7 @@
 
 #include "dpaa_ethdev.h"
 #include "dpaa_rxtx.h"
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_mempool.h>
 
 #include <qman.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 13/27] bus/fslmc: make driver-only headers private
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (11 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 12/27] bus/dpaa: " David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-30  4:49     ` Hemant Agrawal
  2022-08-26 12:41   ` [PATCH v4 14/27] bus/ifpga: cleanup exported symbols David Marchand
                     ` (13 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Hemant Agrawal, Sachin Saxena, Gagandeep Singh

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.marchand@redhat.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


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 14/27] bus/ifpga: cleanup exported symbols
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (12 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 13/27] bus/fslmc: " David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 15/27] bus/ifpga: make driver-only headers private David Marchand
                     ` (12 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

Remove unused symbols (exposed only in an internal header which
guarantees that no application out there relied on them).

Remove rte_ prefix and inline the rest to avoid having to expose them as
global symbols for a relatively small added value.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
 drivers/bus/ifpga/ifpga_bus.c    | 13 +++--
 drivers/bus/ifpga/ifpga_common.c | 88 --------------------------------
 drivers/bus/ifpga/ifpga_common.h | 54 ++++++++++++++++----
 drivers/bus/ifpga/meson.build    |  2 +-
 drivers/bus/ifpga/version.map    |  2 -
 drivers/raw/ifpga/ifpga_rawdev.c |  2 +-
 6 files changed, 53 insertions(+), 108 deletions(-)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c

diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index e005f2cb70..b1e9eb7cc4 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -117,9 +117,9 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-		&rte_ifpga_get_integer32_arg, &afu_pr_conf.afu_id.port) < 0) {
-			IFPGA_BUS_ERR("error to parse %s",
-				     IFPGA_ARG_PORT);
+				ifpga_get_integer32_arg,
+				&afu_pr_conf.afu_id.port) < 0) {
+			IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_PORT);
 			goto end;
 		}
 	} else {
@@ -130,9 +130,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_AFU_BTS) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_AFU_BTS,
-				       &rte_ifpga_get_string_arg, &path) < 0) {
-			IFPGA_BUS_ERR("Failed to parse %s",
-				     IFPGA_AFU_BTS);
+				ifpga_get_string_arg, &path) < 0) {
+			IFPGA_BUS_ERR("Failed to parse %s", IFPGA_AFU_BTS);
 			goto end;
 		}
 		afu_pr_conf.pr_enable = 1;
@@ -228,7 +227,7 @@ ifpga_scan(void)
 
 		if (rte_kvargs_count(kvlist, IFPGA_ARG_NAME) == 1) {
 			if (rte_kvargs_process(kvlist, IFPGA_ARG_NAME,
-				       &rte_ifpga_get_string_arg, &name) < 0) {
+					ifpga_get_string_arg, &name) < 0) {
 				IFPGA_BUS_ERR("error to parse %s",
 				     IFPGA_ARG_NAME);
 				goto end;
diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c
deleted file mode 100644
index 78e2eaee4e..0000000000
--- a/drivers/bus/ifpga/ifpga_common.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2018 Intel Corporation
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/queue.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <rte_errno.h>
-#include <rte_bus.h>
-#include <rte_per_lcore.h>
-#include <rte_memory.h>
-#include <rte_memzone.h>
-#include <rte_eal.h>
-#include <rte_common.h>
-
-#include <rte_devargs.h>
-#include <rte_kvargs.h>
-#include <rte_alarm.h>
-
-#include "rte_bus_ifpga.h"
-#include "ifpga_logs.h"
-#include "ifpga_common.h"
-
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(char **)extra_args = strdup(value);
-
-	if (!*(char **)extra_args)
-		return -ENOMEM;
-
-	return 0;
-}
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(int *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_unsigned_long(const char *str, int base)
-{
-	unsigned long num;
-	char *end = NULL;
-
-	errno = 0;
-
-	num = strtoul(str, &end, base);
-	if ((str[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0))
-		return -1;
-
-	return num;
-}
-
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1)
-{
-	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
-		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
-		(afu_id0->port == afu_id1->port)) {
-		return 0;
-	} else
-		return 1;
-}
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index f9254b9d5d..bb6524030f 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -5,14 +5,50 @@
 #ifndef _IFPGA_COMMON_H_
 #define _IFPGA_COMMON_H_
 
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_unsigned_long(const char *str, int base);
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1);
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_bus_ifpga.h>
+#include <rte_common.h>
+
+static inline int
+ifpga_get_string_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(char **)extra_args = strdup(value);
+
+	if (!*(char **)extra_args)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static inline int
+ifpga_get_integer32_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(int *)extra_args = strtoull(value, NULL, 0);
+
+	return 0;
+}
+
+static inline int
+ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
+	const struct rte_afu_id *afu_id1)
+{
+	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
+		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
+		(afu_id0->port == afu_id1->port)) {
+		return 0;
+	} else
+		return 1;
+}
 
 #endif /* _IFPGA_COMMON_H_ */
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index cc5047e3ce..9d56a4bb2b 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -9,4 +9,4 @@ endif
 
 deps += ['pci', 'kvargs', 'rawdev']
 headers = files('rte_bus_ifpga.h')
-sources = files('ifpga_common.c', 'ifpga_bus.c')
+sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index c0a1eecae8..da7f92c2a0 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -4,8 +4,6 @@ DPDK_23 {
 	rte_ifpga_driver_register;
 	rte_ifpga_driver_unregister;
 	rte_ifpga_find_afu_by_name;
-	rte_ifpga_get_integer32_arg;
-	rte_ifpga_get_string_arg;
 
 	local: *;
 };
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 3b616c45ff..153203a42f 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1754,7 +1754,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-			&rte_ifpga_get_integer32_arg, &port) < 0) {
+				ifpga_get_integer32_arg, &port) < 0) {
 			IFPGA_RAWDEV_PMD_ERR("error to parse %s",
 				IFPGA_ARG_PORT);
 			goto end;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 15/27] bus/ifpga: make driver-only headers private
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (13 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 14/27] bus/ifpga: cleanup exported symbols David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 16/27] bus/pci: " David Marchand
                     ` (11 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

The ifpga bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- 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 <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst         |  2 +-
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}    | 18 ++++++++----------
 drivers/bus/ifpga/ifpga_bus.c                  |  6 +++---
 drivers/bus/ifpga/ifpga_common.h               |  2 +-
 drivers/bus/ifpga/meson.build                  |  2 +-
 drivers/bus/ifpga/version.map                  |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c             |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h             |  2 +-
 drivers/net/ipn3ke/ipn3ke_flow.c               |  2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c        |  2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                 |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h               |  2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c             |  2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c              |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c               |  2 +-
 17 files changed, 26 insertions(+), 28 deletions(-)
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 9fd95e13dd..2f2bd2b086 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,7 +88,7 @@ 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``,
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``
   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).
diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/bus_ifpga_driver.h
similarity index 91%
rename from drivers/bus/ifpga/rte_bus_ifpga.h
rename to drivers/bus/ifpga/bus_ifpga_driver.h
index 007ad19875..7b75c2ddbc 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -2,8 +2,8 @@
  * Copyright(c) 2010-2018 Intel Corporation
  */
 
-#ifndef _RTE_BUS_IFPGA_H_
-#define _RTE_BUS_IFPGA_H_
+#ifndef BUS_IFPGA_DRIVER_H
+#define BUS_IFPGA_DRIVER_H
 
 /**
  * @file
@@ -15,23 +15,17 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#include <rte_bus.h>
+#include <rte_compat.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
 
-/** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
 
 /* Forward declarations */
 struct rte_afu_device;
 struct rte_afu_driver;
 
-/** Double linked list of Intel FPGA AFU device. */
-RTE_TAILQ_HEAD(ifpga_afu_dev_list, rte_afu_device);
-/** Double linked list of Intel FPGA AFU device drivers. */
-RTE_TAILQ_HEAD(ifpga_afu_drv_list, rte_afu_driver);
-
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
 struct rte_afu_uuid {
@@ -112,6 +106,7 @@ struct rte_afu_driver {
 	const struct rte_afu_uuid *id_table;    /**< AFU uuid within FPGA. */
 };
 
+__rte_internal
 static inline const char *
 rte_ifpga_device_name(const struct rte_afu_device *afu)
 {
@@ -126,6 +121,7 @@ rte_ifpga_device_name(const struct rte_afu_device *afu)
  * @param name
  *   A pointer to AFU name string.
  */
+__rte_internal
 struct rte_afu_device *
 rte_ifpga_find_afu_by_name(const char *name);
 
@@ -136,6 +132,7 @@ rte_ifpga_find_afu_by_name(const char *name);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be registered.
  */
+__rte_internal
 void rte_ifpga_driver_register(struct rte_afu_driver *driver);
 
 /**
@@ -145,6 +142,7 @@ void rte_ifpga_driver_register(struct rte_afu_driver *driver);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be unregistered.
  */
+__rte_internal
 void rte_ifpga_driver_unregister(struct rte_afu_driver *driver);
 
 #define RTE_PMD_REGISTER_AFU(nm, afudrv)\
@@ -164,4 +162,4 @@ static const char *afudrvinit_ ## nm ## _alias = RTE_STR(alias)
 }
 #endif /* __cplusplus */
 
-#endif /* _RTE_BUS_IFPGA_H_ */
+#endif /* BUS_IFPGA_DRIVER_H */
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index b1e9eb7cc4..27e2de7072 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -28,7 +28,7 @@
 
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_logs.h"
 #include "ifpga_common.h"
 
@@ -37,9 +37,9 @@
  */
 static struct rte_bus rte_ifpga_bus;
 
-static struct ifpga_afu_dev_list ifpga_afu_dev_list =
+static TAILQ_HEAD(, rte_afu_device) ifpga_afu_dev_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_dev_list);
-static struct ifpga_afu_drv_list ifpga_afu_drv_list =
+static TAILQ_HEAD(, rte_afu_driver) ifpga_afu_drv_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_drv_list);
 
 
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index bb6524030f..a41a1628f5 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_common.h>
 
 static inline int
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index 9d56a4bb2b..dedc94db2d 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -8,5 +8,5 @@ if is_windows
 endif
 
 deps += ['pci', 'kvargs', 'rawdev']
-headers = files('rte_bus_ifpga.h')
+driver_sdk_headers += files('bus_ifpga_driver.h')
 sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index da7f92c2a0..3d1943afe4 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -1,4 +1,4 @@
-DPDK_23 {
+INTERNAL {
 	global:
 
 	rte_ifpga_driver_register;
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 550a8b0466..2e39113941 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 58fcc50c57..dbf57f9ba8 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -24,7 +24,7 @@
 #include <rte_spinlock.h>
 
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_tm_driver.h>
 
 #define IPN3KE_TM_SCRATCH_RW 0
diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c
index 66ae31a5a9..5b57ee9341 100644
--- a/drivers/net/ipn3ke/ipn3ke_flow.c
+++ b/drivers/net/ipn3ke/ipn3ke_flow.c
@@ -20,7 +20,7 @@
 #include <rte_tailq.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index abbecfdf2e..2f088d767f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 6a9b98fd7f..2f242b678a 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/raw/ifpga/afu_pmd_core.h b/drivers/raw/ifpga/afu_pmd_core.h
index 91118a19ab..ab5a228147 100644
--- a/drivers/raw/ifpga/afu_pmd_core.h
+++ b/drivers/raw/ifpga/afu_pmd_core.h
@@ -15,7 +15,7 @@ extern "C" {
 
 #include <rte_spinlock.h>
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "ifpga_rawdev.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index 102de50812..eca1edc270 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index 8b2c85b5f8..da0aba6e00 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 0f57a03b0e..3c41aa9ee8 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 5120df5f77..b7438bd372 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 153203a42f..32de5ff0ce 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -35,7 +35,7 @@
 #include "base/ifpga_api.h"
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_common.h"
 #include "ifpga_logs.h"
 #include "ifpga_rawdev.h"
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 16/27] bus/pci: make driver-only headers private
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (14 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 15/27] bus/ifpga: make driver-only headers private David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:41   ` [PATCH v4 17/27] bus/vdev: " David Marchand
                     ` (10 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ajit Khaparde, Rosen Xu,
	Nicolas Chautru, Ray Kinsella, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Matan Azrad, Viacheslav Ovsiienko,
	Fan Zhang, Andrew Rybchenko, Ashish Gupta, Chandubabu Namburu,
	Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Nagadheeraj Rottela, Srikanth Jampala, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru, Chengwen Feng,
	Kevin Laatz, Conor Walsh, Timothy McDaniel, Jerin Jacob,
	Pavan Nikhilesh, Elena Agostini, Ashwin Sekhar T K, Harman Kalra,
	Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Chas Williams, Min Hu (Connor),
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Dongdong Liu, Yisen Zhuang, Yuying Zhang,
	Beilei Xing, Junfeng Guo, Andrew Boyer, Qiming Yang,
	Stephen Hemminger, Long Li, Jiawen Wu, Devendra Singh Rawat,
	Maciej Czekaj, Jian Wang, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Tianfei zhang,
	Jingjing Wu, Ori Kam, Xiao Wang, Vijay Kumar Srivastava,
	Ferruh Yigit

The pci 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 <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 app/test/virtual_pmd.c                        |   2 +-
 doc/guides/rel_notes/release_22_11.rst        |   2 +-
 drivers/baseband/acc100/rte_acc100_pmd.c      |   2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   2 +-
 drivers/bus/pci/bsd/pci.c                     |   3 -
 drivers/bus/pci/bus_pci_driver.h              | 200 +++++++++++++++++
 drivers/bus/pci/linux/pci.c                   |   3 -
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |   2 -
 drivers/bus/pci/private.h                     |  19 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +-----------------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   1 +
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/common/cnxk/roc_platform.h            |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |   2 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   2 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   2 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   2 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   2 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   2 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   3 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/netvsc/hn_vf.c                    |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   2 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   2 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 lib/ethdev/ethdev_pci.h                       |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 128 files changed, 350 insertions(+), 331 deletions(-)
 create mode 100644 drivers/bus/pci/bus_pci_driver.h

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index cd4611ab48..2b55c85fd8 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2f2bd2b086..8fa4cf468d 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,7 +88,7 @@ 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``, ``ifpga``
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``
   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).
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index a8482bd411..801e8920df 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -14,7 +14,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_hexdump.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
 #endif
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 82ae6ba678..c1d877c87f 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 21d35292a3..f16814e241 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 9a11f99ae3..bc560a2a56 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -28,7 +28,6 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
@@ -48,8 +47,6 @@
  * PCI probing under BSD.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /* Map pci device */
 int
 rte_pci_map_device(struct rte_pci_device *dev)
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
new file mode 100644
index 0000000000..b5c7dee617
--- /dev/null
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -0,0 +1,200 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2015 Intel Corporation.
+ * Copyright 2013-2014 6WIND S.A.
+ */
+
+#ifndef BUS_PCI_DRIVER_H
+#define BUS_PCI_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_pci.h>
+#include <rte_dev.h>
+#include <rte_compat.h>
+
+/** Pathname of PCI devices directory. */
+__rte_internal
+const char *rte_pci_get_sysfs_path(void);
+
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* no attached driver */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
+};
+
+/**
+ * A structure describing a PCI device.
+ */
+struct rte_pci_device {
+	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
+	struct rte_device device;           /**< Inherit core device */
+	struct rte_pci_addr addr;           /**< PCI location. */
+	struct rte_pci_id id;               /**< PCI ID. */
+	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
+					    /**< PCI Memory Resource */
+	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
+	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
+	uint16_t max_vfs;                   /**< sriov enable if not zero */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
+	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	struct rte_intr_handle *vfio_req_intr_handle;
+				/**< Handler of VFIO request interrupt */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_pci_device.
+ */
+#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
+
+#define RTE_DEV_TO_PCI_CONST(ptr) \
+	container_of(ptr, const struct rte_pci_device, device)
+
+#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
+
+#ifdef __cplusplus
+/** C++ macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev) \
+	RTE_CLASS_ANY_ID,         \
+	(vend),                   \
+	(dev),                    \
+	RTE_PCI_ANY_ID,           \
+	RTE_PCI_ANY_ID
+#else
+/** Macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev)          \
+	.class_id = RTE_CLASS_ANY_ID,      \
+	.vendor_id = (vend),               \
+	.device_id = (dev),                \
+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
+	.subsystem_device_id = RTE_PCI_ANY_ID
+#endif
+
+/**
+ * Initialisation function for the driver called during PCI probing.
+ */
+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
+
+/**
+ * Uninitialisation function for the driver called during hotplugging.
+ */
+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A structure describing a PCI driver.
+ */
+struct rte_pci_driver {
+	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
+	struct rte_driver driver;          /**< Inherit core driver. */
+	rte_pci_probe_t *probe;            /**< Device probe function. */
+	rte_pci_remove_t *remove;          /**< Device remove function. */
+	pci_dma_map_t *dma_map;		   /**< device dma map function. */
+	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
+	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
+	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
+};
+
+/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
+#define RTE_PCI_DRV_NEED_MAPPING 0x0001
+/** Device needs PCI BAR mapping with enabled write combining (wc) */
+#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
+/** Device already probed can be probed again to check for new ports. */
+#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
+/** Device driver supports link state interrupt */
+#define RTE_PCI_DRV_INTR_LSC	0x0008
+/** Device driver supports device removal interrupt */
+#define RTE_PCI_DRV_INTR_RMV 0x0010
+/** Device driver needs to keep mapped resources if unsupported dev detected */
+#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
+
+/**
+ * Register a PCI driver.
+ *
+ * @param driver
+ *   A pointer to a rte_pci_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_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) \
+{\
+	(pci_drv).driver.name = RTE_STR(nm);\
+	rte_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.
+ */
+__rte_internal
+void rte_pci_unregister(struct rte_pci_driver *driver);
+
+/*
+ * A structure used to access io resources for a pci device.
+ * rte_pci_ioport is arch, os, driver specific, and should not be used outside
+ * of pci ioport api.
+ */
+struct rte_pci_ioport {
+	struct rte_pci_device *dev;
+	uint64_t base;
+	uint64_t len; /* only filled for memory mapped ports */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_PCI_DRIVER_H */
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index e521459870..fa5d5e131d 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -6,7 +6,6 @@
 #include <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_malloc.h>
@@ -24,8 +23,6 @@
  * PCI probing using Linux sysfs.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 static int
 pci_get_kernel_driver_by_path(const char *filename, char *dri_name,
 			      size_t len)
diff --git a/drivers/bus/pci/meson.build b/drivers/bus/pci/meson.build
index 81c7e94c00..f50f039a68 100644
--- a/drivers/bus/pci/meson.build
+++ b/drivers/bus/pci/meson.build
@@ -3,6 +3,7 @@
 
 deps += ['pci']
 headers = files('rte_bus_pci.h')
+driver_sdk_headers = files('bus_pci_driver.h')
 sources = files('pci_common.c',
     'pci_params.c')
 if is_linux
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 37ab879779..0d61d49287 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -443,7 +443,6 @@ void
 rte_pci_register(struct rte_pci_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = &rte_pci_bus;
 }
 
 /* unregister a driver */
@@ -451,7 +450,6 @@ void
 rte_pci_unregister(struct rte_pci_driver *driver)
 {
 	TAILQ_REMOVE(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to PCI bus */
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 0fbef8e1d8..4e40a2ed85 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,12 +8,29 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
+/**
+ * Structure describing the PCI bus
+ */
+struct rte_pci_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_pci_device) device_list; /**< List of PCI devices */
+	RTE_TAILQ_HEAD(, rte_pci_driver) driver_list; /**< List of PCI drivers */
+};
+
 extern struct rte_pci_bus rte_pci_bus;
 
+/* PCI Bus iterators */
+#define FOREACH_DEVICE_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+
 struct rte_pci_driver;
 struct rte_pci_device;
 
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1c6a8fdd7b..60e50ca875 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -24,176 +24,15 @@ extern "C" {
 
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 
-/** Pathname of PCI devices directory. */
-const char *rte_pci_get_sysfs_path(void);
-
 /* Forward declarations */
 struct rte_pci_device;
 struct rte_pci_driver;
-
-/** List of PCI devices */
-RTE_TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
-/** List of PCI drivers */
-RTE_TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
-
-/* PCI Bus iterators */
-#define FOREACH_DEVICE_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+struct rte_pci_ioport;
 
 struct rte_devargs;
 
-enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
-	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
-	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
-	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
-	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
-	RTE_PCI_KDRV_NONE,         /* no attached driver */
-	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
-};
-
-/**
- * A structure describing a PCI device.
- */
-struct rte_pci_device {
-	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
-	struct rte_device device;           /**< Inherit core device */
-	struct rte_pci_addr addr;           /**< PCI location. */
-	struct rte_pci_id id;               /**< PCI ID. */
-	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
-					    /**< PCI Memory Resource */
-	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
-	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
-	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
-	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
-	struct rte_intr_handle *vfio_req_intr_handle;
-				/**< Handler of VFIO request interrupt */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_pci_device.
- */
-#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
-
-#define RTE_DEV_TO_PCI_CONST(ptr) \
-	container_of(ptr, const struct rte_pci_device, device)
-
-#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
-
-#ifdef __cplusplus
-/** C++ macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev) \
-	RTE_CLASS_ANY_ID,         \
-	(vend),                   \
-	(dev),                    \
-	RTE_PCI_ANY_ID,           \
-	RTE_PCI_ANY_ID
-#else
-/** Macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev)          \
-	.class_id = RTE_CLASS_ANY_ID,      \
-	.vendor_id = (vend),               \
-	.device_id = (dev),                \
-	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
-	.subsystem_device_id = RTE_PCI_ANY_ID
-#endif
-
-/**
- * Initialisation function for the driver called during PCI probing.
- */
-typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
-
-/**
- * Uninitialisation function for the driver called during hotplugging.
- */
-typedef int (rte_pci_remove_t)(struct rte_pci_device *);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A structure describing a PCI driver.
- */
-struct rte_pci_driver {
-	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
-	struct rte_driver driver;          /**< Inherit core driver. */
-	struct rte_pci_bus *bus;           /**< PCI bus reference. */
-	rte_pci_probe_t *probe;            /**< Device probe function. */
-	rte_pci_remove_t *remove;          /**< Device remove function. */
-	pci_dma_map_t *dma_map;		   /**< device dma map function. */
-	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
-	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
-	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
-};
-
-/**
- * Structure describing the PCI bus
- */
-struct rte_pci_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_pci_device_list device_list;  /**< List of PCI devices */
-	struct rte_pci_driver_list driver_list;  /**< List of PCI drivers */
-};
-
-/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
-#define RTE_PCI_DRV_NEED_MAPPING 0x0001
-/** Device needs PCI BAR mapping with enabled write combining (wc) */
-#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
-/** Device already probed can be probed again to check for new ports. */
-#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
-/** Device driver supports link state interrupt */
-#define RTE_PCI_DRV_INTR_LSC	0x0008
-/** Device driver supports device removal interrupt */
-#define RTE_PCI_DRV_INTR_RMV 0x0010
-/** Device driver needs to keep mapped resources if unsupported dev detected */
-#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
-
 /**
  * Map the PCI device resources in user space virtual memory address
  *
@@ -261,33 +100,6 @@ off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap);
 __rte_experimental
 int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable);
 
-/**
- * Register a PCI driver.
- *
- * @param driver
- *   A pointer to a rte_pci_driver structure describing the driver
- *   to be registered.
- */
-void rte_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) \
-{\
-	(pci_drv).driver.name = RTE_STR(nm);\
-	rte_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_pci_unregister(struct rte_pci_driver *driver);
-
 /**
  * Read PCI config space.
  *
@@ -322,17 +134,6 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 int rte_pci_write_config(const struct rte_pci_device *device,
 		const void *buf, size_t len, off_t offset);
 
-/**
- * A structure used to access io resources for a pci device.
- * rte_pci_ioport is arch, os, driver specific, and should not be used outside
- * of pci ioport api.
- */
-struct rte_pci_ioport {
-	struct rte_pci_device *dev;
-	uint64_t base;
-	uint64_t len; /* only filled for memory mapped ports */
-};
-
 /**
  * Initialize a rte_pci_ioport object for a pci device io resource.
  *
diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map
index 3d5c2f3068..161ab86d3b 100644
--- a/drivers/bus/pci/version.map
+++ b/drivers/bus/pci/version.map
@@ -2,16 +2,13 @@ DPDK_23 {
 	global:
 
 	rte_pci_dump;
-	rte_pci_get_sysfs_path;
 	rte_pci_ioport_map;
 	rte_pci_ioport_read;
 	rte_pci_ioport_unmap;
 	rte_pci_ioport_write;
 	rte_pci_map_device;
 	rte_pci_read_config;
-	rte_pci_register;
 	rte_pci_unmap_device;
-	rte_pci_unregister;
 	rte_pci_write_config;
 
 	local: *;
@@ -25,3 +22,11 @@ EXPERIMENTAL {
 	# added in 21.08
 	rte_pci_set_bus_master;
 };
+
+INTERNAL {
+	global:
+
+	rte_pci_get_sysfs_path;
+	rte_pci_register;
+	rte_pci_unregister;
+};
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 7bf091158b..f013b743b3 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -9,6 +9,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_bus_pci.h>
 
 #include "private.h"
 #include "pci_netuio.h"
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index 5460399eea..314bbcf547 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 #include <rte_log.h>
 #include <rte_eal.h>
+#include <rte_bus_pci.h>
 
 #ifdef __MINGW32__
 #include <ddk/ndisguid.h>
diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h
index 502f243a81..a7cbe444ae 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -7,7 +7,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bitmap.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c
index b42102e84c..aafff60eeb 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -15,7 +15,7 @@
 
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 
 #include "mlx5_common.h"
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h
index 479bb3c7cb..81702b8768 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.h
+++ b/drivers/common/mlx5/linux/mlx5_common_os.h
@@ -9,7 +9,7 @@
 #include <malloc.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_log.h>
diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
index 63f31437da..629a639a81 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -8,7 +8,7 @@
 #include <stdio.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_rwlock.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 66626953f1..e82cb881bf 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,8 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
 #include "mlx5_common_private.h"
diff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c
index f2fc7cd494..2b6058eb3e 100644
--- a/drivers/common/mlx5/windows/mlx5_common_os.c
+++ b/drivers/common/mlx5/windows/mlx5_common_os.c
@@ -7,7 +7,7 @@
 #include <stdio.h>
 
 #include <rte_mempool.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_errno.h>
 
diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h
index e1a32a7e87..d1512f3b89 100644
--- a/drivers/common/qat/qat_device.h
+++ b/drivers/common/qat/qat_device.h
@@ -4,7 +4,7 @@
 #ifndef _QAT_DEVICE_H_
 #define _QAT_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "qat_common.h"
 #include "qat_logs.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 8674eccdca..5916e745e2 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
diff --git a/drivers/common/sfc_efx/sfc_efx.h b/drivers/common/sfc_efx/sfc_efx.h
index c16eca60f3..d3ea586cb8 100644
--- a/drivers/common/sfc_efx/sfc_efx.h
+++ b/drivers/common/sfc_efx/sfc_efx.h
@@ -10,7 +10,7 @@
 #ifndef _SFC_EFX_H_
 #define _SFC_EFX_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "efx.h"
 #include "efsys.h"
diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c
index d64a628c74..3d2c45fcee 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -5,7 +5,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h
index 46c80c8dc2..cdef8cc6cb 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -7,7 +7,7 @@
 
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
 #include <rte_compressdev_pmd.h>
diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index e8f57c3cc4..fe4a4999c6 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_hexdump.h>
 #include <rte_comp.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_memcpy.h>
 #include <rte_common.h>
diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h
index 2a205cd446..9deaae7980 100644
--- a/drivers/crypto/ccp/ccp_dev.h
+++ b/drivers/crypto/ccp/ccp_dev.h
@@ -10,7 +10,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_byteorder.h>
 #include <rte_io.h>
diff --git a/drivers/crypto/ccp/ccp_pci.h b/drivers/crypto/ccp/ccp_pci.h
index 7ed3bac406..6736bf8ad3 100644
--- a/drivers/crypto/ccp/ccp_pci.h
+++ b/drivers/crypto/ccp/ccp_pci.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
 #define PROC_MODULES "/proc/modules"
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a35a8cd775..4957f11e97 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_bus_vdev.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 1e0a7b91c9..3fd9f3c426 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index 54cd77e575..bd425f95ff 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index eb7616257e..dc8e291f50 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -7,7 +7,7 @@
 #include <rte_eal_paging.h>
 #include <rte_errno.h>
 #include <rte_log.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/crypto/nitrox/nitrox_device.h b/drivers/crypto/nitrox/nitrox_device.h
index 6b8095f42b..1ff7c59b63 100644
--- a/drivers/crypto/nitrox/nitrox_device.h
+++ b/drivers/crypto/nitrox/nitrox_device.h
@@ -5,7 +5,7 @@
 #ifndef _NITROX_DEVICE_H_
 #define _NITROX_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 struct nitrox_sym_device;
diff --git a/drivers/crypto/octeontx/otx_cryptodev.c b/drivers/crypto/octeontx/otx_cryptodev.c
index 337d06aab8..b5ab937c3a 100644
--- a/drivers/crypto/octeontx/otx_cryptodev.c
+++ b/drivers/crypto/octeontx/otx_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium, Inc
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_log.h>
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 7aee67ab09..11840f5ecf 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eventdev.h>
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index db6316fbe9..f3a99ae15c 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -7,7 +7,7 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_crypto_sym.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 
 #include "qat_sym.h"
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index ed64866758..21bd996064 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eal.h>
diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c
index ae069794a6..95a43c8801 100644
--- a/drivers/crypto/virtio/virtio_pci.c
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -10,7 +10,6 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
 
 #include "virtio_pci.h"
 #include "virtqueue.h"
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
index 0a7ea1bb64..41949c3d13 100644
--- a/drivers/crypto/virtio/virtio_pci.h
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 
 #include <rte_eal_paging.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 #include "virtio_crypto.h"
diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c
index 2824c1b44f..9f0de60861 100644
--- a/drivers/dma/cnxk/cnxk_dmadev.c
+++ b/drivers/dma/cnxk/cnxk_dmadev.c
@@ -5,8 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index 9494b60779..0e11ca14cc 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c
index 2f8ec06d9e..781fa02db3 100644
--- a/drivers/dma/idxd/idxd_pci.c
+++ b/drivers/dma/idxd/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_devargs.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
index a230496b11..5906eb45aa 100644
--- a/drivers/dma/ioat/ioat_dmadev.c
+++ b/drivers/dma/ioat/ioat_dmadev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
 #include <rte_prefetch.h>
diff --git a/drivers/event/dlb2/pf/dlb2_main.h b/drivers/event/dlb2/pf/dlb2_main.h
index 9eeda482a3..5aa51b1616 100644
--- a/drivers/event/dlb2/pf/dlb2_main.h
+++ b/drivers/event/dlb2/pf/dlb2_main.h
@@ -9,7 +9,7 @@
 #include <rte_log.h>
 #include <rte_spinlock.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include "base/dlb2_hw_types.h"
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index dd3f2b8ece..9f8c6cd8b8 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -25,7 +25,7 @@
 #include <rte_cycles.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
 #include <eventdev_pmd_pci.h>
diff --git a/drivers/event/octeontx/ssovf_probe.c b/drivers/event/octeontx/ssovf_probe.c
index 4da7d1ae45..2c9601a8ff 100644
--- a/drivers/event/octeontx/ssovf_probe.c
+++ b/drivers/event/octeontx/ssovf_probe.c
@@ -7,7 +7,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "octeontx_mbox.h"
 #include "ssovf_evdev.h"
diff --git a/drivers/event/octeontx/timvf_probe.c b/drivers/event/octeontx/timvf_probe.c
index 59bba31e8e..7ce3eddd7e 100644
--- a/drivers/event/octeontx/timvf_probe.c
+++ b/drivers/event/octeontx/timvf_probe.c
@@ -5,7 +5,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <octeontx_mbox.h>
 
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 664605d9fb..2be7b8d2df 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -6,7 +6,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_dev.h>
 
diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index 54a1a7d3ae..78caf987d0 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_atomic.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 8fd9edced2..1513c632c6 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -13,7 +13,7 @@
 
 #include <rte_atomic.h>
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index e8e4092be6..c654a229f7 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7ac55584ff..7c0cb666fb 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index d7e1729e68..89414ac88a 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -16,7 +16,7 @@
 
 #include <rte_byteorder.h>
 #include <rte_spinlock.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_io.h>
 
 #include "bnx2x_osal.h"
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e86e51e1fa..c9aa45ed3b 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 5406e1c934..1a86eb3c00 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,8 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index 1c016a7115..16cbc1a345 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -8,7 +8,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index cf9a2fdc19..fd71a50a58 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_tailq.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 794496abfc..409de50083 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index cea5b490ba..d48fd52404 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -18,7 +18,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a9c18b27e8..43979992d3 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 3f3fd0d61e..c7588ea57e 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -10,7 +10,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 0db0918b43..4709675af8 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -12,7 +12,7 @@
 #include <ethdev_pci.h>
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_timer.h>
 #include <rte_dev.h>
 #include <rte_net.h>
diff --git a/drivers/net/enic/base/vnic_dev.h b/drivers/net/enic/base/vnic_dev.h
index 4b9f75b65f..44ca5c739f 100644
--- a/drivers/net/enic/base/vnic_dev.h
+++ b/drivers/net/enic/base/vnic_dev.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "enic_compat.h"
 #include "vnic_resource.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index a8d470e8ac..998436e5e8 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9f351de72e..19a99a82c5 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 1ad6ad3dfb..7312c411bd 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c
index 5eb022297e..818698dcb3 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwdev.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c
@@ -3,7 +3,7 @@
  */
 
 #include<ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index 26fa1e27d4..2d3f192b21 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_csr.h"
diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index ad5db9f1de..4aa3fa6adc 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
-#include<rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_pmd_hwdev.h"
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 35788f46eb..7aa5e7d8e9 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 424205356e..e8e5aa2c86 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_kvargs.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
 
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6b1d1a5fb1..144daf1636 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 
 #include "hns3_ethdev.h"
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 95f711e7eb..cd0c91f3a3 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018-2021 HiSilicon Limited.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 67d79de08d..7bdc453ec1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 7f8e81858e..cc0f992453 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Intel Corporation.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 7f221a5d34..e3727b7b41 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -7,7 +7,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h
index 49b90d1b7c..a55202b178 100644
--- a/drivers/net/ionic/ionic.h
+++ b/drivers/net/ionic/ionic.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "ionic_dev.h"
 #include "ionic_if.h"
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 28280c5377..d72033c32c 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 2e39113941..70a06a3b15 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -4,7 +4,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 2f088d767f..2ef96a984a 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 2f242b678a..0260227900 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f31bbb7895..552e41692c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index cc6049a66a..ff34fd1515 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index ce74c51ce2..bb1dd33e7c 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -32,7 +32,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_ether.h>
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index aaf636aa0d..661d362dc0 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -25,7 +25,7 @@
 #include <time.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index c9ed38ef7c..efb262e368 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,8 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 998846adbe..30923b0732 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 05c919ed39..a5c7ca8c52 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -11,7 +11,7 @@
 #include <errno.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index bee9363515..e122b39cb3 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -15,7 +15,7 @@
 #include <rte_flow_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ip.h>
 #include <rte_gre.h>
 #include <rte_vxlan.h>
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 0140f8b3b2..9150ced72d 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -13,7 +13,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal_paging.h>
 
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 62948bf889..cce0a79edb 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h
index bf1fa30312..8783fce4dd 100644
--- a/drivers/net/ngbe/base/ngbe_osdep.h
+++ b/drivers/net/ngbe/base/ngbe_osdep.h
@@ -19,7 +19,7 @@
 #include <rte_config.h>
 #include <rte_io.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../ngbe_logs.h"
 
diff --git a/drivers/net/ngbe/ngbe_pf.c b/drivers/net/ngbe/ngbe_pf.c
index 12a18de31d..947ae7fe94 100644
--- a/drivers/net/ngbe/ngbe_pf.c
+++ b/drivers/net/ngbe/ngbe_pf.c
@@ -6,7 +6,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/ngbe.h"
 #include "ngbe_ethdev.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c
index 0ddff54886..6a48a22de6 100644
--- a/drivers/net/octeontx/base/octeontx_pkivf.c
+++ b/drivers/net/octeontx/base/octeontx_pkivf.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../octeontx_logs.h"
 #include "octeontx_io.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c
index bf28bc7992..5d445dfb49 100644
--- a/drivers/net/octeontx/base/octeontx_pkovf.c
+++ b/drivers/net/octeontx/base/octeontx_pkovf.c
@@ -10,7 +10,7 @@
 #include <rte_cycles.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 
 #include "../octeontx_logs.h"
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 9ea579bfc8..67e7f759fe 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -20,7 +20,7 @@
 #include <rte_ether.h>
 #include <rte_io.h>
 #include <rte_version.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 /* Forward declaration */
 struct ecore_dev;
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index a0979618be..0a1e224fa2 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -13,7 +13,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 39f85e8b84..506c62a726 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_ether.h>
diff --git a/drivers/net/sfc/sfc_sriov.c b/drivers/net/sfc/sfc_sriov.c
index 385b172e2e..009b884d8d 100644
--- a/drivers/net/sfc/sfc_sriov.c
+++ b/drivers/net/sfc/sfc_sriov.c
@@ -8,7 +8,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc.h"
 #include "sfc_log.h"
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 262c024560..28183ec740 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -32,7 +32,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index 262dbb5e38..6fb22ca7d9 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_ethdev_core.h>
 #include <rte_hash.h>
 #include <rte_hash_crc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index d0093c0163..f19bdf36dc 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -4,7 +4,7 @@
  */
 
 #include <sys/queue.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c
index 0b82fb1a88..176f79005c 100644
--- a/drivers/net/txgbe/txgbe_pf.c
+++ b/drivers/net/txgbe/txgbe_pf.c
@@ -20,7 +20,7 @@
 #include <rte_memcpy.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/txgbe.h"
 #include "txgbe_ethdev.h"
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 11e25a0142..6d4a8712c2 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 
 #include "virtio.h"
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 1f6bdeddda..2b9e35cef5 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 
 #include <rte_memory.h>
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 2af67dc0a3..101b1cb500 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index 349d551839..db029cbf34 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_eal.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
index 26def43564..2d8466ef91 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
index bbe7f74def..b424d6127d 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index eca1edc270..859f28dcc1 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index da0aba6e00..c7c5cda48c 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 3c41aa9ee8..a1db533eeb 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -17,7 +17,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index b7438bd372..67b3941265 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 32de5ff0ce..ec86bfdb0c 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -16,7 +16,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 #include <rte_alarm.h>
 #include <rte_interrupts.h>
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 1ca248123b..a47d5a0350 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 #include "rte_pmd_ifpga.h"
diff --git a/drivers/raw/ioat/idxd_pci.c b/drivers/raw/ioat/idxd_pci.c
index 13515dbc6c..90ec0222e6 100644
--- a/drivers/raw/ioat/idxd_pci.c
+++ b/drivers/raw/ioat/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_devargs.h>
 
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 11341fcf5d..f58006bbda 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index f5e773c53b..76e98fe515 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_mbuf.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_memcpy.h>
 #include <rte_rawdev.h>
diff --git a/drivers/raw/ntb/ntb_hw_intel.c b/drivers/raw/ntb/ntb_hw_intel.c
index 20cdb761a3..9b4465176a 100644
--- a/drivers/raw/ntb/ntb_hw_intel.c
+++ b/drivers/raw/ntb/ntb_hw_intel.c
@@ -8,7 +8,7 @@
 #include <rte_io.h>
 #include <rte_eal.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index 9f79c6907c..4c20daac94 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -9,7 +9,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_common_mr.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c
index 9a2db7e43f..0a8c83fe14 100644
--- a/drivers/regex/mlx5/mlx5_regex_fastpath.c
+++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c
@@ -10,7 +10,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_regexdev_driver.h>
 #include <rte_mbuf.h>
diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h
index 3d567695cc..6444d7f72c 100644
--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h
+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h
@@ -10,7 +10,7 @@
 
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_io.h>
 
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index ac42de9c79..d5ac583589 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -14,7 +14,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_vhost.h>
 #include <rte_vdpa.h>
 #include <vdpa_driver.h>
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index 91af792a3a..026daa3f24 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/vdpa/sfc/sfc_vdpa.h b/drivers/vdpa/sfc/sfc_vdpa.h
index daeb27d4cd..b25eb3a5fe 100644
--- a/drivers/vdpa/sfc/sfc_vdpa.h
+++ b/drivers/vdpa/sfc/sfc_vdpa.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc_efx.h"
 #include "sfc_efx_mcdi.h"
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index a268507801..94b8fba5d7 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_config.h>
 #include <ethdev_driver.h>
 
diff --git a/lib/eventdev/eventdev_pmd_pci.h b/lib/eventdev/eventdev_pmd_pci.h
index 24b56faaa9..7bbec40c71 100644
--- a/lib/eventdev/eventdev_pmd_pci.h
+++ b/lib/eventdev/eventdev_pmd_pci.h
@@ -23,7 +23,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 17/27] bus/vdev: make driver-only headers private
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (15 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 16/27] bus/pci: " David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-29  7:17     ` Ruifeng Wang
  2022-08-26 12:41   ` [PATCH v4 18/27] bus/vmbus: " David Marchand
                     ` (9 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Rosen Xu, Gagandeep Singh,
	Hemant Agrawal, Nicolas Chautru, Ray Kinsella, Lee Daly,
	Fan Zhang, Ashish Gupta, Sunila Sahu, Ruifeng Wang,
	Ajit Khaparde, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Pablo de Lara, Michael Shamis, Liron Himi,
	Chengwen Feng, Kevin Laatz, Sachin Saxena, Jerin Jacob, Liang Ma,
	Peter Mccarthy, Harry van Haaren, John W. Linville, Ciara Loftus,
	Qi Zhang, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Jakub Grajciar, Zyta Szpak, Tetsuya Mukawa,
	Harman Kalra, Jasvinder Singh, Cristian Dumitrescu, Matan Azrad,
	Maxime Coquelin, Chenbo Xia, Jakub Palider, Tomasz Duszynski,
	Tianfei zhang, Ferruh Yigit, Andrew Rybchenko

The vdev 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 <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 app/test/test_vdev.c                          |   2 +-
 doc/guides/rel_notes/release_22_11.rst        |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++++++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 ----------------
 drivers/bus/vdev/vdev.c                       |   8 +-
 drivers/bus/vdev/vdev_params.c                |   1 -
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_evdev.c          |   2 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   2 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   2 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   2 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   2 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |   2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   2 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 63 files changed, 221 insertions(+), 200 deletions(-)
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 5eeff3106d..3cc3abe70b 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_bus.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "test.h"
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8fa4cf468d..bafd99c39e 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,8 +88,8 @@ 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``, ``ifpga``, ``pci``
-  buses has been marked as an internal API.
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
+  ``vdev`` 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).
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 4d1bd16751..f0927d9fca 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -10,7 +10,7 @@
 #include <dirent.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 248e12987f..e76ef2313f 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index af7bc416f9..e8d0c43e6f 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
new file mode 100644
index 0000000000..36748cdfae
--- /dev/null
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -0,0 +1,151 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ */
+
+#ifndef BUS_VDEV_DRIVER_H
+#define BUS_VDEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vdev.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
+	struct rte_device device;               /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+	container_of(ptr, struct rte_vdev_device, device)
+
+#define RTE_DEV_TO_VDEV_CONST(ptr) \
+	container_of(ptr, const struct rte_vdev_device, device)
+
+#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.name)
+		return dev->device.name;
+	return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.devargs)
+		return dev->device.devargs->args;
+	return "";
+}
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+	struct rte_driver driver;        /**< Inherited general driver. */
+	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
+	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
+	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
+	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
+	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
+};
+
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+static const char *vdrvinit_ ## nm ## _alias;\
+RTE_INIT(vdrvinitfn_ ##vdrv)\
+{\
+	(vdrv).driver.name = RTE_STR(nm);\
+	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+	rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VDEV_DRIVER_H */
diff --git a/drivers/bus/vdev/meson.build b/drivers/bus/vdev/meson.build
index 8adf674530..1532ed4f35 100644
--- a/drivers/bus/vdev/meson.build
+++ b/drivers/bus/vdev/meson.build
@@ -6,5 +6,6 @@ sources = files(
         'vdev_params.c',
 )
 headers = files('rte_bus_vdev.h')
+driver_sdk_headers = files('bus_vdev_driver.h')
 
 deps += ['kvargs']
diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
index 5af6be009f..f48dd24e5e 100644
--- a/drivers/bus/vdev/rte_bus_vdev.h
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -15,140 +15,6 @@
 extern "C" {
 #endif
 
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
-	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
-	struct rte_device device;               /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
-	container_of(ptr, struct rte_vdev_device, device)
-
-#define RTE_DEV_TO_VDEV_CONST(ptr) \
-	container_of(ptr, const struct rte_vdev_device, device)
-
-#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.name)
-		return dev->device.name;
-	return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.devargs)
-		return dev->device.devargs->args;
-	return "";
-}
-
-/** Double linked list of virtual device drivers. */
-RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
-	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
-	struct rte_driver driver;        /**< Inherited general driver. */
-	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
-	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
-	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
-	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
-	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
-};
-
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-static const char *vdrvinit_ ## nm ## _alias;\
-RTE_INIT(vdrvinitfn_ ##vdrv)\
-{\
-	(vdrv).driver.name = RTE_STR(nm);\
-	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
-	rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
 typedef void (*rte_vdev_scan_callback)(void *user_arg);
 
 /**
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index a8d8b2327e..7d78cf93bc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -21,7 +21,7 @@
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 
-#include "rte_bus_vdev.h"
+#include "bus_vdev_driver.h"
 #include "vdev_logs.h"
 #include "vdev_private.h"
 
@@ -30,16 +30,14 @@
 /* Forward declare to access virtual bus name */
 static struct rte_bus rte_vdev_bus;
 
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
 
-static struct vdev_device_list vdev_device_list =
+static TAILQ_HEAD(, rte_vdev_device) vdev_device_list =
 	TAILQ_HEAD_INITIALIZER(vdev_device_list);
 /* The lock needs to be recursive because a vdev can manage another vdev. */
 static rte_spinlock_recursive_t vdev_device_list_lock =
 	RTE_SPINLOCK_RECURSIVE_INITIALIZER;
 
-static struct vdev_driver_list vdev_driver_list =
+static TAILQ_HEAD(, rte_vdev_driver) vdev_driver_list =
 	TAILQ_HEAD_INITIALIZER(vdev_driver_list);
 
 struct vdev_custom_scan {
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 3969faf16d..2c72614776 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -5,7 +5,6 @@
 #include <string.h>
 
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vdev/version.map b/drivers/bus/vdev/version.map
index 7cc3098a50..594c48c3db 100644
--- a/drivers/bus/vdev/version.map
+++ b/drivers/bus/vdev/version.map
@@ -3,10 +3,15 @@ DPDK_23 {
 
 	rte_vdev_add_custom_scan;
 	rte_vdev_init;
-	rte_vdev_register;
 	rte_vdev_remove_custom_scan;
 	rte_vdev_uninit;
-	rte_vdev_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vdev_register;
+	rte_vdev_unregister;
+};
diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index b7ba61c434..cb23e929ed 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -3,7 +3,7 @@
  */
 #include <isa-l.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_malloc.h>
diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zlib_pmd.c
index 0220c6d038..98abd41013 100644
--- a/drivers/compress/zlib/zlib_pmd.c
+++ b/drivers/compress/zlib/zlib_pmd.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium Networks
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 
 #include "zlib_pmd_private.h"
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 32127a874c..5c060e71a3 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -8,7 +8,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_device.h b/drivers/crypto/bcmfs/bcmfs_device.h
index 4901a6cfd9..610454dd5e 100644
--- a/drivers/crypto/bcmfs/bcmfs_device.h
+++ b/drivers/crypto/bcmfs/bcmfs_device.h
@@ -9,7 +9,7 @@
 #include <sys/queue.h>
 
 #include <rte_spinlock.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "bcmfs_logs.h"
 #include "bcmfs_qp.h"
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8e9cfe73d8..8c0b4909cf 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -12,7 +12,7 @@
 #include <cryptodev_pmd.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_security_driver.h>
 #include <rte_hexdump.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 4957f11e97..6c3e45e333 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_string_fns.h>
 #include <bus_pci_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.c b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
index aab42c360c..2e7347fa79 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index e2c240dfc0..d0d4258ee1 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -7,7 +7,7 @@
 
 #include <intel-ipsec-mb.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #if defined(RTE_LIB_SECURITY)
 #define IPSEC_MB_DOCSIS_SEC_ENABLED 1
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index c9d4f9d0ae..fba10b8cf4 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2016-2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 04efd9aaa8..c35876c8b4 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_security_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 9ecb434fd0..eab74ad45f 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 
 #include "null_crypto_pmd_private.h"
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index e01dacc98d..ed6d215f1b 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index dd198080bf..a15c02b4d8 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 82b4661323..09068a9521 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -4,7 +4,7 @@
 
 #include <inttypes.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 5de3e9e5f5..08df6e223a 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -23,7 +23,7 @@
 #include <rte_memcpy.h>
 #include <rte_memory.h>
 #include <rte_pci.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
index 941fb8fc43..427aff4b11 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index 9e14e35d10..fe157c59d5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -16,7 +16,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "ssovf_evdev.h"
 #include "timvf_evdev.h"
diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c
index b55523632a..3dbf31efa9 100644
--- a/drivers/event/octeontx/ssovf_evdev_selftest.c
+++ b/drivers/event/octeontx/ssovf_evdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 #include "ssovf_evdev.h"
diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c
index 8b6890b220..368e5a9657 100644
--- a/drivers/event/opdl/opdl_evdev.c
+++ b/drivers/event/opdl/opdl_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memzone.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/opdl/opdl_evdev_init.c b/drivers/event/opdl/opdl_evdev_init.c
index 15aae47524..be3437fc2f 100644
--- a/drivers/event/opdl/opdl_evdev_init.c
+++ b/drivers/event/opdl/opdl_evdev_init.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_errno.h>
 #include <rte_cycles.h>
 #include <rte_memzone.h>
diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 24b92df476..50c12a18b0 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -19,7 +19,7 @@
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
 #include <rte_eventdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_pause.h>
 
 #include "opdl_evdev.h"
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index bf3b01ebc8..6bd8fec6d4 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "skeleton_eventdev.h"
 
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index f93313b31b..22cba1e74b 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_ring.h>
 #include <rte_errno.h>
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index cb97a4d615..59bcdf5734 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -21,7 +21,7 @@
 #include <rte_pause.h>
 #include <rte_service.h>
 #include <rte_service_component.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "sw_evdev.h"
 
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 1396f32c3d..e2771e6765 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -12,7 +12,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <errno.h>
 #include <linux/if_ether.h>
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fce649c2a1..fd7be47311 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -20,7 +20,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 4ac191c468..b44dd219cb 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_tcp.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 73e6972035..cd80a0af46 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -15,7 +15,7 @@
 #include <rte_ip_frag.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 05cf533896..5d4d52c341 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,8 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <rte_bus.h>
+#include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
 
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index dbf57f9ba8..4b93d2649e 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -19,7 +19,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index 0532de5315..c0e1f8db40 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -12,7 +12,7 @@
 #include <rte_kni.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 /* Only single queue supported */
 #define KNI_MAX_QUEUE_PER_PORT 1
diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 7886644412..4700ce2e77 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -17,7 +17,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index dd951b8296..a574bce49e 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -21,7 +21,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index eef016aa0b..6a0dd6091d 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_string_fns.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <stdio.h>
 #include <fcntl.h>
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 735efb6cfc..310e3e5acf 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -9,7 +9,7 @@
 #include <rte_kvargs.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <fcntl.h>
 #include <linux/ethtool.h>
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index bb89c1abc4..a517376d40 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -8,7 +8,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3aca53fb98..9ada22e2ff 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -12,7 +12,7 @@
 #include <eventdev_pmd.h>
 #include <rte_alarm.h>
 #include <rte_branch_prediction.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
 #include <rte_dev.h>
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index ec29fd6bc5..7fb4abb20b 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_os_shim.h>
 
 #include "pcap_osdep.h"
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index c2991ab1cc..0352a57950 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/epoll.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_ether.h>
 #include <dpaa_of.h>
 
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cfb81da5fe..37e7ccfda0 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 8c098cad5b..fa89940735 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -9,7 +9,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 #include <rte_ring.h>
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 9e1032fe72..d047489e94 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -10,7 +10,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_net.h>
 #include <rte_debug.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 2587195168..65043a04eb 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -25,7 +25,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bus.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7e512d94bf..6c81967c6f 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_net.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_vhost.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index a7d7063c2a..3edfd7439e 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 
diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c
index d759ed82d4..e2907c18b5 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.c
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/stat.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_lcore.h>
diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index c7bddbc6cc..aeee4ac289 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -6,7 +6,7 @@
 #include <errno.h>
 #include <stdint.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_atomic.h>
 #include <rte_interrupts.h>
 #include <rte_branch_prediction.h>
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index ec86bfdb0c..1020adcf6e 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -26,7 +26,7 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_pmd_i40e.h>
 
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 72d3b69d75..6831cc8d20 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index 693b24c415..fc257c5f44 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -8,7 +8,7 @@
 #include <rte_memcpy.h>
 #include <rte_dev.h>
 #include <rte_rawdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 /* Using relative path as skeleton_rawdev is not part of exported headers */
diff --git a/lib/ethdev/ethdev_vdev.h b/lib/ethdev/ethdev_vdev.h
index f5f536ce64..364f140f91 100644
--- a/lib/ethdev/ethdev_vdev.h
+++ b/lib/ethdev/ethdev_vdev.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_config.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd_vdev.h b/lib/eventdev/eventdev_pmd_vdev.h
index 77904910a2..cf2333cf41 100644
--- a/lib/eventdev/eventdev_pmd_vdev.h
+++ b/lib/eventdev/eventdev_pmd_vdev.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_config.h>
 #include <rte_debug.h>
 #include <rte_eal.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 18/27] bus/vmbus: make driver-only headers private
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (16 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 17/27] bus/vdev: " David Marchand
@ 2022-08-26 12:41   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 19/27] bus: move IOVA definition from header David Marchand
                     ` (8 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Stephen Hemminger, Long Li, Ray Kinsella

The vmbus 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 <david.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst |   2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h   | 106 +++++++++++++++++++++++++
 drivers/bus/vmbus/linux/vmbus_uio.c    |   1 -
 drivers/bus/vmbus/meson.build          |   1 +
 drivers/bus/vmbus/private.h            |  20 ++++-
 drivers/bus/vmbus/rte_bus_vmbus.h      | 104 ------------------------
 drivers/bus/vmbus/version.map          |   9 ++-
 drivers/bus/vmbus/vmbus_bufring.c      |   1 -
 drivers/bus/vmbus/vmbus_channel.c      |   1 -
 drivers/bus/vmbus/vmbus_common.c       |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c   |   1 -
 drivers/net/netvsc/hn_ethdev.c         |   3 +-
 drivers/net/netvsc/hn_nvs.c            |   2 +-
 drivers/net/netvsc/hn_rndis.c          |   2 +-
 drivers/net/netvsc/hn_rxtx.c           |   2 +-
 drivers/net/netvsc/hn_vf.c             |   2 +-
 16 files changed, 140 insertions(+), 120 deletions(-)
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index bafd99c39e..e08a548285 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -89,7 +89,7 @@ API Changes
   to update their code.
 
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
-  ``vdev`` buses has been marked as an internal API.
+  ``vdev``, ``vmbus`` 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).
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
new file mode 100644
index 0000000000..3424e791c9
--- /dev/null
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018, Microsoft Corporation.
+ * All Rights Reserved.
+ */
+
+#ifndef BUS_VMBUS_DRIVER_H
+#define BUS_VMBUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vmbus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+
+struct vmbus_channel;
+struct vmbus_mon_page;
+
+/** Maximum number of VMBUS resources. */
+enum hv_uio_map {
+	HV_TXRX_RING_MAP = 0,
+	HV_INT_PAGE_MAP,
+	HV_MON_PAGE_MAP,
+	HV_RECV_BUF_MAP,
+	HV_SEND_BUF_MAP
+};
+#define VMBUS_MAX_RESOURCE 5
+
+/**
+ * A structure describing a VMBUS device.
+ */
+struct rte_vmbus_device {
+	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
+	const struct rte_vmbus_driver *driver; /**< Associated driver */
+	struct rte_device device;              /**< Inherit core device */
+	rte_uuid_t device_id;		       /**< VMBUS device id */
+	rte_uuid_t class_id;		       /**< VMBUS device type */
+	uint32_t relid;			       /**< id for primary */
+	uint8_t monitor_id;		       /**< monitor page */
+	int uio_num;			       /**< UIO device number */
+	uint32_t *int_page;		       /**< VMBUS interrupt page */
+	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
+	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
+
+	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
+	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
+};
+
+/**
+ * Initialization function for the driver called during VMBUS probing.
+ */
+typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
+			    struct rte_vmbus_device *);
+
+/**
+ * Initialization function for the driver called during hot plugging.
+ */
+typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
+
+/**
+ * A structure describing a VMBUS driver.
+ */
+struct rte_vmbus_driver {
+	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
+	struct rte_driver driver;
+	vmbus_probe_t *probe;               /**< Device Probe function. */
+	vmbus_remove_t *remove;             /**< Device Remove function. */
+
+	const rte_uuid_t *id_table;	    /**< ID table. */
+};
+
+/**
+ * Register a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vmbus_register(struct rte_vmbus_driver *driver);
+
+/**
+ * Unregister a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
+
+/** Helper for VMBUS device registration from driver instance */
+#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
+	RTE_INIT(vmbusinitfn_ ##nm)			\
+	{						\
+		(vmbus_drv).driver.name = RTE_STR(nm);	\
+		rte_vmbus_register(&vmbus_drv);		\
+	}						\
+	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VMBUS_DRIVER_H */
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5db70f8e0d..26edef342d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -13,7 +13,6 @@
 
 #include <rte_eal.h>
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_memory.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
diff --git a/drivers/bus/vmbus/meson.build b/drivers/bus/vmbus/meson.build
index 3892cbf67f..34988d1d84 100644
--- a/drivers/bus/vmbus/meson.build
+++ b/drivers/bus/vmbus/meson.build
@@ -8,6 +8,7 @@ endif
 
 
 headers = files('rte_bus_vmbus.h','rte_vmbus_reg.h')
+driver_sdk_headers = files('bus_vmbus_driver.h')
 
 sources = files(
         'vmbus_bufring.c',
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 658303bc27..3d233fa83c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -8,13 +8,31 @@
 
 #include <stdbool.h>
 #include <sys/uio.h>
+
+#include <rte_bus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
-#include <rte_bus_vmbus.h>
+
+/**
+ * Structure describing the VM bus
+ */
+struct rte_vmbus_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_vmbus_device) device_list; /**< List of devices */
+	RTE_TAILQ_HEAD(, rte_vmbus_driver) driver_list; /**< List of drivers */
+};
 
 extern struct rte_vmbus_bus rte_vmbus_bus;
 
+/* VMBus iterators */
+#define FOREACH_DEVICE_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
+
 extern int vmbus_logtype_bus;
 #define VMBUS_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index a24bad831d..03894a5d46 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -27,89 +27,12 @@ extern "C" {
 #include <rte_uuid.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
 #include <rte_vmbus_reg.h>
 
 /* Forward declarations */
 struct rte_vmbus_device;
 struct rte_vmbus_driver;
-struct rte_vmbus_bus;
 struct vmbus_channel;
-struct vmbus_mon_page;
-
-RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
-RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
-
-/* VMBus iterators */
-#define FOREACH_DEVICE_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
-
-/** Maximum number of VMBUS resources. */
-enum hv_uio_map {
-	HV_TXRX_RING_MAP = 0,
-	HV_INT_PAGE_MAP,
-	HV_MON_PAGE_MAP,
-	HV_RECV_BUF_MAP,
-	HV_SEND_BUF_MAP
-};
-#define VMBUS_MAX_RESOURCE 5
-
-/**
- * A structure describing a VMBUS device.
- */
-struct rte_vmbus_device {
-	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
-	const struct rte_vmbus_driver *driver; /**< Associated driver */
-	struct rte_device device;              /**< Inherit core device */
-	rte_uuid_t device_id;		       /**< VMBUS device id */
-	rte_uuid_t class_id;		       /**< VMBUS device type */
-	uint32_t relid;			       /**< id for primary */
-	uint8_t monitor_id;		       /**< monitor page */
-	int uio_num;			       /**< UIO device number */
-	uint32_t *int_page;		       /**< VMBUS interrupt page */
-	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
-	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
-
-	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
-	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
-};
-
-/**
- * Initialization function for the driver called during VMBUS probing.
- */
-typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
-			    struct rte_vmbus_device *);
-
-/**
- * Initialization function for the driver called during hot plugging.
- */
-typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
-
-/**
- * A structure describing a VMBUS driver.
- */
-struct rte_vmbus_driver {
-	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
-	struct rte_driver driver;
-	struct rte_vmbus_bus *bus;          /**< VM bus reference. */
-	vmbus_probe_t *probe;               /**< Device Probe function. */
-	vmbus_remove_t *remove;             /**< Device Remove function. */
-
-	const rte_uuid_t *id_table;	    /**< ID table. */
-};
-
-
-/**
- * Structure describing the VM bus
- */
-struct rte_vmbus_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_vmbus_device_list device_list;  /**< List of devices */
-	struct rte_vmbus_driver_list driver_list;  /**< List of drivers */
-};
 
 /**
  * Scan the content of the VMBUS bus, and the devices in the devices
@@ -378,15 +301,6 @@ void rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
 			   const struct vmbus_channel *chan,
 			   uint32_t latency);
 
-/**
- * Register a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be registered.
- */
-void rte_vmbus_register(struct rte_vmbus_driver *driver);
-
 /**
  * For debug dump contents of ring buffer.
  *
@@ -395,24 +309,6 @@ void rte_vmbus_register(struct rte_vmbus_driver *driver);
  */
 void rte_vmbus_chan_dump(FILE *f, const struct vmbus_channel *chan);
 
-/**
- * Unregister a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
-
-/** Helper for VMBUS device registration from driver instance */
-#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
-	RTE_INIT(vmbusinitfn_ ##nm)			\
-	{						\
-		(vmbus_drv).driver.name = RTE_STR(nm);	\
-		rte_vmbus_register(&vmbus_drv);		\
-	}						\
-	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/drivers/bus/vmbus/version.map b/drivers/bus/vmbus/version.map
index 84db31b6e9..430781b29b 100644
--- a/drivers/bus/vmbus/version.map
+++ b/drivers/bus/vmbus/version.map
@@ -16,13 +16,18 @@ DPDK_23 {
 	rte_vmbus_map_device;
 	rte_vmbus_max_channels;
 	rte_vmbus_probe;
-	rte_vmbus_register;
 	rte_vmbus_scan;
 	rte_vmbus_set_latency;
 	rte_vmbus_sub_channel_index;
 	rte_vmbus_subchan_open;
 	rte_vmbus_unmap_device;
-	rte_vmbus_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vmbus_register;
+	rte_vmbus_unregister;
+};
diff --git a/drivers/bus/vmbus/vmbus_bufring.c b/drivers/bus/vmbus/vmbus_bufring.c
index c4aa07b307..c78619dc44 100644
--- a/drivers/bus/vmbus/vmbus_bufring.c
+++ b/drivers/bus/vmbus/vmbus_bufring.c
@@ -15,7 +15,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_pause.h>
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 9bd01679c3..5549fd0944 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -12,7 +12,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..03b39c82b7 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -11,7 +11,6 @@
 #include <sys/mman.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
@@ -235,7 +234,6 @@ rte_vmbus_register(struct rte_vmbus_driver *driver)
 		"Registered driver %s", driver->driver.name);
 
 	TAILQ_INSERT_TAIL(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = &rte_vmbus_bus;
 }
 
 /* unregister vmbus driver */
@@ -243,7 +241,6 @@ void
 rte_vmbus_unregister(struct rte_vmbus_driver *driver)
 {
 	TAILQ_REMOVE(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to VMBUS bus */
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 882a24f869..4d4613513c 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -13,7 +13,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_bus_vmbus.h>
 
 #include "private.h"
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 787139c0b2..188d92ffac 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,8 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <rte_bus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index b90280c9ff..817fb06dfb 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -29,7 +29,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 1b63b27e0c..20f75a17b0 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -27,7 +27,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 909c07a4ab..61cf374224 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -27,7 +27,7 @@
 #include <rte_eal.h>
 #include <rte_dev.h>
 #include <rte_net.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index cce0a79edb..40981706d5 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_log.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 19/27] bus: move IOVA definition from header
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (17 preceding siblings ...)
  2022-08-26 12:41   ` [PATCH v4 18/27] bus/vmbus: " David Marchand
@ 2022-08-26 12:42   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 20/27] bus: introduce accessors David Marchand
                     ` (7 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Sunila Sahu,
	Fan Zhang, Ashish Gupta, Gaetan Rivet, Anatoly Burakov,
	Akhil Goyal, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
	Dmitry Malloy, Pallavi Kadam, Ferruh Yigit, Andrew Rybchenko,
	Reshma Pattan, Stephen Hemminger

iova enum definition does not need to be defined as part of the bus API.
Move it to rte_eal.h.
With this step, rte_eal.h does not depend on rte_bus.h and rte_dev.h.
Fix existing code that was relying on these implicit inclusions.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-compress-perf/comp_perf_options.h   |  2 ++
 app/test-pmd/config.c                        |  1 +
 app/test-pmd/testpmd.c                       |  1 +
 drivers/compress/zlib/zlib_pmd_ops.c         |  1 +
 drivers/net/failsafe/failsafe_eal.c          |  1 +
 examples/multi_process/hotplug_mp/commands.c |  2 ++
 lib/compressdev/rte_compressdev.c            |  1 +
 lib/compressdev/rte_compressdev_pmd.c        |  1 +
 lib/cryptodev/cryptodev_pmd.c                |  2 ++
 lib/eal/common/eal_thread.h                  |  1 +
 lib/eal/common/hotplug_mp.c                  |  1 +
 lib/eal/include/rte_bus.h                    | 18 ++----------------
 lib/eal/include/rte_eal.h                    | 15 ++++++++++++++-
 lib/eal/include/rte_lcore.h                  |  2 ++
 lib/eal/windows/eal.c                        |  1 +
 lib/ethdev/rte_ethdev.c                      |  1 +
 lib/pcapng/rte_pcapng.c                      |  1 +
 17 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0b777521c5..57dd146330 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -5,6 +5,8 @@
 #ifndef _COMP_PERF_OPS_
 #define _COMP_PERF_OPS_
 
+#include <rte_dev.h>
+
 #define MAX_LIST		32
 #define MIN_COMPRESSED_BUF_SIZE 8
 #define EXPANSE_RATIO 1.1
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index bc73819183..d988429f24 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -24,6 +24,7 @@
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
 #include <rte_launch.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index ee686393c5..510e0be624 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -32,6 +32,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_launch.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_alarm.h>
 #include <rte_per_lcore.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 0a73aed949..7d657d81bc 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_dev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index cb4a2abc02..130344dce2 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,6 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
+#include <rte_bus.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index 41ea265e45..da8b5e5924 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -8,6 +8,8 @@
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
 #include <cmdline.h>
+
+#include <rte_bus.h>
 #include <rte_ethdev.h>
 
 /**********************************************************/
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 5ddbc3f9c0..e997bd01ed 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 7f500d76d4..9bfae077db 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,6 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 1903ade388..75d0075b86 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -3,6 +3,8 @@
  */
 
 #include <sys/queue.h>
+
+#include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/eal/common/eal_thread.h b/lib/eal/common/eal_thread.h
index ca3378d463..e0240ccc60 100644
--- a/lib/eal/common/eal_thread.h
+++ b/lib/eal/common/eal_thread.h
@@ -5,6 +5,7 @@
 #ifndef EAL_THREAD_H
 #define EAL_THREAD_H
 
+#include <rte_common.h>
 #include <rte_lcore.h>
 
 /**
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index bde0de196e..1614a57752 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,6 +3,7 @@
  */
 #include <string.h>
 
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index bbbb6efd28..17edaa37c9 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,27 +20,13 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_log.h>
 #include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_log.h>
 
 /** Double linked list of buses */
 RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
 
-
-/**
- * IOVA mapping mode.
- *
- * IOVA mapping mode is iommu programming mode of a device.
- * That device (for example: IOMMU backed DMA device) based
- * on rte_iova_mode will generate physical or virtual address.
- *
- */
-enum rte_iova_mode {
-	RTE_IOVA_DC = 0,	/* Don't care mode */
-	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
-	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
-};
-
 /**
  * Bus specific scan for devices attached on the bus.
  * For each bus object, the scan would be responsible for finding devices and
diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h
index 5dfc50e987..fd3d7c1da8 100644
--- a/lib/eal/include/rte_eal.h
+++ b/lib/eal/include/rte_eal.h
@@ -17,7 +17,6 @@
 #include <rte_config.h>
 #include <rte_compat.h>
 #include <rte_per_lcore.h>
-#include <rte_bus.h>
 #include <rte_uuid.h>
 
 #include <rte_pci_dev_feature_defs.h>
@@ -458,6 +457,20 @@ static inline int rte_gettid(void)
 __rte_internal
 uint64_t rte_eal_get_baseaddr(void);
 
+/**
+ * IOVA mapping mode.
+ *
+ * IOVA mapping mode is iommu programming mode of a device.
+ * That device (for example: IOMMU backed DMA device) based
+ * on rte_iova_mode will generate physical or virtual address.
+ *
+ */
+enum rte_iova_mode {
+	RTE_IOVA_DC = 0,	/* Don't care mode */
+	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
+	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
+};
+
 /**
  * Get the iova mode
  *
diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h
index b598e1b9ec..4d3978512c 100644
--- a/lib/eal/include/rte_lcore.h
+++ b/lib/eal/include/rte_lcore.h
@@ -11,6 +11,8 @@
  * API for lcore and socket manipulation
  *
  */
+#include <stdio.h>
+
 #include <rte_config.h>
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index 122de2a319..79322d2ce9 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 
 #include <rte_debug.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <eal_memcfg.h>
 #include <rte_errno.h>
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9d6f460726..9e358d187a 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
+#include <rte_bus.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 06ad712bd1..5b079cd14a 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,6 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <rte_bus.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 20/27] bus: introduce accessors
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (18 preceding siblings ...)
  2022-08-26 12:42   ` [PATCH v4 19/27] bus: move IOVA definition from header David Marchand
@ 2022-08-26 12:42   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 21/27] bus: hide bus object David Marchand
                     ` (6 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang,
	Anatoly Burakov, Ray Kinsella

Add helpers to get a rte_bus object details.
This will be used externally.
Internal users may still dereference a rte_bus object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v1:
- changed approach: only external users are updated,

---
 app/test-pmd/config.c                        |  4 +--
 app/test-pmd/testpmd.c                       |  4 +--
 app/test/test_devargs.c                      |  4 +--
 examples/multi_process/hotplug_mp/commands.c |  4 +--
 lib/eal/common/eal_common_bus.c              | 26 ++++++++++++--------
 lib/eal/include/rte_bus.h                    | 14 +++++++++++
 lib/eal/version.map                          |  3 +++
 7 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d988429f24..7bd28ee3e8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -642,7 +642,7 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
+		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
 			if (!dev->driver)
@@ -653,7 +653,7 @@ device_infos_display(const char *identifier)
 				continue;
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
-			printf("Bus name: %s", dev->bus->name);
+			printf("Bus name: %s", rte_bus_name(dev->bus));
 			printf("\nDriver name: %s", dev->driver->name);
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 510e0be624..c7d1fa2719 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3507,9 +3507,9 @@ detach_devargs(char *identifier)
 		}
 	}
 
-	if (rte_eal_hotplug_remove(da.bus->name, da.name) != 0) {
+	if (rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name) != 0) {
 		TESTPMD_LOG(ERR, "Failed to detach device %s(%s)\n",
-			    da.name, da.bus->name);
+			    da.name, rte_bus_name(da.bus));
 		rte_devargs_reset(&da);
 		return;
 	}
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 16621285d2..ac5bc34c18 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -98,9 +98,9 @@ test_valid_devargs_cases(const struct devargs_case *list, size_t n)
 			      list[i].bus_kv) != 0)
 			goto fail;
 		if (list[i].bus != NULL &&
-		    strcmp(da.bus->name, list[i].bus) != 0) {
+		    strcmp(rte_bus_name(da.bus), list[i].bus) != 0) {
 			printf("rte_devargs_parse(%s) bus name (%s) not expected (%s)\n",
-			       list[i].devargs, da.bus->name, list[i].bus);
+			       list[i].devargs, rte_bus_name(da.bus), list[i].bus);
 			goto fail;
 		}
 		if ((list[i].class_kv > 0 || list[i].class != NULL) &&
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index da8b5e5924..88f44e00a0 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -126,7 +126,7 @@ static void cmd_dev_attach_parsed(void *parsed_result,
 		return;
 	}
 
-	if (!rte_eal_hotplug_add(da.bus->name, da.name, da.args))
+	if (!rte_eal_hotplug_add(rte_bus_name(da.bus), da.name, da.args))
 		cmdline_printf(cl, "attached device %s\n", da.name);
 	else
 		cmdline_printf(cl, "failed to attached device %s\n",
@@ -173,7 +173,7 @@ static void cmd_dev_detach_parsed(void *parsed_result,
 	}
 
 	printf("detaching...\n");
-	if (!rte_eal_hotplug_remove(da.bus->name, da.name))
+	if (!rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name))
 		cmdline_printf(cl, "detached device %s\n",
 			da.name);
 	else
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index baa5b532af..cbf382f967 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -16,11 +16,17 @@
 static struct rte_bus_list rte_bus_list =
 	TAILQ_HEAD_INITIALIZER(rte_bus_list);
 
+const char *
+rte_bus_name(const struct rte_bus *bus)
+{
+	return bus->name;
+}
+
 void
 rte_bus_register(struct rte_bus *bus)
 {
 	RTE_VERIFY(bus);
-	RTE_VERIFY(bus->name && strlen(bus->name));
+	RTE_VERIFY(rte_bus_name(bus) && strlen(rte_bus_name(bus)));
 	/* A bus should mandatorily have the scan implemented */
 	RTE_VERIFY(bus->scan);
 	RTE_VERIFY(bus->probe);
@@ -29,14 +35,14 @@ rte_bus_register(struct rte_bus *bus)
 	RTE_VERIFY(!bus->plug || bus->unplug);
 
 	TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", rte_bus_name(bus));
 }
 
 void
 rte_bus_unregister(struct rte_bus *bus)
 {
 	TAILQ_REMOVE(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", rte_bus_name(bus));
 }
 
 /* Scan all the buses for registered devices */
@@ -50,7 +56,7 @@ rte_bus_scan(void)
 		ret = bus->scan();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	return 0;
@@ -64,7 +70,7 @@ rte_bus_probe(void)
 	struct rte_bus *bus, *vbus = NULL;
 
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
-		if (!strcmp(bus->name, "vdev")) {
+		if (!strcmp(rte_bus_name(bus), "vdev")) {
 			vbus = bus;
 			continue;
 		}
@@ -72,14 +78,14 @@ rte_bus_probe(void)
 		ret = bus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				vbus->name);
+				rte_bus_name(vbus));
 	}
 
 	return 0;
@@ -92,7 +98,7 @@ bus_dump_one(FILE *f, struct rte_bus *bus)
 	int ret;
 
 	/* For now, dump only the bus name */
-	ret = fprintf(f, " %s\n", bus->name);
+	ret = fprintf(f, " %s\n", rte_bus_name(bus));
 
 	/* Error in case of inability in writing to stream */
 	if (ret < 0)
@@ -163,7 +169,7 @@ cmp_bus_name(const struct rte_bus *bus, const void *_name)
 {
 	const char *name = _name;
 
-	return strcmp(bus->name, name);
+	return strcmp(rte_bus_name(bus), name);
 }
 
 struct rte_bus *
@@ -213,7 +219,7 @@ rte_bus_get_iommu_class(void)
 
 		bus_iova_mode = bus->get_iommu_class();
 		RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n",
-			bus->name,
+			rte_bus_name(bus),
 			bus_iova_mode == RTE_IOVA_DC ? "DC" :
 			(bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA"));
 		if (bus_iova_mode == RTE_IOVA_PA)
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 17edaa37c9..3848b44db0 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -266,6 +266,20 @@ struct rte_bus {
 
 };
 
+/**
+ * Retrieve a bus name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure.
+ * @return
+ *   A pointer to the bus name string.
+ */
+__rte_experimental
+const char *rte_bus_name(const struct rte_bus *bus);
+
 /**
  * Register a Bus handler.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..aa53064db1 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_bus_name;
 };
 
 INTERNAL {
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 21/27] bus: hide bus object
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (19 preceding siblings ...)
  2022-08-26 12:42   ` [PATCH v4 20/27] bus: introduce accessors David Marchand
@ 2022-08-26 12:42   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 22/27] dev: introduce driver accessors David Marchand
                     ` (5 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Anatoly Burakov,
	Stephen Hemminger, Long Li, Matan Azrad, Viacheslav Ovsiienko,
	Kevin Laatz, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Ferruh Yigit,
	Andrew Rybchenko, Reshma Pattan

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_bus objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

Changes since RFC v1:
- update all existing users of the public header to use the internal one,

---
 app/test/test_devargs.c                  |   2 +-
 app/test/test_vdev.c                     |   2 +-
 doc/guides/rel_notes/deprecation.rst     |   6 -
 doc/guides/rel_notes/release_22_11.rst   |   6 +
 drivers/bus/auxiliary/auxiliary_common.c |   2 +-
 drivers/bus/auxiliary/auxiliary_params.c |   2 +-
 drivers/bus/auxiliary/private.h          |   2 +-
 drivers/bus/dpaa/dpaa_bus.c              |   2 +-
 drivers/bus/fslmc/fslmc_bus.c            |   2 +-
 drivers/bus/fslmc/private.h              |   2 +-
 drivers/bus/ifpga/ifpga_bus.c            |   2 +-
 drivers/bus/pci/linux/pci_vfio.c         |   2 +-
 drivers/bus/pci/pci_common.c             |   2 +-
 drivers/bus/pci/pci_params.c             |   2 +-
 drivers/bus/pci/private.h                |   2 +-
 drivers/bus/vdev/vdev.c                  |   2 +-
 drivers/bus/vmbus/private.h              |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c    |   2 +-
 drivers/dma/idxd/idxd_bus.c              |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c  |   2 +-
 drivers/net/failsafe/failsafe.c          |   2 +-
 drivers/net/failsafe/failsafe_eal.c      |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c         |   2 +-
 drivers/net/netvsc/hn_ethdev.c           |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c    |   2 +-
 drivers/net/virtio/virtio_pci.c          |   2 +-
 drivers/raw/ioat/idxd_bus.c              |   2 +-
 lib/eal/common/eal_common_bus.c          |   2 +-
 lib/eal/common/eal_common_dev.c          |   2 +-
 lib/eal/common/eal_common_devargs.c      |   2 +-
 lib/eal/common/hotplug_mp.c              |   2 +-
 lib/eal/include/bus_driver.h             | 296 +++++++++++++++++++++++
 lib/eal/include/meson.build              |   4 +
 lib/eal/include/rte_bus.h                | 278 +--------------------
 lib/eal/linux/eal_dev.c                  |   2 +-
 lib/eal/version.map                      |   8 +-
 lib/ethdev/rte_ethdev.c                  |   2 +-
 lib/pcapng/rte_pcapng.c                  |   2 +-
 38 files changed, 343 insertions(+), 319 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..0a4c34a1ad 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 3cc3abe70b..c3a8ad64bb 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "test.h"
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 5b4ffc992d..98a00da385 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,12 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* bus: The ``rte_bus`` object will be made opaque in DPDK 22.11.
-  The goal is to remove it from the public ABI and make this object extendable.
-  As a side effect, registering a bus will be marked as an internal API:
-  external users may still register their bus using a new driver header
-  (see ``enable_driver_sdk`` meson option).
-
 * drivers: As a follow-up of the work on the ``rte_bus`` object,
   the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
   their bus-specific counterparts) will be made opaque in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index e08a548285..36df0ccf93 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,6 +88,12 @@ API Changes
   in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
   to update their code.
 
+* bus: Registering a bus has been marked as an internal API.
+  External users may still register their bus using the ``bus_driver.h``
+  driver header (see ``enable_driver_sdk`` meson option).
+  The ``rte_bus`` object is now opaque and must be manipulated through added
+  accessors.
+
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 6cf6c170ec..259ff152c4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -12,7 +12,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 0289777922..a889e392c6 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 3f49f62493..3dee13e1d1 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "bus_auxiliary_driver.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 1ac6aa314f..682427ba2c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -29,7 +29,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index b9b0981329..8503004e3d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 60d68155e1..6f14085d98 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef BUS_FSLMC_PRIVATE_H
 #define BUS_FSLMC_PRIVATE_H
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 27e2de7072..bb943b58b5 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index cd0d0b1670..fab3483d9f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_vfio.h>
 #include <rte_eal.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 0d61d49287..c26aacd364 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_lcore.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 61a868707f..39d702a418 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 4e40a2ed85..fddf49251d 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7d78cf93bc..809a8bb08f 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 3d233fa83c..e33424675c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e82cb881bf..73178ce0f3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 1a86eb3c00..6553166f5c 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 5d4d52c341..32811403b4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..d71b512f81 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,7 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index efb262e368..4f0a6f4d55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 188d92ffac..ccc06bdda6 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 65043a04eb..dc90569df1 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..9cf4d760b4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -9,7 +9,7 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "virtio_pci.h"
 #include "virtio_logs.h"
diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 539f51b1b1..f32d811055 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include "ioat_private.h"
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..62a598957c 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..03e6e59baf 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..5202bd5658 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..d2e615a736
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,296 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_devargs;
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+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);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_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 */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 3848b44db0..dfe756fb11 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,284 +20,21 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-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);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_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 */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * Retrieve a bus name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param bus
  *   A pointer to a rte_bus structure.
  * @return
  *   A pointer to the bus name string.
  */
-__rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -387,17 +124,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..098a2c3076 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -13,7 +13,7 @@
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index aa53064db1..6ec15f1147 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -12,10 +12,9 @@ DPDK_23 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
+	rte_bus_name;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -424,14 +423,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_bus_name;
 };
 
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9e358d187a..0c2c1088c0 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..72aabd4dd0 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 22/27] dev: introduce driver accessors
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (20 preceding siblings ...)
  2022-08-26 12:42   ` [PATCH v4 21/27] bus: hide bus object David Marchand
@ 2022-08-26 12:42   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 23/27] dev: hide driver object David Marchand
                     ` (4 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Ray Kinsella,
	Ferruh Yigit, Andrew Rybchenko

Prepare for making the driver object opaque by adding accessors.
Update existing "external" users.
Internal users may still dereference a rte_driver object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/config.c           |  2 +-
 lib/eal/common/eal_common_dev.c |  6 ++++++
 lib/eal/include/rte_dev.h       | 15 +++++++++++++++
 lib/eal/version.map             |  3 +++
 lib/ethdev/rte_ethdev.h         |  2 +-
 5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7bd28ee3e8..6510f29c76 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,7 +654,7 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
 			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", dev->driver->name);
+			printf("\nDriver name: %s", rte_driver_name(dev->driver));
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
 			printf("\nConnect to socket: %d", dev->numa_node);
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 62a598957c..16c5aef1d8 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -19,6 +19,12 @@
 #include "eal_private.h"
 #include "hotplug_mp.h"
 
+const char *
+rte_driver_name(const struct rte_driver *driver)
+{
+	return driver->name;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 2743c09320..ddea163cca 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -76,6 +76,21 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * Retrieve a driver name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param driver
+ *   A pointer to a driver structure.
+ * @return
+ *   A pointer to the driver name string.
+ */
+__rte_experimental
+const char *
+rte_driver_name(const struct rte_driver *driver);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 6ec15f1147..d10fd89458 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -423,6 +423,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 41d37e41b5..7556b94602 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = dev->device->driver->name
+ * driver_name = rte_driver_name(dev->device->driver)
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 23/27] dev: hide driver object
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (21 preceding siblings ...)
  2022-08-26 12:42   ` [PATCH v4 22/27] dev: introduce driver accessors David Marchand
@ 2022-08-26 12:42   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 24/27] dev: introduce device accessors David Marchand
                     ` (3 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Jay Jayatheerthan, Ajit Khaparde,
	Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Kevin Laatz, Timothy McDaniel, Jerin Jacob,
	Elena Agostini, Ciara Loftus, Qi Zhang, Shepard Siegel, Ed Czeck,
	John Miller, Steven Webster, Matt Peters, Rasesh Mody,
	Shahed Shaikh, Somnath Kotur, Rahul Lakkireddy, Simei Su,
	Wenjun Wu, Marcin Wojtas, Michal Krawczyk, Shai Brandes,
	Evgeny Schemeilin, Igor Chauskin, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Yuying Zhang, Beilei Xing, Jingjing Wu,
	Qiming Yang, Matan Azrad, Viacheslav Ovsiienko, Chaoyong He,
	Niklas Soderlund, Harman Kalra, Devendra Singh Rawat,
	Andrew Rybchenko, Maciej Czekaj, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Ori Kam,
	Akhil Goyal, Chengwen Feng, Ray Kinsella, Ferruh Yigit,
	Abhinandan Gujjar, Olivier Matz, Reshma Pattan

Make rte_driver opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_driver definition.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_driver objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/release_22_11.rst        |  2 ++
 drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
 drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
 drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
 drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
 drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
 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/pci/bus_pci_driver.h              |  2 +-
 drivers/bus/pci/pci_params.c                  |  2 +-
 drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
 drivers/bus/vdev/vdev.c                       |  2 +-
 drivers/bus/vdev/vdev_params.c                |  2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
 drivers/common/qat/qat_qp.c                   |  2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
 drivers/dma/idxd/idxd_bus.c                   |  1 +
 drivers/event/dlb2/dlb2.c                     |  2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
 drivers/event/octeontx/ssovf_evdev.c          |  2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
 drivers/gpu/cuda/cuda.c                       |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
 drivers/net/ark/ark_global.h                  |  2 +-
 drivers/net/avp/avp_ethdev.c                  |  2 +-
 drivers/net/axgbe/axgbe_common.h              |  2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
 drivers/net/cxgbe/base/t4_hw.c                |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                |  2 +-
 drivers/net/cxgbe/sge.c                       |  2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
 drivers/net/e1000/em_ethdev.c                 |  2 +-
 drivers/net/e1000/igb_ethdev.c                |  2 +-
 drivers/net/e1000/igb_flow.c                  |  2 +-
 drivers/net/ena/ena_ethdev.h                  |  2 +-
 drivers/net/enic/enic_ethdev.c                |  2 +-
 drivers/net/enic/enic_vf_representor.c        |  2 +-
 drivers/net/failsafe/failsafe_private.h       |  2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
 drivers/net/i40e/i40e_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_vchnl.c                 |  2 +-
 drivers/net/ice/ice_dcf.c                     |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
 drivers/net/mlx4/mlx4.c                       |  2 +-
 drivers/net/netvsc/hn_ethdev.c                |  2 +-
 drivers/net/netvsc/hn_nvs.c                   |  2 +-
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/netvsc/hn_rxtx.c                  |  2 +-
 drivers/net/nfp/nfp_common.c                  |  2 +-
 drivers/net/nfp/nfp_ethdev.c                  |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
 drivers/net/qede/qede_ethdev.h                |  2 +-
 drivers/net/sfc/sfc_ethdev.c                  |  2 +-
 drivers/net/sfc/sfc_sw_stats.c                |  2 +-
 drivers/net/sfc/sfc_sw_stats.h                |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
 lib/compressdev/rte_compressdev.c             |  2 +-
 lib/compressdev/rte_compressdev_pmd.c         |  2 +-
 lib/compressdev/rte_compressdev_pmd.h         |  1 +
 lib/cryptodev/cryptodev_pmd.c                 |  2 +-
 lib/cryptodev/cryptodev_pmd.h                 |  1 +
 lib/cryptodev/rte_cryptodev.c                 |  2 +-
 lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
 lib/eal/common/eal_common_dev.c               |  2 +-
 lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
 lib/eal/include/meson.build                   |  1 +
 lib/eal/include/rte_dev.h                     | 15 ++--------
 lib/eal/version.map                           |  4 +--
 lib/ethdev/ethdev_driver.h                    |  1 +
 lib/eventdev/eventdev_pmd.h                   |  2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
 lib/eventdev/rte_eventdev.c                   |  2 +-
 lib/gpudev/gpudev_driver.h                    |  2 +-
 lib/mempool/rte_mempool_ops.c                 |  2 +-
 lib/pcapng/rte_pcapng.c                       |  2 +-
 lib/rawdev/rte_rawdev.c                       |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
 lib/security/rte_security.c                   |  2 +-
 115 files changed, 144 insertions(+), 122 deletions(-)
 create mode 100644 lib/eal/include/dev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 36df0ccf93..4e20345b7a 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,6 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` 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).
+  The ``rte_driver`` object is now opaque and must be manipulated through added
+  accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 801e8920df..e2d9409185 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_byteorder.h>
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index c1d877c87f..51dd090c1b 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index f16814e241..036579e3ec 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a889e392c6..e4c7ee0c3b 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <bus_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1c2d2c04af..58fb7c7f69 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -25,7 +25,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index cf66fc0c53..26a83b2cdf 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -7,7 +7,7 @@
 #define BUS_DPAA_DRIVER_H
 
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 798ddebf3a..7ac5fe6ff1 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -29,7 +29,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8604e43947..5966776a85 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -28,7 +28,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index cfe4280f87..d7f6e45b7d 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -18,7 +18,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_pool_ops.h>
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index b7d81b518c..07256ed7ec 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <fslmc_logs.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 071b0d297d..4aec7b2cd8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -30,7 +30,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index 223e34bcba..65e2d799c3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "private.h"
 #include <fslmc_logs.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b5c7dee617..0f2f9b5101 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_compat.h>
 
 /** Pathname of PCI devices directory. */
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 39d702a418..d24cc201b8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -6,7 +6,7 @@
 
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 36748cdfae..bc7e30d7c6 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 
 #include <rte_bus_vdev.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 809a8bb08f..b176b658fc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 2c72614776..2d10a1e8ad 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index 3424e791c9..e2475a642d 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_bus_vmbus.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 struct vmbus_channel;
 struct vmbus_mon_page;
diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
index 7ffde5f4c8..85d6ddfcf4 100644
--- a/drivers/common/qat/dev/qat_dev_gen4.c
+++ b/drivers/common/qat/dev/qat_dev_gen4.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "qat_device.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 5916e745e2..9cbd19a481 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 7d657d81bc..445a3baa67 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
index 61d457f4e0..d1ede5e990 100644
--- a/drivers/crypto/bcmfs/bcmfs_qp.c
+++ b/drivers/crypto/bcmfs/bcmfs_qp.c
@@ -8,7 +8,7 @@
 #include <rte_atomic.h>
 #include <rte_bitmap.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_prefetch.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
index bc7fb67218..78272d616c 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
@@ -4,7 +4,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 6c3e45e333..013f3be1e6 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 
 #include "ccp_crypto.h"
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 3fd9f3c426..db11ac7444 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn10k_cryptodev.h"
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index bd425f95ff..4cfc1f2150 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn9k_cryptodev.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0cce861899..3b13578de0 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_common.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7e554cb2b1..c6bd785262 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -19,7 +19,7 @@
 #include <rte_security_driver.h>
 #endif
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 83ae6b6be9..11b559e025 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -5,7 +5,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index e30dcfc281..9b7b16c6e3 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -9,6 +9,7 @@
 #include <libgen.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 5a443acff8..759578378f 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -17,7 +17,7 @@
 #include <rte_config.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 9f8c6cd8b8..71ac141b66 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -15,7 +15,7 @@
 
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
 #include <rte_ring.h>
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index aa403f9e06..8e470584ea 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 08df6e223a..1001297cda 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <bus_fslmc_driver.h>
 #include <rte_lcore.h>
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 3882a9cf1d..a68d3ac154 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index fe157c59d5..99fa326ad5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <ethdev_driver.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 6bd8fec6d4..8513b9a013 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -12,7 +12,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 2be7b8d2df..a552aabeb8 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -8,7 +8,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <gpudev_driver.h>
 
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 56c629c681..84371d5d1a 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -20,7 +20,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include "rte_dpaa2_mempool.h"
 
 #include "fslmc_vfio.h"
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fd7be47311..9957de2314 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -24,7 +24,7 @@
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 748db590c1..71d0b53e03 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_version.h>
 
 #include "ark_pktdir.h"
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7c0cb666fb..b2a08f5635 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_cycles.h>
 #include <rte_spinlock.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index b9ebf64fb8..a5d11c5832 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -33,7 +33,7 @@
 #include <rte_memzone.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_pci.h>
 #include <rte_common.h>
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f36ad30e17..4448cf2de2 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -9,7 +9,7 @@
 #include "bnx2x_rxtx.h"
 
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53f..1460dce2ab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef04c..fd1506ddd4 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -7,7 +7,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 384080e6d3..bed755f5d9 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -18,7 +18,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_byteorder.h>
 
 #include "common.h"
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index fd71a50a58..45bbeaef0c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -31,7 +31,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "cxgbe.h"
 #include "cxgbe_pfvf.h"
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3c02c98b3d..f8dd833032 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -31,7 +31,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "base/common.h"
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5d91355c9a..5b13cb5c94 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -30,7 +30,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 9509f6e8a3..4d33b51fea 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <dpaa2_pmd_logs.h>
 #include <dpaa2_hw_pvt.h>
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index f876f4790c..37a8b43114 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 #include "rte_dpaa2_mempool.h"
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 932570c6e0..fbfdf360d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -14,7 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7b9c528d13..9436a95ac8 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hexdump.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
index ba0d500f74..63463c4fbf 100644
--- a/drivers/net/dpaa2/dpaa2_sparser.c
+++ b/drivers/net/dpaa2/dpaa2_sparser.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <fslmc_vfio.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 409de50083..8ee9be12ad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 43979992d3..d6bcc5bf58 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index e46697b6a1..b775310651 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -21,7 +21,7 @@
 #include <rte_eal.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 4709675af8..4d27fba585 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -14,7 +14,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_timer.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 
 #include "ena_com.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 998436e5e8..cdf0915591 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 7312c411bd..46f85964e9 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -7,7 +7,7 @@
 
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index a80f5e2caf..53a451c1b1 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -11,7 +11,7 @@
 #include <pthread.h>
 
 #include <rte_atomic.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_devargs.h>
 #include <rte_flow.h>
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8bbd8b445d..7adb20bff9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_spinlock.h>
 #include <rte_kvargs.h>
 #include <rte_vect.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bdc453ec1..67111ac251 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -23,7 +23,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_alarm.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_hash_crc.h>
 #include <rte_bitmap.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..ef2ab06475 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,7 +24,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 21bd1e2193..15f695682d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,7 +19,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..1c3d22ae0f 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -21,7 +21,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "ice_dcf.h"
 #include "ice_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 0da267db1f..dee712af98 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -18,7 +18,7 @@
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <iavf_devids.h>
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 552e41692c..04c9ce78a2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..67373a7b78 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -27,7 +27,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 910b76a92c..7e7e1824ef 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ccc06bdda6..d0bbc0a4c0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -30,7 +30,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 817fb06dfb..7db82af9f3 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -28,7 +28,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 20f75a17b0..e6f1f28768 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -26,7 +26,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 61cf374224..bc6f60c64a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -25,7 +25,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 #include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c792..eaafe11fb9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -19,7 +19,7 @@
 #include <rte_debug.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e588..47359501bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_common.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9ada22e2ff..0eee191566 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -15,7 +15,7 @@
 #include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index a38b701183..b781bcdcfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -13,7 +13,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ip.h>
 
 /* ecore includes */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 506c62a726..2ec743ebce 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -7,7 +7,7 @@
  * for Solarflare) and Solarflare Communications, Inc.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 81f5aa3cc4..3ae5023b6f 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2021 Xilinx, Inc.
  */
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_bitmap.h>
 
 #include "sfc.h"
diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
index 1abded8018..d9738e5214 100644
--- a/drivers/net/sfc/sfc_sw_stats.h
+++ b/drivers/net/sfc/sfc_sw_stats.h
@@ -5,7 +5,7 @@
 #ifndef _SFC_SW_STATS_H
 #define _SFC_SW_STATS_H
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "sfc.h"
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 28183ec740..9f57cb1a20 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index dc90569df1..c3e045d892 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -27,7 +27,7 @@
 #include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d180162abd..edf3becd32 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -24,7 +24,7 @@
 #include <rte_memory.h>
 #include <rte_eal_paging.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 2b9e35cef5..abc63b0935 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -16,7 +16,7 @@
 
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "virtio.h"
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 101b1cb500..fd946dec5c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/vmxnet3_defs.h"
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index db029cbf34..909fb8faab 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -3,7 +3,7 @@
  */
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 6831cc8d20..5dd5bbb652 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index fc257c5f44..8ef7a6b127 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_rawdev.h>
 #include <bus_vdev_driver.h>
 #include <rte_test.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 6ab62a12fc..92cf5f495e 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -11,7 +11,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_glue.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index e997bd01ed..cf2c20a704 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 9bfae077db..41f1415bea 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
index 9fabc399c5..72e52f876f 100644
--- a/lib/compressdev/rte_compressdev_pmd.h
+++ b/lib/compressdev/rte_compressdev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 
 #include "rte_compressdev.h"
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 75d0075b86..f07b92dfd7 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..96d7e225b0 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 6250302f3b..29c9c55131 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -13,7 +13,7 @@
 
 #include <rte_log.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index 82ab7a8cc7..acd7f71cd1 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -14,7 +14,7 @@
  * by any application.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_dmadev.h"
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 16c5aef1d8..98f3c78795 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -9,7 +9,7 @@
 
 #include <bus_driver.h>
 #include <rte_class.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_errno.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
new file mode 100644
index 0000000000..015188abd5
--- /dev/null
+++ b/lib/eal/include/dev_driver.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef DEV_DRIVER_H
+#define DEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include <rte_dev.h>
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+	const char *name;                   /**< Driver name. */
+	const char *alias;              /**< Driver alias. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEV_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index 77d8621a51..cfcd40aaed 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -57,6 +57,7 @@ headers += files(
 
 driver_sdk_headers = files(
         'bus_driver.h',
+        'dev_driver.h',
 )
 
 # special case install the generic headers, since they go in a subdir
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ddea163cca..7214f5d7fb 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,8 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_driver;
+
 /**
  * The device event type.
  */
@@ -67,27 +69,14 @@ struct rte_mem_resource {
 	void *addr;         /**< Virtual address, NULL when not mapped. */
 };
 
-/**
- * A structure describing a device driver.
- */
-struct rte_driver {
-	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
-	const char *name;                   /**< Driver name. */
-	const char *alias;              /**< Driver alias. */
-};
-
 /**
  * Retrieve a driver name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param driver
  *   A pointer to a driver structure.
  * @return
  *   A pointer to the driver name string.
  */
-__rte_experimental
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index d10fd89458..8b53a1d258 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -37,6 +37,7 @@ DPDK_23 {
 	rte_devargs_parsef;
 	rte_devargs_remove;
 	rte_devargs_type_count;
+	rte_driver_name;
 	rte_dump_physmem_layout;
 	rte_dump_stack;
 	rte_dump_tailq;
@@ -423,9 +424,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..47a55a419e 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -19,6 +19,7 @@ extern "C" {
  *
  */
 
+#include <dev_driver.h>
 #include <rte_ethdev.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..def6cd0876 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 4938b4ee07..a8ef5bac06 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 8e81cf774d..29515401bd 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -9,7 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_log.h>
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 79b905e9fc..bbb027aa0c 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 0e55b00bfe..23972b3dbd 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_gpudev.h"
 
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index ac32c4bb72..3b43edc548 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -9,7 +9,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_mempool_trace.h"
 
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 72aabd4dd0..af2b814251 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -14,7 +14,7 @@
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index e157d65332..569e836560 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_telemetry.h>
diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 3b7be57d3e..a51944c8ff 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -19,7 +19,7 @@ extern "C" {
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 1a2a408f0e..94160f4177 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -5,7 +5,7 @@
  */
 
 #include <rte_cryptodev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_telemetry.h>
 #include "rte_security.h"
 #include "rte_security_driver.h"
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 24/27] dev: introduce device accessors
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (22 preceding siblings ...)
  2022-08-26 12:42   ` [PATCH v4 23/27] dev: hide driver object David Marchand
@ 2022-08-26 12:42   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 25/27] dev: provide bus specific information David Marchand
                     ` (2 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Maryam Tahhan, Reshma Pattan,
	Aman Singh, Yuying Zhang, Maxime Coquelin, Chenbo Xia,
	Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

Prepare for making the device object opaque by adding accessors.
Update existing "external" users.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- added rte_dev_devargs,
- updated testpmd,

---
 app/proc-info/main.c               |  6 +--
 app/test-pmd/config.c              | 18 +++----
 app/test-pmd/testpmd.c             |  6 +--
 examples/ethtool/lib/rte_ethtool.c |  2 +-
 examples/l3fwd/l3fwd_em.c          |  4 +-
 examples/l3fwd/l3fwd_fib.c         |  8 +--
 examples/l3fwd/l3fwd_lpm.c         |  4 +-
 examples/vdpa/main.c               | 16 +++---
 lib/eal/common/eal_common_dev.c    | 30 ++++++++++++
 lib/eal/include/rte_dev.h          | 78 ++++++++++++++++++++++++++++++
 lib/eal/version.map                |  7 +++
 lib/ethdev/rte_ethdev.h            |  2 +-
 12 files changed, 148 insertions(+), 33 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 1bfba5f60d..d52ac8a038 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -755,7 +755,7 @@ show_port(void)
 		}
 
 		printf("\t  -- driver %s device %s socket %d\n",
-		       dev_info.driver_name, dev_info.device->name,
+		       dev_info.driver_name, rte_dev_name(dev_info.device),
 		       rte_eth_dev_socket_id(i));
 
 		ret = rte_eth_dev_owner_get(i, &owner);
@@ -1254,7 +1254,7 @@ show_crypto(void)
 		       rte_cryptodev_name_get(i),
 		       dev_info.driver_name,
 		       dev_info.driver_id,
-		       dev_info.device->numa_node,
+		       rte_dev_numa_node(dev_info.device),
 		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
@@ -1466,7 +1466,7 @@ dump_regs(char *file_prefix)
 			else
 				printf("Device (%s) regs dumped successfully, "
 					"driver:%s version:0X%08X\n",
-					dev_info.device->name,
+					rte_dev_name(dev_info.device),
 					dev_info.driver_name, reg_info.version);
 
 			fclose(fp_regs);
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 6510f29c76..de74690f06 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -645,19 +645,19 @@ device_infos_display(const char *identifier)
 		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
-			if (!dev->driver)
+			if (rte_dev_driver(dev) == NULL)
 				continue;
 			/* Check for matching device if identifier is present */
 			if (identifier &&
-			    strncmp(da.name, dev->name, strlen(dev->name)))
+			    strncmp(da.name, rte_dev_name(dev), strlen(rte_dev_name(dev))))
 				continue;
 			printf("\n%s Infos for device %s %s\n",
-			       info_border, dev->name, info_border);
-			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", rte_driver_name(dev->driver));
+			       info_border, rte_dev_name(dev), info_border);
+			printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev)));
+			printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev)));
 			printf("\nDevargs: %s",
-			       dev->devargs ? dev->devargs->args : "");
-			printf("\nConnect to socket: %d", dev->numa_node);
+			       rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : "");
+			printf("\nConnect to socket: %d", rte_dev_numa_node(dev));
 			printf("\n");
 
 			/* List ports with matching device name */
@@ -802,8 +802,8 @@ port_infos_display(portid_t port_id)
 	else
 		printf("\nFirmware-version: %s", "not available");
 
-	if (dev_info.device->devargs && dev_info.device->devargs->args)
-		printf("\nDevargs: %s", dev_info.device->devargs->args);
+	if (rte_dev_devargs(dev_info.device) && rte_dev_devargs(dev_info.device)->args)
+		printf("\nDevargs: %s", rte_dev_devargs(dev_info.device)->args);
 	printf("\nConnect to socket: %u", port->socket_id);
 
 	if (port_numa[port_id] != NUMA_NO_CONFIG) {
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c7d1fa2719..a399193e53 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1057,7 +1057,7 @@ dma_unmap_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
 			TESTPMD_LOG(DEBUG,
 				    "unable to DMA unmap addr 0x%p "
 				    "for device %s\n",
-				    memhdr->addr, dev_info.device->name);
+				    memhdr->addr, rte_dev_name(dev_info.device));
 		}
 	}
 	ret = rte_extmem_unregister(memhdr->addr, memhdr->len);
@@ -1098,7 +1098,7 @@ dma_map_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
 			TESTPMD_LOG(DEBUG,
 				    "unable to DMA map addr 0x%p "
 				    "for device %s\n",
-				    memhdr->addr, dev_info.device->name);
+				    memhdr->addr, rte_dev_name(dev_info.device));
 		}
 	}
 }
@@ -3441,7 +3441,7 @@ detach_device(struct rte_device *dev)
 	}
 
 	if (rte_dev_remove(dev) < 0) {
-		TESTPMD_LOG(ERR, "Failed to detach device %s\n", dev->name);
+		TESTPMD_LOG(ERR, "Failed to detach device %s\n", rte_dev_name(dev));
 		return;
 	}
 	remove_invalid_ports();
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 88dc917b73..33acc5e3cc 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -49,7 +49,7 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	strlcpy(drvinfo->bus_info, dev_info.device->name,
+	strlcpy(drvinfo->bus_info, rte_dev_name(dev_info.device),
 		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index 10be24c61d..0531282a1f 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -403,7 +403,7 @@ populate_ipv4_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v4[i].v4_key.port_dst,
 			   em_route_base_v4[i].v4_key.port_src,
 			   em_route_base_v4[i].v4_key.proto,
-		       em_route_base_v4[i].if_out, dev_info.device->name);
+		       em_route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 " keys\n",
 		(uint64_t)route_num_v4);
@@ -455,7 +455,7 @@ populate_ipv6_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v6[i].v6_key.port_dst,
 			   em_route_base_v6[i].v6_key.port_src,
 			   em_route_base_v6[i].v6_key.proto,
-		       em_route_base_v6[i].if_out, dev_info.device->name);
+		       em_route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 "keys\n",
 		(uint64_t)route_num_v6);
diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index e02e4b3f5a..b82e0c0354 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -640,11 +640,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v4[i].depth,
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv4 route added to port %d [%s]\n",
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 	/* >8 End of setup fib. */
@@ -695,11 +695,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v6[i].depth,
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv6 route added to port %d [%s]\n",
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 }
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index d1b850dd5b..22d7f61a42 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -598,7 +598,7 @@ setup_lpm(const int socketid)
 		printf("LPM: Adding route %s / %d (%d) [%s]\n",
 		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 		       route_base_v4[i].depth,
-		       route_base_v4[i].if_out, dev_info.device->name);
+		       route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 
 	/* create the LPM6 table */
@@ -642,7 +642,7 @@ setup_lpm(const int socketid)
 		       inet_ntop(AF_INET6, route_base_v6[i].ip_8, abuf,
 				 sizeof(abuf)),
 		       route_base_v6[i].depth,
-		       route_base_v6[i].if_out, dev_info.device->name);
+		       route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 }
 
diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 7e11ef4e26..ee240dd15a 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -119,7 +119,7 @@ new_device(int vid)
 				"Failed to get generic device for port %d\n", i);
 			continue;
 		}
-		printf("\nnew port %s, device : %s\n", ifname, dev->name);
+		printf("\nnew port %s, device : %s\n", ifname, rte_dev_name(dev));
 		vports[i].vid = vid;
 		break;
 	}
@@ -149,7 +149,7 @@ destroy_device(int vid)
 			continue;
 		}
 
-		printf("\ndestroy port %s, device: %s\n", ifname, dev->name);
+		printf("\ndestroy port %s, device: %s\n", ifname, rte_dev_name(dev));
 		break;
 	}
 }
@@ -353,23 +353,23 @@ static void cmd_list_vdpa_devices_parsed(
 
 	cmdline_printf(cl, "device name\tqueue num\tsupported features\n");
 	RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-		vdev = rte_vdpa_find_device_by_name(dev->name);
+		vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 		if (!vdev)
 			continue;
 		if (rte_vdpa_get_queue_num(vdev, &queue_num) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa queue number "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		if (rte_vdpa_get_features(vdev, &features) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa features "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		cmdline_printf(cl, "%s\t\t%" PRIu32 "\t\t0x%" PRIx64 "\n",
-			dev->name, queue_num, features);
+			rte_dev_name(dev), queue_num, features);
 	}
 }
 
@@ -606,10 +606,10 @@ main(int argc, char *argv[])
 		cmdline_stdin_exit(cl);
 	} else {
 		RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-			vdev = rte_vdpa_find_device_by_name(dev->name);
+			vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 			if (vdev == NULL) {
 				rte_panic("Failed to find vDPA dev for %s\n",
-						dev->name);
+						rte_dev_name(dev));
 			}
 			vports[devcnt].dev = vdev;
 			snprintf(vports[devcnt].ifname, MAX_PATH_LEN, "%s%d",
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 98f3c78795..7b12d6e531 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -25,6 +25,36 @@ rte_driver_name(const struct rte_driver *driver)
 	return driver->name;
 }
 
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev)
+{
+	return dev->bus;
+}
+
+const struct rte_devargs *
+rte_dev_devargs(const struct rte_device *dev)
+{
+	return dev->devargs;
+}
+
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev)
+{
+	return dev->driver;
+}
+
+const char *
+rte_dev_name(const struct rte_device *dev)
+{
+	return dev->name;
+}
+
+int
+rte_dev_numa_node(const struct rte_device *dev)
+{
+	return dev->numa_node;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 7214f5d7fb..ce97ee1086 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,9 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_bus;
+struct rte_devargs;
+struct rte_device;
 struct rte_driver;
 
 /**
@@ -80,6 +83,81 @@ struct rte_mem_resource {
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
+/**
+ * Retrieve a device bus.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device bus.
+ */
+__rte_experimental
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev);
+
+/**
+ * Retrieve a device arguments.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device devargs.
+ */
+__rte_experimental
+const struct rte_devargs *
+rte_dev_devargs(const struct rte_device *dev);
+
+/**
+ * Retrieve a device driver.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device driver.
+ */
+__rte_experimental
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev);
+
+/**
+ * Retrieve a device name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device name.
+ */
+__rte_experimental
+const char *
+rte_dev_name(const struct rte_device *dev);
+
+/**
+ * Retrieve a device numa node.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device numa node.
+ */
+__rte_experimental
+int
+rte_dev_numa_node(const struct rte_device *dev);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 8b53a1d258..719789b8d1 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_dev_bus;
+	rte_dev_devargs;
+	rte_dev_driver;
+	rte_dev_name;
+	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 7556b94602..2e783536c1 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = rte_driver_name(dev->device->driver)
+ * driver_name = rte_driver_name(rte_dev_driver(dev->device));
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 25/27] dev: provide bus specific information
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (23 preceding siblings ...)
  2022-08-26 12:42   ` [PATCH v4 24/27] dev: introduce device accessors David Marchand
@ 2022-08-26 12:42   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 26/27] bus/pci: fill " David Marchand
  2022-08-26 12:42   ` [PATCH v4 27/27] dev: hide device object David Marchand
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Ray Kinsella

For diagnostic, it may be useful to provide a description of the device
with bus specific information.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v3:
- split patch in two, as per Thomas offlist request,

---
 app/test-pmd/config.c           |  2 ++
 lib/eal/common/eal_common_dev.c |  6 ++++++
 lib/eal/include/rte_dev.h       | 16 ++++++++++++++++
 lib/eal/version.map             |  1 +
 4 files changed, 25 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index de74690f06..c5e5a66fa4 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,6 +654,8 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, rte_dev_name(dev), info_border);
 			printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev)));
+			printf("\nBus information: %s",
+				rte_dev_bus_info(dev) ? rte_dev_bus_info(dev) : "");
 			printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev)));
 			printf("\nDevargs: %s",
 			       rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : "");
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 7b12d6e531..a190bd37af 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -31,6 +31,12 @@ rte_dev_bus(const struct rte_device *dev)
 	return dev->bus;
 }
 
+const char *
+rte_dev_bus_info(const struct rte_device *dev)
+{
+	return dev->bus_info;
+}
+
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev)
 {
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ce97ee1086..f010dd6441 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -98,6 +98,21 @@ __rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
+/**
+ * Retrieve bus specific information for a device.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A string describing this device or NULL if none is available.
+ */
+__rte_experimental
+const char *
+rte_dev_bus_info(const struct rte_device *dev);
+
 /**
  * Retrieve a device arguments.
  *
@@ -170,6 +185,7 @@ rte_dev_numa_node(const struct rte_device *dev);
 struct rte_device {
 	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
 	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
 	const struct rte_driver *driver; /**< Driver assigned after probing */
 	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
 	int numa_node;                /**< NUMA node connection */
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 719789b8d1..0cf321605e 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -427,6 +427,7 @@ EXPERIMENTAL {
 
 	# added in 22.11
 	rte_dev_bus;
+	rte_dev_bus_info;
 	rte_dev_devargs;
 	rte_dev_driver;
 	rte_dev_name;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 26/27] bus/pci: fill bus specific information
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (24 preceding siblings ...)
  2022-08-26 12:42   ` [PATCH v4 25/27] dev: provide bus specific information David Marchand
@ 2022-08-26 12:42   ` David Marchand
  2022-08-26 12:42   ` [PATCH v4 27/27] dev: hide device object David Marchand
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

For diagnostic, it may be useful to provide the PCI vendor and device
id.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/bus/pci/bsd/pci.c        |  8 ++++----
 drivers/bus/pci/bus_pci_driver.h |  1 +
 drivers/bus/pci/linux/pci.c      | 24 ++++++++++++------------
 drivers/bus/pci/pci_common.c     | 17 +++++++++++++++--
 drivers/bus/pci/private.h        | 10 ++++++++--
 drivers/bus/pci/windows/pci.c    |  6 +++---
 6 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index bc560a2a56..844d145fed 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -248,7 +248,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	/* FreeBSD has no NUMA support (yet) */
 	dev->device.numa_node = 0;
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	/* FreeBSD has only one pass through driver */
 	dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
@@ -299,11 +299,11 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 			} else { /* already registered */
 				dev2->kdrv = dev->kdrv;
 				dev2->max_vfs = dev->max_vfs;
-				pci_name_set(dev2);
+				pci_common_set(dev2);
 				memmove(dev2->mem_resource,
 					dev->mem_resource,
 					sizeof(dev->mem_resource));
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
@@ -313,7 +313,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	return 0;
 
 skipdev:
-	free(dev);
+	pci_free(dev);
 	return 0;
 }
 
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index 0f2f9b5101..be32263a82 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -43,6 +43,7 @@ struct rte_pci_device {
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
 	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	char *bus_info;                     /**< PCI bus specific info */
 	struct rte_intr_handle *vfio_req_intr_handle;
 				/**< Handler of VFIO request interrupt */
 };
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index fa5d5e131d..c8703d52f3 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -226,7 +226,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* get vendor id */
 	snprintf(filename, sizeof(filename), "%s/vendor", dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.vendor_id = (uint16_t)tmp;
@@ -234,7 +234,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* get device id */
 	snprintf(filename, sizeof(filename), "%s/device", dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.device_id = (uint16_t)tmp;
@@ -243,7 +243,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/subsystem_vendor",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.subsystem_vendor_id = (uint16_t)tmp;
@@ -252,7 +252,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/subsystem_device",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.subsystem_device_id = (uint16_t)tmp;
@@ -261,7 +261,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/class",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	/* the least 24 bits are valid: class, subclass, program interface */
@@ -295,13 +295,13 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		dev->device.numa_node = 0;
 	}
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	/* parse resources */
 	snprintf(filename, sizeof(filename), "%s/resource", dirname);
 	if (pci_parse_sysfs_resource(filename, dev) < 0) {
 		RTE_LOG(ERR, EAL, "%s(): cannot parse resource\n", __func__);
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 
@@ -310,7 +310,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	ret = pci_get_kernel_driver_by_path(filename, driver, sizeof(driver));
 	if (ret < 0) {
 		RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 
@@ -324,7 +324,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		else
 			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
-		free(dev);
+		pci_free(dev);
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
@@ -346,7 +346,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 					dev2->kdrv = dev->kdrv;
 					dev2->max_vfs = dev->max_vfs;
 					dev2->id = dev->id;
-					pci_name_set(dev2);
+					pci_common_set(dev2);
 					memmove(dev2->mem_resource,
 						dev->mem_resource,
 						sizeof(dev->mem_resource));
@@ -376,10 +376,10 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 					else if (dev2->device.devargs !=
 						 dev->device.devargs) {
 						rte_devargs_remove(dev2->device.devargs);
-						pci_name_set(dev2);
+						pci_common_set(dev2);
 					}
 				}
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index c26aacd364..0f344d46aa 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -59,7 +59,7 @@ pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
 }
 
 void
-pci_name_set(struct rte_pci_device *dev)
+pci_common_set(struct rte_pci_device *dev)
 {
 	struct rte_devargs *devargs;
 
@@ -80,6 +80,19 @@ pci_name_set(struct rte_pci_device *dev)
 	else
 		/* Otherwise, it uses the internal, canonical form. */
 		dev->device.name = dev->name;
+
+	if (asprintf(&dev->bus_info, "vendor_id=%"PRIx16", device_id=%"PRIx16,
+			dev->id.vendor_id, dev->id.device_id) != -1)
+		dev->device.bus_info = dev->bus_info;
+}
+
+void
+pci_free(struct rte_pci_device *dev)
+{
+	if (dev == NULL)
+		return;
+	free(dev->bus_info);
+	free(dev);
 }
 
 /* map a particular resource from a file */
@@ -604,7 +617,7 @@ pci_unplug(struct rte_device *dev)
 	if (ret == 0) {
 		rte_pci_remove_device(pdev);
 		rte_devargs_remove(dev->devargs);
-		free(pdev);
+		pci_free(pdev);
 	}
 	return ret;
 }
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index fddf49251d..c8161a1074 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -44,10 +44,16 @@ struct rte_pci_device;
 int rte_pci_scan(void);
 
 /**
- * Find the name of a PCI device.
+ * Set common internal information for a PCI device.
  */
 void
-pci_name_set(struct rte_pci_device *dev);
+pci_common_set(struct rte_pci_device *dev);
+
+/**
+ * Free a PCI device.
+ */
+void
+pci_free(struct rte_pci_device *dev);
 
 /**
  * Validate whether a device with given PCI address should be ignored or not.
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index f013b743b3..3f7a8b9432 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -382,7 +382,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 	dev->id = pci_id;
 	dev->max_vfs = 0; /* TODO: get max_vfs */
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	set_kernel_driver_type(device_info_data, dev);
 
@@ -410,7 +410,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 				dev2->max_vfs = dev->max_vfs;
 				memmove(dev2->mem_resource, dev->mem_resource,
 					sizeof(dev->mem_resource));
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
@@ -419,7 +419,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 
 	return 0;
 end:
-	free(dev);
+	pci_free(dev);
 	return ret;
 }
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v4 27/27] dev: hide device object
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
                     ` (25 preceding siblings ...)
  2022-08-26 12:42   ` [PATCH v4 26/27] bus/pci: fill " David Marchand
@ 2022-08-26 12:42   ` David Marchand
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-26 12:42 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Ray Kinsella, Maxime Coquelin, Chenbo Xia

Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Some applications may have been dereferencing rte_device objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/deprecation.rst   |  7 -----
 doc/guides/rel_notes/release_22_11.rst |  4 +--
 lib/eal/common/eal_private.h           |  2 +-
 lib/eal/include/dev_driver.h           | 13 +++++++++
 lib/eal/include/rte_dev.h              | 37 --------------------------
 lib/eal/version.map                    | 14 +++++-----
 lib/vhost/vdpa.c                       |  1 +
 7 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 98a00da385..64668500c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,13 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* drivers: As a follow-up of the work on the ``rte_bus`` object,
-  the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
-  their bus-specific counterparts) will be made opaque in DPDK 22.11.
-  Registering a driver on a bus will be marked as an internal API:
-  external users may still register their drivers using the bus-specific
-  driver header (see ``enable_driver_sdk`` meson option).
-
 * bus: The ``dev->device.numa_node`` field is set by each bus driver for
   every device it manages to indicate on which NUMA node this device lies.
   When this information is unknown, the assigned value is not consistent
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4e20345b7a..43502349bd 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,8 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` 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).
-  The ``rte_driver`` object is now opaque and must be manipulated through added
-  accessors.
+  The ``rte_driver`` and ``rte_device`` objects are now opaque and must be
+  manipulated through added accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..5efa8c437e 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -21,6 +21,19 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index f010dd6441..dc1acc8953 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -86,90 +86,66 @@ rte_driver_name(const struct rte_driver *driver);
 /**
  * Retrieve a device bus.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device bus.
  */
-__rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
 /**
  * Retrieve bus specific information for a device.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A string describing this device or NULL if none is available.
  */
-__rte_experimental
 const char *
 rte_dev_bus_info(const struct rte_device *dev);
 
 /**
  * Retrieve a device arguments.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device devargs.
  */
-__rte_experimental
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev);
 
 /**
  * Retrieve a device driver.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device driver.
  */
-__rte_experimental
 const struct rte_driver *
 rte_dev_driver(const struct rte_device *dev);
 
 /**
  * Retrieve a device name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device name.
  */
-__rte_experimental
 const char *
 rte_dev_name(const struct rte_device *dev);
 
 /**
  * Retrieve a device numa node.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device numa node.
  */
-__rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
@@ -179,19 +155,6 @@ rte_dev_numa_node(const struct rte_device *dev);
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const char *bus_info;         /**< Device bus specific information */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 0cf321605e..3c14cf2724 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -26,7 +26,13 @@ DPDK_23 {
 	rte_delay_us_block;
 	rte_delay_us_callback_register;
 	rte_delay_us_sleep;
+	rte_dev_bus;
+	rte_dev_bus_info;
+	rte_dev_devargs;
+	rte_dev_driver;
 	rte_dev_is_probed;
+	rte_dev_name;
+	rte_dev_numa_node;
 	rte_dev_probe;
 	rte_dev_remove;
 	rte_devargs_add;
@@ -424,14 +430,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_dev_bus;
-	rte_dev_bus_info;
-	rte_dev_devargs;
-	rte_dev_driver;
-	rte_dev_name;
-	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index a6ca785b29..bb828577cb 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [PATCH v4 17/27] bus/vdev: make driver-only headers private
  2022-08-26 12:41   ` [PATCH v4 17/27] bus/vdev: " David Marchand
@ 2022-08-29  7:17     ` Ruifeng Wang
  2022-08-29  8:12       ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Ruifeng Wang @ 2022-08-29  7:17 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, bruce.richardson, Rosen Xu, Gagandeep Singh,
	hemant.agrawal, Nicolas Chautru, Ray Kinsella, Lee Daly,
	Fan Zhang, Ashish Gupta, Sunila Sahu,
	Ajit Khaparde (ajit.khaparde@broadcom.com),
	Raveendra Padasalagi, Vikas Gupta, Chandubabu Namburu,
	Pablo de Lara, Michael Shamis, Liron Himi, Chengwen Feng,
	Kevin Laatz, Sachin Saxena, jerinj, Liang Ma, Peter Mccarthy,
	Harry van Haaren, John W. Linville, Ciara Loftus, Qi Zhang,
	Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Jakub Grajciar, Zyta Szpak, Tetsuya Mukawa,
	Harman Kalra, Jasvinder Singh, Cristian Dumitrescu, Matan Azrad,
	Maxime Coquelin, Chenbo Xia, Jakub Palider, Tomasz Duszynski,
	Tianfei zhang, Ferruh Yigit, Andrew Rybchenko, nd

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday, August 26, 2022 8:42 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; bruce.richardson@intel.com; Rosen Xu <rosen.xu@intel.com>;
> Gagandeep Singh <g.singh@nxp.com>; hemant.agrawal@nxp.com; Nicolas Chautru
> <nicolas.chautru@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Lee Daly <lee.daly@intel.com>;
> Fan Zhang <roy.fan.zhang@intel.com>; Ashish Gupta <ashish.gupta@marvell.com>; Sunila Sahu
> <ssahu@marvell.com>; Ruifeng Wang <Ruifeng.Wang@arm.com>; Ajit Khaparde
> (ajit.khaparde@broadcom.com) <ajit.khaparde@broadcom.com>; Raveendra Padasalagi
> <raveendra.padasalagi@broadcom.com>; Vikas Gupta <vikas.gupta@broadcom.com>; Chandubabu
> Namburu <chandu@amd.com>; Pablo de Lara <pablo.de.lara.guarch@intel.com>; Michael Shamis
> <michaelsh@marvell.com>; Liron Himi <lironh@marvell.com>; Chengwen Feng
> <fengchengwen@huawei.com>; Kevin Laatz <kevin.laatz@intel.com>; Sachin Saxena
> <sachin.saxena@oss.nxp.com>; jerinj@marvell.com; Liang Ma <liangma@liangbit.com>; Peter
> Mccarthy <peter.mccarthy@intel.com>; Harry van Haaren <harry.van.haaren@intel.com>; John W.
> Linville <linville@tuxdriver.com>; Ciara Loftus <ciara.loftus@intel.com>; Qi Zhang
> <qi.z.zhang@intel.com>; Chas Williams <chas3@att.com>; Min Hu (Connor)
> <humin29@huawei.com>; Gaetan Rivet <grive@u256.net>; Jakub Grajciar <jgrajcia@cisco.com>;
> Zyta Szpak <zr@semihalf.com>; Tetsuya Mukawa <mtetsuyah@gmail.com>; Harman Kalra
> <hkalra@marvell.com>; Jasvinder Singh <jasvinder.singh@intel.com>; Cristian Dumitrescu
> <cristian.dumitrescu@intel.com>; Matan Azrad <matan@nvidia.com>; Maxime Coquelin
> <maxime.coquelin@redhat.com>; Chenbo Xia <chenbo.xia@intel.com>; Jakub Palider
> <jpalider@marvell.com>; Tomasz Duszynski <tduszynski@marvell.com>; Tianfei zhang
> <tianfei.zhang@intel.com>; Ferruh Yigit <ferruh.yigit@xilinx.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>
> Subject: [PATCH v4 17/27] bus/vdev: make driver-only headers private
> 
> The vdev 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 <david.marchand@redhat.com>
> Acked-by: Rosen Xu <rosen.xu@intel.com>
> ---
> Changes since RFC v2:
> - squashed cleanup for this bus code from other patches,
> - updated release notes,
> 
> ---
>  app/test/test_vdev.c                          |   2 +-
>  doc/guides/rel_notes/release_22_11.rst        |   4 +-
>  drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
>  drivers/baseband/null/bbdev_null.c            |   2 +-
>  .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
>  drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++++++++++++
>  drivers/bus/vdev/meson.build                  |   1 +
>  drivers/bus/vdev/rte_bus_vdev.h               | 134 ----------------
>  drivers/bus/vdev/vdev.c                       |   8 +-
>  drivers/bus/vdev/vdev_params.c                |   1 -
>  drivers/bus/vdev/version.map                  |   9 +-
>  drivers/compress/isal/isal_compress_pmd.c     |   2 +-
>  drivers/compress/zlib/zlib_pmd.c              |   2 +-
>  drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
>  drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
>  drivers/crypto/caam_jr/caam_jr.c              |   2 +-
>  drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
>  drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
>  drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
>  drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
>  drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
>  drivers/crypto/null/null_crypto_pmd.c         |   2 +-
>  drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
>  drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
>  drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
>  drivers/event/dpaa2/dpaa2_eventdev.c          |   2 +-
>  drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   2 +-
>  drivers/event/octeontx/ssovf_evdev.c          |   2 +-
>  drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
>  drivers/event/opdl/opdl_evdev.c               |   2 +-
>  drivers/event/opdl/opdl_evdev_init.c          |   2 +-
>  drivers/event/opdl/opdl_test.c                |   2 +-
>  drivers/event/skeleton/skeleton_eventdev.c    |   2 +-
>  drivers/event/sw/sw_evdev.c                   |   2 +-
>  drivers/event/sw/sw_evdev_selftest.c          |   2 +-
>  drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
>  drivers/net/af_xdp/rte_eth_af_xdp.c           |   2 +-
>  drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
>  drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
>  drivers/net/failsafe/failsafe.c               |   3 +-
>  drivers/net/ipn3ke/ipn3ke_ethdev.h            |   2 +-
>  drivers/net/kni/rte_eth_kni.c                 |   2 +-
>  drivers/net/memif/memif_socket.c              |   2 +-
>  drivers/net/memif/rte_eth_memif.c             |   2 +-
>  drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
>  drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
>  drivers/net/null/rte_eth_null.c               |   2 +-
>  drivers/net/octeontx/octeontx_ethdev.c        |   2 +-
>  drivers/net/pcap/pcap_ethdev.c                |   2 +-
>  drivers/net/pfe/pfe_ethdev.c                  |   2 +-
>  drivers/net/ring/rte_eth_ring.c               |   2 +-
>  drivers/net/softnic/rte_eth_softnic.c         |   2 +-
>  drivers/net/tap/rte_eth_tap.c                 |   2 +-
>  drivers/net/vdev_netvsc/vdev_netvsc.c         |   2 +-
>  drivers/net/vhost/rte_eth_vhost.c             |   2 +-
>  drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
>  drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
>  drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
>  drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
>  drivers/raw/skeleton/skeleton_rawdev.c        |   2 +-
>  drivers/raw/skeleton/skeleton_rawdev_test.c   |   2 +-
>  lib/ethdev/ethdev_vdev.h                      |   2 +-
>  lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
>  63 files changed, 221 insertions(+), 200 deletions(-)  create mode 100644
> drivers/bus/vdev/bus_vdev_driver.h
> 
> diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c index 5eeff3106d..3cc3abe70b
> 100644
> --- a/app/test/test_vdev.c
> +++ b/app/test/test_vdev.c
> @@ -9,7 +9,7 @@
>  #include <rte_common.h>
>  #include <rte_kvargs.h>
>  #include <rte_bus.h>
> -#include <rte_bus_vdev.h>
> +#include <bus_vdev_driver.h>
This line of change is unnecessary? Application uses rte header.
The rest looks good to me.
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [PATCH v4 17/27] bus/vdev: make driver-only headers private
  2022-08-29  7:17     ` Ruifeng Wang
@ 2022-08-29  8:12       ` David Marchand
  0 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-08-29  8:12 UTC (permalink / raw)
  To: Ruifeng Wang
  Cc: dev, thomas, bruce.richardson, Rosen Xu, Gagandeep Singh,
	hemant.agrawal, Nicolas Chautru, Ray Kinsella, Lee Daly,
	Fan Zhang, Ashish Gupta, Sunila Sahu,
	Ajit Khaparde (ajit.khaparde@broadcom.com),
	Raveendra Padasalagi, Vikas Gupta, Chandubabu Namburu,
	Pablo de Lara, Michael Shamis, Liron Himi, Chengwen Feng,
	Kevin Laatz, Sachin Saxena, jerinj, Liang Ma, Peter Mccarthy,
	Harry van Haaren, John W. Linville, Ciara Loftus, Qi Zhang,
	Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Jakub Grajciar, Zyta Szpak, Tetsuya Mukawa,
	Harman Kalra, Jasvinder Singh, Cristian Dumitrescu, Matan Azrad,
	Maxime Coquelin, Chenbo Xia, Jakub Palider, Tomasz Duszynski,
	Tianfei zhang, Ferruh Yigit, Andrew Rybchenko, nd

On Mon, Aug 29, 2022 at 9:18 AM Ruifeng Wang <Ruifeng.Wang@arm.com> wrote:
> > diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c index 5eeff3106d..3cc3abe70b
> > 100644
> > --- a/app/test/test_vdev.c
> > +++ b/app/test/test_vdev.c
> > @@ -9,7 +9,7 @@
> >  #include <rte_common.h>
> >  #include <rte_kvargs.h>
> >  #include <rte_bus.h>
> > -#include <rte_bus_vdev.h>
> > +#include <bus_vdev_driver.h>
> This line of change is unnecessary? Application uses rte header.

This unit test looks into rte_bus objects (you'll notice a change
later in the series for including bus_driver.h) but, here, it only
uses "standard" API for the rest.
I'll fix this include, in next revision.


> The rest looks good to me.
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

Thanks Ruifeng.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-08-25  9:31     ` David Marchand
@ 2022-08-29 17:12       ` Walker, Benjamin
  2022-08-30 15:09         ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Walker, Benjamin @ 2022-08-29 17:12 UTC (permalink / raw)
  To: David Marchand, Harris, James R
  Cc: dev, Liu, Changpeng, Alexey Marchuk, Shuhei Matsumoto

> From: David Marchand <david.marchand@redhat.com>
> 
> Hello,
> 
> On Fri, Aug 5, 2022 at 1:19 AM Harris, James R <james.r.harris@intel.com>
> wrote:
> > Can we keep rte_pci_register(), or a new variation of it that keeps
> > the rte_pci_driver structure hidden?  Hiding rte_pci_register() would
> > mean SPDK can no longer work with a packaged DPDK.  Or the DPDK
> > packages would need to set enable_driver_sdk which I suspect is not the
> intent.
> 
> What do you think if SPDK maintains a copy of the internal headers?
> 
> The internal API are not supposed to change that often, but we (DPDK) won't
> guarantee it.
> This would still put some maintenance burden on SPDK but I think it is a good
> compromise.
>

Would these internal symbols be considered part of the public/official ABI? When
SPDK goes to dynamically load a shared DPDK library, how can we detect
whether it's a version that we support linking against?

 
> I did a PoC this morning and put patches in my forked repo:
> https://github.com/david-marchand/spdk/commits/master
> 
> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [PATCH v4 13/27] bus/fslmc: make driver-only headers private
  2022-08-26 12:41   ` [PATCH v4 13/27] bus/fslmc: " David Marchand
@ 2022-08-30  4:49     ` Hemant Agrawal
  0 siblings, 0 replies; 231+ messages in thread
From: Hemant Agrawal @ 2022-08-30  4:49 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, bruce.richardson, Hemant Agrawal, Sachin Saxena, Gagandeep Singh

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>



^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [PATCH v4 12/27] bus/dpaa: make driver-only headers private
  2022-08-26 12:41   ` [PATCH v4 12/27] bus/dpaa: " David Marchand
@ 2022-08-30  4:50     ` Hemant Agrawal
  0 siblings, 0 replies; 231+ messages in thread
From: Hemant Agrawal @ 2022-08-30  4:50 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, bruce.richardson, Hemant Agrawal, Sachin Saxena, Gagandeep Singh

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-08-29 17:12       ` Walker, Benjamin
@ 2022-08-30 15:09         ` David Marchand
  2022-09-21 22:29           ` Harris, James R
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-08-30 15:09 UTC (permalink / raw)
  To: Walker, Benjamin
  Cc: Harris, James R, dev, Liu, Changpeng, Alexey Marchuk,
	Shuhei Matsumoto, Thomas Monjalon, Bruce Richardson,
	Stephen Hemminger

On Mon, Aug 29, 2022 at 7:12 PM Walker, Benjamin
<benjamin.walker@intel.com> wrote:
> > > Can we keep rte_pci_register(), or a new variation of it that keeps
> > > the rte_pci_driver structure hidden?  Hiding rte_pci_register() would
> > > mean SPDK can no longer work with a packaged DPDK.  Or the DPDK
> > > packages would need to set enable_driver_sdk which I suspect is not the
> > intent.
> >
> > What do you think if SPDK maintains a copy of the internal headers?
> >
> > The internal API are not supposed to change that often, but we (DPDK) won't
> > guarantee it.
> > This would still put some maintenance burden on SPDK but I think it is a good
> > compromise.
> >
>
> Would these internal symbols be considered part of the public/official ABI? When

What do you mean by "public/official"?
If you mean the "stable" ABI (as described in the ABI policy document
and for which compatibility is preserved across minor versions of the
ABI), the answer is no: internal symbols are not part of it.


> SPDK goes to dynamically load a shared DPDK library, how can we detect
> whether it's a version that we support linking against?

The runtime version of a DPDK library is available via rte_version().


As for the PCI drivers that SPDK wants to register in DPDK, what do
you think if SPDK people added and maintained a "generic" PCI driver
in DPDK.
This driver would expose a new API (which can not re-expose internal
structures, like rte_pci_driver and consorts) and ensure its ABI is
maintained in the long term.
This makes me think of pci-stub, but in DPDK.

I did not think too much about it and I don't understand what SPDK
requires, but is there something wrong with this approach?


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 00/27] Bus and device cleanup for 22.11
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (13 preceding siblings ...)
  2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
@ 2022-09-05  8:35 ` David Marchand
  2022-09-05  8:35   ` [PATCH v5 01/27] devtools: forbid inclusions of driver only headers David Marchand
                     ` (8 more replies)
  2022-09-05  8:39 ` David Marchand
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  16 siblings, 9 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

The rte_bus, rte_driver and rte_device objects are part of the public
ABI and this has proved to be a problem when needing to extend them.
This series hides them, and mark associated driver only API as internal.

A good amount of the patches are preparation work on rte_bus.h,
rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
between them.

PCI bus specific handling are removed from testpmd, unit tests and
examples.

After this series, driver-only API headers for registering to buses are
not exported anymore, unless the enable_driver_sdk meson option is
selected.

New accessors for rte_bus, rte_driver and rte_device have been added,
marked with an experimental tag first when introducing them, and later
in the series marked as stable since external users will want to use
those drop-in replacements right away.

A check is added to ensure we won't pollute app/ and examples/ again,
though some unit tests are left intentionnally untouched as they test
some internals of DPDK.

Changes since v4:
- (hopefully, because I can't test) fixed Windows build,
- dropped unneeded change in vdev unit test,

Changes since RFC v3:
- marked the series as non-RFC,
- rebased on v22.11-rc0,
- marked RTE_FUNC_PTR_* macros as deprecated,
- split the bus specific patch in two patches,

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (27):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  eal: deprecate RTE_FUNC_PTR_* macros
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide bus specific information
  bus/pci: fill bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   5 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |  20 +-
 doc/guides/rel_notes/release_22_11.rst        |  19 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 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 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  52 ++-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |  35 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   8 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 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             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  21 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  25 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |  48 ++-
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |  45 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_dev.h                     | 104 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       | 277 +++++++++-----
 lib/ethdev/rte_ethdev.h                       |  11 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  12 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  15 +-
 lib/eventdev/rte_eventdev.c                   |  64 ++--
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   5 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |  77 ++--
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |  59 +--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   8 +-
 lib/vhost/vdpa.c                              |  10 +-
 lib/vhost/vhost_user.c                        |   6 +-
 367 files changed, 2225 insertions(+), 2490 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 01/27] devtools: forbid inclusions of driver only headers
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
@ 2022-09-05  8:35   ` David Marchand
  2022-09-05  8:35   ` [PATCH v5 02/27] common/mlx5: rework check on driver registration David Marchand
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Let's be good citizens and enforce not using driver only headers in our
own examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 1edc5810ad..0e82c01947 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -142,6 +142,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid inclusion of driver specific headers in apps and examples
+	awk -v FOLDERS='app examples' \
+		-v EXPRESSIONS='include.*_driver\\.h include.*_pmd\\.h' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using driver specific headers in applications' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# SVG must be included with wildcard extension to allow conversion
 	awk -v FOLDERS='doc' \
 		-v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 02/27] common/mlx5: rework check on driver registration
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
  2022-09-05  8:35   ` [PATCH v5 01/27] devtools: forbid inclusions of driver only headers David Marchand
@ 2022-09-05  8:35   ` David Marchand
  2022-09-05  8:35   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Matan Azrad, Viacheslav Ovsiienko

Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@ static struct rte_auxiliary_driver mlx5_auxiliary_driver = {
 	.dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-	if (mlx5_auxiliary_driver.bus == NULL)
+	if (!mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_register(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = true;
+	}
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-	if (mlx5_auxiliary_driver.bus != NULL)
+	if (mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = false;
+	}
 }
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
  2022-09-05  8:35   ` [PATCH v5 01/27] devtools: forbid inclusions of driver only headers David Marchand
  2022-09-05  8:35   ` [PATCH v5 02/27] common/mlx5: rework check on driver registration David Marchand
@ 2022-09-05  8:35   ` David Marchand
  2022-09-05  8:35   ` [PATCH v5 04/27] app/testpmd: drop PCI register commands David Marchand
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * raw/dpaa2_cmdif: The ``dpaa2_cmdif`` rawdev driver will be deprecated
   in DPDK 22.11, as it is no longer in use, no active user known.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 04/27] app/testpmd: drop PCI register commands
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (2 preceding siblings ...)
  2022-09-05  8:35   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-09-05  8:35   ` David Marchand
  2022-09-05  8:35   ` [PATCH v5 05/27] kni: stop populating PCI info in examples David Marchand
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang

Those commands date back to the early stages of DPDK when only PCI
devices were supported.
At the time, developers may have used those commands to help in
debugging their buggy^Wwork in progress drivers.

Removing them, we can drop the dependency on the PCI bus and library and
make testpmd bus agnostic.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/cmdline.c                      | 339 +-------------------
 app/test-pmd/config.c                       | 195 -----------
 app/test-pmd/csumonly.c                     |   1 -
 app/test-pmd/flowgen.c                      |   1 -
 app/test-pmd/iofwd.c                        |   1 -
 app/test-pmd/macfwd.c                       |   1 -
 app/test-pmd/macswap.c                      |   1 -
 app/test-pmd/meson.build                    |   2 +-
 app/test-pmd/parameters.c                   |   1 -
 app/test-pmd/rxonly.c                       |   1 -
 app/test-pmd/testpmd.c                      |   1 -
 app/test-pmd/testpmd.h                      |  72 +----
 app/test-pmd/txonly.c                       |   1 -
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  81 -----
 14 files changed, 4 insertions(+), 694 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b4fe9dfb17..4697b7c494 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -28,7 +28,6 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -89,7 +88,6 @@ static void cmd_help_brief_parsed(__rte_unused void *parsed_result,
 		"information.\n"
 		"    help config                     : Configuration information.\n"
 		"    help ports                      : Configuring ports.\n"
-		"    help registers                  : Reading and setting port registers.\n"
 		"    help filters                    : Filters configuration help.\n"
 		"    help traffic_management         : Traffic Management commands.\n"
 		"    help devices                    : Device related commands.\n"
@@ -799,34 +797,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 		);
 	}
 
-	if (show_all || !strcmp(res->section, "registers")) {
-
-		cmdline_printf(
-			cl,
-			"\n"
-			"Registers:\n"
-			"----------\n\n"
-
-			"read reg (port_id) (address)\n"
-			"    Display value of a port register.\n\n"
-
-			"read regfield (port_id) (address) (bit_x) (bit_y)\n"
-			"    Display a port register bit field.\n\n"
-
-			"read regbit (port_id) (address) (bit_x)\n"
-			"    Display a single port register bit.\n\n"
-
-			"write reg (port_id) (address) (value)\n"
-			"    Set value of a port register.\n\n"
-
-			"write regfield (port_id) (address) (bit_x) (bit_y)"
-			" (value)\n"
-			"    Set bit field of a port register.\n\n"
-
-			"write regbit (port_id) (address) (bit_x) (value)\n"
-			"    Set single bit value of a port register.\n\n"
-		);
-	}
 	if (show_all || !strcmp(res->section, "filters")) {
 
 		cmdline_printf(
@@ -1077,13 +1047,13 @@ static cmdline_parse_token_string_t cmd_help_long_help =
 
 static cmdline_parse_token_string_t cmd_help_long_section =
 	TOKEN_STRING_INITIALIZER(struct cmd_help_long_result, section,
-		"all#control#display#config#ports#registers#"
+		"all#control#display#config#ports#"
 		"filters#traffic_management#devices#drivers");
 
 static cmdline_parse_inst_t cmd_help_long = {
 	.f = cmd_help_long_parsed,
 	.data = NULL,
-	.help_str = "help all|control|display|config|ports|register|"
+	.help_str = "help all|control|display|config|ports|"
 		"filters|traffic_management|devices|drivers: "
 		"Show help",
 	.tokens = {
@@ -7390,305 +7360,6 @@ static cmdline_parse_inst_t cmd_showfwdall = {
 	},
 };
 
-/* *** READ PORT REGISTER *** */
-struct cmd_read_reg_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-};
-
-static void
-cmd_read_reg_parsed(void *parsed_result,
-		    __rte_unused struct cmdline *cl,
-		    __rte_unused void *data)
-{
-	struct cmd_read_reg_result *res = parsed_result;
-	port_reg_display(res->port_id, res->reg_off);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_read_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, reg_off, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_read_reg = {
-	.f = cmd_read_reg_parsed,
-	.data = NULL,
-	.help_str = "read reg <port_id> <reg_off>",
-	.tokens = {
-		(void *)&cmd_read_reg_read,
-		(void *)&cmd_read_reg_reg,
-		(void *)&cmd_read_reg_port_id,
-		(void *)&cmd_read_reg_reg_off,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT FIELD *** */
-struct cmd_read_reg_bit_field_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-};
-
-static void
-cmd_read_reg_bit_field_parsed(void *parsed_result,
-			      __rte_unused struct cmdline *cl,
-			      __rte_unused void *data)
-{
-	struct cmd_read_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_display(res->port_id, res->reg_off,
-				   res->bit1_pos, res->bit2_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result, read,
-				 "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit_field = {
-	.f = cmd_read_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "read regfield <port_id> <reg_off> <bit_x> <bit_y>: "
-	"Read register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_field_read,
-		(void *)&cmd_read_reg_bit_field_regfield,
-		(void *)&cmd_read_reg_bit_field_port_id,
-		(void *)&cmd_read_reg_bit_field_reg_off,
-		(void *)&cmd_read_reg_bit_field_bit1_pos,
-		(void *)&cmd_read_reg_bit_field_bit2_pos,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT *** */
-struct cmd_read_reg_bit_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-};
-
-static void
-cmd_read_reg_bit_parsed(void *parsed_result,
-			__rte_unused struct cmdline *cl,
-			__rte_unused void *data)
-{
-	struct cmd_read_reg_bit_result *res = parsed_result;
-	port_reg_bit_display(res->port_id, res->reg_off, res->bit_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_read_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit = {
-	.f = cmd_read_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "read regbit <port_id> <reg_off> <bit_x>: 0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_read,
-		(void *)&cmd_read_reg_bit_regbit,
-		(void *)&cmd_read_reg_bit_port_id,
-		(void *)&cmd_read_reg_bit_reg_off,
-		(void *)&cmd_read_reg_bit_bit_pos,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER *** */
-struct cmd_write_reg_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_parsed(void *parsed_result,
-		     __rte_unused struct cmdline *cl,
-		     __rte_unused void *data)
-{
-	struct cmd_write_reg_result *res = parsed_result;
-	port_reg_set(res->port_id, res->reg_off, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, write, "write");
-static cmdline_parse_token_string_t cmd_write_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_write_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, reg_off, RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, value, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg = {
-	.f = cmd_write_reg_parsed,
-	.data = NULL,
-	.help_str = "write reg <port_id> <reg_off> <reg_value>",
-	.tokens = {
-		(void *)&cmd_write_reg_write,
-		(void *)&cmd_write_reg_reg,
-		(void *)&cmd_write_reg_port_id,
-		(void *)&cmd_write_reg_reg_off,
-		(void *)&cmd_write_reg_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT FIELD *** */
-struct cmd_write_reg_bit_field_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_bit_field_parsed(void *parsed_result,
-			       __rte_unused struct cmdline *cl,
-			       __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_set(res->port_id, res->reg_off,
-			  res->bit1_pos, res->bit2_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, value,
-			      RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg_bit_field = {
-	.f = cmd_write_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "write regfield <port_id> <reg_off> <bit_x> <bit_y> "
-		"<reg_value>: "
-		"Set register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_field_write,
-		(void *)&cmd_write_reg_bit_field_regfield,
-		(void *)&cmd_write_reg_bit_field_port_id,
-		(void *)&cmd_write_reg_bit_field_reg_off,
-		(void *)&cmd_write_reg_bit_field_bit1_pos,
-		(void *)&cmd_write_reg_bit_field_bit2_pos,
-		(void *)&cmd_write_reg_bit_field_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT *** */
-struct cmd_write_reg_bit_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-	uint8_t value;
-};
-
-static void
-cmd_write_reg_bit_parsed(void *parsed_result,
-			 __rte_unused struct cmdline *cl,
-			 __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_result *res = parsed_result;
-	port_reg_bit_set(res->port_id, res->reg_off, res->bit_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_write_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, value,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_write_reg_bit = {
-	.f = cmd_write_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "write regbit <port_id> <reg_off> <bit_x> 0|1: "
-		"0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_write,
-		(void *)&cmd_write_reg_bit_regbit,
-		(void *)&cmd_write_reg_bit_port_id,
-		(void *)&cmd_write_reg_bit_reg_off,
-		(void *)&cmd_write_reg_bit_bit_pos,
-		(void *)&cmd_write_reg_bit_value,
-		NULL,
-	},
-};
-
 /* *** READ A RING DESCRIPTOR OF A PORT RX/TX QUEUE *** */
 struct cmd_read_rxd_txd_result {
 	cmdline_fixed_string_t read;
@@ -14222,12 +13893,6 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_queue_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_config_dcb,
-	(cmdline_parse_inst_t *)&cmd_read_reg,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit,
-	(cmdline_parse_inst_t *)&cmd_write_reg,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit,
 	(cmdline_parse_inst_t *)&cmd_read_rxd_txd,
 	(cmdline_parse_inst_t *)&cmd_stop,
 	(cmdline_parse_inst_t *)&cmd_mac_addr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a2939867c4..3a53b616d8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -31,7 +31,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -1138,200 +1137,6 @@ vlan_id_is_invalid(uint16_t vlan_id)
 	return 1;
 }
 
-static int
-port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	uint64_t pci_len;
-
-	if (reg_off & 0x3) {
-		fprintf(stderr,
-			"Port register offset 0x%X not aligned on a 4-byte boundary\n",
-			(unsigned int)reg_off);
-		return 1;
-	}
-
-	if (!ports[port_id].dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 1;
-	}
-
-	pci_len = pci_dev->mem_resource[0].len;
-	if (reg_off >= pci_len) {
-		fprintf(stderr,
-			"Port %d: register offset %u (0x%X) out of port PCI resource (length=%"PRIu64")\n",
-			port_id, (unsigned int)reg_off, (unsigned int)reg_off,
-			pci_len);
-		return 1;
-	}
-	return 0;
-}
-
-static int
-reg_bit_pos_is_invalid(uint8_t bit_pos)
-{
-	if (bit_pos <= 31)
-		return 0;
-	fprintf(stderr, "Invalid bit position %d (must be <= 31)\n", bit_pos);
-	return 1;
-}
-
-#define display_port_and_reg_off(port_id, reg_off) \
-	printf("port %d PCI register at offset 0x%X: ", (port_id), (reg_off))
-
-static inline void
-display_port_reg_value(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("0x%08X (%u)\n", (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x)
-{
-	uint32_t reg_v;
-
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_x))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bit %d=%d\n", bit_x, (int) ((reg_v & (1 << bit_x)) >> bit_x));
-}
-
-void
-port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-			   uint8_t bit1_pos, uint8_t bit2_pos)
-{
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v >>= l_bit;
-	if (h_bit < 31)
-		reg_v &= ((1 << (h_bit - l_bit + 1)) - 1);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bits[%d, %d]=0x%0*X (%u)\n", l_bit, h_bit,
-	       ((h_bit - l_bit) / 4) + 1, (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_display(portid_t port_id, uint32_t reg_off)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		 uint8_t bit_v)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_pos))
-		return;
-	if (bit_v > 1) {
-		fprintf(stderr, "Invalid bit value %d (must be 0 or 1)\n",
-			(int) bit_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	if (bit_v == 0)
-		reg_v &= ~(1 << bit_pos);
-	else
-		reg_v |= (1 << bit_pos);
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-		       uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value)
-{
-	uint32_t max_v;
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	if ((h_bit - l_bit) < 31)
-		max_v = (1 << (h_bit - l_bit + 1)) - 1;
-	else
-		max_v = 0xFFFFFFFF;
-
-	if (value > max_v) {
-		fprintf(stderr, "Invalid value %u (0x%x) must be < %u (0x%x)\n",
-				(unsigned)value, (unsigned)value,
-				(unsigned)max_v, (unsigned)max_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v &= ~(max_v << l_bit); /* Keep unchanged bits */
-	reg_v |= (value << l_bit); /* Set changed bits */
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
 static uint32_t
 eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
 {
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 1a3fd9ce8a..144f28819c 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 1e01120ae9..fd6abc0f41 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c
index 71849aaf96..8fafdec548 100644
--- a/app/test-pmd/iofwd.c
+++ b/app/test-pmd/iofwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index 79c9241d00..beb220fbb4 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index acb0fd7fb4..4f8deb3382 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 74399178dd..8488efc138 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON')
     ext_deps += jansson_dep
 endif
 
-deps += ['ethdev', 'cmdline', 'bus_pci']
+deps += ['ethdev', 'cmdline']
 if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
     deps += 'crypto_scheduler'
 endif
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e3c9757f3f..c77624302f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -33,7 +33,6 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 04457010f4..d528d4f34e 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index addcbcac85..ee686393c5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -42,7 +42,6 @@
 #include <rte_mbuf.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_dev.h>
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index fb2f5195d3..e4ba7147a3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -7,8 +7,6 @@
 
 #include <stdbool.h>
 
-#include <rte_pci.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
@@ -267,7 +265,7 @@ struct port_txqueue {
  * The data structure associated with each port.
  */
 struct rte_port {
-	struct rte_eth_dev_info dev_info;   /**< PCI info + driver name */
+	struct rte_eth_dev_info dev_info;   /**< Device info + driver name */
 	struct rte_eth_conf     dev_conf;   /**< Port configuration. */
 	struct rte_ether_addr       eth_addr;   /**< Port ethernet address */
 	struct rte_eth_stats    stats;      /**< Last port statistics */
@@ -801,65 +799,6 @@ mbuf_pool_find(unsigned int sock_id, uint16_t idx)
 	return rte_mempool_lookup((const char *)pool_name);
 }
 
-/**
- * Read/Write operations on a PCI register of a port.
- */
-static inline uint32_t
-port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-	uint32_t reg_v;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 0;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	reg_v = *((volatile uint32_t *)reg_addr);
-	return rte_le_to_cpu_32(reg_v);
-}
-
-#define port_id_pci_reg_read(pt_id, reg_off) \
-	port_pci_reg_read(&ports[(pt_id)], (reg_off))
-
-static inline void
-port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
-}
-
-#define port_id_pci_reg_write(pt_id, reg_off, reg_value) \
-	port_pci_reg_write(&ports[(pt_id)], (reg_off), (reg_value))
-
 static inline void
 get_start_cycles(uint64_t *start_tsc)
 {
@@ -922,15 +861,6 @@ void update_fwd_ports(portid_t new_pid);
 void set_fwd_eth_peer(portid_t port_id, char *peer_addr);
 
 void port_mtu_set(portid_t port_id, uint16_t mtu);
-void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos);
-void port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		      uint8_t bit_v);
-void port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-				uint8_t bit1_pos, uint8_t bit2_pos);
-void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-			    uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
-void port_reg_display(portid_t port_id, uint32_t reg_off);
-void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
 int port_action_handle_create(portid_t port_id, uint32_t id,
 			      const struct rte_flow_indir_action_conf *conf,
 			      const struct rte_flow_action *action);
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index e1bc78b73d..021624952d 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 330e34427d..7dacd6fb04 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -55,7 +55,6 @@ These are divided into sections and can be accessed using help, help section or
            help display                    : Displaying port, stats and config information.
            help config                     : Configuration information.
            help ports                      : Configuring ports.
-           help registers                  : Reading and setting port registers.
            help filters                    : Filters configuration help.
            help traffic_management         : Traffic Management commands.
            help devices                    : Device related commands.
@@ -2356,86 +2355,6 @@ manage link bonding devices from within testpmd interactive prompt.
 
 See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information.
 
-Register Functions
-------------------
-
-The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
-This is mainly useful for debugging purposes.
-Reference should be made to the appropriate datasheet for the network card for details on the register addresses
-and fields that can be accessed.
-
-read reg
-~~~~~~~~
-
-Display the value of a port register::
-
-   testpmd> read reg (port_id) (address)
-
-For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
-
-   testpmd> read reg 0 0xEE00
-   port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
-
-read regfield
-~~~~~~~~~~~~~
-
-Display a port register bit field::
-
-   testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
-
-For example, reading the lowest two bits from the register in the example above::
-
-   testpmd> read regfield 0 0xEE00 0 1
-   port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
-
-read regbit
-~~~~~~~~~~~
-
-Display a single port register bit::
-
-   testpmd> read regbit (port_id) (address) (bit_x)
-
-For example, reading the lowest bit from the register in the example above::
-
-   testpmd> read regbit 0 0xEE00 0
-   port 0 PCI register at offset 0xEE00: bit 0=1
-
-write reg
-~~~~~~~~~
-
-Set the value of a port register::
-
-   testpmd> write reg (port_id) (address) (value)
-
-For example, to clear a register::
-
-   testpmd> write reg 0 0xEE00 0x0
-   port 0 PCI register at offset 0xEE00: 0x00000000 (0)
-
-write regfield
-~~~~~~~~~~~~~~
-
-Set bit field of a port register::
-
-   testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
-
-For example, writing to the register cleared in the example above::
-
-   testpmd> write regfield 0 0xEE00 0 1 2
-   port 0 PCI register at offset 0xEE00: 0x00000002 (2)
-
-write regbit
-~~~~~~~~~~~~
-
-Set single bit value of a port register::
-
-   testpmd> write regbit (port_id) (address) (bit_x) (value)
-
-For example, to set the high bit in the register from the example above::
-
-   testpmd> write regbit 0 0xEE00 31 1
-   port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
-
 Traffic Metering and Policing
 -----------------------------
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 05/27] kni: stop populating PCI info in examples
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (3 preceding siblings ...)
  2022-09-05  8:35   ` [PATCH v5 04/27] app/testpmd: drop PCI register commands David Marchand
@ 2022-09-05  8:35   ` David Marchand
  2022-09-05  8:35   ` [PATCH v5 06/27] examples/ethtool: prefer device name David Marchand
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Cristian Dumitrescu

addr and id fields are deprecated and are not used in the kni library.
Stop populating them in the in-tree examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_kni.c        | 30 ------------------------------
 examples/ip_pipeline/kni.c | 10 ----------
 2 files changed, 40 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 622315c8b1..4039da0b08 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -25,7 +25,6 @@ test_kni(void)
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
@@ -426,8 +425,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 
 	if (!mp)
 		return -1;
@@ -443,13 +440,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
 
 	/* core id 1 configured for kernel thread */
@@ -545,8 +535,6 @@ test_kni(void)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
 	FILE *fd;
 	DIR *dir;
 	char buf[16];
@@ -645,15 +633,6 @@ test_kni(void)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
@@ -689,15 +668,6 @@ test_kni(void)
 		goto fail;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index a2d3331cb0..cd02c39478 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_string_fns.h>
 
 #include "kni.h"
@@ -107,8 +106,6 @@ kni_create(const char *name, struct kni_params *params)
 	struct mempool *mempool;
 	struct link *link;
 	struct rte_kni *k;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int ret;
 
 	/* Check input params */
@@ -134,13 +131,6 @@ kni_create(const char *name, struct kni_params *params)
 	kni_conf.core_id = params->thread_id;
 	kni_conf.group_id = link->port_id;
 	kni_conf.mbuf_size = mempool->buffer_size;
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		kni_conf.addr = pci_dev->addr;
-		kni_conf.id = pci_dev->id;
-	}
 
 	memset(&kni_ops, 0, sizeof(kni_ops));
 	kni_ops.port_id = link->port_id;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 06/27] examples/ethtool: prefer device name
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (4 preceding siblings ...)
  2022-09-05  8:35   ` [PATCH v5 05/27] kni: stop populating PCI info in examples David Marchand
@ 2022-09-05  8:35   ` David Marchand
  2022-09-05  8:35   ` [PATCH v5 07/27] dev: hide debug messages in device iterator David Marchand
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Rely on the generic device name rather than restrict to only supporting
PCI devices.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/ethtool/lib/rte_ethtool.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index ffaad96498..88dc917b73 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -8,7 +8,6 @@
 #include <rte_version.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_NET_IXGBE
 #include <rte_pmd_ixgbe.h>
 #endif
@@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 {
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int n;
 	int ret;
 
@@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	/* TODO: replace bus_info by rte_devargs.name */
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
-			"%04x:%02x:%02x.%x",
-			pci_dev->addr.domain, pci_dev->addr.bus,
-			pci_dev->addr.devid, pci_dev->addr.function);
-	} else {
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
-	}
+	strlcpy(drvinfo->bus_info, dev_info.device->name,
+		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
 	rte_eth_dev_get_reg_info(port_id, &reg_info);
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 07/27] dev: hide debug messages in device iterator
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (5 preceding siblings ...)
  2022-09-05  8:35   ` [PATCH v5 06/27] examples/ethtool: prefer device name David Marchand
@ 2022-09-05  8:35   ` David Marchand
  2022-09-05  8:35   ` [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
  2022-09-05  8:39   ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
  8 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang

For any bus that does not support device iteration, rte_dev_iterator_init
both returned an error code and logged an error message.
An application (like testpmd) that only wants to list devices, would have
no choice but to inspect a bus object to avoid spewing error logs.

Make those log messages debug level, and remove the check in testpmd.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/config.c           | 4 ----
 lib/eal/common/eal_common_dev.c | 7 +++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3a53b616d8..bc73819183 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -641,10 +641,6 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		/* Skip buses that don't have iterate method */
-		if (!next->dev_iterate)
-			continue;
-
 		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 9d913e5478..b6f0392f30 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -592,18 +592,17 @@ rte_dev_iterator_init(struct rte_dev_iterator *it,
 	 * one layer specified.
 	 */
 	if (bus == NULL && cls == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Either bus or class must be specified.\n");
+		RTE_LOG(DEBUG, EAL, "Either bus or class must be specified.\n");
 		rte_errno = EINVAL;
 		goto get_out;
 	}
 	if (bus != NULL && bus->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Bus %s not supported\n", bus->name);
+		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", bus->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
 	if (cls != NULL && cls->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Class %s not supported\n", cls->name);
+		RTE_LOG(DEBUG, EAL, "Class %s not supported\n", cls->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (6 preceding siblings ...)
  2022-09-05  8:35   ` [PATCH v5 07/27] dev: hide debug messages in device iterator David Marchand
@ 2022-09-05  8:35   ` David Marchand
  2022-09-06  8:24     ` Jayatheerthan, Jay
  2022-09-05  8:39   ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
  8 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:35 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Fan Zhang, Ashish Gupta,
	Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Rosen Xu, Tianfei zhang,
	Sachin Saxena, Hemant Agrawal, Akhil Goyal, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Abhinandan Gujjar,
	Jerin Jacob, Jay Jayatheerthan, Olivier Matz, Ori Kam,
	Maxime Coquelin, Chenbo Xia

Those macros have no real value and are easily replaced with a simple
if() block.

Existing users have been converted using a new cocci script.
Deprecate them.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |   4 +
 doc/guides/rel_notes/release_22_11.rst        |   4 +
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_qp.c                   |  31 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   6 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   6 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  21 +-
 lib/compressdev/rte_compressdev.c             |  47 +--
 lib/cryptodev/rte_cryptodev.c                 |  43 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/eal/include/rte_dev.h                     |   7 +-
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_pci.h                       |   3 +-
 lib/ethdev/rte_ethdev.c                       | 276 ++++++++++++------
 lib/ethdev/rte_ethdev.h                       |   9 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  10 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  13 +-
 lib/eventdev/rte_eventdev.c                   |  62 ++--
 lib/mempool/rte_mempool_ops.c                 |   3 +-
 lib/rawdev/rte_rawdev.c                       |  75 +++--
 lib/regexdev/rte_regexdev.c                   |  59 ++--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   6 +-
 lib/vhost/vdpa.c                              |   9 +-
 lib/vhost/vhost_user.c                        |   6 +-
 31 files changed, 517 insertions(+), 285 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci

diff --git a/devtools/cocci/func_or_ret.cocci b/devtools/cocci/func_or_ret.cocci
new file mode 100644
index 0000000000..f23d60cc4e
--- /dev/null
+++ b/devtools/cocci/func_or_ret.cocci
@@ -0,0 +1,12 @@
+@@
+expression cond, ret;
+@@
+-RTE_FUNC_PTR_OR_ERR_RET(cond, ret);
++if (cond == NULL)
++	return ret;
+@@
+expression cond;
+@@
+-RTE_FUNC_PTR_OR_RET(cond);
++if (cond == NULL)
++	return;
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index dba252067c..5b4ffc992d 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -14,6 +14,10 @@ Deprecation Notices
 * kvargs: The function ``rte_kvargs_process`` will get a new parameter
   for returning key match count. It will ease handling of no-match case.
 
+* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
+  to update their code.
+
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 3cea3aa8eb..225a380de0 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,10 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
+  to update their code.
+
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
 
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index db4b087d2b..30e5cdb573 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -58,8 +58,8 @@ qat_pci_get_extra_size(enum qat_device_gen qat_dev_gen)
 {
 	struct qat_dev_hw_spec_funcs *ops_hw =
 		qat_dev_hw_spec[qat_dev_gen];
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_get_extra_size,
-		-ENOTSUP);
+	if (ops_hw->qat_dev_get_extra_size == NULL)
+		return -ENOTSUP;
 	return ops_hw->qat_dev_get_extra_size();
 }
 
@@ -381,8 +381,8 @@ static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		return -ENODEV;
 
 	ops_hw = qat_dev_hw_spec[qat_pci_dev->qat_dev_gen];
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_reset_ring_pairs,
-		-ENOTSUP);
+	if (ops_hw->qat_dev_reset_ring_pairs == NULL)
+		return -ENOTSUP;
 	if (ops_hw->qat_dev_reset_ring_pairs(qat_pci_dev)) {
 		QAT_LOG(ERR,
 			"Cannot reset ring pairs, does pf driver supports pf2vf comms?"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 08ac91eac4..8674eccdca 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -370,8 +370,8 @@ adf_queue_arb_enable(struct qat_pci_device *qat_dev, struct qat_queue *txq,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_enable,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_arb_enable == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_arb_enable(txq, base_addr, lock);
 	return 0;
 }
@@ -383,8 +383,8 @@ adf_queue_arb_disable(enum qat_device_gen qat_dev_gen, struct qat_queue *txq,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_disable,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_arb_disable == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_arb_disable(txq, base_addr, lock);
 	return 0;
 }
@@ -396,8 +396,8 @@ qat_qp_build_ring_base(struct qat_pci_device *qat_dev, void *io_addr,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_build_ring_base,
-			-ENOTSUP);
+	if (ops->qat_qp_build_ring_base == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_build_ring_base(io_addr, queue);
 	return 0;
 }
@@ -409,8 +409,8 @@ qat_qps_per_service(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_rings_per_service,
-			-ENOTSUP);
+	if (ops->qat_qp_rings_per_service == NULL)
+		return -ENOTSUP;
 	return ops->qat_qp_rings_per_service(qat_dev, service);
 }
 
@@ -421,7 +421,8 @@ qat_qp_get_hw_data(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_get_hw_data, NULL);
+	if (ops->qat_qp_get_hw_data == NULL)
+		return NULL;
 	return ops->qat_qp_get_hw_data(qat_dev, service, qp_id);
 }
 
@@ -431,8 +432,8 @@ qat_read_qp_config(struct qat_pci_device *qat_dev)
 	struct qat_dev_hw_spec_funcs *ops_hw =
 		qat_dev_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_read_config,
-			-ENOTSUP);
+	if (ops_hw->qat_dev_read_config == NULL)
+		return -ENOTSUP;
 	return ops_hw->qat_dev_read_config(qat_dev);
 }
 
@@ -442,8 +443,8 @@ adf_configure_queues(struct qat_qp *qp, enum qat_device_gen qat_dev_gen)
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_configure_queues,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_configure_queues == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_configure_queues(qp);
 	return 0;
 }
@@ -483,8 +484,8 @@ qat_qp_csr_setup(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_csr_setup,
-			-ENOTSUP);
+	if (ops->qat_qp_csr_setup == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_csr_setup(qat_dev, io_addr, qp);
 	return 0;
 }
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index dc8db84a68..6fb8cf69be 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -25,8 +25,8 @@ qat_comp_capabilities_info qat_comp_get_capa_info(
 
 	if (qat_dev_gen >= QAT_N_GENS)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(qat_comp_gen_dev_ops[qat_dev_gen]
-			.qat_comp_get_capabilities, ret);
+	if (qat_comp_gen_dev_ops[qat_dev_gen].qat_comp_get_capabilities == NULL)
+		return ret;
 	return qat_comp_gen_dev_ops[qat_dev_gen]
 			.qat_comp_get_capabilities(qat_dev);
 }
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 1e0c4fe464..258d6f8c43 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -541,7 +541,8 @@ rte_cryptodev_scheduler_option_set(uint8_t scheduler_id,
 
 	sched_ctx = dev->data->dev_private;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_set, -ENOTSUP);
+	if (*sched_ctx->ops.option_set == NULL)
+		return -ENOTSUP;
 
 	return (*sched_ctx->ops.option_set)(dev, option_type, option);
 }
@@ -571,7 +572,8 @@ rte_cryptodev_scheduler_option_get(uint8_t scheduler_id,
 
 	sched_ctx = dev->data->dev_private;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_get, -ENOTSUP);
+	if (*sched_ctx->ops.option_get == NULL)
+		return -ENOTSUP;
 
 	return (*sched_ctx->ops.option_get)(dev, option_type, option);
 }
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index f3a1bd626c..83ae6b6be9 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -160,7 +160,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
 		return -1;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.worker_attach, -ENOTSUP);
+	if (*sched_ctx->ops.worker_attach == NULL)
+		return -ENOTSUP;
 
 	for (i = 0; i < sched_ctx->nb_workers; i++) {
 		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
@@ -171,7 +172,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.scheduler_start, -ENOTSUP);
+	if (*sched_ctx->ops.scheduler_start == NULL)
+		return -ENOTSUP;
 
 	if ((*sched_ctx->ops.scheduler_start)(dev) < 0) {
 		CR_SCHED_LOG(ERR, "Scheduler start failed");
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f8575f..89fe3a828a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -291,7 +291,8 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 	if (on > 1)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
+		return -ENOTSUP;
 
 	/* The PF has 128 queue pairs and in SRIOV configuration
 	 * those queues will be assigned to VF's, so RXDCTL
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 90ffe31b9f..ebcfbb1a5c 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -281,7 +281,8 @@ lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
 	}
 
 	/* clear stored per queue stats */
-	RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
+	if (*eth_dev->dev_ops->stats_reset == NULL)
+		return 0;
 	return (*eth_dev->dev_ops->stats_reset)(eth_dev);
 }
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 78a7123528..3b616c45ff 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -713,7 +713,8 @@ ifpga_rawdev_configure(const struct rte_rawdev *dev,
 {
 	IFPGA_RAWDEV_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	return config ? 0 : 1;
 }
@@ -726,7 +727,8 @@ ifpga_rawdev_start(struct rte_rawdev *dev)
 
 	IFPGA_RAWDEV_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	adapter = ifpga_rawdev_get_priv(dev);
 	if (!adapter)
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 16ecae3d92..72d3b69d75 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -76,7 +76,8 @@ static int skeleton_rawdev_configure(const struct rte_rawdev *dev,
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	if (config == NULL || config_size != sizeof(*skeldev_conf)) {
 		SKELETON_PMD_ERR("Invalid configuration");
@@ -106,7 +107,8 @@ static int skeleton_rawdev_start(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -169,7 +171,8 @@ static int skeleton_rawdev_close(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -212,7 +215,8 @@ static int skeleton_rawdev_reset(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -295,7 +299,8 @@ static int skeleton_rawdev_queue_release(struct rte_rawdev *dev,
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -317,7 +322,8 @@ static uint16_t skeleton_rawdev_queue_count(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 	return skeldev->num_queues;
@@ -468,7 +474,8 @@ static int skeleton_rawdev_firmware_status_get(struct rte_rawdev *dev,
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	if (status_info)
 		memcpy(status_info, &skeldev->fw.firmware_state,
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 22c438f2dd..5ddbc3f9c0 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -315,7 +315,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
 
 	memset(&dev_info, 0, sizeof(struct rte_compressdev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
 	if ((dev_info.max_nb_queue_pairs != 0) &&
@@ -344,8 +345,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
 
 		qp = dev->data->queue_pairs;
 
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+		if (*dev->dev_ops->queue_pair_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_qpairs; i < old_nb_queues; i++) {
 			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -395,8 +396,8 @@ rte_compressdev_queue_pairs_release(struct rte_compressdev *dev)
 	COMPRESSDEV_LOG(DEBUG, "Free %d queues pairs on device %u",
 			dev->data->nb_queue_pairs, dev->data->dev_id);
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+	if (*dev->dev_ops->queue_pair_release == NULL)
+		return -ENOTSUP;
 
 	for (i = 0; i < num_qps; i++) {
 		ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -430,7 +431,8 @@ rte_compressdev_configure(uint8_t dev_id, struct rte_compressdev_config *config)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	/* Setup new number of queue pairs and reconfigure device. */
 	diag = rte_compressdev_queue_pairs_config(dev, config->nb_queue_pairs,
@@ -460,7 +462,8 @@ rte_compressdev_start(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -489,7 +492,8 @@ rte_compressdev_stop(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -527,7 +531,8 @@ rte_compressdev_close(uint8_t dev_id)
 	if (retval < 0)
 		return retval;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	retval = (*dev->dev_ops->dev_close)(dev);
 
 	if (retval < 0)
@@ -565,7 +570,8 @@ rte_compressdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_pair_setup == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id,
 			max_inflight_ops, socket_id);
@@ -611,7 +617,8 @@ rte_compressdev_stats_get(uint8_t dev_id, struct rte_compressdev_stats *stats)
 	dev = &rte_comp_devices[dev_id];
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->stats_get)(dev, stats);
 	return 0;
 }
@@ -628,7 +635,8 @@ rte_compressdev_stats_reset(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return;
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -647,7 +655,8 @@ rte_compressdev_info_get(uint8_t dev_id, struct rte_compressdev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_compressdev_info));
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->driver_name = dev->device->driver->name;
@@ -666,7 +675,8 @@ rte_compressdev_private_xform_create(uint8_t dev_id,
 	if (xform == NULL || priv_xform == NULL || dev == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_create, -ENOTSUP);
+	if (*dev->dev_ops->private_xform_create == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->private_xform_create)(dev, xform, priv_xform);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -689,7 +699,8 @@ rte_compressdev_private_xform_free(uint8_t dev_id, void *priv_xform)
 	if (dev == NULL || priv_xform == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_free, -ENOTSUP);
+	if (*dev->dev_ops->private_xform_free == NULL)
+		return -ENOTSUP;
 	ret = dev->dev_ops->private_xform_free(dev, priv_xform);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -714,7 +725,8 @@ rte_compressdev_stream_create(uint8_t dev_id,
 	if (xform == NULL || dev == NULL || stream == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_create, -ENOTSUP);
+	if (*dev->dev_ops->stream_create == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->stream_create)(dev, xform, stream);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -738,7 +750,8 @@ rte_compressdev_stream_free(uint8_t dev_id, void *stream)
 	if (dev == NULL || stream == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_free, -ENOTSUP);
+	if (*dev->dev_ops->stream_free == NULL)
+		return -ENOTSUP;
 	ret = dev->dev_ops->stream_free(dev, stream);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..6250302f3b 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -978,7 +978,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
 
 	memset(&dev_info, 0, sizeof(struct rte_cryptodev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
 	if (nb_qpairs > (dev_info.max_nb_queue_pairs)) {
@@ -1007,8 +1008,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
 
 		qp = dev->data->queue_pairs;
 
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+		if (*dev->dev_ops->queue_pair_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_qpairs; i < old_nb_queues; i++) {
 			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -1041,7 +1042,8 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	rte_spinlock_lock(&rte_cryptodev_callback_lock);
 	cryptodev_cb_cleanup(dev);
@@ -1083,7 +1085,8 @@ rte_cryptodev_start(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already started",
@@ -1116,7 +1119,8 @@ rte_cryptodev_stop(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already stopped",
@@ -1163,7 +1167,8 @@ rte_cryptodev_close(uint8_t dev_id)
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	retval = (*dev->dev_ops->dev_close)(dev);
 	rte_cryptodev_trace_close(dev_id, retval);
 
@@ -1262,7 +1267,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_pair_setup == NULL)
+		return -ENOTSUP;
 
 	rte_cryptodev_trace_queue_pair_setup(dev_id, queue_pair_id, qp_conf);
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
@@ -1557,7 +1563,8 @@ rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
 	dev = &rte_crypto_devices[dev_id];
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->stats_get)(dev, stats);
 	return 0;
 }
@@ -1574,7 +1581,8 @@ rte_cryptodev_stats_reset(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return;
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -1592,7 +1600,8 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_cryptodev_info));
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->driver_name = dev->device->driver->name;
@@ -1739,7 +1748,8 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 	if (index >= sess->nb_drivers)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
+	if (*dev->dev_ops->sym_session_configure == NULL)
+		return -ENOTSUP;
 
 	if (sess->sess_data[index].refcnt == 0) {
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
@@ -1968,7 +1978,8 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
 	/* Clear device session pointer.*/
 	memset(sess->sess_private_data, 0, session_priv_data_sz + sess->user_data_sz);
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_configure, -ENOTSUP);
+	if (*dev->dev_ops->asym_session_configure == NULL)
+		return -ENOTSUP;
 
 	if (sess->sess_private_data[0] == 0) {
 		ret = dev->dev_ops->asym_session_configure(dev, xforms, sess);
@@ -2007,7 +2018,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
 	if (--sess->sess_data[driver_id].refcnt != 0)
 		return -EBUSY;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
+	if (*dev->dev_ops->sym_session_clear == NULL)
+		return -ENOTSUP;
 
 	dev->dev_ops->sym_session_clear(dev, sess);
 
@@ -2054,7 +2066,8 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
 	if (dev == NULL || sess == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_clear, -ENOTSUP);
+	if (*dev->dev_ops->asym_session_clear == NULL)
+		return -ENOTSUP;
 
 	dev->dev_ops->asym_session_clear(dev, sess);
 
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..d575c14493 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -420,7 +420,8 @@ rte_dma_info_get(int16_t dev_id, struct rte_dma_info *dev_info)
 	if (!rte_dma_is_valid(dev_id) || dev_info == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_info_get == NULL)
+		return -ENOTSUP;
 	memset(dev_info, 0, sizeof(struct rte_dma_info));
 	ret = (*dev->dev_ops->dev_info_get)(dev, dev_info,
 					    sizeof(struct rte_dma_info));
@@ -472,7 +473,8 @@ rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_configure)(dev, dev_conf,
 					     sizeof(struct rte_dma_conf));
 	if (ret == 0)
@@ -555,7 +557,8 @@ rte_dma_close(int16_t dev_id)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_close)(dev);
 	if (ret == 0)
 		dma_release(dev);
@@ -648,7 +651,8 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_setup, -ENOTSUP);
+	if (*dev->dev_ops->vchan_setup == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->vchan_setup)(dev, vchan, conf,
 					sizeof(struct rte_dma_vchan_conf));
 }
@@ -668,7 +672,8 @@ rte_dma_stats_get(int16_t dev_id, uint16_t vchan, struct rte_dma_stats *stats)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	memset(stats, 0, sizeof(struct rte_dma_stats));
 	return (*dev->dev_ops->stats_get)(dev, vchan, stats,
 					  sizeof(struct rte_dma_stats));
@@ -689,7 +694,8 @@ rte_dma_stats_reset(int16_t dev_id, uint16_t vchan)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->stats_reset)(dev, vchan);
 }
 
@@ -706,7 +712,8 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_status, -ENOTSUP);
+	if (*dev->dev_ops->vchan_status == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->vchan_status)(dev, vchan, status);
 }
 
diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
index e7f992b734..e61d71959e 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -860,7 +860,8 @@ rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || length == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy, -ENOTSUP);
+	if (*obj->copy == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->copy)(obj->dev_private, vchan, src, dst, length, flags);
@@ -911,7 +912,8 @@ rte_dma_copy_sg(int16_t dev_id, uint16_t vchan, struct rte_dma_sge *src,
 	if (!rte_dma_is_valid(dev_id) || src == NULL || dst == NULL ||
 	    nb_src == 0 || nb_dst == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy_sg, -ENOTSUP);
+	if (*obj->copy_sg == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->copy_sg)(obj->dev_private, vchan, src, dst, nb_src,
@@ -957,7 +959,8 @@ rte_dma_fill(int16_t dev_id, uint16_t vchan, uint64_t pattern,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || length == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->fill, -ENOTSUP);
+	if (*obj->fill == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->fill)(obj->dev_private, vchan, pattern, dst, length,
@@ -990,7 +993,8 @@ rte_dma_submit(int16_t dev_id, uint16_t vchan)
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id))
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->submit, -ENOTSUP);
+	if (*obj->submit == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->submit)(obj->dev_private, vchan);
@@ -1033,7 +1037,8 @@ rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0)
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed, 0);
+	if (*obj->completed == NULL)
+		return 0;
 #endif
 
 	/* Ensure the pointer values are non-null to simplify drivers.
@@ -1095,7 +1100,8 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0 || status == NULL)
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed_status, 0);
+	if (*obj->completed_status == NULL)
+		return 0;
 #endif
 
 	if (last_idx == NULL)
@@ -1129,7 +1135,8 @@ rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan)
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id))
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->burst_capacity, 0);
+	if (*obj->burst_capacity == NULL)
+		return 0;
 #endif
 	return (*obj->burst_capacity)(obj->dev_private, vchan);
 }
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index e6ff1218f9..2743c09320 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -20,6 +20,7 @@ extern "C" {
 #include <stdio.h>
 
 #include <rte_config.h>
+#include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_log.h>
 
@@ -37,12 +38,14 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					void *cb_arg);
 
 /* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \
+do { \
 	if ((func) == NULL) \
 		return retval; \
 } while (0)
 
-#define RTE_FUNC_PTR_OR_RET(func) do { \
+#define RTE_FUNC_PTR_OR_RET(func) RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET) \
+do { \
 	if ((func) == NULL) \
 		return; \
 } while (0)
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
index a285f213f0..24a3969225 100644
--- a/lib/ethdev/ethdev_driver.c
+++ b/lib/ethdev/ethdev_driver.c
@@ -264,7 +264,8 @@ rte_eth_dev_create(struct rte_device *device, const char *name,
 	struct rte_eth_dev *ethdev;
 	int retval;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_init, -EINVAL);
+	if (*ethdev_init == NULL)
+		return -EINVAL;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		ethdev = rte_eth_dev_allocate(name);
@@ -328,7 +329,8 @@ rte_eth_dev_destroy(struct rte_eth_dev *ethdev,
 	if (!ethdev)
 		return -ENODEV;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_uninit, -EINVAL);
+	if (*ethdev_uninit == NULL)
+		return -EINVAL;
 
 	ret = ethdev_uninit(ethdev);
 	if (ret)
@@ -558,8 +560,8 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[cur_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_bind,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_bind == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_bind)(dev, cur_queue,
 							peer_info, direction);
@@ -573,8 +575,8 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[cur_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_unbind,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_unbind == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_unbind)(dev, cur_queue,
 							  direction);
@@ -594,8 +596,8 @@ rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[peer_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_update,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_update == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_update)(dev, peer_queue,
 					cur_info, peer_info, direction);
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 0549842709..a268507801 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -130,7 +130,8 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
 	if (!eth_dev)
 		return -ENOMEM;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
+	if (*dev_init == NULL)
+		return -EINVAL;
 	ret = dev_init(eth_dev);
 	if (ret)
 		rte_eth_dev_release_port(eth_dev);
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0850..9d6f460726 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -719,7 +719,8 @@ rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_start == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -751,7 +752,8 @@ rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_stop == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -790,7 +792,8 @@ rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_start == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -822,7 +825,8 @@ rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_stop == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1077,7 +1081,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started) {
 		RTE_ETHDEV_LOG(ERR,
@@ -1447,7 +1452,8 @@ rte_eth_dev_start(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1493,7 +1499,8 @@ rte_eth_dev_start(uint16_t port_id)
 	}
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 0);
 	}
 
@@ -1513,7 +1520,8 @@ rte_eth_dev_stop(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started == 0) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1541,7 +1549,8 @@ rte_eth_dev_set_link_up(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
+	if (*dev->dev_ops->dev_set_link_up == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_set_link_up)(dev));
 }
 
@@ -1553,7 +1562,8 @@ rte_eth_dev_set_link_down(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
+	if (*dev->dev_ops->dev_set_link_down == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev));
 }
 
@@ -1579,7 +1589,8 @@ rte_eth_dev_close(uint16_t port_id)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	*lasterr = (*dev->dev_ops->dev_close)(dev);
 	if (*lasterr != 0)
 		lasterr = &binerr;
@@ -1599,7 +1610,8 @@ rte_eth_dev_reset(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_reset == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_stop(port_id);
 	if (ret != 0) {
@@ -1624,7 +1636,8 @@ rte_eth_dev_is_removed(uint16_t port_id)
 	if (dev->state == RTE_ETH_DEV_REMOVED)
 		return 1;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->is_removed, 0);
+	if (*dev->dev_ops->is_removed == NULL)
+		return 0;
 
 	ret = dev->dev_ops->is_removed(dev);
 	if (ret != 0)
@@ -1725,7 +1738,8 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_setup == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
@@ -1928,8 +1942,8 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
 	if (ret != 0)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_hairpin_queue_setup,
-				-ENOTSUP);
+	if (*dev->dev_ops->rx_hairpin_queue_setup == NULL)
+		return -ENOTSUP;
 	/* if nb_rx_desc is zero use max number of desc from the driver. */
 	if (nb_rx_desc == 0)
 		nb_rx_desc = cap.max_nb_desc;
@@ -1990,7 +2004,8 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_setup == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
@@ -2094,8 +2109,8 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
 	if (ret != 0)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_hairpin_queue_setup,
-				-ENOTSUP);
+	if (*dev->dev_ops->tx_hairpin_queue_setup == NULL)
+		return -ENOTSUP;
 	/* if nb_rx_desc is zero use max number of desc from the driver. */
 	if (nb_tx_desc == 0)
 		nb_tx_desc = cap.max_nb_desc;
@@ -2152,7 +2167,8 @@ rte_eth_hairpin_bind(uint16_t tx_port, uint16_t rx_port)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_bind, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_bind == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->hairpin_bind)(dev, rx_port);
 	if (ret != 0)
 		RTE_ETHDEV_LOG(ERR, "Failed to bind hairpin Tx %d"
@@ -2176,7 +2192,8 @@ rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_unbind, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_unbind == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->hairpin_unbind)(dev, rx_port);
 	if (ret != 0)
 		RTE_ETHDEV_LOG(ERR, "Failed to unbind hairpin Tx %d"
@@ -2210,8 +2227,8 @@ rte_eth_hairpin_get_peer_ports(uint16_t port_id, uint16_t *peer_ports,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_get_peer_ports,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_get_peer_ports == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->hairpin_get_peer_ports)(dev, peer_ports,
 						      len, direction);
@@ -2282,7 +2299,8 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_done_cleanup, -ENOTSUP);
+	if (*dev->dev_ops->tx_done_cleanup == NULL)
+		return -ENOTSUP;
 
 	/* Call driver to free pending mbufs. */
 	ret = (*dev->dev_ops->tx_done_cleanup)(dev->data->tx_queues[queue_id],
@@ -2302,7 +2320,8 @@ rte_eth_promiscuous_enable(uint16_t port_id)
 	if (dev->data->promiscuous == 1)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
+	if (*dev->dev_ops->promiscuous_enable == NULL)
+		return -ENOTSUP;
 
 	diag = (*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = (diag == 0) ? 1 : 0;
@@ -2322,7 +2341,8 @@ rte_eth_promiscuous_disable(uint16_t port_id)
 	if (dev->data->promiscuous == 0)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
+	if (*dev->dev_ops->promiscuous_disable == NULL)
+		return -ENOTSUP;
 
 	dev->data->promiscuous = 0;
 	diag = (*dev->dev_ops->promiscuous_disable)(dev);
@@ -2355,7 +2375,8 @@ rte_eth_allmulticast_enable(uint16_t port_id)
 	if (dev->data->all_multicast == 1)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_enable, -ENOTSUP);
+	if (*dev->dev_ops->allmulticast_enable == NULL)
+		return -ENOTSUP;
 	diag = (*dev->dev_ops->allmulticast_enable)(dev);
 	dev->data->all_multicast = (diag == 0) ? 1 : 0;
 
@@ -2374,7 +2395,8 @@ rte_eth_allmulticast_disable(uint16_t port_id)
 	if (dev->data->all_multicast == 0)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_disable, -ENOTSUP);
+	if (*dev->dev_ops->allmulticast_disable == NULL)
+		return -ENOTSUP;
 	dev->data->all_multicast = 0;
 	diag = (*dev->dev_ops->allmulticast_disable)(dev);
 	if (diag != 0)
@@ -2411,7 +2433,8 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link)
 	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
 		rte_eth_linkstatus_get(dev, eth_link);
 	else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 1);
 		*eth_link = dev->data->dev_link;
 	}
@@ -2436,7 +2459,8 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link)
 	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
 		rte_eth_linkstatus_get(dev, eth_link);
 	else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 0);
 		*eth_link = dev->data->dev_link;
 	}
@@ -2513,7 +2537,8 @@ rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats)
 
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
 	return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats));
 }
@@ -2527,7 +2552,8 @@ rte_eth_stats_reset(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->stats_reset)(dev);
 	if (ret != 0)
 		return eth_err(port_id, ret);
@@ -3043,7 +3069,8 @@ eth_dev_set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id,
 	if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+	if (*dev->dev_ops->queue_stats_mapping_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_stats_mapping_set) (dev, queue_id, stat_idx, is_rx);
 }
 
@@ -3080,7 +3107,8 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	if (*dev->dev_ops->fw_version_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fw_version_get)(dev,
 							fw_version, fw_size));
 }
@@ -3121,7 +3149,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
 		RTE_ETHER_CRC_LEN;
 	dev_info->max_mtu = UINT16_MAX;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	diag = (*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	if (diag != 0) {
 		/* Cleanup already filled in device information */
@@ -3182,7 +3211,8 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_supported_ptypes_get, 0);
+	if (*dev->dev_ops->dev_supported_ptypes_get == NULL)
+		return 0;
 	all_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev);
 
 	if (!all_ptypes)
@@ -3360,7 +3390,8 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
+	if (*dev->dev_ops->mtu_set == NULL)
+		return -ENOTSUP;
 
 	/*
 	 * Check if the device supports dev_infos_get, if it does not
@@ -3413,7 +3444,8 @@ rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
 			port_id, vlan_id);
 		return -EINVAL;
 	}
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_filter_set == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
 	if (ret == 0) {
@@ -3448,7 +3480,8 @@ rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on);
 
 	return 0;
@@ -3464,7 +3497,8 @@ rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_tpid_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->vlan_tpid_set)(dev, vlan_type,
 							       tpid));
 }
@@ -3549,7 +3583,8 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_offload_set == NULL)
+		return -ENOTSUP;
 	dev->data->dev_conf.rxmode.offloads = dev_offloads;
 	ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);
 	if (ret) {
@@ -3594,7 +3629,8 @@ rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_pvid_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->vlan_pvid_set)(dev, pvid, on));
 }
 
@@ -3613,7 +3649,8 @@ rte_eth_dev_flow_ctrl_get(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
+	if (*dev->dev_ops->flow_ctrl_get == NULL)
+		return -ENOTSUP;
 	memset(fc_conf, 0, sizeof(*fc_conf));
 	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf));
 }
@@ -3638,7 +3675,8 @@ rte_eth_dev_flow_ctrl_set(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
+	if (*dev->dev_ops->flow_ctrl_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf));
 }
 
@@ -3899,7 +3937,8 @@ rte_eth_dev_rss_reta_update(uint16_t port_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
+	if (*dev->dev_ops->reta_update == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->reta_update)(dev, reta_conf,
 							     reta_size));
 }
@@ -3927,7 +3966,8 @@ rte_eth_dev_rss_reta_query(uint16_t port_id,
 	if (ret < 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
+	if (*dev->dev_ops->reta_query == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->reta_query)(dev, reta_conf,
 							    reta_size));
 }
@@ -3971,7 +4011,8 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
+	if (*dev->dev_ops->rss_hash_update == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
 								 rss_conf));
 }
@@ -3992,7 +4033,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
+	if (*dev->dev_ops->rss_hash_conf_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev,
 								   rss_conf));
 }
@@ -4018,7 +4060,8 @@ rte_eth_dev_udp_tunnel_port_add(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP);
+	if (*dev->dev_ops->udp_tunnel_port_add == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_add)(dev,
 								udp_tunnel));
 }
@@ -4044,7 +4087,8 @@ rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP);
+	if (*dev->dev_ops->udp_tunnel_port_del == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_del)(dev,
 								udp_tunnel));
 }
@@ -4057,7 +4101,8 @@ rte_eth_led_on(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
+	if (*dev->dev_ops->dev_led_on == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_led_on)(dev));
 }
 
@@ -4069,7 +4114,8 @@ rte_eth_led_off(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
+	if (*dev->dev_ops->dev_led_off == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev));
 }
 
@@ -4091,7 +4137,8 @@ rte_eth_fec_get_capability(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get_capability, -ENOTSUP);
+	if (*dev->dev_ops->fec_get_capability == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->fec_get_capability)(dev, speed_fec_capa, num);
 
 	return ret;
@@ -4112,7 +4159,8 @@ rte_eth_fec_get(uint16_t port_id, uint32_t *fec_capa)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get, -ENOTSUP);
+	if (*dev->dev_ops->fec_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fec_get)(dev, fec_capa));
 }
 
@@ -4124,7 +4172,8 @@ rte_eth_fec_set(uint16_t port_id, uint32_t fec_capa)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_set, -ENOTSUP);
+	if (*dev->dev_ops->fec_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fec_set)(dev, fec_capa));
 }
 
@@ -4173,7 +4222,8 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_add == NULL)
+		return -ENOTSUP;
 
 	if (rte_is_zero_ether_addr(addr)) {
 		RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n",
@@ -4231,7 +4281,8 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_remove == NULL)
+		return -ENOTSUP;
 
 	index = eth_dev_get_mac_addr_index(port_id, addr);
 	if (index == 0) {
@@ -4273,7 +4324,8 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)
 	if (!rte_is_valid_assigned_ether_addr(addr))
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_set == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->mac_addr_set)(dev, addr);
 	if (ret < 0)
@@ -4359,7 +4411,8 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr,
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
+	if (*dev->dev_ops->uc_hash_table_set == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
 	if (ret == 0) {
 		/* Update address in NIC data structure */
@@ -4382,7 +4435,8 @@ rte_eth_dev_uc_all_hash_table_set(uint16_t port_id, uint8_t on)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
+	if (*dev->dev_ops->uc_all_hash_table_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->uc_all_hash_table_set)(dev,
 								       on));
 }
@@ -4418,7 +4472,8 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
+	if (*dev->dev_ops->set_queue_rate_limit == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->set_queue_rate_limit)(dev,
 							queue_idx, tx_rate));
 }
@@ -4444,7 +4499,8 @@ int rte_eth_rx_avail_thresh_set(uint16_t port_id, uint16_t queue_id,
 			port_id);
 		return -EINVAL;
 	}
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_set, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_avail_thresh_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_set)(dev,
 							     queue_id, avail_thresh));
 }
@@ -4462,7 +4518,8 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,
 	if (*queue_id >= dev->data->nb_rx_queues)
 		*queue_id = 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_query, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_avail_thresh_query == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_query)(dev,
 							     queue_id, avail_thresh));
 }
@@ -4736,7 +4793,8 @@ rte_eth_dev_rx_intr_enable(uint16_t port_id,
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_intr_enable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id));
 }
 
@@ -4754,7 +4812,8 @@ rte_eth_dev_rx_intr_disable(uint16_t port_id,
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_intr_disable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id));
 }
 
@@ -5018,7 +5077,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+	if (*dev->dev_ops->rxq_info_get == NULL)
+		return -ENOTSUP;
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
@@ -5063,7 +5123,8 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+	if (*dev->dev_ops->txq_info_get == NULL)
+		return -ENOTSUP;
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
@@ -5093,7 +5154,8 @@ rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_burst_mode_get, -ENOTSUP);
+	if (*dev->dev_ops->rx_burst_mode_get == NULL)
+		return -ENOTSUP;
 	memset(mode, 0, sizeof(*mode));
 	return eth_err(port_id,
 		       dev->dev_ops->rx_burst_mode_get(dev, queue_id, mode));
@@ -5120,7 +5182,8 @@ rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_burst_mode_get, -ENOTSUP);
+	if (*dev->dev_ops->tx_burst_mode_get == NULL)
+		return -ENOTSUP;
 	memset(mode, 0, sizeof(*mode));
 	return eth_err(port_id,
 		       dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode));
@@ -5147,7 +5210,8 @@ rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_monitor_addr, -ENOTSUP);
+	if (*dev->dev_ops->get_monitor_addr == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		dev->dev_ops->get_monitor_addr(dev->data->rx_queues[queue_id], pmc));
 }
@@ -5162,7 +5226,8 @@ rte_eth_dev_set_mc_addr_list(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
+	if (*dev->dev_ops->set_mc_addr_list == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, dev->dev_ops->set_mc_addr_list(dev,
 						mc_addr_set, nb_mc_addr));
 }
@@ -5175,7 +5240,8 @@ rte_eth_timesync_enable(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
+	if (*dev->dev_ops->timesync_enable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_enable)(dev));
 }
 
@@ -5187,7 +5253,8 @@ rte_eth_timesync_disable(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
+	if (*dev->dev_ops->timesync_disable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_disable)(dev));
 }
 
@@ -5207,7 +5274,8 @@ rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_rx_timestamp == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_rx_timestamp)
 				(dev, timestamp, flags));
 }
@@ -5228,7 +5296,8 @@ rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_tx_timestamp == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_tx_timestamp)
 				(dev, timestamp));
 }
@@ -5241,7 +5310,8 @@ rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_adjust_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_adjust_time)(dev, delta));
 }
 
@@ -5260,7 +5330,8 @@ rte_eth_timesync_read_time(uint16_t port_id, struct timespec *timestamp)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_time)(dev,
 								timestamp));
 }
@@ -5280,7 +5351,8 @@ rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_write_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_write_time)(dev,
 								timestamp));
 }
@@ -5299,7 +5371,8 @@ rte_eth_read_clock(uint16_t port_id, uint64_t *clock)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->read_clock, -ENOTSUP);
+	if (*dev->dev_ops->read_clock == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->read_clock)(dev, clock));
 }
 
@@ -5318,7 +5391,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
+	if (*dev->dev_ops->get_reg == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_reg)(dev, info));
 }
 
@@ -5330,7 +5404,8 @@ rte_eth_dev_get_eeprom_length(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
+	if (*dev->dev_ops->get_eeprom_length == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_eeprom_length)(dev));
 }
 
@@ -5349,7 +5424,8 @@ rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->get_eeprom == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_eeprom)(dev, info));
 }
 
@@ -5368,7 +5444,8 @@ rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->set_eeprom == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->set_eeprom)(dev, info));
 }
 
@@ -5388,7 +5465,8 @@ rte_eth_dev_get_module_info(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_info, -ENOTSUP);
+	if (*dev->dev_ops->get_module_info == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->get_module_info)(dev, modinfo);
 }
 
@@ -5422,7 +5500,8 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->get_module_eeprom == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->get_module_eeprom)(dev, info);
 }
 
@@ -5444,7 +5523,8 @@ rte_eth_dev_get_dcb_info(uint16_t port_id,
 
 	memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
+	if (*dev->dev_ops->get_dcb_info == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_dcb_info)(dev, dcb_info));
 }
 
@@ -5500,7 +5580,8 @@ rte_eth_dev_hairpin_capability_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_cap_get, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_cap_get == NULL)
+		return -ENOTSUP;
 	memset(cap, 0, sizeof(*cap));
 	return eth_err(port_id, (*dev->dev_ops->hairpin_cap_get)(dev, cap));
 }
@@ -5775,7 +5856,8 @@ rte_eth_representor_info_get(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->representor_info_get, -ENOTSUP);
+	if (*dev->dev_ops->representor_info_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->representor_info_get)(dev, info));
 }
 
@@ -5799,7 +5881,8 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_metadata_negotiate, -ENOTSUP);
+	if (*dev->dev_ops->rx_metadata_negotiate == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		       (*dev->dev_ops->rx_metadata_negotiate)(dev, features));
 }
@@ -5826,8 +5909,8 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_capability_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_capability_get == NULL)
+		return -ENOTSUP;
 	memset(reassembly_capa, 0, sizeof(struct rte_eth_ip_reassembly_params));
 
 	return eth_err(port_id, (*dev->dev_ops->ip_reassembly_capability_get)
@@ -5856,8 +5939,8 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_conf_get == NULL)
+		return -ENOTSUP;
 	memset(conf, 0, sizeof(struct rte_eth_ip_reassembly_params));
 	return eth_err(port_id,
 		       (*dev->dev_ops->ip_reassembly_conf_get)(dev, conf));
@@ -5894,8 +5977,8 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_set,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_conf_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		       (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf));
 }
@@ -5913,7 +5996,8 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP);
+	if (*dev->dev_ops->eth_dev_priv_dump == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file));
 }
 
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index de9e970d4d..41d37e41b5 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -5710,7 +5710,8 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
 	qd = p->rxq.data[queue_id];
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_queue_count, -ENOTSUP);
+	if (*p->rx_queue_count == NULL)
+		return -ENOTSUP;
 	if (qd == NULL)
 		return -EINVAL;
 
@@ -5784,7 +5785,8 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
 	if (qd == NULL)
 		return -ENODEV;
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_descriptor_status, -ENOTSUP);
+	if (*p->rx_descriptor_status == NULL)
+		return -ENOTSUP;
 	return (*p->rx_descriptor_status)(qd, offset);
 }
 
@@ -5854,7 +5856,8 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
 	if (qd == NULL)
 		return -ENODEV;
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*p->tx_descriptor_status, -ENOTSUP);
+	if (*p->tx_descriptor_status == NULL)
+		return -ENOTSUP;
 	return (*p->tx_descriptor_status)(qd, offset);
 }
 
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7c695176f4..4938b4ee07 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -974,9 +974,8 @@ rte_event_crypto_adapter_queue_pair_add(uint8_t id,
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW) ||
 	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->crypto_adapter_queue_pair_add,
-			-ENOTSUP);
+		if (*dev->dev_ops->crypto_adapter_queue_pair_add == NULL)
+			return -ENOTSUP;
 		if (dev_info->qpairs == NULL) {
 			dev_info->qpairs =
 			    rte_zmalloc_socket(adapter->mem_name,
@@ -1076,9 +1075,8 @@ rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id,
 	if ((cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
 	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->crypto_adapter_queue_pair_del,
-			-ENOTSUP);
+		if (*dev->dev_ops->crypto_adapter_queue_pair_del == NULL)
+			return -ENOTSUP;
 		ret = (*dev->dev_ops->crypto_adapter_queue_pair_del)(dev,
 						dev_info->dev,
 						queue_pair_id);
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bf8741d2ea..8e81cf774d 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2655,8 +2655,8 @@ rte_event_eth_rx_adapter_queue_add(uint8_t id,
 	dev_info = &rx_adapter->eth_devices[eth_dev_id];
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_add,
-					-ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_queue_add == NULL)
+			return -ENOTSUP;
 		if (dev_info->rx_queue == NULL) {
 			dev_info->rx_queue =
 			    rte_zmalloc_socket(rx_adapter->mem_name,
@@ -2750,8 +2750,8 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
 	dev_info = &rx_adapter->eth_devices[eth_dev_id];
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_del,
-				 -ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_queue_del == NULL)
+			return -ENOTSUP;
 		ret = (*dev->dev_ops->eth_rx_adapter_queue_del)(dev,
 						&rte_eth_devices[eth_dev_id],
 						rx_queue_id);
@@ -2861,9 +2861,8 @@ rte_event_eth_rx_adapter_vector_limits_get(
 	}
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->eth_rx_adapter_vector_limits_get,
-			-ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_vector_limits_get == NULL)
+			return -ENOTSUP;
 		ret = dev->dev_ops->eth_rx_adapter_vector_limits_get(
 			dev, &rte_eth_devices[eth_port_id], limits);
 	} else {
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 1dc4f966be..79b905e9fc 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -92,7 +92,8 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_event_dev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns;
@@ -216,7 +217,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 
 	if (nb_queues != 0) {
 		queues_cfg = dev->data->queues_cfg;
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+		if (*dev->dev_ops->queue_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
@@ -229,7 +231,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 				sizeof(queues_cfg[0]) * new_qs);
 		}
 	} else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+		if (*dev->dev_ops->queue_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
@@ -254,7 +257,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 			 dev->data->dev_id);
 
 	if (nb_ports != 0) { /* re-config */
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
+		if (*dev->dev_ops->port_release == NULL)
+			return -ENOTSUP;
 
 		ports = dev->data->ports;
 		ports_cfg = dev->data->ports_cfg;
@@ -279,7 +283,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 	} else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
+		if (*dev->dev_ops->port_release == NULL)
+			return -ENOTSUP;
 
 		ports = dev->data->ports;
 		for (i = nb_ports; i < old_nb_ports; i++) {
@@ -303,8 +308,10 @@ rte_event_dev_configure(uint8_t dev_id,
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started) {
 		RTE_EDEV_LOG_ERR(
@@ -509,7 +516,8 @@ rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->queue_def_conf == NULL)
+		return -ENOTSUP;
 	memset(queue_conf, 0, sizeof(struct rte_event_queue_conf));
 	(*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf);
 	return 0;
@@ -595,11 +603,12 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_setup == NULL)
+		return -ENOTSUP;
 
 	if (queue_conf == NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf,
-					-ENOTSUP);
+		if (*dev->dev_ops->queue_def_conf == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->queue_def_conf)(dev, queue_id, &def_conf);
 		queue_conf = &def_conf;
 	}
@@ -635,7 +644,8 @@ rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->port_def_conf == NULL)
+		return -ENOTSUP;
 	memset(port_conf, 0, sizeof(struct rte_event_port_conf));
 	(*dev->dev_ops->port_def_conf)(dev, port_id, port_conf);
 	return 0;
@@ -706,11 +716,12 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_setup, -ENOTSUP);
+	if (*dev->dev_ops->port_setup == NULL)
+		return -ENOTSUP;
 
 	if (port_conf == NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf,
-					-ENOTSUP);
+		if (*dev->dev_ops->port_def_conf == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->port_def_conf)(dev, port_id, &def_conf);
 		port_conf = &def_conf;
 	}
@@ -896,7 +907,8 @@ rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
+	if (*dev->dev_ops->queue_attr_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_attr_set)(dev, queue_id, attr_id,
 					       attr_value);
 }
@@ -1045,7 +1057,8 @@ rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id)
 	 * This allows PMDs which handle unlink synchronously to not implement
 	 * this function at all.
 	 */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_unlinks_in_progress, 0);
+	if (*dev->dev_ops->port_unlinks_in_progress == NULL)
+		return 0;
 
 	return (*dev->dev_ops->port_unlinks_in_progress)(dev,
 			dev->data->ports[port_id]);
@@ -1087,7 +1100,8 @@ rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timeout_ticks, -ENOTSUP);
+	if (*dev->dev_ops->timeout_ticks == NULL)
+		return -ENOTSUP;
 
 	if (timeout_ticks == NULL)
 		return -EINVAL;
@@ -1119,7 +1133,8 @@ rte_event_dev_dump(uint8_t dev_id, FILE *f)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+	if (*dev->dev_ops->dump == NULL)
+		return -ENOTSUP;
 	if (f == NULL)
 		return -EINVAL;
 
@@ -1285,7 +1300,8 @@ rte_event_dev_start(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already started",
@@ -1331,7 +1347,8 @@ rte_event_dev_stop(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already stopped",
@@ -1352,7 +1369,8 @@ rte_event_dev_close(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 
 	/* Device must be stopped before it can be closed */
 	if (dev->data->dev_started == 1) {
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 2d36dee8f0..ac32c4bb72 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -154,7 +154,8 @@ rte_mempool_ops_get_info(const struct rte_mempool *mp,
 
 	ops = rte_mempool_get_ops(mp->ops_index);
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->get_info, -ENOTSUP);
+	if (ops->get_info == NULL)
+		return -ENOTSUP;
 	return ops->get_info(mp, info);
 }
 
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index 2f0a4f132e..e157d65332 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -71,12 +71,14 @@ rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info,
 	int ret = 0;
 
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(dev_info, -EINVAL);
+	if (dev_info == NULL)
+		return -EINVAL;
 
 	rawdev = &rte_rawdevs[dev_id];
 
 	if (dev_info->dev_private != NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*rawdev->dev_ops->dev_info_get, -ENOTSUP);
+		if (*rawdev->dev_ops->dev_info_get == NULL)
+			return -ENOTSUP;
 		ret = (*rawdev->dev_ops->dev_info_get)(rawdev,
 				dev_info->dev_private,
 				dev_private_size);
@@ -97,11 +99,13 @@ rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf,
 	int diag;
 
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(dev_conf, -EINVAL);
+	if (dev_conf == NULL)
+		return -EINVAL;
 
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->started) {
 		RTE_RDEV_ERR(
@@ -131,7 +135,8 @@ rte_rawdev_queue_conf_get(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->queue_def_conf == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf,
 			queue_conf_size);
 }
@@ -147,7 +152,8 @@ rte_rawdev_queue_setup(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_setup == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf,
 			queue_conf_size);
 }
@@ -160,7 +166,8 @@ rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+	if (*dev->dev_ops->queue_release == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_release)(dev, queue_id);
 }
 
@@ -172,7 +179,8 @@ rte_rawdev_queue_count(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_count, -ENOTSUP);
+	if (*dev->dev_ops->queue_count == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_count)(dev);
 }
 
@@ -186,7 +194,8 @@ rte_rawdev_get_attr(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_get, -ENOTSUP);
+	if (*dev->dev_ops->attr_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->attr_get)(dev, attr_name, attr_value);
 }
 
@@ -200,7 +209,8 @@ rte_rawdev_set_attr(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_set, -ENOTSUP);
+	if (*dev->dev_ops->attr_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->attr_set)(dev, attr_name, attr_value);
 }
 
@@ -215,7 +225,8 @@ rte_rawdev_enqueue_buffers(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->enqueue_bufs, -ENOTSUP);
+	if (*dev->dev_ops->enqueue_bufs == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->enqueue_bufs)(dev, buffers, count, context);
 }
 
@@ -230,7 +241,8 @@ rte_rawdev_dequeue_buffers(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dequeue_bufs, -ENOTSUP);
+	if (*dev->dev_ops->dequeue_bufs == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dequeue_bufs)(dev, buffers, count, context);
 }
 
@@ -242,7 +254,8 @@ rte_rawdev_dump(uint16_t dev_id, FILE *f)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+	if (*dev->dev_ops->dump == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dump)(dev, f);
 }
 
@@ -251,7 +264,8 @@ xstats_get_count(uint16_t dev_id)
 {
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_names == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_names)(dev, NULL, 0);
 }
 
@@ -273,7 +287,8 @@ rte_rawdev_xstats_names_get(uint16_t dev_id,
 
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_names == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_names)(dev, xstats_names, size);
 }
 
@@ -287,7 +302,8 @@ rte_rawdev_xstats_get(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
 	const struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get)(dev, ids, values, n);
 }
 
@@ -306,7 +322,8 @@ rte_rawdev_xstats_by_name_get(uint16_t dev_id,
 		id = &temp; /* driver never gets a NULL value */
 
 	/* implemented by driver */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_by_name, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_by_name == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_by_name)(dev, name, id);
 }
 
@@ -317,7 +334,8 @@ rte_rawdev_xstats_reset(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_reset, -ENOTSUP);
+	if (*dev->dev_ops->xstats_reset == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids);
 }
 
@@ -327,7 +345,8 @@ rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_status_get, -ENOTSUP);
+	if (*dev->dev_ops->firmware_status_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_status_get)(dev, status_info);
 }
 
@@ -337,7 +356,8 @@ rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_version_get, -ENOTSUP);
+	if (*dev->dev_ops->firmware_version_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_version_get)(dev, version_info);
 }
 
@@ -350,7 +370,8 @@ rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image)
 	if (!firmware_image)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
+	if (*dev->dev_ops->firmware_load == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_load)(dev, firmware_image);
 }
 
@@ -360,7 +381,8 @@ rte_rawdev_firmware_unload(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
+	if (*dev->dev_ops->firmware_load == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_unload)(dev);
 }
 
@@ -370,7 +392,8 @@ rte_rawdev_selftest(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+	if (*dev->dev_ops->dev_selftest == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_selftest)(dev_id);
 }
 
@@ -435,7 +458,8 @@ rte_rawdev_close(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	/* Device must be stopped before it can be closed */
 	if (dev->started == 1) {
 		RTE_RDEV_ERR("Device %u must be stopped before closing",
@@ -454,7 +478,8 @@ rte_rawdev_reset(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_reset == NULL)
+		return -ENOTSUP;
 	/* Reset is not dependent on state of the device */
 	return (*dev->dev_ops->dev_reset)(dev);
 }
diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
index 02a388bc5d..caec069182 100644
--- a/lib/regexdev/rte_regexdev.c
+++ b/lib/regexdev/rte_regexdev.c
@@ -189,7 +189,8 @@ regexdev_info_get(uint8_t dev_id, struct rte_regexdev_info *dev_info)
 	if (dev_info == NULL)
 		return -EINVAL;
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_info_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_info_get)(dev, dev_info);
 
 }
@@ -211,7 +212,8 @@ rte_regexdev_configure(uint8_t dev_id, const struct rte_regexdev_config *cfg)
 	if (cfg == NULL)
 		return -EINVAL;
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 	if (dev->data->dev_started) {
 		RTE_REGEXDEV_LOG
 			(ERR, "Dev %u must be stopped to allow configuration\n",
@@ -301,7 +303,8 @@ rte_regexdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_qp_setup, -ENOTSUP);
+	if (*dev->dev_ops->dev_qp_setup == NULL)
+		return -ENOTSUP;
 	if (dev->data->dev_started) {
 		RTE_REGEXDEV_LOG
 			(ERR, "Dev %u must be stopped to allow configuration\n",
@@ -332,7 +335,8 @@ rte_regexdev_start(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_start)(dev);
 	if (ret == 0)
 		dev->data->dev_started = 1;
@@ -346,7 +350,8 @@ rte_regexdev_stop(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_stop)(dev);
 	dev->data->dev_started = 0;
 	return 0;
@@ -359,7 +364,8 @@ rte_regexdev_close(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_close)(dev);
 	dev->data->dev_started = 0;
 	dev->state = RTE_REGEXDEV_UNUSED;
@@ -374,7 +380,8 @@ rte_regexdev_attr_get(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_attr_get == NULL)
+		return -ENOTSUP;
 	if (attr_value == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
 				 dev_id);
@@ -391,7 +398,8 @@ rte_regexdev_attr_set(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_set, -ENOTSUP);
+	if (*dev->dev_ops->dev_attr_set == NULL)
+		return -ENOTSUP;
 	if (attr_value == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
 				 dev_id);
@@ -409,7 +417,8 @@ rte_regexdev_rule_db_update(uint8_t dev_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_update, -ENOTSUP);
+	if (*dev->dev_ops->dev_rule_db_update == NULL)
+		return -ENOTSUP;
 	if (rules == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
 				 dev_id);
@@ -425,8 +434,8 @@ rte_regexdev_rule_db_compile_activate(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_compile_activate,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_rule_db_compile_activate == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_rule_db_compile_activate)(dev);
 }
 
@@ -438,8 +447,8 @@ rte_regexdev_rule_db_import(uint8_t dev_id, const char *rule_db,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_import,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_db_import == NULL)
+		return -ENOTSUP;
 	if (rule_db == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
 				 dev_id);
@@ -455,8 +464,8 @@ rte_regexdev_rule_db_export(uint8_t dev_id, char *rule_db)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_export,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_db_export == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_db_export)(dev, rule_db);
 }
 
@@ -468,8 +477,8 @@ rte_regexdev_xstats_names_get(uint8_t dev_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_names_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_names_get == NULL)
+		return -ENOTSUP;
 	if (xstats_map == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d xstats map can't be NULL\n",
 				 dev_id);
@@ -486,7 +495,8 @@ rte_regexdev_xstats_get(uint8_t dev_id, const uint16_t *ids,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_get == NULL)
+		return -ENOTSUP;
 	if (ids == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -506,8 +516,8 @@ rte_regexdev_xstats_by_name_get(uint8_t dev_id, const char *name,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_by_name_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_by_name_get == NULL)
+		return -ENOTSUP;
 	if (name == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d name can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -531,7 +541,8 @@ rte_regexdev_xstats_reset(uint8_t dev_id, const uint16_t *ids,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_reset == NULL)
+		return -ENOTSUP;
 	if (ids == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -546,7 +557,8 @@ rte_regexdev_selftest(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+	if (*dev->dev_ops->dev_selftest == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_selftest)(dev);
 }
 
@@ -557,7 +569,8 @@ rte_regexdev_dump(uint8_t dev_id, FILE *f)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_dump, -ENOTSUP);
+	if (*dev->dev_ops->dev_dump == NULL)
+		return -ENOTSUP;
 	if (f == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d file can't be NULL\n", dev_id);
 		return -EINVAL;
diff --git a/lib/regexdev/rte_regexdev.h b/lib/regexdev/rte_regexdev.h
index 3bce8090f6..6061e648b1 100644
--- a/lib/regexdev/rte_regexdev.h
+++ b/lib/regexdev/rte_regexdev.h
@@ -1473,7 +1473,8 @@ rte_regexdev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
 #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->enqueue, -ENOTSUP);
+	if (*dev->enqueue == NULL)
+		return -ENOTSUP;
 	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
 		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
 		return -EINVAL;
@@ -1532,7 +1533,8 @@ rte_regexdev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
 	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
 #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dequeue, -ENOTSUP);
+	if (*dev->dequeue == NULL)
+		return -ENOTSUP;
 	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
 		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
 		return -EINVAL;
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..1a2a408f0e 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -131,7 +131,8 @@ __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
 	RTE_PTR_OR_ERR_RET(instance, -EINVAL);
 	RTE_PTR_OR_ERR_RET(instance->ops, -EINVAL);
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->set_pkt_metadata, -ENOTSUP);
+	if (*instance->ops->set_pkt_metadata == NULL)
+		return -ENOTSUP;
 	return instance->ops->set_pkt_metadata(instance->device,
 					       sess, m, params);
 }
@@ -145,7 +146,8 @@ __rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md)
 	RTE_PTR_OR_ERR_RET(instance, NULL);
 	RTE_PTR_OR_ERR_RET(instance->ops, NULL);
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_userdata, NULL);
+	if (*instance->ops->get_userdata == NULL)
+		return NULL;
 	if (instance->ops->get_userdata(instance->device, md, &userdata))
 		return NULL;
 
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index b2a2919fc0..a6ca785b29 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -266,7 +266,8 @@ rte_vdpa_get_stats_names(struct rte_vdpa_device *dev,
 	if (!dev)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats_names, -ENOTSUP);
+	if (dev->ops->get_stats_names == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->get_stats_names(dev, stats_names, size);
 }
@@ -278,7 +279,8 @@ rte_vdpa_get_stats(struct rte_vdpa_device *dev, uint16_t qid,
 	if (!dev || !stats || !n)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats, -ENOTSUP);
+	if (dev->ops->get_stats == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->get_stats(dev, qid, stats, n);
 }
@@ -289,7 +291,8 @@ rte_vdpa_reset_stats(struct rte_vdpa_device *dev, uint16_t qid)
 	if (!dev)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->reset_stats, -ENOTSUP);
+	if (dev->ops->reset_stats == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->reset_stats(dev, qid);
 }
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 4ad28bac45..0ae059ad29 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -3381,8 +3381,10 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable)
 		q_last = qid;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_vfio_device_fd, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_notify_area, -ENOTSUP);
+	if (vdpa_dev->ops->get_vfio_device_fd == NULL)
+		return -ENOTSUP;
+	if (vdpa_dev->ops->get_notify_area == NULL)
+		return -ENOTSUP;
 
 	vfio_device_fd = vdpa_dev->ops->get_vfio_device_fd(vid);
 	if (vfio_device_fd < 0)
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 00/27] Bus and device cleanup for 22.11
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (14 preceding siblings ...)
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
@ 2022-09-05  8:39 ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 01/27] devtools: forbid inclusions of driver only headers David Marchand
                     ` (26 more replies)
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  16 siblings, 27 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

The rte_bus, rte_driver and rte_device objects are part of the public
ABI and this has proved to be a problem when needing to extend them.
This series hides them, and mark associated driver only API as internal.

A good amount of the patches are preparation work on rte_bus.h,
rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
between them.

PCI bus specific handling are removed from testpmd, unit tests and
examples.

After this series, driver-only API headers for registering to buses are
not exported anymore, unless the enable_driver_sdk meson option is
selected.

New accessors for rte_bus, rte_driver and rte_device have been added,
marked with an experimental tag first when introducing them, and later
in the series marked as stable since external users will want to use
those drop-in replacements right away.

A check is added to ensure we won't pollute app/ and examples/ again,
though some unit tests are left intentionnally untouched as they test
some internals of DPDK.

Changes since v4:
- (hopefully, because I can't test) fixed Windows build,
- dropped unneeded change in vdev unit test,

Changes since RFC v3:
- marked the series as non-RFC,
- rebased on v22.11-rc0,
- marked RTE_FUNC_PTR_* macros as deprecated,
- split the bus specific patch in two patches,

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (27):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  eal: deprecate RTE_FUNC_PTR_* macros
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide bus specific information
  bus/pci: fill bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   5 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |  20 +-
 doc/guides/rel_notes/release_22_11.rst        |  19 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 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 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  52 ++-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |  35 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   8 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 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             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  21 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  25 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |  48 ++-
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |  45 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_dev.h                     | 104 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       | 277 +++++++++-----
 lib/ethdev/rte_ethdev.h                       |  11 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  12 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  15 +-
 lib/eventdev/rte_eventdev.c                   |  64 ++--
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   5 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |  77 ++--
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |  59 +--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   8 +-
 lib/vhost/vdpa.c                              |  10 +-
 lib/vhost/vhost_user.c                        |   6 +-
 367 files changed, 2225 insertions(+), 2490 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 01/27] devtools: forbid inclusions of driver only headers
  2022-09-05  8:39 ` David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 02/27] common/mlx5: rework check on driver registration David Marchand
                     ` (25 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Let's be good citizens and enforce not using driver only headers in our
own examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 1edc5810ad..0e82c01947 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -142,6 +142,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid inclusion of driver specific headers in apps and examples
+	awk -v FOLDERS='app examples' \
+		-v EXPRESSIONS='include.*_driver\\.h include.*_pmd\\.h' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using driver specific headers in applications' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# SVG must be included with wildcard extension to allow conversion
 	awk -v FOLDERS='doc' \
 		-v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 02/27] common/mlx5: rework check on driver registration
  2022-09-05  8:39 ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 01/27] devtools: forbid inclusions of driver only headers David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (24 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Matan Azrad, Viacheslav Ovsiienko

Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@ static struct rte_auxiliary_driver mlx5_auxiliary_driver = {
 	.dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-	if (mlx5_auxiliary_driver.bus == NULL)
+	if (!mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_register(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = true;
+	}
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-	if (mlx5_auxiliary_driver.bus != NULL)
+	if (mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = false;
+	}
 }
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor
  2022-09-05  8:39 ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 01/27] devtools: forbid inclusions of driver only headers David Marchand
  2022-09-05  8:39   ` [PATCH v5 02/27] common/mlx5: rework check on driver registration David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 04/27] app/testpmd: drop PCI register commands David Marchand
                     ` (23 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * raw/dpaa2_cmdif: The ``dpaa2_cmdif`` rawdev driver will be deprecated
   in DPDK 22.11, as it is no longer in use, no active user known.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 04/27] app/testpmd: drop PCI register commands
  2022-09-05  8:39 ` David Marchand
                     ` (2 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 05/27] kni: stop populating PCI info in examples David Marchand
                     ` (22 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang

Those commands date back to the early stages of DPDK when only PCI
devices were supported.
At the time, developers may have used those commands to help in
debugging their buggy^Wwork in progress drivers.

Removing them, we can drop the dependency on the PCI bus and library and
make testpmd bus agnostic.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/cmdline.c                      | 339 +-------------------
 app/test-pmd/config.c                       | 195 -----------
 app/test-pmd/csumonly.c                     |   1 -
 app/test-pmd/flowgen.c                      |   1 -
 app/test-pmd/iofwd.c                        |   1 -
 app/test-pmd/macfwd.c                       |   1 -
 app/test-pmd/macswap.c                      |   1 -
 app/test-pmd/meson.build                    |   2 +-
 app/test-pmd/parameters.c                   |   1 -
 app/test-pmd/rxonly.c                       |   1 -
 app/test-pmd/testpmd.c                      |   1 -
 app/test-pmd/testpmd.h                      |  72 +----
 app/test-pmd/txonly.c                       |   1 -
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  81 -----
 14 files changed, 4 insertions(+), 694 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b4fe9dfb17..4697b7c494 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -28,7 +28,6 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -89,7 +88,6 @@ static void cmd_help_brief_parsed(__rte_unused void *parsed_result,
 		"information.\n"
 		"    help config                     : Configuration information.\n"
 		"    help ports                      : Configuring ports.\n"
-		"    help registers                  : Reading and setting port registers.\n"
 		"    help filters                    : Filters configuration help.\n"
 		"    help traffic_management         : Traffic Management commands.\n"
 		"    help devices                    : Device related commands.\n"
@@ -799,34 +797,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 		);
 	}
 
-	if (show_all || !strcmp(res->section, "registers")) {
-
-		cmdline_printf(
-			cl,
-			"\n"
-			"Registers:\n"
-			"----------\n\n"
-
-			"read reg (port_id) (address)\n"
-			"    Display value of a port register.\n\n"
-
-			"read regfield (port_id) (address) (bit_x) (bit_y)\n"
-			"    Display a port register bit field.\n\n"
-
-			"read regbit (port_id) (address) (bit_x)\n"
-			"    Display a single port register bit.\n\n"
-
-			"write reg (port_id) (address) (value)\n"
-			"    Set value of a port register.\n\n"
-
-			"write regfield (port_id) (address) (bit_x) (bit_y)"
-			" (value)\n"
-			"    Set bit field of a port register.\n\n"
-
-			"write regbit (port_id) (address) (bit_x) (value)\n"
-			"    Set single bit value of a port register.\n\n"
-		);
-	}
 	if (show_all || !strcmp(res->section, "filters")) {
 
 		cmdline_printf(
@@ -1077,13 +1047,13 @@ static cmdline_parse_token_string_t cmd_help_long_help =
 
 static cmdline_parse_token_string_t cmd_help_long_section =
 	TOKEN_STRING_INITIALIZER(struct cmd_help_long_result, section,
-		"all#control#display#config#ports#registers#"
+		"all#control#display#config#ports#"
 		"filters#traffic_management#devices#drivers");
 
 static cmdline_parse_inst_t cmd_help_long = {
 	.f = cmd_help_long_parsed,
 	.data = NULL,
-	.help_str = "help all|control|display|config|ports|register|"
+	.help_str = "help all|control|display|config|ports|"
 		"filters|traffic_management|devices|drivers: "
 		"Show help",
 	.tokens = {
@@ -7390,305 +7360,6 @@ static cmdline_parse_inst_t cmd_showfwdall = {
 	},
 };
 
-/* *** READ PORT REGISTER *** */
-struct cmd_read_reg_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-};
-
-static void
-cmd_read_reg_parsed(void *parsed_result,
-		    __rte_unused struct cmdline *cl,
-		    __rte_unused void *data)
-{
-	struct cmd_read_reg_result *res = parsed_result;
-	port_reg_display(res->port_id, res->reg_off);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_read_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, reg_off, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_read_reg = {
-	.f = cmd_read_reg_parsed,
-	.data = NULL,
-	.help_str = "read reg <port_id> <reg_off>",
-	.tokens = {
-		(void *)&cmd_read_reg_read,
-		(void *)&cmd_read_reg_reg,
-		(void *)&cmd_read_reg_port_id,
-		(void *)&cmd_read_reg_reg_off,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT FIELD *** */
-struct cmd_read_reg_bit_field_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-};
-
-static void
-cmd_read_reg_bit_field_parsed(void *parsed_result,
-			      __rte_unused struct cmdline *cl,
-			      __rte_unused void *data)
-{
-	struct cmd_read_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_display(res->port_id, res->reg_off,
-				   res->bit1_pos, res->bit2_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result, read,
-				 "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit_field = {
-	.f = cmd_read_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "read regfield <port_id> <reg_off> <bit_x> <bit_y>: "
-	"Read register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_field_read,
-		(void *)&cmd_read_reg_bit_field_regfield,
-		(void *)&cmd_read_reg_bit_field_port_id,
-		(void *)&cmd_read_reg_bit_field_reg_off,
-		(void *)&cmd_read_reg_bit_field_bit1_pos,
-		(void *)&cmd_read_reg_bit_field_bit2_pos,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT *** */
-struct cmd_read_reg_bit_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-};
-
-static void
-cmd_read_reg_bit_parsed(void *parsed_result,
-			__rte_unused struct cmdline *cl,
-			__rte_unused void *data)
-{
-	struct cmd_read_reg_bit_result *res = parsed_result;
-	port_reg_bit_display(res->port_id, res->reg_off, res->bit_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_read_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit = {
-	.f = cmd_read_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "read regbit <port_id> <reg_off> <bit_x>: 0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_read,
-		(void *)&cmd_read_reg_bit_regbit,
-		(void *)&cmd_read_reg_bit_port_id,
-		(void *)&cmd_read_reg_bit_reg_off,
-		(void *)&cmd_read_reg_bit_bit_pos,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER *** */
-struct cmd_write_reg_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_parsed(void *parsed_result,
-		     __rte_unused struct cmdline *cl,
-		     __rte_unused void *data)
-{
-	struct cmd_write_reg_result *res = parsed_result;
-	port_reg_set(res->port_id, res->reg_off, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, write, "write");
-static cmdline_parse_token_string_t cmd_write_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_write_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, reg_off, RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, value, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg = {
-	.f = cmd_write_reg_parsed,
-	.data = NULL,
-	.help_str = "write reg <port_id> <reg_off> <reg_value>",
-	.tokens = {
-		(void *)&cmd_write_reg_write,
-		(void *)&cmd_write_reg_reg,
-		(void *)&cmd_write_reg_port_id,
-		(void *)&cmd_write_reg_reg_off,
-		(void *)&cmd_write_reg_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT FIELD *** */
-struct cmd_write_reg_bit_field_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_bit_field_parsed(void *parsed_result,
-			       __rte_unused struct cmdline *cl,
-			       __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_set(res->port_id, res->reg_off,
-			  res->bit1_pos, res->bit2_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, value,
-			      RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg_bit_field = {
-	.f = cmd_write_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "write regfield <port_id> <reg_off> <bit_x> <bit_y> "
-		"<reg_value>: "
-		"Set register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_field_write,
-		(void *)&cmd_write_reg_bit_field_regfield,
-		(void *)&cmd_write_reg_bit_field_port_id,
-		(void *)&cmd_write_reg_bit_field_reg_off,
-		(void *)&cmd_write_reg_bit_field_bit1_pos,
-		(void *)&cmd_write_reg_bit_field_bit2_pos,
-		(void *)&cmd_write_reg_bit_field_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT *** */
-struct cmd_write_reg_bit_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-	uint8_t value;
-};
-
-static void
-cmd_write_reg_bit_parsed(void *parsed_result,
-			 __rte_unused struct cmdline *cl,
-			 __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_result *res = parsed_result;
-	port_reg_bit_set(res->port_id, res->reg_off, res->bit_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_write_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, value,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_write_reg_bit = {
-	.f = cmd_write_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "write regbit <port_id> <reg_off> <bit_x> 0|1: "
-		"0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_write,
-		(void *)&cmd_write_reg_bit_regbit,
-		(void *)&cmd_write_reg_bit_port_id,
-		(void *)&cmd_write_reg_bit_reg_off,
-		(void *)&cmd_write_reg_bit_bit_pos,
-		(void *)&cmd_write_reg_bit_value,
-		NULL,
-	},
-};
-
 /* *** READ A RING DESCRIPTOR OF A PORT RX/TX QUEUE *** */
 struct cmd_read_rxd_txd_result {
 	cmdline_fixed_string_t read;
@@ -14222,12 +13893,6 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_queue_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_config_dcb,
-	(cmdline_parse_inst_t *)&cmd_read_reg,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit,
-	(cmdline_parse_inst_t *)&cmd_write_reg,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit,
 	(cmdline_parse_inst_t *)&cmd_read_rxd_txd,
 	(cmdline_parse_inst_t *)&cmd_stop,
 	(cmdline_parse_inst_t *)&cmd_mac_addr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a2939867c4..3a53b616d8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -31,7 +31,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -1138,200 +1137,6 @@ vlan_id_is_invalid(uint16_t vlan_id)
 	return 1;
 }
 
-static int
-port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	uint64_t pci_len;
-
-	if (reg_off & 0x3) {
-		fprintf(stderr,
-			"Port register offset 0x%X not aligned on a 4-byte boundary\n",
-			(unsigned int)reg_off);
-		return 1;
-	}
-
-	if (!ports[port_id].dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 1;
-	}
-
-	pci_len = pci_dev->mem_resource[0].len;
-	if (reg_off >= pci_len) {
-		fprintf(stderr,
-			"Port %d: register offset %u (0x%X) out of port PCI resource (length=%"PRIu64")\n",
-			port_id, (unsigned int)reg_off, (unsigned int)reg_off,
-			pci_len);
-		return 1;
-	}
-	return 0;
-}
-
-static int
-reg_bit_pos_is_invalid(uint8_t bit_pos)
-{
-	if (bit_pos <= 31)
-		return 0;
-	fprintf(stderr, "Invalid bit position %d (must be <= 31)\n", bit_pos);
-	return 1;
-}
-
-#define display_port_and_reg_off(port_id, reg_off) \
-	printf("port %d PCI register at offset 0x%X: ", (port_id), (reg_off))
-
-static inline void
-display_port_reg_value(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("0x%08X (%u)\n", (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x)
-{
-	uint32_t reg_v;
-
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_x))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bit %d=%d\n", bit_x, (int) ((reg_v & (1 << bit_x)) >> bit_x));
-}
-
-void
-port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-			   uint8_t bit1_pos, uint8_t bit2_pos)
-{
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v >>= l_bit;
-	if (h_bit < 31)
-		reg_v &= ((1 << (h_bit - l_bit + 1)) - 1);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bits[%d, %d]=0x%0*X (%u)\n", l_bit, h_bit,
-	       ((h_bit - l_bit) / 4) + 1, (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_display(portid_t port_id, uint32_t reg_off)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		 uint8_t bit_v)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_pos))
-		return;
-	if (bit_v > 1) {
-		fprintf(stderr, "Invalid bit value %d (must be 0 or 1)\n",
-			(int) bit_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	if (bit_v == 0)
-		reg_v &= ~(1 << bit_pos);
-	else
-		reg_v |= (1 << bit_pos);
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-		       uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value)
-{
-	uint32_t max_v;
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	if ((h_bit - l_bit) < 31)
-		max_v = (1 << (h_bit - l_bit + 1)) - 1;
-	else
-		max_v = 0xFFFFFFFF;
-
-	if (value > max_v) {
-		fprintf(stderr, "Invalid value %u (0x%x) must be < %u (0x%x)\n",
-				(unsigned)value, (unsigned)value,
-				(unsigned)max_v, (unsigned)max_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v &= ~(max_v << l_bit); /* Keep unchanged bits */
-	reg_v |= (value << l_bit); /* Set changed bits */
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
 static uint32_t
 eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
 {
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 1a3fd9ce8a..144f28819c 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 1e01120ae9..fd6abc0f41 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c
index 71849aaf96..8fafdec548 100644
--- a/app/test-pmd/iofwd.c
+++ b/app/test-pmd/iofwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index 79c9241d00..beb220fbb4 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index acb0fd7fb4..4f8deb3382 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 74399178dd..8488efc138 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON')
     ext_deps += jansson_dep
 endif
 
-deps += ['ethdev', 'cmdline', 'bus_pci']
+deps += ['ethdev', 'cmdline']
 if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
     deps += 'crypto_scheduler'
 endif
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e3c9757f3f..c77624302f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -33,7 +33,6 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 04457010f4..d528d4f34e 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index addcbcac85..ee686393c5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -42,7 +42,6 @@
 #include <rte_mbuf.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_dev.h>
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index fb2f5195d3..e4ba7147a3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -7,8 +7,6 @@
 
 #include <stdbool.h>
 
-#include <rte_pci.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
@@ -267,7 +265,7 @@ struct port_txqueue {
  * The data structure associated with each port.
  */
 struct rte_port {
-	struct rte_eth_dev_info dev_info;   /**< PCI info + driver name */
+	struct rte_eth_dev_info dev_info;   /**< Device info + driver name */
 	struct rte_eth_conf     dev_conf;   /**< Port configuration. */
 	struct rte_ether_addr       eth_addr;   /**< Port ethernet address */
 	struct rte_eth_stats    stats;      /**< Last port statistics */
@@ -801,65 +799,6 @@ mbuf_pool_find(unsigned int sock_id, uint16_t idx)
 	return rte_mempool_lookup((const char *)pool_name);
 }
 
-/**
- * Read/Write operations on a PCI register of a port.
- */
-static inline uint32_t
-port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-	uint32_t reg_v;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 0;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	reg_v = *((volatile uint32_t *)reg_addr);
-	return rte_le_to_cpu_32(reg_v);
-}
-
-#define port_id_pci_reg_read(pt_id, reg_off) \
-	port_pci_reg_read(&ports[(pt_id)], (reg_off))
-
-static inline void
-port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
-}
-
-#define port_id_pci_reg_write(pt_id, reg_off, reg_value) \
-	port_pci_reg_write(&ports[(pt_id)], (reg_off), (reg_value))
-
 static inline void
 get_start_cycles(uint64_t *start_tsc)
 {
@@ -922,15 +861,6 @@ void update_fwd_ports(portid_t new_pid);
 void set_fwd_eth_peer(portid_t port_id, char *peer_addr);
 
 void port_mtu_set(portid_t port_id, uint16_t mtu);
-void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos);
-void port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		      uint8_t bit_v);
-void port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-				uint8_t bit1_pos, uint8_t bit2_pos);
-void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-			    uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
-void port_reg_display(portid_t port_id, uint32_t reg_off);
-void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
 int port_action_handle_create(portid_t port_id, uint32_t id,
 			      const struct rte_flow_indir_action_conf *conf,
 			      const struct rte_flow_action *action);
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index e1bc78b73d..021624952d 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 330e34427d..7dacd6fb04 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -55,7 +55,6 @@ These are divided into sections and can be accessed using help, help section or
            help display                    : Displaying port, stats and config information.
            help config                     : Configuration information.
            help ports                      : Configuring ports.
-           help registers                  : Reading and setting port registers.
            help filters                    : Filters configuration help.
            help traffic_management         : Traffic Management commands.
            help devices                    : Device related commands.
@@ -2356,86 +2355,6 @@ manage link bonding devices from within testpmd interactive prompt.
 
 See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information.
 
-Register Functions
-------------------
-
-The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
-This is mainly useful for debugging purposes.
-Reference should be made to the appropriate datasheet for the network card for details on the register addresses
-and fields that can be accessed.
-
-read reg
-~~~~~~~~
-
-Display the value of a port register::
-
-   testpmd> read reg (port_id) (address)
-
-For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
-
-   testpmd> read reg 0 0xEE00
-   port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
-
-read regfield
-~~~~~~~~~~~~~
-
-Display a port register bit field::
-
-   testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
-
-For example, reading the lowest two bits from the register in the example above::
-
-   testpmd> read regfield 0 0xEE00 0 1
-   port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
-
-read regbit
-~~~~~~~~~~~
-
-Display a single port register bit::
-
-   testpmd> read regbit (port_id) (address) (bit_x)
-
-For example, reading the lowest bit from the register in the example above::
-
-   testpmd> read regbit 0 0xEE00 0
-   port 0 PCI register at offset 0xEE00: bit 0=1
-
-write reg
-~~~~~~~~~
-
-Set the value of a port register::
-
-   testpmd> write reg (port_id) (address) (value)
-
-For example, to clear a register::
-
-   testpmd> write reg 0 0xEE00 0x0
-   port 0 PCI register at offset 0xEE00: 0x00000000 (0)
-
-write regfield
-~~~~~~~~~~~~~~
-
-Set bit field of a port register::
-
-   testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
-
-For example, writing to the register cleared in the example above::
-
-   testpmd> write regfield 0 0xEE00 0 1 2
-   port 0 PCI register at offset 0xEE00: 0x00000002 (2)
-
-write regbit
-~~~~~~~~~~~~
-
-Set single bit value of a port register::
-
-   testpmd> write regbit (port_id) (address) (bit_x) (value)
-
-For example, to set the high bit in the register from the example above::
-
-   testpmd> write regbit 0 0xEE00 31 1
-   port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
-
 Traffic Metering and Policing
 -----------------------------
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 05/27] kni: stop populating PCI info in examples
  2022-09-05  8:39 ` David Marchand
                     ` (3 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 04/27] app/testpmd: drop PCI register commands David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 06/27] examples/ethtool: prefer device name David Marchand
                     ` (21 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Cristian Dumitrescu

addr and id fields are deprecated and are not used in the kni library.
Stop populating them in the in-tree examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_kni.c        | 30 ------------------------------
 examples/ip_pipeline/kni.c | 10 ----------
 2 files changed, 40 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 622315c8b1..4039da0b08 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -25,7 +25,6 @@ test_kni(void)
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
@@ -426,8 +425,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 
 	if (!mp)
 		return -1;
@@ -443,13 +440,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
 
 	/* core id 1 configured for kernel thread */
@@ -545,8 +535,6 @@ test_kni(void)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
 	FILE *fd;
 	DIR *dir;
 	char buf[16];
@@ -645,15 +633,6 @@ test_kni(void)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
@@ -689,15 +668,6 @@ test_kni(void)
 		goto fail;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index a2d3331cb0..cd02c39478 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_string_fns.h>
 
 #include "kni.h"
@@ -107,8 +106,6 @@ kni_create(const char *name, struct kni_params *params)
 	struct mempool *mempool;
 	struct link *link;
 	struct rte_kni *k;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int ret;
 
 	/* Check input params */
@@ -134,13 +131,6 @@ kni_create(const char *name, struct kni_params *params)
 	kni_conf.core_id = params->thread_id;
 	kni_conf.group_id = link->port_id;
 	kni_conf.mbuf_size = mempool->buffer_size;
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		kni_conf.addr = pci_dev->addr;
-		kni_conf.id = pci_dev->id;
-	}
 
 	memset(&kni_ops, 0, sizeof(kni_ops));
 	kni_ops.port_id = link->port_id;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 06/27] examples/ethtool: prefer device name
  2022-09-05  8:39 ` David Marchand
                     ` (4 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 05/27] kni: stop populating PCI info in examples David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 07/27] dev: hide debug messages in device iterator David Marchand
                     ` (20 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Rely on the generic device name rather than restrict to only supporting
PCI devices.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/ethtool/lib/rte_ethtool.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index ffaad96498..88dc917b73 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -8,7 +8,6 @@
 #include <rte_version.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_NET_IXGBE
 #include <rte_pmd_ixgbe.h>
 #endif
@@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 {
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int n;
 	int ret;
 
@@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	/* TODO: replace bus_info by rte_devargs.name */
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
-			"%04x:%02x:%02x.%x",
-			pci_dev->addr.domain, pci_dev->addr.bus,
-			pci_dev->addr.devid, pci_dev->addr.function);
-	} else {
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
-	}
+	strlcpy(drvinfo->bus_info, dev_info.device->name,
+		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
 	rte_eth_dev_get_reg_info(port_id, &reg_info);
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 07/27] dev: hide debug messages in device iterator
  2022-09-05  8:39 ` David Marchand
                     ` (5 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 06/27] examples/ethtool: prefer device name David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
                     ` (19 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang

For any bus that does not support device iteration, rte_dev_iterator_init
both returned an error code and logged an error message.
An application (like testpmd) that only wants to list devices, would have
no choice but to inspect a bus object to avoid spewing error logs.

Make those log messages debug level, and remove the check in testpmd.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/config.c           | 4 ----
 lib/eal/common/eal_common_dev.c | 7 +++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3a53b616d8..bc73819183 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -641,10 +641,6 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		/* Skip buses that don't have iterate method */
-		if (!next->dev_iterate)
-			continue;
-
 		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 9d913e5478..b6f0392f30 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -592,18 +592,17 @@ rte_dev_iterator_init(struct rte_dev_iterator *it,
 	 * one layer specified.
 	 */
 	if (bus == NULL && cls == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Either bus or class must be specified.\n");
+		RTE_LOG(DEBUG, EAL, "Either bus or class must be specified.\n");
 		rte_errno = EINVAL;
 		goto get_out;
 	}
 	if (bus != NULL && bus->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Bus %s not supported\n", bus->name);
+		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", bus->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
 	if (cls != NULL && cls->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Class %s not supported\n", cls->name);
+		RTE_LOG(DEBUG, EAL, "Class %s not supported\n", cls->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-09-05  8:39 ` David Marchand
                     ` (6 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 07/27] dev: hide debug messages in device iterator David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-06  6:11     ` [EXT] " Akhil Goyal
  2022-09-05  8:39   ` [PATCH v5 09/27] devargs: remove dependency on bus header David Marchand
                     ` (18 subsequent siblings)
  26 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Fan Zhang, Ashish Gupta,
	Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Rosen Xu, Tianfei zhang,
	Sachin Saxena, Hemant Agrawal, Akhil Goyal, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Abhinandan Gujjar,
	Jerin Jacob, Jay Jayatheerthan, Olivier Matz, Ori Kam,
	Maxime Coquelin, Chenbo Xia

Those macros have no real value and are easily replaced with a simple
if() block.

Existing users have been converted using a new cocci script.
Deprecate them.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |   4 +
 doc/guides/rel_notes/release_22_11.rst        |   4 +
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_qp.c                   |  31 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   6 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   6 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  21 +-
 lib/compressdev/rte_compressdev.c             |  47 +--
 lib/cryptodev/rte_cryptodev.c                 |  43 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/eal/include/rte_dev.h                     |   7 +-
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_pci.h                       |   3 +-
 lib/ethdev/rte_ethdev.c                       | 276 ++++++++++++------
 lib/ethdev/rte_ethdev.h                       |   9 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  10 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  13 +-
 lib/eventdev/rte_eventdev.c                   |  62 ++--
 lib/mempool/rte_mempool_ops.c                 |   3 +-
 lib/rawdev/rte_rawdev.c                       |  75 +++--
 lib/regexdev/rte_regexdev.c                   |  59 ++--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   6 +-
 lib/vhost/vdpa.c                              |   9 +-
 lib/vhost/vhost_user.c                        |   6 +-
 31 files changed, 517 insertions(+), 285 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci

diff --git a/devtools/cocci/func_or_ret.cocci b/devtools/cocci/func_or_ret.cocci
new file mode 100644
index 0000000000..f23d60cc4e
--- /dev/null
+++ b/devtools/cocci/func_or_ret.cocci
@@ -0,0 +1,12 @@
+@@
+expression cond, ret;
+@@
+-RTE_FUNC_PTR_OR_ERR_RET(cond, ret);
++if (cond == NULL)
++	return ret;
+@@
+expression cond;
+@@
+-RTE_FUNC_PTR_OR_RET(cond);
++if (cond == NULL)
++	return;
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index dba252067c..5b4ffc992d 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -14,6 +14,10 @@ Deprecation Notices
 * kvargs: The function ``rte_kvargs_process`` will get a new parameter
   for returning key match count. It will ease handling of no-match case.
 
+* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
+  to update their code.
+
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 3cea3aa8eb..225a380de0 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,10 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
+  to update their code.
+
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
 
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index db4b087d2b..30e5cdb573 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -58,8 +58,8 @@ qat_pci_get_extra_size(enum qat_device_gen qat_dev_gen)
 {
 	struct qat_dev_hw_spec_funcs *ops_hw =
 		qat_dev_hw_spec[qat_dev_gen];
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_get_extra_size,
-		-ENOTSUP);
+	if (ops_hw->qat_dev_get_extra_size == NULL)
+		return -ENOTSUP;
 	return ops_hw->qat_dev_get_extra_size();
 }
 
@@ -381,8 +381,8 @@ static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		return -ENODEV;
 
 	ops_hw = qat_dev_hw_spec[qat_pci_dev->qat_dev_gen];
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_reset_ring_pairs,
-		-ENOTSUP);
+	if (ops_hw->qat_dev_reset_ring_pairs == NULL)
+		return -ENOTSUP;
 	if (ops_hw->qat_dev_reset_ring_pairs(qat_pci_dev)) {
 		QAT_LOG(ERR,
 			"Cannot reset ring pairs, does pf driver supports pf2vf comms?"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 08ac91eac4..8674eccdca 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -370,8 +370,8 @@ adf_queue_arb_enable(struct qat_pci_device *qat_dev, struct qat_queue *txq,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_enable,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_arb_enable == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_arb_enable(txq, base_addr, lock);
 	return 0;
 }
@@ -383,8 +383,8 @@ adf_queue_arb_disable(enum qat_device_gen qat_dev_gen, struct qat_queue *txq,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_disable,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_arb_disable == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_arb_disable(txq, base_addr, lock);
 	return 0;
 }
@@ -396,8 +396,8 @@ qat_qp_build_ring_base(struct qat_pci_device *qat_dev, void *io_addr,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_build_ring_base,
-			-ENOTSUP);
+	if (ops->qat_qp_build_ring_base == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_build_ring_base(io_addr, queue);
 	return 0;
 }
@@ -409,8 +409,8 @@ qat_qps_per_service(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_rings_per_service,
-			-ENOTSUP);
+	if (ops->qat_qp_rings_per_service == NULL)
+		return -ENOTSUP;
 	return ops->qat_qp_rings_per_service(qat_dev, service);
 }
 
@@ -421,7 +421,8 @@ qat_qp_get_hw_data(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_get_hw_data, NULL);
+	if (ops->qat_qp_get_hw_data == NULL)
+		return NULL;
 	return ops->qat_qp_get_hw_data(qat_dev, service, qp_id);
 }
 
@@ -431,8 +432,8 @@ qat_read_qp_config(struct qat_pci_device *qat_dev)
 	struct qat_dev_hw_spec_funcs *ops_hw =
 		qat_dev_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_read_config,
-			-ENOTSUP);
+	if (ops_hw->qat_dev_read_config == NULL)
+		return -ENOTSUP;
 	return ops_hw->qat_dev_read_config(qat_dev);
 }
 
@@ -442,8 +443,8 @@ adf_configure_queues(struct qat_qp *qp, enum qat_device_gen qat_dev_gen)
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_configure_queues,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_configure_queues == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_configure_queues(qp);
 	return 0;
 }
@@ -483,8 +484,8 @@ qat_qp_csr_setup(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_csr_setup,
-			-ENOTSUP);
+	if (ops->qat_qp_csr_setup == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_csr_setup(qat_dev, io_addr, qp);
 	return 0;
 }
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index dc8db84a68..6fb8cf69be 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -25,8 +25,8 @@ qat_comp_capabilities_info qat_comp_get_capa_info(
 
 	if (qat_dev_gen >= QAT_N_GENS)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(qat_comp_gen_dev_ops[qat_dev_gen]
-			.qat_comp_get_capabilities, ret);
+	if (qat_comp_gen_dev_ops[qat_dev_gen].qat_comp_get_capabilities == NULL)
+		return ret;
 	return qat_comp_gen_dev_ops[qat_dev_gen]
 			.qat_comp_get_capabilities(qat_dev);
 }
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 1e0c4fe464..258d6f8c43 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -541,7 +541,8 @@ rte_cryptodev_scheduler_option_set(uint8_t scheduler_id,
 
 	sched_ctx = dev->data->dev_private;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_set, -ENOTSUP);
+	if (*sched_ctx->ops.option_set == NULL)
+		return -ENOTSUP;
 
 	return (*sched_ctx->ops.option_set)(dev, option_type, option);
 }
@@ -571,7 +572,8 @@ rte_cryptodev_scheduler_option_get(uint8_t scheduler_id,
 
 	sched_ctx = dev->data->dev_private;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_get, -ENOTSUP);
+	if (*sched_ctx->ops.option_get == NULL)
+		return -ENOTSUP;
 
 	return (*sched_ctx->ops.option_get)(dev, option_type, option);
 }
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index f3a1bd626c..83ae6b6be9 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -160,7 +160,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
 		return -1;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.worker_attach, -ENOTSUP);
+	if (*sched_ctx->ops.worker_attach == NULL)
+		return -ENOTSUP;
 
 	for (i = 0; i < sched_ctx->nb_workers; i++) {
 		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
@@ -171,7 +172,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.scheduler_start, -ENOTSUP);
+	if (*sched_ctx->ops.scheduler_start == NULL)
+		return -ENOTSUP;
 
 	if ((*sched_ctx->ops.scheduler_start)(dev) < 0) {
 		CR_SCHED_LOG(ERR, "Scheduler start failed");
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f8575f..89fe3a828a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -291,7 +291,8 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 	if (on > 1)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
+		return -ENOTSUP;
 
 	/* The PF has 128 queue pairs and in SRIOV configuration
 	 * those queues will be assigned to VF's, so RXDCTL
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 90ffe31b9f..ebcfbb1a5c 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -281,7 +281,8 @@ lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
 	}
 
 	/* clear stored per queue stats */
-	RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
+	if (*eth_dev->dev_ops->stats_reset == NULL)
+		return 0;
 	return (*eth_dev->dev_ops->stats_reset)(eth_dev);
 }
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 78a7123528..3b616c45ff 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -713,7 +713,8 @@ ifpga_rawdev_configure(const struct rte_rawdev *dev,
 {
 	IFPGA_RAWDEV_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	return config ? 0 : 1;
 }
@@ -726,7 +727,8 @@ ifpga_rawdev_start(struct rte_rawdev *dev)
 
 	IFPGA_RAWDEV_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	adapter = ifpga_rawdev_get_priv(dev);
 	if (!adapter)
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 16ecae3d92..72d3b69d75 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -76,7 +76,8 @@ static int skeleton_rawdev_configure(const struct rte_rawdev *dev,
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	if (config == NULL || config_size != sizeof(*skeldev_conf)) {
 		SKELETON_PMD_ERR("Invalid configuration");
@@ -106,7 +107,8 @@ static int skeleton_rawdev_start(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -169,7 +171,8 @@ static int skeleton_rawdev_close(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -212,7 +215,8 @@ static int skeleton_rawdev_reset(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -295,7 +299,8 @@ static int skeleton_rawdev_queue_release(struct rte_rawdev *dev,
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -317,7 +322,8 @@ static uint16_t skeleton_rawdev_queue_count(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 	return skeldev->num_queues;
@@ -468,7 +474,8 @@ static int skeleton_rawdev_firmware_status_get(struct rte_rawdev *dev,
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	if (status_info)
 		memcpy(status_info, &skeldev->fw.firmware_state,
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 22c438f2dd..5ddbc3f9c0 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -315,7 +315,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
 
 	memset(&dev_info, 0, sizeof(struct rte_compressdev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
 	if ((dev_info.max_nb_queue_pairs != 0) &&
@@ -344,8 +345,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
 
 		qp = dev->data->queue_pairs;
 
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+		if (*dev->dev_ops->queue_pair_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_qpairs; i < old_nb_queues; i++) {
 			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -395,8 +396,8 @@ rte_compressdev_queue_pairs_release(struct rte_compressdev *dev)
 	COMPRESSDEV_LOG(DEBUG, "Free %d queues pairs on device %u",
 			dev->data->nb_queue_pairs, dev->data->dev_id);
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+	if (*dev->dev_ops->queue_pair_release == NULL)
+		return -ENOTSUP;
 
 	for (i = 0; i < num_qps; i++) {
 		ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -430,7 +431,8 @@ rte_compressdev_configure(uint8_t dev_id, struct rte_compressdev_config *config)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	/* Setup new number of queue pairs and reconfigure device. */
 	diag = rte_compressdev_queue_pairs_config(dev, config->nb_queue_pairs,
@@ -460,7 +462,8 @@ rte_compressdev_start(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -489,7 +492,8 @@ rte_compressdev_stop(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -527,7 +531,8 @@ rte_compressdev_close(uint8_t dev_id)
 	if (retval < 0)
 		return retval;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	retval = (*dev->dev_ops->dev_close)(dev);
 
 	if (retval < 0)
@@ -565,7 +570,8 @@ rte_compressdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_pair_setup == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id,
 			max_inflight_ops, socket_id);
@@ -611,7 +617,8 @@ rte_compressdev_stats_get(uint8_t dev_id, struct rte_compressdev_stats *stats)
 	dev = &rte_comp_devices[dev_id];
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->stats_get)(dev, stats);
 	return 0;
 }
@@ -628,7 +635,8 @@ rte_compressdev_stats_reset(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return;
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -647,7 +655,8 @@ rte_compressdev_info_get(uint8_t dev_id, struct rte_compressdev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_compressdev_info));
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->driver_name = dev->device->driver->name;
@@ -666,7 +675,8 @@ rte_compressdev_private_xform_create(uint8_t dev_id,
 	if (xform == NULL || priv_xform == NULL || dev == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_create, -ENOTSUP);
+	if (*dev->dev_ops->private_xform_create == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->private_xform_create)(dev, xform, priv_xform);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -689,7 +699,8 @@ rte_compressdev_private_xform_free(uint8_t dev_id, void *priv_xform)
 	if (dev == NULL || priv_xform == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_free, -ENOTSUP);
+	if (*dev->dev_ops->private_xform_free == NULL)
+		return -ENOTSUP;
 	ret = dev->dev_ops->private_xform_free(dev, priv_xform);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -714,7 +725,8 @@ rte_compressdev_stream_create(uint8_t dev_id,
 	if (xform == NULL || dev == NULL || stream == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_create, -ENOTSUP);
+	if (*dev->dev_ops->stream_create == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->stream_create)(dev, xform, stream);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -738,7 +750,8 @@ rte_compressdev_stream_free(uint8_t dev_id, void *stream)
 	if (dev == NULL || stream == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_free, -ENOTSUP);
+	if (*dev->dev_ops->stream_free == NULL)
+		return -ENOTSUP;
 	ret = dev->dev_ops->stream_free(dev, stream);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..6250302f3b 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -978,7 +978,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
 
 	memset(&dev_info, 0, sizeof(struct rte_cryptodev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
 	if (nb_qpairs > (dev_info.max_nb_queue_pairs)) {
@@ -1007,8 +1008,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
 
 		qp = dev->data->queue_pairs;
 
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+		if (*dev->dev_ops->queue_pair_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_qpairs; i < old_nb_queues; i++) {
 			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -1041,7 +1042,8 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	rte_spinlock_lock(&rte_cryptodev_callback_lock);
 	cryptodev_cb_cleanup(dev);
@@ -1083,7 +1085,8 @@ rte_cryptodev_start(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already started",
@@ -1116,7 +1119,8 @@ rte_cryptodev_stop(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already stopped",
@@ -1163,7 +1167,8 @@ rte_cryptodev_close(uint8_t dev_id)
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	retval = (*dev->dev_ops->dev_close)(dev);
 	rte_cryptodev_trace_close(dev_id, retval);
 
@@ -1262,7 +1267,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_pair_setup == NULL)
+		return -ENOTSUP;
 
 	rte_cryptodev_trace_queue_pair_setup(dev_id, queue_pair_id, qp_conf);
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
@@ -1557,7 +1563,8 @@ rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
 	dev = &rte_crypto_devices[dev_id];
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->stats_get)(dev, stats);
 	return 0;
 }
@@ -1574,7 +1581,8 @@ rte_cryptodev_stats_reset(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return;
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -1592,7 +1600,8 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_cryptodev_info));
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->driver_name = dev->device->driver->name;
@@ -1739,7 +1748,8 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 	if (index >= sess->nb_drivers)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
+	if (*dev->dev_ops->sym_session_configure == NULL)
+		return -ENOTSUP;
 
 	if (sess->sess_data[index].refcnt == 0) {
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
@@ -1968,7 +1978,8 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
 	/* Clear device session pointer.*/
 	memset(sess->sess_private_data, 0, session_priv_data_sz + sess->user_data_sz);
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_configure, -ENOTSUP);
+	if (*dev->dev_ops->asym_session_configure == NULL)
+		return -ENOTSUP;
 
 	if (sess->sess_private_data[0] == 0) {
 		ret = dev->dev_ops->asym_session_configure(dev, xforms, sess);
@@ -2007,7 +2018,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
 	if (--sess->sess_data[driver_id].refcnt != 0)
 		return -EBUSY;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
+	if (*dev->dev_ops->sym_session_clear == NULL)
+		return -ENOTSUP;
 
 	dev->dev_ops->sym_session_clear(dev, sess);
 
@@ -2054,7 +2066,8 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
 	if (dev == NULL || sess == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_clear, -ENOTSUP);
+	if (*dev->dev_ops->asym_session_clear == NULL)
+		return -ENOTSUP;
 
 	dev->dev_ops->asym_session_clear(dev, sess);
 
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..d575c14493 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -420,7 +420,8 @@ rte_dma_info_get(int16_t dev_id, struct rte_dma_info *dev_info)
 	if (!rte_dma_is_valid(dev_id) || dev_info == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_info_get == NULL)
+		return -ENOTSUP;
 	memset(dev_info, 0, sizeof(struct rte_dma_info));
 	ret = (*dev->dev_ops->dev_info_get)(dev, dev_info,
 					    sizeof(struct rte_dma_info));
@@ -472,7 +473,8 @@ rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_configure)(dev, dev_conf,
 					     sizeof(struct rte_dma_conf));
 	if (ret == 0)
@@ -555,7 +557,8 @@ rte_dma_close(int16_t dev_id)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_close)(dev);
 	if (ret == 0)
 		dma_release(dev);
@@ -648,7 +651,8 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_setup, -ENOTSUP);
+	if (*dev->dev_ops->vchan_setup == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->vchan_setup)(dev, vchan, conf,
 					sizeof(struct rte_dma_vchan_conf));
 }
@@ -668,7 +672,8 @@ rte_dma_stats_get(int16_t dev_id, uint16_t vchan, struct rte_dma_stats *stats)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	memset(stats, 0, sizeof(struct rte_dma_stats));
 	return (*dev->dev_ops->stats_get)(dev, vchan, stats,
 					  sizeof(struct rte_dma_stats));
@@ -689,7 +694,8 @@ rte_dma_stats_reset(int16_t dev_id, uint16_t vchan)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->stats_reset)(dev, vchan);
 }
 
@@ -706,7 +712,8 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_status, -ENOTSUP);
+	if (*dev->dev_ops->vchan_status == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->vchan_status)(dev, vchan, status);
 }
 
diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
index e7f992b734..e61d71959e 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -860,7 +860,8 @@ rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || length == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy, -ENOTSUP);
+	if (*obj->copy == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->copy)(obj->dev_private, vchan, src, dst, length, flags);
@@ -911,7 +912,8 @@ rte_dma_copy_sg(int16_t dev_id, uint16_t vchan, struct rte_dma_sge *src,
 	if (!rte_dma_is_valid(dev_id) || src == NULL || dst == NULL ||
 	    nb_src == 0 || nb_dst == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy_sg, -ENOTSUP);
+	if (*obj->copy_sg == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->copy_sg)(obj->dev_private, vchan, src, dst, nb_src,
@@ -957,7 +959,8 @@ rte_dma_fill(int16_t dev_id, uint16_t vchan, uint64_t pattern,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || length == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->fill, -ENOTSUP);
+	if (*obj->fill == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->fill)(obj->dev_private, vchan, pattern, dst, length,
@@ -990,7 +993,8 @@ rte_dma_submit(int16_t dev_id, uint16_t vchan)
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id))
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->submit, -ENOTSUP);
+	if (*obj->submit == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->submit)(obj->dev_private, vchan);
@@ -1033,7 +1037,8 @@ rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0)
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed, 0);
+	if (*obj->completed == NULL)
+		return 0;
 #endif
 
 	/* Ensure the pointer values are non-null to simplify drivers.
@@ -1095,7 +1100,8 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0 || status == NULL)
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed_status, 0);
+	if (*obj->completed_status == NULL)
+		return 0;
 #endif
 
 	if (last_idx == NULL)
@@ -1129,7 +1135,8 @@ rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan)
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id))
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->burst_capacity, 0);
+	if (*obj->burst_capacity == NULL)
+		return 0;
 #endif
 	return (*obj->burst_capacity)(obj->dev_private, vchan);
 }
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index e6ff1218f9..2743c09320 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -20,6 +20,7 @@ extern "C" {
 #include <stdio.h>
 
 #include <rte_config.h>
+#include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_log.h>
 
@@ -37,12 +38,14 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					void *cb_arg);
 
 /* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \
+do { \
 	if ((func) == NULL) \
 		return retval; \
 } while (0)
 
-#define RTE_FUNC_PTR_OR_RET(func) do { \
+#define RTE_FUNC_PTR_OR_RET(func) RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET) \
+do { \
 	if ((func) == NULL) \
 		return; \
 } while (0)
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
index a285f213f0..24a3969225 100644
--- a/lib/ethdev/ethdev_driver.c
+++ b/lib/ethdev/ethdev_driver.c
@@ -264,7 +264,8 @@ rte_eth_dev_create(struct rte_device *device, const char *name,
 	struct rte_eth_dev *ethdev;
 	int retval;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_init, -EINVAL);
+	if (*ethdev_init == NULL)
+		return -EINVAL;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		ethdev = rte_eth_dev_allocate(name);
@@ -328,7 +329,8 @@ rte_eth_dev_destroy(struct rte_eth_dev *ethdev,
 	if (!ethdev)
 		return -ENODEV;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_uninit, -EINVAL);
+	if (*ethdev_uninit == NULL)
+		return -EINVAL;
 
 	ret = ethdev_uninit(ethdev);
 	if (ret)
@@ -558,8 +560,8 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[cur_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_bind,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_bind == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_bind)(dev, cur_queue,
 							peer_info, direction);
@@ -573,8 +575,8 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[cur_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_unbind,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_unbind == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_unbind)(dev, cur_queue,
 							  direction);
@@ -594,8 +596,8 @@ rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[peer_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_update,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_update == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_update)(dev, peer_queue,
 					cur_info, peer_info, direction);
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 0549842709..a268507801 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -130,7 +130,8 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
 	if (!eth_dev)
 		return -ENOMEM;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
+	if (*dev_init == NULL)
+		return -EINVAL;
 	ret = dev_init(eth_dev);
 	if (ret)
 		rte_eth_dev_release_port(eth_dev);
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0850..9d6f460726 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -719,7 +719,8 @@ rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_start == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -751,7 +752,8 @@ rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_stop == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -790,7 +792,8 @@ rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_start == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -822,7 +825,8 @@ rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_stop == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1077,7 +1081,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started) {
 		RTE_ETHDEV_LOG(ERR,
@@ -1447,7 +1452,8 @@ rte_eth_dev_start(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1493,7 +1499,8 @@ rte_eth_dev_start(uint16_t port_id)
 	}
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 0);
 	}
 
@@ -1513,7 +1520,8 @@ rte_eth_dev_stop(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started == 0) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1541,7 +1549,8 @@ rte_eth_dev_set_link_up(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
+	if (*dev->dev_ops->dev_set_link_up == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_set_link_up)(dev));
 }
 
@@ -1553,7 +1562,8 @@ rte_eth_dev_set_link_down(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
+	if (*dev->dev_ops->dev_set_link_down == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev));
 }
 
@@ -1579,7 +1589,8 @@ rte_eth_dev_close(uint16_t port_id)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	*lasterr = (*dev->dev_ops->dev_close)(dev);
 	if (*lasterr != 0)
 		lasterr = &binerr;
@@ -1599,7 +1610,8 @@ rte_eth_dev_reset(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_reset == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_stop(port_id);
 	if (ret != 0) {
@@ -1624,7 +1636,8 @@ rte_eth_dev_is_removed(uint16_t port_id)
 	if (dev->state == RTE_ETH_DEV_REMOVED)
 		return 1;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->is_removed, 0);
+	if (*dev->dev_ops->is_removed == NULL)
+		return 0;
 
 	ret = dev->dev_ops->is_removed(dev);
 	if (ret != 0)
@@ -1725,7 +1738,8 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_setup == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
@@ -1928,8 +1942,8 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
 	if (ret != 0)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_hairpin_queue_setup,
-				-ENOTSUP);
+	if (*dev->dev_ops->rx_hairpin_queue_setup == NULL)
+		return -ENOTSUP;
 	/* if nb_rx_desc is zero use max number of desc from the driver. */
 	if (nb_rx_desc == 0)
 		nb_rx_desc = cap.max_nb_desc;
@@ -1990,7 +2004,8 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_setup == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
@@ -2094,8 +2109,8 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
 	if (ret != 0)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_hairpin_queue_setup,
-				-ENOTSUP);
+	if (*dev->dev_ops->tx_hairpin_queue_setup == NULL)
+		return -ENOTSUP;
 	/* if nb_rx_desc is zero use max number of desc from the driver. */
 	if (nb_tx_desc == 0)
 		nb_tx_desc = cap.max_nb_desc;
@@ -2152,7 +2167,8 @@ rte_eth_hairpin_bind(uint16_t tx_port, uint16_t rx_port)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_bind, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_bind == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->hairpin_bind)(dev, rx_port);
 	if (ret != 0)
 		RTE_ETHDEV_LOG(ERR, "Failed to bind hairpin Tx %d"
@@ -2176,7 +2192,8 @@ rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_unbind, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_unbind == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->hairpin_unbind)(dev, rx_port);
 	if (ret != 0)
 		RTE_ETHDEV_LOG(ERR, "Failed to unbind hairpin Tx %d"
@@ -2210,8 +2227,8 @@ rte_eth_hairpin_get_peer_ports(uint16_t port_id, uint16_t *peer_ports,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_get_peer_ports,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_get_peer_ports == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->hairpin_get_peer_ports)(dev, peer_ports,
 						      len, direction);
@@ -2282,7 +2299,8 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_done_cleanup, -ENOTSUP);
+	if (*dev->dev_ops->tx_done_cleanup == NULL)
+		return -ENOTSUP;
 
 	/* Call driver to free pending mbufs. */
 	ret = (*dev->dev_ops->tx_done_cleanup)(dev->data->tx_queues[queue_id],
@@ -2302,7 +2320,8 @@ rte_eth_promiscuous_enable(uint16_t port_id)
 	if (dev->data->promiscuous == 1)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
+	if (*dev->dev_ops->promiscuous_enable == NULL)
+		return -ENOTSUP;
 
 	diag = (*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = (diag == 0) ? 1 : 0;
@@ -2322,7 +2341,8 @@ rte_eth_promiscuous_disable(uint16_t port_id)
 	if (dev->data->promiscuous == 0)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
+	if (*dev->dev_ops->promiscuous_disable == NULL)
+		return -ENOTSUP;
 
 	dev->data->promiscuous = 0;
 	diag = (*dev->dev_ops->promiscuous_disable)(dev);
@@ -2355,7 +2375,8 @@ rte_eth_allmulticast_enable(uint16_t port_id)
 	if (dev->data->all_multicast == 1)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_enable, -ENOTSUP);
+	if (*dev->dev_ops->allmulticast_enable == NULL)
+		return -ENOTSUP;
 	diag = (*dev->dev_ops->allmulticast_enable)(dev);
 	dev->data->all_multicast = (diag == 0) ? 1 : 0;
 
@@ -2374,7 +2395,8 @@ rte_eth_allmulticast_disable(uint16_t port_id)
 	if (dev->data->all_multicast == 0)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_disable, -ENOTSUP);
+	if (*dev->dev_ops->allmulticast_disable == NULL)
+		return -ENOTSUP;
 	dev->data->all_multicast = 0;
 	diag = (*dev->dev_ops->allmulticast_disable)(dev);
 	if (diag != 0)
@@ -2411,7 +2433,8 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link)
 	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
 		rte_eth_linkstatus_get(dev, eth_link);
 	else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 1);
 		*eth_link = dev->data->dev_link;
 	}
@@ -2436,7 +2459,8 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link)
 	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
 		rte_eth_linkstatus_get(dev, eth_link);
 	else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 0);
 		*eth_link = dev->data->dev_link;
 	}
@@ -2513,7 +2537,8 @@ rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats)
 
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
 	return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats));
 }
@@ -2527,7 +2552,8 @@ rte_eth_stats_reset(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->stats_reset)(dev);
 	if (ret != 0)
 		return eth_err(port_id, ret);
@@ -3043,7 +3069,8 @@ eth_dev_set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id,
 	if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+	if (*dev->dev_ops->queue_stats_mapping_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_stats_mapping_set) (dev, queue_id, stat_idx, is_rx);
 }
 
@@ -3080,7 +3107,8 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	if (*dev->dev_ops->fw_version_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fw_version_get)(dev,
 							fw_version, fw_size));
 }
@@ -3121,7 +3149,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
 		RTE_ETHER_CRC_LEN;
 	dev_info->max_mtu = UINT16_MAX;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	diag = (*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	if (diag != 0) {
 		/* Cleanup already filled in device information */
@@ -3182,7 +3211,8 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_supported_ptypes_get, 0);
+	if (*dev->dev_ops->dev_supported_ptypes_get == NULL)
+		return 0;
 	all_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev);
 
 	if (!all_ptypes)
@@ -3360,7 +3390,8 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
+	if (*dev->dev_ops->mtu_set == NULL)
+		return -ENOTSUP;
 
 	/*
 	 * Check if the device supports dev_infos_get, if it does not
@@ -3413,7 +3444,8 @@ rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
 			port_id, vlan_id);
 		return -EINVAL;
 	}
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_filter_set == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
 	if (ret == 0) {
@@ -3448,7 +3480,8 @@ rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on);
 
 	return 0;
@@ -3464,7 +3497,8 @@ rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_tpid_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->vlan_tpid_set)(dev, vlan_type,
 							       tpid));
 }
@@ -3549,7 +3583,8 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_offload_set == NULL)
+		return -ENOTSUP;
 	dev->data->dev_conf.rxmode.offloads = dev_offloads;
 	ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);
 	if (ret) {
@@ -3594,7 +3629,8 @@ rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_pvid_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->vlan_pvid_set)(dev, pvid, on));
 }
 
@@ -3613,7 +3649,8 @@ rte_eth_dev_flow_ctrl_get(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
+	if (*dev->dev_ops->flow_ctrl_get == NULL)
+		return -ENOTSUP;
 	memset(fc_conf, 0, sizeof(*fc_conf));
 	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf));
 }
@@ -3638,7 +3675,8 @@ rte_eth_dev_flow_ctrl_set(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
+	if (*dev->dev_ops->flow_ctrl_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf));
 }
 
@@ -3899,7 +3937,8 @@ rte_eth_dev_rss_reta_update(uint16_t port_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
+	if (*dev->dev_ops->reta_update == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->reta_update)(dev, reta_conf,
 							     reta_size));
 }
@@ -3927,7 +3966,8 @@ rte_eth_dev_rss_reta_query(uint16_t port_id,
 	if (ret < 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
+	if (*dev->dev_ops->reta_query == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->reta_query)(dev, reta_conf,
 							    reta_size));
 }
@@ -3971,7 +4011,8 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
+	if (*dev->dev_ops->rss_hash_update == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
 								 rss_conf));
 }
@@ -3992,7 +4033,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
+	if (*dev->dev_ops->rss_hash_conf_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev,
 								   rss_conf));
 }
@@ -4018,7 +4060,8 @@ rte_eth_dev_udp_tunnel_port_add(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP);
+	if (*dev->dev_ops->udp_tunnel_port_add == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_add)(dev,
 								udp_tunnel));
 }
@@ -4044,7 +4087,8 @@ rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP);
+	if (*dev->dev_ops->udp_tunnel_port_del == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_del)(dev,
 								udp_tunnel));
 }
@@ -4057,7 +4101,8 @@ rte_eth_led_on(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
+	if (*dev->dev_ops->dev_led_on == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_led_on)(dev));
 }
 
@@ -4069,7 +4114,8 @@ rte_eth_led_off(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
+	if (*dev->dev_ops->dev_led_off == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev));
 }
 
@@ -4091,7 +4137,8 @@ rte_eth_fec_get_capability(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get_capability, -ENOTSUP);
+	if (*dev->dev_ops->fec_get_capability == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->fec_get_capability)(dev, speed_fec_capa, num);
 
 	return ret;
@@ -4112,7 +4159,8 @@ rte_eth_fec_get(uint16_t port_id, uint32_t *fec_capa)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get, -ENOTSUP);
+	if (*dev->dev_ops->fec_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fec_get)(dev, fec_capa));
 }
 
@@ -4124,7 +4172,8 @@ rte_eth_fec_set(uint16_t port_id, uint32_t fec_capa)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_set, -ENOTSUP);
+	if (*dev->dev_ops->fec_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fec_set)(dev, fec_capa));
 }
 
@@ -4173,7 +4222,8 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_add == NULL)
+		return -ENOTSUP;
 
 	if (rte_is_zero_ether_addr(addr)) {
 		RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n",
@@ -4231,7 +4281,8 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_remove == NULL)
+		return -ENOTSUP;
 
 	index = eth_dev_get_mac_addr_index(port_id, addr);
 	if (index == 0) {
@@ -4273,7 +4324,8 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)
 	if (!rte_is_valid_assigned_ether_addr(addr))
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_set == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->mac_addr_set)(dev, addr);
 	if (ret < 0)
@@ -4359,7 +4411,8 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr,
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
+	if (*dev->dev_ops->uc_hash_table_set == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
 	if (ret == 0) {
 		/* Update address in NIC data structure */
@@ -4382,7 +4435,8 @@ rte_eth_dev_uc_all_hash_table_set(uint16_t port_id, uint8_t on)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
+	if (*dev->dev_ops->uc_all_hash_table_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->uc_all_hash_table_set)(dev,
 								       on));
 }
@@ -4418,7 +4472,8 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
+	if (*dev->dev_ops->set_queue_rate_limit == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->set_queue_rate_limit)(dev,
 							queue_idx, tx_rate));
 }
@@ -4444,7 +4499,8 @@ int rte_eth_rx_avail_thresh_set(uint16_t port_id, uint16_t queue_id,
 			port_id);
 		return -EINVAL;
 	}
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_set, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_avail_thresh_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_set)(dev,
 							     queue_id, avail_thresh));
 }
@@ -4462,7 +4518,8 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,
 	if (*queue_id >= dev->data->nb_rx_queues)
 		*queue_id = 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_query, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_avail_thresh_query == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_query)(dev,
 							     queue_id, avail_thresh));
 }
@@ -4736,7 +4793,8 @@ rte_eth_dev_rx_intr_enable(uint16_t port_id,
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_intr_enable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id));
 }
 
@@ -4754,7 +4812,8 @@ rte_eth_dev_rx_intr_disable(uint16_t port_id,
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_intr_disable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id));
 }
 
@@ -5018,7 +5077,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+	if (*dev->dev_ops->rxq_info_get == NULL)
+		return -ENOTSUP;
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
@@ -5063,7 +5123,8 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+	if (*dev->dev_ops->txq_info_get == NULL)
+		return -ENOTSUP;
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
@@ -5093,7 +5154,8 @@ rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_burst_mode_get, -ENOTSUP);
+	if (*dev->dev_ops->rx_burst_mode_get == NULL)
+		return -ENOTSUP;
 	memset(mode, 0, sizeof(*mode));
 	return eth_err(port_id,
 		       dev->dev_ops->rx_burst_mode_get(dev, queue_id, mode));
@@ -5120,7 +5182,8 @@ rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_burst_mode_get, -ENOTSUP);
+	if (*dev->dev_ops->tx_burst_mode_get == NULL)
+		return -ENOTSUP;
 	memset(mode, 0, sizeof(*mode));
 	return eth_err(port_id,
 		       dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode));
@@ -5147,7 +5210,8 @@ rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_monitor_addr, -ENOTSUP);
+	if (*dev->dev_ops->get_monitor_addr == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		dev->dev_ops->get_monitor_addr(dev->data->rx_queues[queue_id], pmc));
 }
@@ -5162,7 +5226,8 @@ rte_eth_dev_set_mc_addr_list(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
+	if (*dev->dev_ops->set_mc_addr_list == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, dev->dev_ops->set_mc_addr_list(dev,
 						mc_addr_set, nb_mc_addr));
 }
@@ -5175,7 +5240,8 @@ rte_eth_timesync_enable(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
+	if (*dev->dev_ops->timesync_enable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_enable)(dev));
 }
 
@@ -5187,7 +5253,8 @@ rte_eth_timesync_disable(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
+	if (*dev->dev_ops->timesync_disable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_disable)(dev));
 }
 
@@ -5207,7 +5274,8 @@ rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_rx_timestamp == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_rx_timestamp)
 				(dev, timestamp, flags));
 }
@@ -5228,7 +5296,8 @@ rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_tx_timestamp == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_tx_timestamp)
 				(dev, timestamp));
 }
@@ -5241,7 +5310,8 @@ rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_adjust_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_adjust_time)(dev, delta));
 }
 
@@ -5260,7 +5330,8 @@ rte_eth_timesync_read_time(uint16_t port_id, struct timespec *timestamp)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_time)(dev,
 								timestamp));
 }
@@ -5280,7 +5351,8 @@ rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_write_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_write_time)(dev,
 								timestamp));
 }
@@ -5299,7 +5371,8 @@ rte_eth_read_clock(uint16_t port_id, uint64_t *clock)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->read_clock, -ENOTSUP);
+	if (*dev->dev_ops->read_clock == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->read_clock)(dev, clock));
 }
 
@@ -5318,7 +5391,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
+	if (*dev->dev_ops->get_reg == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_reg)(dev, info));
 }
 
@@ -5330,7 +5404,8 @@ rte_eth_dev_get_eeprom_length(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
+	if (*dev->dev_ops->get_eeprom_length == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_eeprom_length)(dev));
 }
 
@@ -5349,7 +5424,8 @@ rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->get_eeprom == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_eeprom)(dev, info));
 }
 
@@ -5368,7 +5444,8 @@ rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->set_eeprom == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->set_eeprom)(dev, info));
 }
 
@@ -5388,7 +5465,8 @@ rte_eth_dev_get_module_info(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_info, -ENOTSUP);
+	if (*dev->dev_ops->get_module_info == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->get_module_info)(dev, modinfo);
 }
 
@@ -5422,7 +5500,8 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->get_module_eeprom == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->get_module_eeprom)(dev, info);
 }
 
@@ -5444,7 +5523,8 @@ rte_eth_dev_get_dcb_info(uint16_t port_id,
 
 	memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
+	if (*dev->dev_ops->get_dcb_info == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_dcb_info)(dev, dcb_info));
 }
 
@@ -5500,7 +5580,8 @@ rte_eth_dev_hairpin_capability_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_cap_get, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_cap_get == NULL)
+		return -ENOTSUP;
 	memset(cap, 0, sizeof(*cap));
 	return eth_err(port_id, (*dev->dev_ops->hairpin_cap_get)(dev, cap));
 }
@@ -5775,7 +5856,8 @@ rte_eth_representor_info_get(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->representor_info_get, -ENOTSUP);
+	if (*dev->dev_ops->representor_info_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->representor_info_get)(dev, info));
 }
 
@@ -5799,7 +5881,8 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_metadata_negotiate, -ENOTSUP);
+	if (*dev->dev_ops->rx_metadata_negotiate == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		       (*dev->dev_ops->rx_metadata_negotiate)(dev, features));
 }
@@ -5826,8 +5909,8 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_capability_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_capability_get == NULL)
+		return -ENOTSUP;
 	memset(reassembly_capa, 0, sizeof(struct rte_eth_ip_reassembly_params));
 
 	return eth_err(port_id, (*dev->dev_ops->ip_reassembly_capability_get)
@@ -5856,8 +5939,8 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_conf_get == NULL)
+		return -ENOTSUP;
 	memset(conf, 0, sizeof(struct rte_eth_ip_reassembly_params));
 	return eth_err(port_id,
 		       (*dev->dev_ops->ip_reassembly_conf_get)(dev, conf));
@@ -5894,8 +5977,8 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_set,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_conf_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		       (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf));
 }
@@ -5913,7 +5996,8 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP);
+	if (*dev->dev_ops->eth_dev_priv_dump == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file));
 }
 
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index de9e970d4d..41d37e41b5 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -5710,7 +5710,8 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
 	qd = p->rxq.data[queue_id];
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_queue_count, -ENOTSUP);
+	if (*p->rx_queue_count == NULL)
+		return -ENOTSUP;
 	if (qd == NULL)
 		return -EINVAL;
 
@@ -5784,7 +5785,8 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
 	if (qd == NULL)
 		return -ENODEV;
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_descriptor_status, -ENOTSUP);
+	if (*p->rx_descriptor_status == NULL)
+		return -ENOTSUP;
 	return (*p->rx_descriptor_status)(qd, offset);
 }
 
@@ -5854,7 +5856,8 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
 	if (qd == NULL)
 		return -ENODEV;
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*p->tx_descriptor_status, -ENOTSUP);
+	if (*p->tx_descriptor_status == NULL)
+		return -ENOTSUP;
 	return (*p->tx_descriptor_status)(qd, offset);
 }
 
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7c695176f4..4938b4ee07 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -974,9 +974,8 @@ rte_event_crypto_adapter_queue_pair_add(uint8_t id,
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW) ||
 	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->crypto_adapter_queue_pair_add,
-			-ENOTSUP);
+		if (*dev->dev_ops->crypto_adapter_queue_pair_add == NULL)
+			return -ENOTSUP;
 		if (dev_info->qpairs == NULL) {
 			dev_info->qpairs =
 			    rte_zmalloc_socket(adapter->mem_name,
@@ -1076,9 +1075,8 @@ rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id,
 	if ((cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
 	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->crypto_adapter_queue_pair_del,
-			-ENOTSUP);
+		if (*dev->dev_ops->crypto_adapter_queue_pair_del == NULL)
+			return -ENOTSUP;
 		ret = (*dev->dev_ops->crypto_adapter_queue_pair_del)(dev,
 						dev_info->dev,
 						queue_pair_id);
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bf8741d2ea..8e81cf774d 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2655,8 +2655,8 @@ rte_event_eth_rx_adapter_queue_add(uint8_t id,
 	dev_info = &rx_adapter->eth_devices[eth_dev_id];
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_add,
-					-ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_queue_add == NULL)
+			return -ENOTSUP;
 		if (dev_info->rx_queue == NULL) {
 			dev_info->rx_queue =
 			    rte_zmalloc_socket(rx_adapter->mem_name,
@@ -2750,8 +2750,8 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
 	dev_info = &rx_adapter->eth_devices[eth_dev_id];
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_del,
-				 -ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_queue_del == NULL)
+			return -ENOTSUP;
 		ret = (*dev->dev_ops->eth_rx_adapter_queue_del)(dev,
 						&rte_eth_devices[eth_dev_id],
 						rx_queue_id);
@@ -2861,9 +2861,8 @@ rte_event_eth_rx_adapter_vector_limits_get(
 	}
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->eth_rx_adapter_vector_limits_get,
-			-ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_vector_limits_get == NULL)
+			return -ENOTSUP;
 		ret = dev->dev_ops->eth_rx_adapter_vector_limits_get(
 			dev, &rte_eth_devices[eth_port_id], limits);
 	} else {
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 1dc4f966be..79b905e9fc 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -92,7 +92,8 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_event_dev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns;
@@ -216,7 +217,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 
 	if (nb_queues != 0) {
 		queues_cfg = dev->data->queues_cfg;
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+		if (*dev->dev_ops->queue_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
@@ -229,7 +231,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 				sizeof(queues_cfg[0]) * new_qs);
 		}
 	} else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+		if (*dev->dev_ops->queue_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
@@ -254,7 +257,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 			 dev->data->dev_id);
 
 	if (nb_ports != 0) { /* re-config */
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
+		if (*dev->dev_ops->port_release == NULL)
+			return -ENOTSUP;
 
 		ports = dev->data->ports;
 		ports_cfg = dev->data->ports_cfg;
@@ -279,7 +283,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 	} else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
+		if (*dev->dev_ops->port_release == NULL)
+			return -ENOTSUP;
 
 		ports = dev->data->ports;
 		for (i = nb_ports; i < old_nb_ports; i++) {
@@ -303,8 +308,10 @@ rte_event_dev_configure(uint8_t dev_id,
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started) {
 		RTE_EDEV_LOG_ERR(
@@ -509,7 +516,8 @@ rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->queue_def_conf == NULL)
+		return -ENOTSUP;
 	memset(queue_conf, 0, sizeof(struct rte_event_queue_conf));
 	(*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf);
 	return 0;
@@ -595,11 +603,12 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_setup == NULL)
+		return -ENOTSUP;
 
 	if (queue_conf == NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf,
-					-ENOTSUP);
+		if (*dev->dev_ops->queue_def_conf == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->queue_def_conf)(dev, queue_id, &def_conf);
 		queue_conf = &def_conf;
 	}
@@ -635,7 +644,8 @@ rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->port_def_conf == NULL)
+		return -ENOTSUP;
 	memset(port_conf, 0, sizeof(struct rte_event_port_conf));
 	(*dev->dev_ops->port_def_conf)(dev, port_id, port_conf);
 	return 0;
@@ -706,11 +716,12 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_setup, -ENOTSUP);
+	if (*dev->dev_ops->port_setup == NULL)
+		return -ENOTSUP;
 
 	if (port_conf == NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf,
-					-ENOTSUP);
+		if (*dev->dev_ops->port_def_conf == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->port_def_conf)(dev, port_id, &def_conf);
 		port_conf = &def_conf;
 	}
@@ -896,7 +907,8 @@ rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
+	if (*dev->dev_ops->queue_attr_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_attr_set)(dev, queue_id, attr_id,
 					       attr_value);
 }
@@ -1045,7 +1057,8 @@ rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id)
 	 * This allows PMDs which handle unlink synchronously to not implement
 	 * this function at all.
 	 */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_unlinks_in_progress, 0);
+	if (*dev->dev_ops->port_unlinks_in_progress == NULL)
+		return 0;
 
 	return (*dev->dev_ops->port_unlinks_in_progress)(dev,
 			dev->data->ports[port_id]);
@@ -1087,7 +1100,8 @@ rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timeout_ticks, -ENOTSUP);
+	if (*dev->dev_ops->timeout_ticks == NULL)
+		return -ENOTSUP;
 
 	if (timeout_ticks == NULL)
 		return -EINVAL;
@@ -1119,7 +1133,8 @@ rte_event_dev_dump(uint8_t dev_id, FILE *f)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+	if (*dev->dev_ops->dump == NULL)
+		return -ENOTSUP;
 	if (f == NULL)
 		return -EINVAL;
 
@@ -1285,7 +1300,8 @@ rte_event_dev_start(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already started",
@@ -1331,7 +1347,8 @@ rte_event_dev_stop(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already stopped",
@@ -1352,7 +1369,8 @@ rte_event_dev_close(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 
 	/* Device must be stopped before it can be closed */
 	if (dev->data->dev_started == 1) {
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 2d36dee8f0..ac32c4bb72 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -154,7 +154,8 @@ rte_mempool_ops_get_info(const struct rte_mempool *mp,
 
 	ops = rte_mempool_get_ops(mp->ops_index);
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->get_info, -ENOTSUP);
+	if (ops->get_info == NULL)
+		return -ENOTSUP;
 	return ops->get_info(mp, info);
 }
 
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index 2f0a4f132e..e157d65332 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -71,12 +71,14 @@ rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info,
 	int ret = 0;
 
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(dev_info, -EINVAL);
+	if (dev_info == NULL)
+		return -EINVAL;
 
 	rawdev = &rte_rawdevs[dev_id];
 
 	if (dev_info->dev_private != NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*rawdev->dev_ops->dev_info_get, -ENOTSUP);
+		if (*rawdev->dev_ops->dev_info_get == NULL)
+			return -ENOTSUP;
 		ret = (*rawdev->dev_ops->dev_info_get)(rawdev,
 				dev_info->dev_private,
 				dev_private_size);
@@ -97,11 +99,13 @@ rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf,
 	int diag;
 
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(dev_conf, -EINVAL);
+	if (dev_conf == NULL)
+		return -EINVAL;
 
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->started) {
 		RTE_RDEV_ERR(
@@ -131,7 +135,8 @@ rte_rawdev_queue_conf_get(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->queue_def_conf == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf,
 			queue_conf_size);
 }
@@ -147,7 +152,8 @@ rte_rawdev_queue_setup(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_setup == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf,
 			queue_conf_size);
 }
@@ -160,7 +166,8 @@ rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+	if (*dev->dev_ops->queue_release == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_release)(dev, queue_id);
 }
 
@@ -172,7 +179,8 @@ rte_rawdev_queue_count(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_count, -ENOTSUP);
+	if (*dev->dev_ops->queue_count == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_count)(dev);
 }
 
@@ -186,7 +194,8 @@ rte_rawdev_get_attr(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_get, -ENOTSUP);
+	if (*dev->dev_ops->attr_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->attr_get)(dev, attr_name, attr_value);
 }
 
@@ -200,7 +209,8 @@ rte_rawdev_set_attr(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_set, -ENOTSUP);
+	if (*dev->dev_ops->attr_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->attr_set)(dev, attr_name, attr_value);
 }
 
@@ -215,7 +225,8 @@ rte_rawdev_enqueue_buffers(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->enqueue_bufs, -ENOTSUP);
+	if (*dev->dev_ops->enqueue_bufs == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->enqueue_bufs)(dev, buffers, count, context);
 }
 
@@ -230,7 +241,8 @@ rte_rawdev_dequeue_buffers(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dequeue_bufs, -ENOTSUP);
+	if (*dev->dev_ops->dequeue_bufs == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dequeue_bufs)(dev, buffers, count, context);
 }
 
@@ -242,7 +254,8 @@ rte_rawdev_dump(uint16_t dev_id, FILE *f)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+	if (*dev->dev_ops->dump == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dump)(dev, f);
 }
 
@@ -251,7 +264,8 @@ xstats_get_count(uint16_t dev_id)
 {
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_names == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_names)(dev, NULL, 0);
 }
 
@@ -273,7 +287,8 @@ rte_rawdev_xstats_names_get(uint16_t dev_id,
 
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_names == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_names)(dev, xstats_names, size);
 }
 
@@ -287,7 +302,8 @@ rte_rawdev_xstats_get(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
 	const struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get)(dev, ids, values, n);
 }
 
@@ -306,7 +322,8 @@ rte_rawdev_xstats_by_name_get(uint16_t dev_id,
 		id = &temp; /* driver never gets a NULL value */
 
 	/* implemented by driver */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_by_name, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_by_name == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_by_name)(dev, name, id);
 }
 
@@ -317,7 +334,8 @@ rte_rawdev_xstats_reset(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_reset, -ENOTSUP);
+	if (*dev->dev_ops->xstats_reset == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids);
 }
 
@@ -327,7 +345,8 @@ rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_status_get, -ENOTSUP);
+	if (*dev->dev_ops->firmware_status_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_status_get)(dev, status_info);
 }
 
@@ -337,7 +356,8 @@ rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_version_get, -ENOTSUP);
+	if (*dev->dev_ops->firmware_version_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_version_get)(dev, version_info);
 }
 
@@ -350,7 +370,8 @@ rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image)
 	if (!firmware_image)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
+	if (*dev->dev_ops->firmware_load == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_load)(dev, firmware_image);
 }
 
@@ -360,7 +381,8 @@ rte_rawdev_firmware_unload(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
+	if (*dev->dev_ops->firmware_load == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_unload)(dev);
 }
 
@@ -370,7 +392,8 @@ rte_rawdev_selftest(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+	if (*dev->dev_ops->dev_selftest == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_selftest)(dev_id);
 }
 
@@ -435,7 +458,8 @@ rte_rawdev_close(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	/* Device must be stopped before it can be closed */
 	if (dev->started == 1) {
 		RTE_RDEV_ERR("Device %u must be stopped before closing",
@@ -454,7 +478,8 @@ rte_rawdev_reset(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_reset == NULL)
+		return -ENOTSUP;
 	/* Reset is not dependent on state of the device */
 	return (*dev->dev_ops->dev_reset)(dev);
 }
diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
index 02a388bc5d..caec069182 100644
--- a/lib/regexdev/rte_regexdev.c
+++ b/lib/regexdev/rte_regexdev.c
@@ -189,7 +189,8 @@ regexdev_info_get(uint8_t dev_id, struct rte_regexdev_info *dev_info)
 	if (dev_info == NULL)
 		return -EINVAL;
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_info_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_info_get)(dev, dev_info);
 
 }
@@ -211,7 +212,8 @@ rte_regexdev_configure(uint8_t dev_id, const struct rte_regexdev_config *cfg)
 	if (cfg == NULL)
 		return -EINVAL;
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 	if (dev->data->dev_started) {
 		RTE_REGEXDEV_LOG
 			(ERR, "Dev %u must be stopped to allow configuration\n",
@@ -301,7 +303,8 @@ rte_regexdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_qp_setup, -ENOTSUP);
+	if (*dev->dev_ops->dev_qp_setup == NULL)
+		return -ENOTSUP;
 	if (dev->data->dev_started) {
 		RTE_REGEXDEV_LOG
 			(ERR, "Dev %u must be stopped to allow configuration\n",
@@ -332,7 +335,8 @@ rte_regexdev_start(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_start)(dev);
 	if (ret == 0)
 		dev->data->dev_started = 1;
@@ -346,7 +350,8 @@ rte_regexdev_stop(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_stop)(dev);
 	dev->data->dev_started = 0;
 	return 0;
@@ -359,7 +364,8 @@ rte_regexdev_close(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_close)(dev);
 	dev->data->dev_started = 0;
 	dev->state = RTE_REGEXDEV_UNUSED;
@@ -374,7 +380,8 @@ rte_regexdev_attr_get(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_attr_get == NULL)
+		return -ENOTSUP;
 	if (attr_value == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
 				 dev_id);
@@ -391,7 +398,8 @@ rte_regexdev_attr_set(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_set, -ENOTSUP);
+	if (*dev->dev_ops->dev_attr_set == NULL)
+		return -ENOTSUP;
 	if (attr_value == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
 				 dev_id);
@@ -409,7 +417,8 @@ rte_regexdev_rule_db_update(uint8_t dev_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_update, -ENOTSUP);
+	if (*dev->dev_ops->dev_rule_db_update == NULL)
+		return -ENOTSUP;
 	if (rules == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
 				 dev_id);
@@ -425,8 +434,8 @@ rte_regexdev_rule_db_compile_activate(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_compile_activate,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_rule_db_compile_activate == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_rule_db_compile_activate)(dev);
 }
 
@@ -438,8 +447,8 @@ rte_regexdev_rule_db_import(uint8_t dev_id, const char *rule_db,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_import,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_db_import == NULL)
+		return -ENOTSUP;
 	if (rule_db == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
 				 dev_id);
@@ -455,8 +464,8 @@ rte_regexdev_rule_db_export(uint8_t dev_id, char *rule_db)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_export,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_db_export == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_db_export)(dev, rule_db);
 }
 
@@ -468,8 +477,8 @@ rte_regexdev_xstats_names_get(uint8_t dev_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_names_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_names_get == NULL)
+		return -ENOTSUP;
 	if (xstats_map == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d xstats map can't be NULL\n",
 				 dev_id);
@@ -486,7 +495,8 @@ rte_regexdev_xstats_get(uint8_t dev_id, const uint16_t *ids,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_get == NULL)
+		return -ENOTSUP;
 	if (ids == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -506,8 +516,8 @@ rte_regexdev_xstats_by_name_get(uint8_t dev_id, const char *name,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_by_name_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_by_name_get == NULL)
+		return -ENOTSUP;
 	if (name == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d name can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -531,7 +541,8 @@ rte_regexdev_xstats_reset(uint8_t dev_id, const uint16_t *ids,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_reset == NULL)
+		return -ENOTSUP;
 	if (ids == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -546,7 +557,8 @@ rte_regexdev_selftest(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+	if (*dev->dev_ops->dev_selftest == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_selftest)(dev);
 }
 
@@ -557,7 +569,8 @@ rte_regexdev_dump(uint8_t dev_id, FILE *f)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_dump, -ENOTSUP);
+	if (*dev->dev_ops->dev_dump == NULL)
+		return -ENOTSUP;
 	if (f == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d file can't be NULL\n", dev_id);
 		return -EINVAL;
diff --git a/lib/regexdev/rte_regexdev.h b/lib/regexdev/rte_regexdev.h
index 3bce8090f6..6061e648b1 100644
--- a/lib/regexdev/rte_regexdev.h
+++ b/lib/regexdev/rte_regexdev.h
@@ -1473,7 +1473,8 @@ rte_regexdev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
 #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->enqueue, -ENOTSUP);
+	if (*dev->enqueue == NULL)
+		return -ENOTSUP;
 	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
 		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
 		return -EINVAL;
@@ -1532,7 +1533,8 @@ rte_regexdev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
 	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
 #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dequeue, -ENOTSUP);
+	if (*dev->dequeue == NULL)
+		return -ENOTSUP;
 	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
 		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
 		return -EINVAL;
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..1a2a408f0e 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -131,7 +131,8 @@ __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
 	RTE_PTR_OR_ERR_RET(instance, -EINVAL);
 	RTE_PTR_OR_ERR_RET(instance->ops, -EINVAL);
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->set_pkt_metadata, -ENOTSUP);
+	if (*instance->ops->set_pkt_metadata == NULL)
+		return -ENOTSUP;
 	return instance->ops->set_pkt_metadata(instance->device,
 					       sess, m, params);
 }
@@ -145,7 +146,8 @@ __rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md)
 	RTE_PTR_OR_ERR_RET(instance, NULL);
 	RTE_PTR_OR_ERR_RET(instance->ops, NULL);
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_userdata, NULL);
+	if (*instance->ops->get_userdata == NULL)
+		return NULL;
 	if (instance->ops->get_userdata(instance->device, md, &userdata))
 		return NULL;
 
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index b2a2919fc0..a6ca785b29 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -266,7 +266,8 @@ rte_vdpa_get_stats_names(struct rte_vdpa_device *dev,
 	if (!dev)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats_names, -ENOTSUP);
+	if (dev->ops->get_stats_names == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->get_stats_names(dev, stats_names, size);
 }
@@ -278,7 +279,8 @@ rte_vdpa_get_stats(struct rte_vdpa_device *dev, uint16_t qid,
 	if (!dev || !stats || !n)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats, -ENOTSUP);
+	if (dev->ops->get_stats == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->get_stats(dev, qid, stats, n);
 }
@@ -289,7 +291,8 @@ rte_vdpa_reset_stats(struct rte_vdpa_device *dev, uint16_t qid)
 	if (!dev)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->reset_stats, -ENOTSUP);
+	if (dev->ops->reset_stats == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->reset_stats(dev, qid);
 }
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 4ad28bac45..0ae059ad29 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -3381,8 +3381,10 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable)
 		q_last = qid;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_vfio_device_fd, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_notify_area, -ENOTSUP);
+	if (vdpa_dev->ops->get_vfio_device_fd == NULL)
+		return -ENOTSUP;
+	if (vdpa_dev->ops->get_notify_area == NULL)
+		return -ENOTSUP;
 
 	vfio_device_fd = vdpa_dev->ops->get_vfio_device_fd(vid);
 	if (vfio_device_fd < 0)
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [PATCH v5 00/27] Bus and device cleanup for 22.11
  2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (7 preceding siblings ...)
  2022-09-05  8:35   ` [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
@ 2022-09-05  8:39   ` David Marchand
  8 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: Thomas Monjalon, Bruce Richardson

On Mon, Sep 5, 2022 at 10:36 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> The rte_bus, rte_driver and rte_device objects are part of the public
> ABI and this has proved to be a problem when needing to extend them.
> This series hides them, and mark associated driver only API as internal.
>
> A good amount of the patches are preparation work on rte_bus.h,
> rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
> between them.
>
> PCI bus specific handling are removed from testpmd, unit tests and
> examples.
>
> After this series, driver-only API headers for registering to buses are
> not exported anymore, unless the enable_driver_sdk meson option is
> selected.
>
> New accessors for rte_bus, rte_driver and rte_device have been added,
> marked with an experimental tag first when introducing them, and later
> in the series marked as stable since external users will want to use
> those drop-in replacements right away.
>
> A check is added to ensure we won't pollute app/ and examples/ again,
> though some unit tests are left intentionnally untouched as they test
> some internals of DPDK.
>
> Changes since v4:
> - (hopefully, because I can't test) fixed Windows build,
> - dropped unneeded change in vdev unit test,

Pebcak, I only sent the first patches... resending the whole series.
Sorry for the noise.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 09/27] devargs: remove dependency on bus header
  2022-09-05  8:39 ` David Marchand
                     ` (7 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 10/27] build: export drivers headers David Marchand
                     ` (17 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

We don't need to include rte_bus.h in rte_devargs.h.
Only a forward declaration of rte_bus and an inclusion of rte_dev.h are
needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_vdev.c          | 1 +
 lib/eal/include/rte_devargs.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 720722c363..5eeff3106d 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/lib/eal/include/rte_devargs.h b/lib/eal/include/rte_devargs.h
index 37a0f042ab..38dee2f288 100644
--- a/lib/eal/include/rte_devargs.h
+++ b/lib/eal/include/rte_devargs.h
@@ -22,7 +22,9 @@ extern "C" {
 
 #include <stdio.h>
 #include <rte_compat.h>
-#include <rte_bus.h>
+#include <rte_dev.h>
+
+struct rte_bus;
 
 /**
  * Bus type key in global devargs syntax.
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 10/27] build: export drivers headers
  2022-09-05  8:39 ` David Marchand
                     ` (8 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 09/27] devargs: remove dependency on bus header David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 11/27] bus/auxiliary: make driver-only headers private David Marchand
                     ` (16 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Same as for device classes, external DPDK users may need to include some
bus headers for their out of tree drivers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/meson.build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/meson.build b/drivers/meson.build
index 376a64f4da..f6ba5ba4fb 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -91,6 +91,7 @@ foreach subpath:subdirs
         name = drv
         sources = []
         headers = []
+        driver_sdk_headers = [] # public headers included by drivers
         objs = []
         cflags = default_cflags
         includes = [include_directories(drv_path)]
@@ -160,6 +161,9 @@ foreach subpath:subdirs
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         install_headers(headers)
+        if get_option('enable_driver_sdk')
+            install_headers(driver_sdk_headers)
+        endif
 
         # generate pmdinfo sources by building a temporary
         # lib and then running pmdinfogen on the contents of
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 11/27] bus/auxiliary: make driver-only headers private
  2022-09-05  8:39 ` David Marchand
                     ` (9 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 10/27] build: export drivers headers David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 12/27] bus/dpaa: " David Marchand
                     ` (15 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Parav Pandit, Xueming Li, Ray Kinsella,
	Matan Azrad, Viacheslav Ovsiienko

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 <david.marchand@redhat.com>
---
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 <rte_devargs.h>
 
 #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 <rte_kvargs.h>
 
 #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 <stdint.h>
 #include <inttypes.h>
 
+#include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 
 #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 <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <eal_filesystem.h>
 
-#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 <stdio.h>
 #include <sys/queue.h>
 
-#include "rte_bus_auxiliary.h"
+#include <rte_bus.h>
+
+#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 <rte_malloc.h>
 #include <rte_errno.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #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 <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <rte_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <ethdev_pci.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 12/27] bus/dpaa: make driver-only headers private
  2022-09-05  8:39 ` David Marchand
                     ` (10 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 11/27] bus/auxiliary: make driver-only headers private David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 13/27] bus/fslmc: " David Marchand
                     ` (14 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Hemant Agrawal, Sachin Saxena, Gagandeep Singh

The dpaa 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.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 drivers/bus/dpaa/base/qbman/qman.c            |  2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     | 25 ++++++-------------
 drivers/bus/dpaa/dpaa_bus.c                   | 20 +++++++--------
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |  2 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |  2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |  2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |  2 +-
 10 files changed, 26 insertions(+), 35 deletions(-)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 447c091770..3949bf8712 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -7,7 +7,7 @@
 
 #include "qman.h"
 #include <rte_branch_prediction.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_eventdev.h>
 #include <rte_byteorder.h>
 
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/bus_dpaa_driver.h
similarity index 92%
rename from drivers/bus/dpaa/rte_dpaa_bus.h
rename to drivers/bus/dpaa/bus_dpaa_driver.h
index 1f04d9ebd3..cf66fc0c53 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -3,12 +3,14 @@
  *   Copyright 2017-2022 NXP
  *
  */
-#ifndef __RTE_DPAA_BUS_H__
-#define __RTE_DPAA_BUS_H__
+#ifndef BUS_DPAA_DRIVER_H
+#define BUS_DPAA_DRIVER_H
 
-#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
+
 #include <dpaax_iova_table.h>
 
 #include <dpaa_of.h>
@@ -73,24 +75,12 @@ extern unsigned int dpaa_svr_family;
 struct rte_dpaa_device;
 struct rte_dpaa_driver;
 
-/* DPAA Device and Driver lists for DPAA bus */
-TAILQ_HEAD(rte_dpaa_device_list, rte_dpaa_device);
-TAILQ_HEAD(rte_dpaa_driver_list, rte_dpaa_driver);
-
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
 	FSL_DPAA_QDMA
 };
 
-struct rte_dpaa_bus {
-	struct rte_bus bus;
-	struct rte_dpaa_device_list device_list;
-	struct rte_dpaa_driver_list driver_list;
-	int device_count;
-	int detected;
-};
-
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
@@ -119,7 +109,6 @@ typedef int (*rte_dpaa_remove_t)(struct rte_dpaa_device *dpaa_dev);
 struct rte_dpaa_driver {
 	TAILQ_ENTRY(rte_dpaa_driver) next;
 	struct rte_driver driver;
-	struct rte_dpaa_bus *dpaa_bus;
 	enum rte_dpaa_type drv_type;
 	rte_dpaa_probe_t probe;
 	rte_dpaa_remove_t remove;
@@ -166,6 +155,7 @@ extern struct dpaa_memseg_list rte_dpaa_memsegs;
 /* Either iterate over the list of internal memseg references or fallback to
  * EAL memseg based iova2virt.
  */
+__rte_internal
 static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 {
 	struct dpaa_memseg *ms;
@@ -192,6 +182,7 @@ static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 	return va;
 }
 
+__rte_internal
 static inline rte_iova_t
 rte_dpaa_mem_vtop(void *vaddr)
 {
@@ -263,4 +254,4 @@ struct fm_eth_port_cfg *dpaa_get_eth_port_cfg(int dev_id);
 }
 #endif
 
-#endif /* __RTE_DPAA_BUS_H__ */
+#endif /* BUS_DPAA_DRIVER_H */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e442bc4c33..1ac6aa314f 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,7 +34,7 @@
 #include <rte_mbuf_dyn.h>
 
 #include <dpaa_of.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaax_iova_table.h>
 
@@ -43,6 +43,14 @@
 #include <fsl_bman.h>
 #include <netcfg.h>
 
+struct rte_dpaa_bus {
+	struct rte_bus bus;
+	TAILQ_HEAD(, rte_dpaa_device) device_list;
+	TAILQ_HEAD(, rte_dpaa_driver) driver_list;
+	int device_count;
+	int detected;
+};
+
 static struct rte_dpaa_bus rte_dpaa_bus;
 struct netcfg_info *dpaa_netcfg;
 
@@ -520,23 +528,15 @@ rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
 	BUS_INIT_FUNC_TRACE();
 
 	TAILQ_INSERT_TAIL(&rte_dpaa_bus.driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = &rte_dpaa_bus;
 }
 
 /* un-register a dpaa bus based dpaa driver */
 void
 rte_dpaa_driver_unregister(struct rte_dpaa_driver *driver)
 {
-	struct rte_dpaa_bus *dpaa_bus;
-
 	BUS_INIT_FUNC_TRACE();
 
-	dpaa_bus = driver->dpaa_bus;
-
-	TAILQ_REMOVE(&dpaa_bus->driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = NULL;
+	TAILQ_REMOVE(&rte_dpaa_bus.driver_list, driver, next);
 }
 
 static int
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 05415dbf3b..7e554cb2b1 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -41,7 +41,7 @@
 #include <desc/pdcp.h>
 #include <desc/sdap.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_event.h>
 #include <dpaa_sec_log.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d081953e26..29c5935739 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -15,7 +15,7 @@
 #include <desc/algo.h>
 #include <desc/ipsec.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_log.h>
 
diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c
index 9386fe5698..10e65ef1d7 100644
--- a/drivers/dma/dpaa/dpaa_qdma.c
+++ b/drivers/dma/dpaa/dpaa_qdma.c
@@ -2,7 +2,7 @@
  * Copyright 2021 NXP
  */
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dmadev_pmd.h>
 
 #include "dpaa_qdma.h"
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index ff6cc0be18..aa403f9e06 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -29,7 +29,7 @@
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_event_eth_tx_adapter.h>
 #include <cryptodev_pmd.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h
index dc0058e6dd..3f0eafa7dd 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.h
+++ b/drivers/mempool/dpaa/dpaa_mempool.h
@@ -14,7 +14,7 @@
 
 #include <rte_mempool.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 
 #include <fsl_usd.h>
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index e5a072cf49..f21cbba0d9 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -33,7 +33,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaa_mempool.h>
 
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 956fe946fa..20b75efb63 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -37,7 +37,7 @@
 
 #include "dpaa_ethdev.h"
 #include "dpaa_rxtx.h"
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_mempool.h>
 
 #include <qman.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 13/27] bus/fslmc: make driver-only headers private
  2022-09-05  8:39 ` David Marchand
                     ` (11 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 12/27] bus/dpaa: " David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 14/27] bus/ifpga: cleanup exported symbols David Marchand
                     ` (13 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Hemant Agrawal, Sachin Saxena, Gagandeep Singh

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.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@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


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 14/27] bus/ifpga: cleanup exported symbols
  2022-09-05  8:39 ` David Marchand
                     ` (12 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 13/27] bus/fslmc: " David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 15/27] bus/ifpga: make driver-only headers private David Marchand
                     ` (12 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

Remove unused symbols (exposed only in an internal header which
guarantees that no application out there relied on them).

Remove rte_ prefix and inline the rest to avoid having to expose them as
global symbols for a relatively small added value.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
 drivers/bus/ifpga/ifpga_bus.c    | 13 +++--
 drivers/bus/ifpga/ifpga_common.c | 88 --------------------------------
 drivers/bus/ifpga/ifpga_common.h | 54 ++++++++++++++++----
 drivers/bus/ifpga/meson.build    |  2 +-
 drivers/bus/ifpga/version.map    |  2 -
 drivers/raw/ifpga/ifpga_rawdev.c |  2 +-
 6 files changed, 53 insertions(+), 108 deletions(-)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c

diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index e005f2cb70..b1e9eb7cc4 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -117,9 +117,9 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-		&rte_ifpga_get_integer32_arg, &afu_pr_conf.afu_id.port) < 0) {
-			IFPGA_BUS_ERR("error to parse %s",
-				     IFPGA_ARG_PORT);
+				ifpga_get_integer32_arg,
+				&afu_pr_conf.afu_id.port) < 0) {
+			IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_PORT);
 			goto end;
 		}
 	} else {
@@ -130,9 +130,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_AFU_BTS) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_AFU_BTS,
-				       &rte_ifpga_get_string_arg, &path) < 0) {
-			IFPGA_BUS_ERR("Failed to parse %s",
-				     IFPGA_AFU_BTS);
+				ifpga_get_string_arg, &path) < 0) {
+			IFPGA_BUS_ERR("Failed to parse %s", IFPGA_AFU_BTS);
 			goto end;
 		}
 		afu_pr_conf.pr_enable = 1;
@@ -228,7 +227,7 @@ ifpga_scan(void)
 
 		if (rte_kvargs_count(kvlist, IFPGA_ARG_NAME) == 1) {
 			if (rte_kvargs_process(kvlist, IFPGA_ARG_NAME,
-				       &rte_ifpga_get_string_arg, &name) < 0) {
+					ifpga_get_string_arg, &name) < 0) {
 				IFPGA_BUS_ERR("error to parse %s",
 				     IFPGA_ARG_NAME);
 				goto end;
diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c
deleted file mode 100644
index 78e2eaee4e..0000000000
--- a/drivers/bus/ifpga/ifpga_common.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2018 Intel Corporation
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/queue.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <rte_errno.h>
-#include <rte_bus.h>
-#include <rte_per_lcore.h>
-#include <rte_memory.h>
-#include <rte_memzone.h>
-#include <rte_eal.h>
-#include <rte_common.h>
-
-#include <rte_devargs.h>
-#include <rte_kvargs.h>
-#include <rte_alarm.h>
-
-#include "rte_bus_ifpga.h"
-#include "ifpga_logs.h"
-#include "ifpga_common.h"
-
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(char **)extra_args = strdup(value);
-
-	if (!*(char **)extra_args)
-		return -ENOMEM;
-
-	return 0;
-}
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(int *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_unsigned_long(const char *str, int base)
-{
-	unsigned long num;
-	char *end = NULL;
-
-	errno = 0;
-
-	num = strtoul(str, &end, base);
-	if ((str[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0))
-		return -1;
-
-	return num;
-}
-
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1)
-{
-	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
-		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
-		(afu_id0->port == afu_id1->port)) {
-		return 0;
-	} else
-		return 1;
-}
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index f9254b9d5d..bb6524030f 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -5,14 +5,50 @@
 #ifndef _IFPGA_COMMON_H_
 #define _IFPGA_COMMON_H_
 
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_unsigned_long(const char *str, int base);
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1);
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_bus_ifpga.h>
+#include <rte_common.h>
+
+static inline int
+ifpga_get_string_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(char **)extra_args = strdup(value);
+
+	if (!*(char **)extra_args)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static inline int
+ifpga_get_integer32_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(int *)extra_args = strtoull(value, NULL, 0);
+
+	return 0;
+}
+
+static inline int
+ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
+	const struct rte_afu_id *afu_id1)
+{
+	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
+		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
+		(afu_id0->port == afu_id1->port)) {
+		return 0;
+	} else
+		return 1;
+}
 
 #endif /* _IFPGA_COMMON_H_ */
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index cc5047e3ce..9d56a4bb2b 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -9,4 +9,4 @@ endif
 
 deps += ['pci', 'kvargs', 'rawdev']
 headers = files('rte_bus_ifpga.h')
-sources = files('ifpga_common.c', 'ifpga_bus.c')
+sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index c0a1eecae8..da7f92c2a0 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -4,8 +4,6 @@ DPDK_23 {
 	rte_ifpga_driver_register;
 	rte_ifpga_driver_unregister;
 	rte_ifpga_find_afu_by_name;
-	rte_ifpga_get_integer32_arg;
-	rte_ifpga_get_string_arg;
 
 	local: *;
 };
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 3b616c45ff..153203a42f 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1754,7 +1754,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-			&rte_ifpga_get_integer32_arg, &port) < 0) {
+				ifpga_get_integer32_arg, &port) < 0) {
 			IFPGA_RAWDEV_PMD_ERR("error to parse %s",
 				IFPGA_ARG_PORT);
 			goto end;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 15/27] bus/ifpga: make driver-only headers private
  2022-09-05  8:39 ` David Marchand
                     ` (13 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 14/27] bus/ifpga: cleanup exported symbols David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 16/27] bus/pci: " David Marchand
                     ` (11 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

The ifpga bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- 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 <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst         |  2 +-
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}    | 18 ++++++++----------
 drivers/bus/ifpga/ifpga_bus.c                  |  6 +++---
 drivers/bus/ifpga/ifpga_common.h               |  2 +-
 drivers/bus/ifpga/meson.build                  |  2 +-
 drivers/bus/ifpga/version.map                  |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c             |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h             |  2 +-
 drivers/net/ipn3ke/ipn3ke_flow.c               |  2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c        |  2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                 |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h               |  2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c             |  2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c              |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c               |  2 +-
 17 files changed, 26 insertions(+), 28 deletions(-)
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 9fd95e13dd..2f2bd2b086 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,7 +88,7 @@ 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``,
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``
   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).
diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/bus_ifpga_driver.h
similarity index 91%
rename from drivers/bus/ifpga/rte_bus_ifpga.h
rename to drivers/bus/ifpga/bus_ifpga_driver.h
index 007ad19875..7b75c2ddbc 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -2,8 +2,8 @@
  * Copyright(c) 2010-2018 Intel Corporation
  */
 
-#ifndef _RTE_BUS_IFPGA_H_
-#define _RTE_BUS_IFPGA_H_
+#ifndef BUS_IFPGA_DRIVER_H
+#define BUS_IFPGA_DRIVER_H
 
 /**
  * @file
@@ -15,23 +15,17 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#include <rte_bus.h>
+#include <rte_compat.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
 
-/** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
 
 /* Forward declarations */
 struct rte_afu_device;
 struct rte_afu_driver;
 
-/** Double linked list of Intel FPGA AFU device. */
-RTE_TAILQ_HEAD(ifpga_afu_dev_list, rte_afu_device);
-/** Double linked list of Intel FPGA AFU device drivers. */
-RTE_TAILQ_HEAD(ifpga_afu_drv_list, rte_afu_driver);
-
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
 struct rte_afu_uuid {
@@ -112,6 +106,7 @@ struct rte_afu_driver {
 	const struct rte_afu_uuid *id_table;    /**< AFU uuid within FPGA. */
 };
 
+__rte_internal
 static inline const char *
 rte_ifpga_device_name(const struct rte_afu_device *afu)
 {
@@ -126,6 +121,7 @@ rte_ifpga_device_name(const struct rte_afu_device *afu)
  * @param name
  *   A pointer to AFU name string.
  */
+__rte_internal
 struct rte_afu_device *
 rte_ifpga_find_afu_by_name(const char *name);
 
@@ -136,6 +132,7 @@ rte_ifpga_find_afu_by_name(const char *name);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be registered.
  */
+__rte_internal
 void rte_ifpga_driver_register(struct rte_afu_driver *driver);
 
 /**
@@ -145,6 +142,7 @@ void rte_ifpga_driver_register(struct rte_afu_driver *driver);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be unregistered.
  */
+__rte_internal
 void rte_ifpga_driver_unregister(struct rte_afu_driver *driver);
 
 #define RTE_PMD_REGISTER_AFU(nm, afudrv)\
@@ -164,4 +162,4 @@ static const char *afudrvinit_ ## nm ## _alias = RTE_STR(alias)
 }
 #endif /* __cplusplus */
 
-#endif /* _RTE_BUS_IFPGA_H_ */
+#endif /* BUS_IFPGA_DRIVER_H */
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index b1e9eb7cc4..27e2de7072 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -28,7 +28,7 @@
 
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_logs.h"
 #include "ifpga_common.h"
 
@@ -37,9 +37,9 @@
  */
 static struct rte_bus rte_ifpga_bus;
 
-static struct ifpga_afu_dev_list ifpga_afu_dev_list =
+static TAILQ_HEAD(, rte_afu_device) ifpga_afu_dev_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_dev_list);
-static struct ifpga_afu_drv_list ifpga_afu_drv_list =
+static TAILQ_HEAD(, rte_afu_driver) ifpga_afu_drv_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_drv_list);
 
 
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index bb6524030f..a41a1628f5 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_common.h>
 
 static inline int
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index 9d56a4bb2b..dedc94db2d 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -8,5 +8,5 @@ if is_windows
 endif
 
 deps += ['pci', 'kvargs', 'rawdev']
-headers = files('rte_bus_ifpga.h')
+driver_sdk_headers += files('bus_ifpga_driver.h')
 sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index da7f92c2a0..3d1943afe4 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -1,4 +1,4 @@
-DPDK_23 {
+INTERNAL {
 	global:
 
 	rte_ifpga_driver_register;
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 550a8b0466..2e39113941 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 58fcc50c57..dbf57f9ba8 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -24,7 +24,7 @@
 #include <rte_spinlock.h>
 
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_tm_driver.h>
 
 #define IPN3KE_TM_SCRATCH_RW 0
diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c
index 66ae31a5a9..5b57ee9341 100644
--- a/drivers/net/ipn3ke/ipn3ke_flow.c
+++ b/drivers/net/ipn3ke/ipn3ke_flow.c
@@ -20,7 +20,7 @@
 #include <rte_tailq.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index abbecfdf2e..2f088d767f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 6a9b98fd7f..2f242b678a 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/raw/ifpga/afu_pmd_core.h b/drivers/raw/ifpga/afu_pmd_core.h
index 91118a19ab..ab5a228147 100644
--- a/drivers/raw/ifpga/afu_pmd_core.h
+++ b/drivers/raw/ifpga/afu_pmd_core.h
@@ -15,7 +15,7 @@ extern "C" {
 
 #include <rte_spinlock.h>
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "ifpga_rawdev.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index 102de50812..eca1edc270 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index 8b2c85b5f8..da0aba6e00 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 0f57a03b0e..3c41aa9ee8 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 5120df5f77..b7438bd372 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 153203a42f..32de5ff0ce 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -35,7 +35,7 @@
 #include "base/ifpga_api.h"
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_common.h"
 #include "ifpga_logs.h"
 #include "ifpga_rawdev.h"
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 16/27] bus/pci: make driver-only headers private
  2022-09-05  8:39 ` David Marchand
                     ` (14 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 15/27] bus/ifpga: make driver-only headers private David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 17/27] bus/vdev: " David Marchand
                     ` (10 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ajit Khaparde, Rosen Xu,
	Nicolas Chautru, Ray Kinsella, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Matan Azrad, Viacheslav Ovsiienko,
	Fan Zhang, Andrew Rybchenko, Ashish Gupta, Chandubabu Namburu,
	Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Nagadheeraj Rottela, Srikanth Jampala, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru, Chengwen Feng,
	Kevin Laatz, Conor Walsh, Timothy McDaniel, Jerin Jacob,
	Pavan Nikhilesh, Elena Agostini, Ashwin Sekhar T K, Harman Kalra,
	Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Chas Williams, Min Hu (Connor),
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Dongdong Liu, Yisen Zhuang, Yuying Zhang,
	Beilei Xing, Junfeng Guo, Andrew Boyer, Qiming Yang,
	Stephen Hemminger, Long Li, Jiawen Wu, Devendra Singh Rawat,
	Maciej Czekaj, Jian Wang, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Tianfei zhang,
	Jingjing Wu, Ori Kam, Xiao Wang, Vijay Kumar Srivastava,
	Ferruh Yigit

The pci 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 <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 app/test/virtual_pmd.c                        |   2 +-
 doc/guides/rel_notes/release_22_11.rst        |   2 +-
 drivers/baseband/acc100/rte_acc100_pmd.c      |   2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   2 +-
 drivers/bus/pci/bsd/pci.c                     |   3 -
 drivers/bus/pci/bus_pci_driver.h              | 200 +++++++++++++++++
 drivers/bus/pci/linux/pci.c                   |   3 -
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |   2 -
 drivers/bus/pci/private.h                     |  19 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +-----------------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   1 +
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/common/cnxk/roc_platform.h            |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |   2 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   2 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   2 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   2 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   2 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   2 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   3 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/netvsc/hn_vf.c                    |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   2 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   2 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 lib/ethdev/ethdev_pci.h                       |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 128 files changed, 350 insertions(+), 331 deletions(-)
 create mode 100644 drivers/bus/pci/bus_pci_driver.h

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index cd4611ab48..2b55c85fd8 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2f2bd2b086..8fa4cf468d 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,7 +88,7 @@ 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``, ``ifpga``
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``
   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).
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index a8482bd411..801e8920df 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -14,7 +14,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_hexdump.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
 #endif
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 82ae6ba678..c1d877c87f 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 21d35292a3..f16814e241 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 9a11f99ae3..bc560a2a56 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -28,7 +28,6 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
@@ -48,8 +47,6 @@
  * PCI probing under BSD.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /* Map pci device */
 int
 rte_pci_map_device(struct rte_pci_device *dev)
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
new file mode 100644
index 0000000000..b5c7dee617
--- /dev/null
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -0,0 +1,200 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2015 Intel Corporation.
+ * Copyright 2013-2014 6WIND S.A.
+ */
+
+#ifndef BUS_PCI_DRIVER_H
+#define BUS_PCI_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_pci.h>
+#include <rte_dev.h>
+#include <rte_compat.h>
+
+/** Pathname of PCI devices directory. */
+__rte_internal
+const char *rte_pci_get_sysfs_path(void);
+
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* no attached driver */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
+};
+
+/**
+ * A structure describing a PCI device.
+ */
+struct rte_pci_device {
+	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
+	struct rte_device device;           /**< Inherit core device */
+	struct rte_pci_addr addr;           /**< PCI location. */
+	struct rte_pci_id id;               /**< PCI ID. */
+	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
+					    /**< PCI Memory Resource */
+	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
+	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
+	uint16_t max_vfs;                   /**< sriov enable if not zero */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
+	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	struct rte_intr_handle *vfio_req_intr_handle;
+				/**< Handler of VFIO request interrupt */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_pci_device.
+ */
+#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
+
+#define RTE_DEV_TO_PCI_CONST(ptr) \
+	container_of(ptr, const struct rte_pci_device, device)
+
+#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
+
+#ifdef __cplusplus
+/** C++ macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev) \
+	RTE_CLASS_ANY_ID,         \
+	(vend),                   \
+	(dev),                    \
+	RTE_PCI_ANY_ID,           \
+	RTE_PCI_ANY_ID
+#else
+/** Macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev)          \
+	.class_id = RTE_CLASS_ANY_ID,      \
+	.vendor_id = (vend),               \
+	.device_id = (dev),                \
+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
+	.subsystem_device_id = RTE_PCI_ANY_ID
+#endif
+
+/**
+ * Initialisation function for the driver called during PCI probing.
+ */
+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
+
+/**
+ * Uninitialisation function for the driver called during hotplugging.
+ */
+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A structure describing a PCI driver.
+ */
+struct rte_pci_driver {
+	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
+	struct rte_driver driver;          /**< Inherit core driver. */
+	rte_pci_probe_t *probe;            /**< Device probe function. */
+	rte_pci_remove_t *remove;          /**< Device remove function. */
+	pci_dma_map_t *dma_map;		   /**< device dma map function. */
+	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
+	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
+	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
+};
+
+/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
+#define RTE_PCI_DRV_NEED_MAPPING 0x0001
+/** Device needs PCI BAR mapping with enabled write combining (wc) */
+#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
+/** Device already probed can be probed again to check for new ports. */
+#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
+/** Device driver supports link state interrupt */
+#define RTE_PCI_DRV_INTR_LSC	0x0008
+/** Device driver supports device removal interrupt */
+#define RTE_PCI_DRV_INTR_RMV 0x0010
+/** Device driver needs to keep mapped resources if unsupported dev detected */
+#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
+
+/**
+ * Register a PCI driver.
+ *
+ * @param driver
+ *   A pointer to a rte_pci_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_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) \
+{\
+	(pci_drv).driver.name = RTE_STR(nm);\
+	rte_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.
+ */
+__rte_internal
+void rte_pci_unregister(struct rte_pci_driver *driver);
+
+/*
+ * A structure used to access io resources for a pci device.
+ * rte_pci_ioport is arch, os, driver specific, and should not be used outside
+ * of pci ioport api.
+ */
+struct rte_pci_ioport {
+	struct rte_pci_device *dev;
+	uint64_t base;
+	uint64_t len; /* only filled for memory mapped ports */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_PCI_DRIVER_H */
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index e521459870..fa5d5e131d 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -6,7 +6,6 @@
 #include <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_malloc.h>
@@ -24,8 +23,6 @@
  * PCI probing using Linux sysfs.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 static int
 pci_get_kernel_driver_by_path(const char *filename, char *dri_name,
 			      size_t len)
diff --git a/drivers/bus/pci/meson.build b/drivers/bus/pci/meson.build
index 81c7e94c00..f50f039a68 100644
--- a/drivers/bus/pci/meson.build
+++ b/drivers/bus/pci/meson.build
@@ -3,6 +3,7 @@
 
 deps += ['pci']
 headers = files('rte_bus_pci.h')
+driver_sdk_headers = files('bus_pci_driver.h')
 sources = files('pci_common.c',
     'pci_params.c')
 if is_linux
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 37ab879779..0d61d49287 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -443,7 +443,6 @@ void
 rte_pci_register(struct rte_pci_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = &rte_pci_bus;
 }
 
 /* unregister a driver */
@@ -451,7 +450,6 @@ void
 rte_pci_unregister(struct rte_pci_driver *driver)
 {
 	TAILQ_REMOVE(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to PCI bus */
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 0fbef8e1d8..4e40a2ed85 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,12 +8,29 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
+/**
+ * Structure describing the PCI bus
+ */
+struct rte_pci_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_pci_device) device_list; /**< List of PCI devices */
+	RTE_TAILQ_HEAD(, rte_pci_driver) driver_list; /**< List of PCI drivers */
+};
+
 extern struct rte_pci_bus rte_pci_bus;
 
+/* PCI Bus iterators */
+#define FOREACH_DEVICE_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+
 struct rte_pci_driver;
 struct rte_pci_device;
 
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1c6a8fdd7b..60e50ca875 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -24,176 +24,15 @@ extern "C" {
 
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 
-/** Pathname of PCI devices directory. */
-const char *rte_pci_get_sysfs_path(void);
-
 /* Forward declarations */
 struct rte_pci_device;
 struct rte_pci_driver;
-
-/** List of PCI devices */
-RTE_TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
-/** List of PCI drivers */
-RTE_TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
-
-/* PCI Bus iterators */
-#define FOREACH_DEVICE_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+struct rte_pci_ioport;
 
 struct rte_devargs;
 
-enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
-	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
-	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
-	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
-	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
-	RTE_PCI_KDRV_NONE,         /* no attached driver */
-	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
-};
-
-/**
- * A structure describing a PCI device.
- */
-struct rte_pci_device {
-	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
-	struct rte_device device;           /**< Inherit core device */
-	struct rte_pci_addr addr;           /**< PCI location. */
-	struct rte_pci_id id;               /**< PCI ID. */
-	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
-					    /**< PCI Memory Resource */
-	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
-	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
-	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
-	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
-	struct rte_intr_handle *vfio_req_intr_handle;
-				/**< Handler of VFIO request interrupt */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_pci_device.
- */
-#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
-
-#define RTE_DEV_TO_PCI_CONST(ptr) \
-	container_of(ptr, const struct rte_pci_device, device)
-
-#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
-
-#ifdef __cplusplus
-/** C++ macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev) \
-	RTE_CLASS_ANY_ID,         \
-	(vend),                   \
-	(dev),                    \
-	RTE_PCI_ANY_ID,           \
-	RTE_PCI_ANY_ID
-#else
-/** Macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev)          \
-	.class_id = RTE_CLASS_ANY_ID,      \
-	.vendor_id = (vend),               \
-	.device_id = (dev),                \
-	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
-	.subsystem_device_id = RTE_PCI_ANY_ID
-#endif
-
-/**
- * Initialisation function for the driver called during PCI probing.
- */
-typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
-
-/**
- * Uninitialisation function for the driver called during hotplugging.
- */
-typedef int (rte_pci_remove_t)(struct rte_pci_device *);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A structure describing a PCI driver.
- */
-struct rte_pci_driver {
-	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
-	struct rte_driver driver;          /**< Inherit core driver. */
-	struct rte_pci_bus *bus;           /**< PCI bus reference. */
-	rte_pci_probe_t *probe;            /**< Device probe function. */
-	rte_pci_remove_t *remove;          /**< Device remove function. */
-	pci_dma_map_t *dma_map;		   /**< device dma map function. */
-	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
-	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
-	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
-};
-
-/**
- * Structure describing the PCI bus
- */
-struct rte_pci_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_pci_device_list device_list;  /**< List of PCI devices */
-	struct rte_pci_driver_list driver_list;  /**< List of PCI drivers */
-};
-
-/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
-#define RTE_PCI_DRV_NEED_MAPPING 0x0001
-/** Device needs PCI BAR mapping with enabled write combining (wc) */
-#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
-/** Device already probed can be probed again to check for new ports. */
-#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
-/** Device driver supports link state interrupt */
-#define RTE_PCI_DRV_INTR_LSC	0x0008
-/** Device driver supports device removal interrupt */
-#define RTE_PCI_DRV_INTR_RMV 0x0010
-/** Device driver needs to keep mapped resources if unsupported dev detected */
-#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
-
 /**
  * Map the PCI device resources in user space virtual memory address
  *
@@ -261,33 +100,6 @@ off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap);
 __rte_experimental
 int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable);
 
-/**
- * Register a PCI driver.
- *
- * @param driver
- *   A pointer to a rte_pci_driver structure describing the driver
- *   to be registered.
- */
-void rte_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) \
-{\
-	(pci_drv).driver.name = RTE_STR(nm);\
-	rte_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_pci_unregister(struct rte_pci_driver *driver);
-
 /**
  * Read PCI config space.
  *
@@ -322,17 +134,6 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 int rte_pci_write_config(const struct rte_pci_device *device,
 		const void *buf, size_t len, off_t offset);
 
-/**
- * A structure used to access io resources for a pci device.
- * rte_pci_ioport is arch, os, driver specific, and should not be used outside
- * of pci ioport api.
- */
-struct rte_pci_ioport {
-	struct rte_pci_device *dev;
-	uint64_t base;
-	uint64_t len; /* only filled for memory mapped ports */
-};
-
 /**
  * Initialize a rte_pci_ioport object for a pci device io resource.
  *
diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map
index 3d5c2f3068..161ab86d3b 100644
--- a/drivers/bus/pci/version.map
+++ b/drivers/bus/pci/version.map
@@ -2,16 +2,13 @@ DPDK_23 {
 	global:
 
 	rte_pci_dump;
-	rte_pci_get_sysfs_path;
 	rte_pci_ioport_map;
 	rte_pci_ioport_read;
 	rte_pci_ioport_unmap;
 	rte_pci_ioport_write;
 	rte_pci_map_device;
 	rte_pci_read_config;
-	rte_pci_register;
 	rte_pci_unmap_device;
-	rte_pci_unregister;
 	rte_pci_write_config;
 
 	local: *;
@@ -25,3 +22,11 @@ EXPERIMENTAL {
 	# added in 21.08
 	rte_pci_set_bus_master;
 };
+
+INTERNAL {
+	global:
+
+	rte_pci_get_sysfs_path;
+	rte_pci_register;
+	rte_pci_unregister;
+};
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 7bf091158b..f013b743b3 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -9,6 +9,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_bus_pci.h>
 
 #include "private.h"
 #include "pci_netuio.h"
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index 5460399eea..314bbcf547 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 #include <rte_log.h>
 #include <rte_eal.h>
+#include <rte_bus_pci.h>
 
 #ifdef __MINGW32__
 #include <ddk/ndisguid.h>
diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h
index 502f243a81..a7cbe444ae 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -7,7 +7,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bitmap.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c
index b42102e84c..aafff60eeb 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -15,7 +15,7 @@
 
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 
 #include "mlx5_common.h"
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h
index 479bb3c7cb..81702b8768 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.h
+++ b/drivers/common/mlx5/linux/mlx5_common_os.h
@@ -9,7 +9,7 @@
 #include <malloc.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_log.h>
diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
index 63f31437da..629a639a81 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -8,7 +8,7 @@
 #include <stdio.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_rwlock.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 66626953f1..e82cb881bf 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,8 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
 #include "mlx5_common_private.h"
diff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c
index f2fc7cd494..2b6058eb3e 100644
--- a/drivers/common/mlx5/windows/mlx5_common_os.c
+++ b/drivers/common/mlx5/windows/mlx5_common_os.c
@@ -7,7 +7,7 @@
 #include <stdio.h>
 
 #include <rte_mempool.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_errno.h>
 
diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h
index e1a32a7e87..d1512f3b89 100644
--- a/drivers/common/qat/qat_device.h
+++ b/drivers/common/qat/qat_device.h
@@ -4,7 +4,7 @@
 #ifndef _QAT_DEVICE_H_
 #define _QAT_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "qat_common.h"
 #include "qat_logs.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 8674eccdca..5916e745e2 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
diff --git a/drivers/common/sfc_efx/sfc_efx.h b/drivers/common/sfc_efx/sfc_efx.h
index c16eca60f3..d3ea586cb8 100644
--- a/drivers/common/sfc_efx/sfc_efx.h
+++ b/drivers/common/sfc_efx/sfc_efx.h
@@ -10,7 +10,7 @@
 #ifndef _SFC_EFX_H_
 #define _SFC_EFX_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "efx.h"
 #include "efsys.h"
diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c
index d64a628c74..3d2c45fcee 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -5,7 +5,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h
index 46c80c8dc2..cdef8cc6cb 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -7,7 +7,7 @@
 
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
 #include <rte_compressdev_pmd.h>
diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index e8f57c3cc4..fe4a4999c6 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_hexdump.h>
 #include <rte_comp.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_memcpy.h>
 #include <rte_common.h>
diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h
index 2a205cd446..9deaae7980 100644
--- a/drivers/crypto/ccp/ccp_dev.h
+++ b/drivers/crypto/ccp/ccp_dev.h
@@ -10,7 +10,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_byteorder.h>
 #include <rte_io.h>
diff --git a/drivers/crypto/ccp/ccp_pci.h b/drivers/crypto/ccp/ccp_pci.h
index 7ed3bac406..6736bf8ad3 100644
--- a/drivers/crypto/ccp/ccp_pci.h
+++ b/drivers/crypto/ccp/ccp_pci.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
 #define PROC_MODULES "/proc/modules"
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a35a8cd775..4957f11e97 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_bus_vdev.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 1e0a7b91c9..3fd9f3c426 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index 54cd77e575..bd425f95ff 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index eb7616257e..dc8e291f50 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -7,7 +7,7 @@
 #include <rte_eal_paging.h>
 #include <rte_errno.h>
 #include <rte_log.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/crypto/nitrox/nitrox_device.h b/drivers/crypto/nitrox/nitrox_device.h
index 6b8095f42b..1ff7c59b63 100644
--- a/drivers/crypto/nitrox/nitrox_device.h
+++ b/drivers/crypto/nitrox/nitrox_device.h
@@ -5,7 +5,7 @@
 #ifndef _NITROX_DEVICE_H_
 #define _NITROX_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 struct nitrox_sym_device;
diff --git a/drivers/crypto/octeontx/otx_cryptodev.c b/drivers/crypto/octeontx/otx_cryptodev.c
index 337d06aab8..b5ab937c3a 100644
--- a/drivers/crypto/octeontx/otx_cryptodev.c
+++ b/drivers/crypto/octeontx/otx_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium, Inc
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_log.h>
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 7aee67ab09..11840f5ecf 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eventdev.h>
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index db6316fbe9..f3a99ae15c 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -7,7 +7,7 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_crypto_sym.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 
 #include "qat_sym.h"
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index ed64866758..21bd996064 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eal.h>
diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c
index ae069794a6..95a43c8801 100644
--- a/drivers/crypto/virtio/virtio_pci.c
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -10,7 +10,6 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
 
 #include "virtio_pci.h"
 #include "virtqueue.h"
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
index 0a7ea1bb64..41949c3d13 100644
--- a/drivers/crypto/virtio/virtio_pci.h
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 
 #include <rte_eal_paging.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 #include "virtio_crypto.h"
diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c
index 2824c1b44f..9f0de60861 100644
--- a/drivers/dma/cnxk/cnxk_dmadev.c
+++ b/drivers/dma/cnxk/cnxk_dmadev.c
@@ -5,8 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index 9494b60779..0e11ca14cc 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c
index 2f8ec06d9e..781fa02db3 100644
--- a/drivers/dma/idxd/idxd_pci.c
+++ b/drivers/dma/idxd/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_devargs.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
index a230496b11..5906eb45aa 100644
--- a/drivers/dma/ioat/ioat_dmadev.c
+++ b/drivers/dma/ioat/ioat_dmadev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
 #include <rte_prefetch.h>
diff --git a/drivers/event/dlb2/pf/dlb2_main.h b/drivers/event/dlb2/pf/dlb2_main.h
index 9eeda482a3..5aa51b1616 100644
--- a/drivers/event/dlb2/pf/dlb2_main.h
+++ b/drivers/event/dlb2/pf/dlb2_main.h
@@ -9,7 +9,7 @@
 #include <rte_log.h>
 #include <rte_spinlock.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include "base/dlb2_hw_types.h"
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index dd3f2b8ece..9f8c6cd8b8 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -25,7 +25,7 @@
 #include <rte_cycles.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
 #include <eventdev_pmd_pci.h>
diff --git a/drivers/event/octeontx/ssovf_probe.c b/drivers/event/octeontx/ssovf_probe.c
index 4da7d1ae45..2c9601a8ff 100644
--- a/drivers/event/octeontx/ssovf_probe.c
+++ b/drivers/event/octeontx/ssovf_probe.c
@@ -7,7 +7,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "octeontx_mbox.h"
 #include "ssovf_evdev.h"
diff --git a/drivers/event/octeontx/timvf_probe.c b/drivers/event/octeontx/timvf_probe.c
index 59bba31e8e..7ce3eddd7e 100644
--- a/drivers/event/octeontx/timvf_probe.c
+++ b/drivers/event/octeontx/timvf_probe.c
@@ -5,7 +5,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <octeontx_mbox.h>
 
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 664605d9fb..2be7b8d2df 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -6,7 +6,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_dev.h>
 
diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index 54a1a7d3ae..78caf987d0 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_atomic.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 8fd9edced2..1513c632c6 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -13,7 +13,7 @@
 
 #include <rte_atomic.h>
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index e8e4092be6..c654a229f7 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7ac55584ff..7c0cb666fb 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index d7e1729e68..89414ac88a 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -16,7 +16,7 @@
 
 #include <rte_byteorder.h>
 #include <rte_spinlock.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_io.h>
 
 #include "bnx2x_osal.h"
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e86e51e1fa..c9aa45ed3b 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 5406e1c934..1a86eb3c00 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,8 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index 1c016a7115..16cbc1a345 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -8,7 +8,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index cf9a2fdc19..fd71a50a58 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_tailq.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 794496abfc..409de50083 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index cea5b490ba..d48fd52404 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -18,7 +18,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a9c18b27e8..43979992d3 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 3f3fd0d61e..c7588ea57e 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -10,7 +10,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 0db0918b43..4709675af8 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -12,7 +12,7 @@
 #include <ethdev_pci.h>
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_timer.h>
 #include <rte_dev.h>
 #include <rte_net.h>
diff --git a/drivers/net/enic/base/vnic_dev.h b/drivers/net/enic/base/vnic_dev.h
index 4b9f75b65f..44ca5c739f 100644
--- a/drivers/net/enic/base/vnic_dev.h
+++ b/drivers/net/enic/base/vnic_dev.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "enic_compat.h"
 #include "vnic_resource.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index a8d470e8ac..998436e5e8 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9f351de72e..19a99a82c5 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 1ad6ad3dfb..7312c411bd 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c
index 5eb022297e..818698dcb3 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwdev.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c
@@ -3,7 +3,7 @@
  */
 
 #include<ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index 26fa1e27d4..2d3f192b21 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_csr.h"
diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index ad5db9f1de..4aa3fa6adc 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
-#include<rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_pmd_hwdev.h"
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 35788f46eb..7aa5e7d8e9 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 424205356e..e8e5aa2c86 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_kvargs.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
 
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6b1d1a5fb1..144daf1636 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 
 #include "hns3_ethdev.h"
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 95f711e7eb..cd0c91f3a3 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018-2021 HiSilicon Limited.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 67d79de08d..7bdc453ec1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 7f8e81858e..cc0f992453 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Intel Corporation.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 7f221a5d34..e3727b7b41 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -7,7 +7,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h
index 49b90d1b7c..a55202b178 100644
--- a/drivers/net/ionic/ionic.h
+++ b/drivers/net/ionic/ionic.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "ionic_dev.h"
 #include "ionic_if.h"
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 28280c5377..d72033c32c 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 2e39113941..70a06a3b15 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -4,7 +4,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 2f088d767f..2ef96a984a 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 2f242b678a..0260227900 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f31bbb7895..552e41692c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index cc6049a66a..ff34fd1515 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index ce74c51ce2..bb1dd33e7c 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -32,7 +32,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_ether.h>
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index aaf636aa0d..661d362dc0 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -25,7 +25,7 @@
 #include <time.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index c9ed38ef7c..efb262e368 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,8 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 998846adbe..30923b0732 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 05c919ed39..a5c7ca8c52 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -11,7 +11,7 @@
 #include <errno.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index bee9363515..e122b39cb3 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -15,7 +15,7 @@
 #include <rte_flow_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ip.h>
 #include <rte_gre.h>
 #include <rte_vxlan.h>
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 0140f8b3b2..9150ced72d 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -13,7 +13,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal_paging.h>
 
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 62948bf889..cce0a79edb 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h
index bf1fa30312..8783fce4dd 100644
--- a/drivers/net/ngbe/base/ngbe_osdep.h
+++ b/drivers/net/ngbe/base/ngbe_osdep.h
@@ -19,7 +19,7 @@
 #include <rte_config.h>
 #include <rte_io.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../ngbe_logs.h"
 
diff --git a/drivers/net/ngbe/ngbe_pf.c b/drivers/net/ngbe/ngbe_pf.c
index 12a18de31d..947ae7fe94 100644
--- a/drivers/net/ngbe/ngbe_pf.c
+++ b/drivers/net/ngbe/ngbe_pf.c
@@ -6,7 +6,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/ngbe.h"
 #include "ngbe_ethdev.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c
index 0ddff54886..6a48a22de6 100644
--- a/drivers/net/octeontx/base/octeontx_pkivf.c
+++ b/drivers/net/octeontx/base/octeontx_pkivf.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../octeontx_logs.h"
 #include "octeontx_io.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c
index bf28bc7992..5d445dfb49 100644
--- a/drivers/net/octeontx/base/octeontx_pkovf.c
+++ b/drivers/net/octeontx/base/octeontx_pkovf.c
@@ -10,7 +10,7 @@
 #include <rte_cycles.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 
 #include "../octeontx_logs.h"
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 9ea579bfc8..67e7f759fe 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -20,7 +20,7 @@
 #include <rte_ether.h>
 #include <rte_io.h>
 #include <rte_version.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 /* Forward declaration */
 struct ecore_dev;
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index a0979618be..0a1e224fa2 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -13,7 +13,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 39f85e8b84..506c62a726 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_ether.h>
diff --git a/drivers/net/sfc/sfc_sriov.c b/drivers/net/sfc/sfc_sriov.c
index 385b172e2e..009b884d8d 100644
--- a/drivers/net/sfc/sfc_sriov.c
+++ b/drivers/net/sfc/sfc_sriov.c
@@ -8,7 +8,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc.h"
 #include "sfc_log.h"
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 262c024560..28183ec740 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -32,7 +32,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index 262dbb5e38..6fb22ca7d9 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_ethdev_core.h>
 #include <rte_hash.h>
 #include <rte_hash_crc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index d0093c0163..f19bdf36dc 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -4,7 +4,7 @@
  */
 
 #include <sys/queue.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c
index 0b82fb1a88..176f79005c 100644
--- a/drivers/net/txgbe/txgbe_pf.c
+++ b/drivers/net/txgbe/txgbe_pf.c
@@ -20,7 +20,7 @@
 #include <rte_memcpy.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/txgbe.h"
 #include "txgbe_ethdev.h"
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 11e25a0142..6d4a8712c2 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 
 #include "virtio.h"
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 1f6bdeddda..2b9e35cef5 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 
 #include <rte_memory.h>
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 2af67dc0a3..101b1cb500 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index 349d551839..db029cbf34 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_eal.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
index 26def43564..2d8466ef91 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
index bbe7f74def..b424d6127d 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index eca1edc270..859f28dcc1 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index da0aba6e00..c7c5cda48c 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 3c41aa9ee8..a1db533eeb 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -17,7 +17,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index b7438bd372..67b3941265 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 32de5ff0ce..ec86bfdb0c 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -16,7 +16,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 #include <rte_alarm.h>
 #include <rte_interrupts.h>
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 1ca248123b..a47d5a0350 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 #include "rte_pmd_ifpga.h"
diff --git a/drivers/raw/ioat/idxd_pci.c b/drivers/raw/ioat/idxd_pci.c
index 13515dbc6c..90ec0222e6 100644
--- a/drivers/raw/ioat/idxd_pci.c
+++ b/drivers/raw/ioat/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_devargs.h>
 
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 11341fcf5d..f58006bbda 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index f5e773c53b..76e98fe515 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_mbuf.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_memcpy.h>
 #include <rte_rawdev.h>
diff --git a/drivers/raw/ntb/ntb_hw_intel.c b/drivers/raw/ntb/ntb_hw_intel.c
index 20cdb761a3..9b4465176a 100644
--- a/drivers/raw/ntb/ntb_hw_intel.c
+++ b/drivers/raw/ntb/ntb_hw_intel.c
@@ -8,7 +8,7 @@
 #include <rte_io.h>
 #include <rte_eal.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index 9f79c6907c..4c20daac94 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -9,7 +9,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_common_mr.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c
index 9a2db7e43f..0a8c83fe14 100644
--- a/drivers/regex/mlx5/mlx5_regex_fastpath.c
+++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c
@@ -10,7 +10,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_regexdev_driver.h>
 #include <rte_mbuf.h>
diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h
index 3d567695cc..6444d7f72c 100644
--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h
+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h
@@ -10,7 +10,7 @@
 
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_io.h>
 
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index ac42de9c79..d5ac583589 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -14,7 +14,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_vhost.h>
 #include <rte_vdpa.h>
 #include <vdpa_driver.h>
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index 91af792a3a..026daa3f24 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/vdpa/sfc/sfc_vdpa.h b/drivers/vdpa/sfc/sfc_vdpa.h
index daeb27d4cd..b25eb3a5fe 100644
--- a/drivers/vdpa/sfc/sfc_vdpa.h
+++ b/drivers/vdpa/sfc/sfc_vdpa.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc_efx.h"
 #include "sfc_efx_mcdi.h"
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index a268507801..94b8fba5d7 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_config.h>
 #include <ethdev_driver.h>
 
diff --git a/lib/eventdev/eventdev_pmd_pci.h b/lib/eventdev/eventdev_pmd_pci.h
index 24b56faaa9..7bbec40c71 100644
--- a/lib/eventdev/eventdev_pmd_pci.h
+++ b/lib/eventdev/eventdev_pmd_pci.h
@@ -23,7 +23,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 17/27] bus/vdev: make driver-only headers private
  2022-09-05  8:39 ` David Marchand
                     ` (15 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 16/27] bus/pci: " David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 18/27] bus/vmbus: " David Marchand
                     ` (9 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Rosen Xu, Ruifeng Wang,
	Gagandeep Singh, Hemant Agrawal, Nicolas Chautru, Ray Kinsella,
	Lee Daly, Fan Zhang, Ashish Gupta, Sunila Sahu, Ajit Khaparde,
	Raveendra Padasalagi, Vikas Gupta, Chandubabu Namburu,
	Pablo de Lara, Michael Shamis, Liron Himi, Chengwen Feng,
	Kevin Laatz, Sachin Saxena, Jerin Jacob, Liang Ma,
	Peter Mccarthy, Harry van Haaren, John W. Linville, Ciara Loftus,
	Qi Zhang, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Jakub Grajciar, Zyta Szpak, Tetsuya Mukawa,
	Harman Kalra, Jasvinder Singh, Cristian Dumitrescu, Matan Azrad,
	Maxime Coquelin, Chenbo Xia, Jakub Palider, Tomasz Duszynski,
	Tianfei zhang, Ferruh Yigit, Andrew Rybchenko

The vdev 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 <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
Changes since v4:
- dropped unnneeded change on test_vdev.c,

Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst        |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++++++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 ----------------
 drivers/bus/vdev/vdev.c                       |   8 +-
 drivers/bus/vdev/vdev_params.c                |   1 -
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_evdev.c          |   2 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   2 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   2 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   2 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   2 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |   2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   2 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 62 files changed, 220 insertions(+), 199 deletions(-)
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8fa4cf468d..bafd99c39e 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,8 +88,8 @@ 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``, ``ifpga``, ``pci``
-  buses has been marked as an internal API.
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
+  ``vdev`` 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).
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 4d1bd16751..f0927d9fca 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -10,7 +10,7 @@
 #include <dirent.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 248e12987f..e76ef2313f 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index af7bc416f9..e8d0c43e6f 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
new file mode 100644
index 0000000000..36748cdfae
--- /dev/null
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -0,0 +1,151 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ */
+
+#ifndef BUS_VDEV_DRIVER_H
+#define BUS_VDEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vdev.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
+	struct rte_device device;               /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+	container_of(ptr, struct rte_vdev_device, device)
+
+#define RTE_DEV_TO_VDEV_CONST(ptr) \
+	container_of(ptr, const struct rte_vdev_device, device)
+
+#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.name)
+		return dev->device.name;
+	return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.devargs)
+		return dev->device.devargs->args;
+	return "";
+}
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+	struct rte_driver driver;        /**< Inherited general driver. */
+	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
+	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
+	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
+	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
+	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
+};
+
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+static const char *vdrvinit_ ## nm ## _alias;\
+RTE_INIT(vdrvinitfn_ ##vdrv)\
+{\
+	(vdrv).driver.name = RTE_STR(nm);\
+	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+	rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VDEV_DRIVER_H */
diff --git a/drivers/bus/vdev/meson.build b/drivers/bus/vdev/meson.build
index 8adf674530..1532ed4f35 100644
--- a/drivers/bus/vdev/meson.build
+++ b/drivers/bus/vdev/meson.build
@@ -6,5 +6,6 @@ sources = files(
         'vdev_params.c',
 )
 headers = files('rte_bus_vdev.h')
+driver_sdk_headers = files('bus_vdev_driver.h')
 
 deps += ['kvargs']
diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
index 5af6be009f..f48dd24e5e 100644
--- a/drivers/bus/vdev/rte_bus_vdev.h
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -15,140 +15,6 @@
 extern "C" {
 #endif
 
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
-	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
-	struct rte_device device;               /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
-	container_of(ptr, struct rte_vdev_device, device)
-
-#define RTE_DEV_TO_VDEV_CONST(ptr) \
-	container_of(ptr, const struct rte_vdev_device, device)
-
-#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.name)
-		return dev->device.name;
-	return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.devargs)
-		return dev->device.devargs->args;
-	return "";
-}
-
-/** Double linked list of virtual device drivers. */
-RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
-	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
-	struct rte_driver driver;        /**< Inherited general driver. */
-	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
-	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
-	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
-	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
-	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
-};
-
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-static const char *vdrvinit_ ## nm ## _alias;\
-RTE_INIT(vdrvinitfn_ ##vdrv)\
-{\
-	(vdrv).driver.name = RTE_STR(nm);\
-	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
-	rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
 typedef void (*rte_vdev_scan_callback)(void *user_arg);
 
 /**
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index a8d8b2327e..7d78cf93bc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -21,7 +21,7 @@
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 
-#include "rte_bus_vdev.h"
+#include "bus_vdev_driver.h"
 #include "vdev_logs.h"
 #include "vdev_private.h"
 
@@ -30,16 +30,14 @@
 /* Forward declare to access virtual bus name */
 static struct rte_bus rte_vdev_bus;
 
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
 
-static struct vdev_device_list vdev_device_list =
+static TAILQ_HEAD(, rte_vdev_device) vdev_device_list =
 	TAILQ_HEAD_INITIALIZER(vdev_device_list);
 /* The lock needs to be recursive because a vdev can manage another vdev. */
 static rte_spinlock_recursive_t vdev_device_list_lock =
 	RTE_SPINLOCK_RECURSIVE_INITIALIZER;
 
-static struct vdev_driver_list vdev_driver_list =
+static TAILQ_HEAD(, rte_vdev_driver) vdev_driver_list =
 	TAILQ_HEAD_INITIALIZER(vdev_driver_list);
 
 struct vdev_custom_scan {
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 3969faf16d..2c72614776 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -5,7 +5,6 @@
 #include <string.h>
 
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vdev/version.map b/drivers/bus/vdev/version.map
index 7cc3098a50..594c48c3db 100644
--- a/drivers/bus/vdev/version.map
+++ b/drivers/bus/vdev/version.map
@@ -3,10 +3,15 @@ DPDK_23 {
 
 	rte_vdev_add_custom_scan;
 	rte_vdev_init;
-	rte_vdev_register;
 	rte_vdev_remove_custom_scan;
 	rte_vdev_uninit;
-	rte_vdev_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vdev_register;
+	rte_vdev_unregister;
+};
diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index b7ba61c434..cb23e929ed 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -3,7 +3,7 @@
  */
 #include <isa-l.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_malloc.h>
diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zlib_pmd.c
index 0220c6d038..98abd41013 100644
--- a/drivers/compress/zlib/zlib_pmd.c
+++ b/drivers/compress/zlib/zlib_pmd.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium Networks
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 
 #include "zlib_pmd_private.h"
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 32127a874c..5c060e71a3 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -8,7 +8,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_device.h b/drivers/crypto/bcmfs/bcmfs_device.h
index 4901a6cfd9..610454dd5e 100644
--- a/drivers/crypto/bcmfs/bcmfs_device.h
+++ b/drivers/crypto/bcmfs/bcmfs_device.h
@@ -9,7 +9,7 @@
 #include <sys/queue.h>
 
 #include <rte_spinlock.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "bcmfs_logs.h"
 #include "bcmfs_qp.h"
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8e9cfe73d8..8c0b4909cf 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -12,7 +12,7 @@
 #include <cryptodev_pmd.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_security_driver.h>
 #include <rte_hexdump.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 4957f11e97..6c3e45e333 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_string_fns.h>
 #include <bus_pci_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.c b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
index aab42c360c..2e7347fa79 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index e2c240dfc0..d0d4258ee1 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -7,7 +7,7 @@
 
 #include <intel-ipsec-mb.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #if defined(RTE_LIB_SECURITY)
 #define IPSEC_MB_DOCSIS_SEC_ENABLED 1
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index c9d4f9d0ae..fba10b8cf4 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2016-2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 04efd9aaa8..c35876c8b4 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_security_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 9ecb434fd0..eab74ad45f 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 
 #include "null_crypto_pmd_private.h"
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index e01dacc98d..ed6d215f1b 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index dd198080bf..a15c02b4d8 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 82b4661323..09068a9521 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -4,7 +4,7 @@
 
 #include <inttypes.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 5de3e9e5f5..08df6e223a 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -23,7 +23,7 @@
 #include <rte_memcpy.h>
 #include <rte_memory.h>
 #include <rte_pci.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
index 941fb8fc43..427aff4b11 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index 9e14e35d10..fe157c59d5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -16,7 +16,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "ssovf_evdev.h"
 #include "timvf_evdev.h"
diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c
index b55523632a..3dbf31efa9 100644
--- a/drivers/event/octeontx/ssovf_evdev_selftest.c
+++ b/drivers/event/octeontx/ssovf_evdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 #include "ssovf_evdev.h"
diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c
index 8b6890b220..368e5a9657 100644
--- a/drivers/event/opdl/opdl_evdev.c
+++ b/drivers/event/opdl/opdl_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memzone.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/opdl/opdl_evdev_init.c b/drivers/event/opdl/opdl_evdev_init.c
index 15aae47524..be3437fc2f 100644
--- a/drivers/event/opdl/opdl_evdev_init.c
+++ b/drivers/event/opdl/opdl_evdev_init.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_errno.h>
 #include <rte_cycles.h>
 #include <rte_memzone.h>
diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 24b92df476..50c12a18b0 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -19,7 +19,7 @@
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
 #include <rte_eventdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_pause.h>
 
 #include "opdl_evdev.h"
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index bf3b01ebc8..6bd8fec6d4 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "skeleton_eventdev.h"
 
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index f93313b31b..22cba1e74b 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_ring.h>
 #include <rte_errno.h>
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index cb97a4d615..59bcdf5734 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -21,7 +21,7 @@
 #include <rte_pause.h>
 #include <rte_service.h>
 #include <rte_service_component.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "sw_evdev.h"
 
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 1396f32c3d..e2771e6765 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -12,7 +12,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <errno.h>
 #include <linux/if_ether.h>
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fce649c2a1..fd7be47311 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -20,7 +20,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 4ac191c468..b44dd219cb 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_tcp.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 73e6972035..cd80a0af46 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -15,7 +15,7 @@
 #include <rte_ip_frag.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 05cf533896..5d4d52c341 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,8 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <rte_bus.h>
+#include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
 
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index dbf57f9ba8..4b93d2649e 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -19,7 +19,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index 0532de5315..c0e1f8db40 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -12,7 +12,7 @@
 #include <rte_kni.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 /* Only single queue supported */
 #define KNI_MAX_QUEUE_PER_PORT 1
diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 7886644412..4700ce2e77 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -17,7 +17,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index dd951b8296..a574bce49e 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -21,7 +21,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index eef016aa0b..6a0dd6091d 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_string_fns.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <stdio.h>
 #include <fcntl.h>
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 735efb6cfc..310e3e5acf 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -9,7 +9,7 @@
 #include <rte_kvargs.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <fcntl.h>
 #include <linux/ethtool.h>
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index bb89c1abc4..a517376d40 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -8,7 +8,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3aca53fb98..9ada22e2ff 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -12,7 +12,7 @@
 #include <eventdev_pmd.h>
 #include <rte_alarm.h>
 #include <rte_branch_prediction.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
 #include <rte_dev.h>
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index ec29fd6bc5..7fb4abb20b 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_os_shim.h>
 
 #include "pcap_osdep.h"
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index c2991ab1cc..0352a57950 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/epoll.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_ether.h>
 #include <dpaa_of.h>
 
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cfb81da5fe..37e7ccfda0 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 8c098cad5b..fa89940735 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -9,7 +9,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 #include <rte_ring.h>
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 9e1032fe72..d047489e94 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -10,7 +10,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_net.h>
 #include <rte_debug.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 2587195168..65043a04eb 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -25,7 +25,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bus.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7e512d94bf..6c81967c6f 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_net.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_vhost.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index a7d7063c2a..3edfd7439e 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 
diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c
index d759ed82d4..e2907c18b5 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.c
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/stat.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_lcore.h>
diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index c7bddbc6cc..aeee4ac289 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -6,7 +6,7 @@
 #include <errno.h>
 #include <stdint.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_atomic.h>
 #include <rte_interrupts.h>
 #include <rte_branch_prediction.h>
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index ec86bfdb0c..1020adcf6e 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -26,7 +26,7 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_pmd_i40e.h>
 
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 72d3b69d75..6831cc8d20 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index 693b24c415..fc257c5f44 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -8,7 +8,7 @@
 #include <rte_memcpy.h>
 #include <rte_dev.h>
 #include <rte_rawdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 /* Using relative path as skeleton_rawdev is not part of exported headers */
diff --git a/lib/ethdev/ethdev_vdev.h b/lib/ethdev/ethdev_vdev.h
index f5f536ce64..364f140f91 100644
--- a/lib/ethdev/ethdev_vdev.h
+++ b/lib/ethdev/ethdev_vdev.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_config.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd_vdev.h b/lib/eventdev/eventdev_pmd_vdev.h
index 77904910a2..cf2333cf41 100644
--- a/lib/eventdev/eventdev_pmd_vdev.h
+++ b/lib/eventdev/eventdev_pmd_vdev.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_config.h>
 #include <rte_debug.h>
 #include <rte_eal.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 18/27] bus/vmbus: make driver-only headers private
  2022-09-05  8:39 ` David Marchand
                     ` (16 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 17/27] bus/vdev: " David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 19/27] bus: move IOVA definition from header David Marchand
                     ` (8 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Stephen Hemminger, Long Li, Ray Kinsella

The vmbus 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 <david.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst |   2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h   | 106 +++++++++++++++++++++++++
 drivers/bus/vmbus/linux/vmbus_uio.c    |   1 -
 drivers/bus/vmbus/meson.build          |   1 +
 drivers/bus/vmbus/private.h            |  20 ++++-
 drivers/bus/vmbus/rte_bus_vmbus.h      | 104 ------------------------
 drivers/bus/vmbus/version.map          |   9 ++-
 drivers/bus/vmbus/vmbus_bufring.c      |   1 -
 drivers/bus/vmbus/vmbus_channel.c      |   1 -
 drivers/bus/vmbus/vmbus_common.c       |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c   |   1 -
 drivers/net/netvsc/hn_ethdev.c         |   3 +-
 drivers/net/netvsc/hn_nvs.c            |   2 +-
 drivers/net/netvsc/hn_rndis.c          |   2 +-
 drivers/net/netvsc/hn_rxtx.c           |   2 +-
 drivers/net/netvsc/hn_vf.c             |   2 +-
 16 files changed, 140 insertions(+), 120 deletions(-)
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index bafd99c39e..e08a548285 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -89,7 +89,7 @@ API Changes
   to update their code.
 
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
-  ``vdev`` buses has been marked as an internal API.
+  ``vdev``, ``vmbus`` 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).
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
new file mode 100644
index 0000000000..3424e791c9
--- /dev/null
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018, Microsoft Corporation.
+ * All Rights Reserved.
+ */
+
+#ifndef BUS_VMBUS_DRIVER_H
+#define BUS_VMBUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vmbus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+
+struct vmbus_channel;
+struct vmbus_mon_page;
+
+/** Maximum number of VMBUS resources. */
+enum hv_uio_map {
+	HV_TXRX_RING_MAP = 0,
+	HV_INT_PAGE_MAP,
+	HV_MON_PAGE_MAP,
+	HV_RECV_BUF_MAP,
+	HV_SEND_BUF_MAP
+};
+#define VMBUS_MAX_RESOURCE 5
+
+/**
+ * A structure describing a VMBUS device.
+ */
+struct rte_vmbus_device {
+	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
+	const struct rte_vmbus_driver *driver; /**< Associated driver */
+	struct rte_device device;              /**< Inherit core device */
+	rte_uuid_t device_id;		       /**< VMBUS device id */
+	rte_uuid_t class_id;		       /**< VMBUS device type */
+	uint32_t relid;			       /**< id for primary */
+	uint8_t monitor_id;		       /**< monitor page */
+	int uio_num;			       /**< UIO device number */
+	uint32_t *int_page;		       /**< VMBUS interrupt page */
+	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
+	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
+
+	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
+	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
+};
+
+/**
+ * Initialization function for the driver called during VMBUS probing.
+ */
+typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
+			    struct rte_vmbus_device *);
+
+/**
+ * Initialization function for the driver called during hot plugging.
+ */
+typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
+
+/**
+ * A structure describing a VMBUS driver.
+ */
+struct rte_vmbus_driver {
+	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
+	struct rte_driver driver;
+	vmbus_probe_t *probe;               /**< Device Probe function. */
+	vmbus_remove_t *remove;             /**< Device Remove function. */
+
+	const rte_uuid_t *id_table;	    /**< ID table. */
+};
+
+/**
+ * Register a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vmbus_register(struct rte_vmbus_driver *driver);
+
+/**
+ * Unregister a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
+
+/** Helper for VMBUS device registration from driver instance */
+#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
+	RTE_INIT(vmbusinitfn_ ##nm)			\
+	{						\
+		(vmbus_drv).driver.name = RTE_STR(nm);	\
+		rte_vmbus_register(&vmbus_drv);		\
+	}						\
+	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VMBUS_DRIVER_H */
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5db70f8e0d..26edef342d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -13,7 +13,6 @@
 
 #include <rte_eal.h>
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_memory.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
diff --git a/drivers/bus/vmbus/meson.build b/drivers/bus/vmbus/meson.build
index 3892cbf67f..34988d1d84 100644
--- a/drivers/bus/vmbus/meson.build
+++ b/drivers/bus/vmbus/meson.build
@@ -8,6 +8,7 @@ endif
 
 
 headers = files('rte_bus_vmbus.h','rte_vmbus_reg.h')
+driver_sdk_headers = files('bus_vmbus_driver.h')
 
 sources = files(
         'vmbus_bufring.c',
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 658303bc27..3d233fa83c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -8,13 +8,31 @@
 
 #include <stdbool.h>
 #include <sys/uio.h>
+
+#include <rte_bus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
-#include <rte_bus_vmbus.h>
+
+/**
+ * Structure describing the VM bus
+ */
+struct rte_vmbus_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_vmbus_device) device_list; /**< List of devices */
+	RTE_TAILQ_HEAD(, rte_vmbus_driver) driver_list; /**< List of drivers */
+};
 
 extern struct rte_vmbus_bus rte_vmbus_bus;
 
+/* VMBus iterators */
+#define FOREACH_DEVICE_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
+
 extern int vmbus_logtype_bus;
 #define VMBUS_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index a24bad831d..03894a5d46 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -27,89 +27,12 @@ extern "C" {
 #include <rte_uuid.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
 #include <rte_vmbus_reg.h>
 
 /* Forward declarations */
 struct rte_vmbus_device;
 struct rte_vmbus_driver;
-struct rte_vmbus_bus;
 struct vmbus_channel;
-struct vmbus_mon_page;
-
-RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
-RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
-
-/* VMBus iterators */
-#define FOREACH_DEVICE_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
-
-/** Maximum number of VMBUS resources. */
-enum hv_uio_map {
-	HV_TXRX_RING_MAP = 0,
-	HV_INT_PAGE_MAP,
-	HV_MON_PAGE_MAP,
-	HV_RECV_BUF_MAP,
-	HV_SEND_BUF_MAP
-};
-#define VMBUS_MAX_RESOURCE 5
-
-/**
- * A structure describing a VMBUS device.
- */
-struct rte_vmbus_device {
-	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
-	const struct rte_vmbus_driver *driver; /**< Associated driver */
-	struct rte_device device;              /**< Inherit core device */
-	rte_uuid_t device_id;		       /**< VMBUS device id */
-	rte_uuid_t class_id;		       /**< VMBUS device type */
-	uint32_t relid;			       /**< id for primary */
-	uint8_t monitor_id;		       /**< monitor page */
-	int uio_num;			       /**< UIO device number */
-	uint32_t *int_page;		       /**< VMBUS interrupt page */
-	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
-	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
-
-	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
-	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
-};
-
-/**
- * Initialization function for the driver called during VMBUS probing.
- */
-typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
-			    struct rte_vmbus_device *);
-
-/**
- * Initialization function for the driver called during hot plugging.
- */
-typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
-
-/**
- * A structure describing a VMBUS driver.
- */
-struct rte_vmbus_driver {
-	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
-	struct rte_driver driver;
-	struct rte_vmbus_bus *bus;          /**< VM bus reference. */
-	vmbus_probe_t *probe;               /**< Device Probe function. */
-	vmbus_remove_t *remove;             /**< Device Remove function. */
-
-	const rte_uuid_t *id_table;	    /**< ID table. */
-};
-
-
-/**
- * Structure describing the VM bus
- */
-struct rte_vmbus_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_vmbus_device_list device_list;  /**< List of devices */
-	struct rte_vmbus_driver_list driver_list;  /**< List of drivers */
-};
 
 /**
  * Scan the content of the VMBUS bus, and the devices in the devices
@@ -378,15 +301,6 @@ void rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
 			   const struct vmbus_channel *chan,
 			   uint32_t latency);
 
-/**
- * Register a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be registered.
- */
-void rte_vmbus_register(struct rte_vmbus_driver *driver);
-
 /**
  * For debug dump contents of ring buffer.
  *
@@ -395,24 +309,6 @@ void rte_vmbus_register(struct rte_vmbus_driver *driver);
  */
 void rte_vmbus_chan_dump(FILE *f, const struct vmbus_channel *chan);
 
-/**
- * Unregister a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
-
-/** Helper for VMBUS device registration from driver instance */
-#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
-	RTE_INIT(vmbusinitfn_ ##nm)			\
-	{						\
-		(vmbus_drv).driver.name = RTE_STR(nm);	\
-		rte_vmbus_register(&vmbus_drv);		\
-	}						\
-	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/drivers/bus/vmbus/version.map b/drivers/bus/vmbus/version.map
index 84db31b6e9..430781b29b 100644
--- a/drivers/bus/vmbus/version.map
+++ b/drivers/bus/vmbus/version.map
@@ -16,13 +16,18 @@ DPDK_23 {
 	rte_vmbus_map_device;
 	rte_vmbus_max_channels;
 	rte_vmbus_probe;
-	rte_vmbus_register;
 	rte_vmbus_scan;
 	rte_vmbus_set_latency;
 	rte_vmbus_sub_channel_index;
 	rte_vmbus_subchan_open;
 	rte_vmbus_unmap_device;
-	rte_vmbus_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vmbus_register;
+	rte_vmbus_unregister;
+};
diff --git a/drivers/bus/vmbus/vmbus_bufring.c b/drivers/bus/vmbus/vmbus_bufring.c
index c4aa07b307..c78619dc44 100644
--- a/drivers/bus/vmbus/vmbus_bufring.c
+++ b/drivers/bus/vmbus/vmbus_bufring.c
@@ -15,7 +15,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_pause.h>
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 9bd01679c3..5549fd0944 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -12,7 +12,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..03b39c82b7 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -11,7 +11,6 @@
 #include <sys/mman.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
@@ -235,7 +234,6 @@ rte_vmbus_register(struct rte_vmbus_driver *driver)
 		"Registered driver %s", driver->driver.name);
 
 	TAILQ_INSERT_TAIL(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = &rte_vmbus_bus;
 }
 
 /* unregister vmbus driver */
@@ -243,7 +241,6 @@ void
 rte_vmbus_unregister(struct rte_vmbus_driver *driver)
 {
 	TAILQ_REMOVE(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to VMBUS bus */
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 882a24f869..4d4613513c 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -13,7 +13,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_bus_vmbus.h>
 
 #include "private.h"
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 787139c0b2..188d92ffac 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,8 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <rte_bus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index b90280c9ff..817fb06dfb 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -29,7 +29,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 1b63b27e0c..20f75a17b0 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -27,7 +27,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 909c07a4ab..61cf374224 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -27,7 +27,7 @@
 #include <rte_eal.h>
 #include <rte_dev.h>
 #include <rte_net.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index cce0a79edb..40981706d5 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_log.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 19/27] bus: move IOVA definition from header
  2022-09-05  8:39 ` David Marchand
                     ` (17 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 18/27] bus/vmbus: " David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 20/27] bus: introduce accessors David Marchand
                     ` (7 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Sunila Sahu,
	Fan Zhang, Ashish Gupta, Gaetan Rivet, Anatoly Burakov,
	Akhil Goyal, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
	Dmitry Malloy, Pallavi Kadam, Ferruh Yigit, Andrew Rybchenko,
	Reshma Pattan, Stephen Hemminger

iova enum definition does not need to be defined as part of the bus API.
Move it to rte_eal.h.
With this step, rte_eal.h does not depend on rte_bus.h and rte_dev.h.
Fix existing code that was relying on these implicit inclusions.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-compress-perf/comp_perf_options.h   |  2 ++
 app/test-pmd/config.c                        |  1 +
 app/test-pmd/testpmd.c                       |  1 +
 drivers/compress/zlib/zlib_pmd_ops.c         |  1 +
 drivers/net/failsafe/failsafe_eal.c          |  1 +
 examples/multi_process/hotplug_mp/commands.c |  2 ++
 lib/compressdev/rte_compressdev.c            |  1 +
 lib/compressdev/rte_compressdev_pmd.c        |  1 +
 lib/cryptodev/cryptodev_pmd.c                |  2 ++
 lib/eal/common/eal_thread.h                  |  1 +
 lib/eal/common/hotplug_mp.c                  |  1 +
 lib/eal/include/rte_bus.h                    | 18 ++----------------
 lib/eal/include/rte_eal.h                    | 15 ++++++++++++++-
 lib/eal/include/rte_lcore.h                  |  2 ++
 lib/eal/windows/eal.c                        |  1 +
 lib/ethdev/rte_ethdev.c                      |  1 +
 lib/pcapng/rte_pcapng.c                      |  1 +
 17 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0b777521c5..57dd146330 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -5,6 +5,8 @@
 #ifndef _COMP_PERF_OPS_
 #define _COMP_PERF_OPS_
 
+#include <rte_dev.h>
+
 #define MAX_LIST		32
 #define MIN_COMPRESSED_BUF_SIZE 8
 #define EXPANSE_RATIO 1.1
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index bc73819183..d988429f24 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -24,6 +24,7 @@
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
 #include <rte_launch.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index ee686393c5..510e0be624 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -32,6 +32,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_launch.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_alarm.h>
 #include <rte_per_lcore.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 0a73aed949..7d657d81bc 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_dev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index cb4a2abc02..130344dce2 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,6 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
+#include <rte_bus.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index 41ea265e45..da8b5e5924 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -8,6 +8,8 @@
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
 #include <cmdline.h>
+
+#include <rte_bus.h>
 #include <rte_ethdev.h>
 
 /**********************************************************/
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 5ddbc3f9c0..e997bd01ed 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 7f500d76d4..9bfae077db 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,6 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 1903ade388..75d0075b86 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -3,6 +3,8 @@
  */
 
 #include <sys/queue.h>
+
+#include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/eal/common/eal_thread.h b/lib/eal/common/eal_thread.h
index ca3378d463..e0240ccc60 100644
--- a/lib/eal/common/eal_thread.h
+++ b/lib/eal/common/eal_thread.h
@@ -5,6 +5,7 @@
 #ifndef EAL_THREAD_H
 #define EAL_THREAD_H
 
+#include <rte_common.h>
 #include <rte_lcore.h>
 
 /**
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index bde0de196e..1614a57752 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,6 +3,7 @@
  */
 #include <string.h>
 
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index bbbb6efd28..17edaa37c9 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,27 +20,13 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_log.h>
 #include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_log.h>
 
 /** Double linked list of buses */
 RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
 
-
-/**
- * IOVA mapping mode.
- *
- * IOVA mapping mode is iommu programming mode of a device.
- * That device (for example: IOMMU backed DMA device) based
- * on rte_iova_mode will generate physical or virtual address.
- *
- */
-enum rte_iova_mode {
-	RTE_IOVA_DC = 0,	/* Don't care mode */
-	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
-	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
-};
-
 /**
  * Bus specific scan for devices attached on the bus.
  * For each bus object, the scan would be responsible for finding devices and
diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h
index 5dfc50e987..fd3d7c1da8 100644
--- a/lib/eal/include/rte_eal.h
+++ b/lib/eal/include/rte_eal.h
@@ -17,7 +17,6 @@
 #include <rte_config.h>
 #include <rte_compat.h>
 #include <rte_per_lcore.h>
-#include <rte_bus.h>
 #include <rte_uuid.h>
 
 #include <rte_pci_dev_feature_defs.h>
@@ -458,6 +457,20 @@ static inline int rte_gettid(void)
 __rte_internal
 uint64_t rte_eal_get_baseaddr(void);
 
+/**
+ * IOVA mapping mode.
+ *
+ * IOVA mapping mode is iommu programming mode of a device.
+ * That device (for example: IOMMU backed DMA device) based
+ * on rte_iova_mode will generate physical or virtual address.
+ *
+ */
+enum rte_iova_mode {
+	RTE_IOVA_DC = 0,	/* Don't care mode */
+	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
+	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
+};
+
 /**
  * Get the iova mode
  *
diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h
index b598e1b9ec..4d3978512c 100644
--- a/lib/eal/include/rte_lcore.h
+++ b/lib/eal/include/rte_lcore.h
@@ -11,6 +11,8 @@
  * API for lcore and socket manipulation
  *
  */
+#include <stdio.h>
+
 #include <rte_config.h>
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index 122de2a319..79322d2ce9 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 
 #include <rte_debug.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <eal_memcfg.h>
 #include <rte_errno.h>
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9d6f460726..9e358d187a 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
+#include <rte_bus.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 06ad712bd1..5b079cd14a 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,6 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <rte_bus.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 20/27] bus: introduce accessors
  2022-09-05  8:39 ` David Marchand
                     ` (18 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 19/27] bus: move IOVA definition from header David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 21/27] bus: hide bus object David Marchand
                     ` (6 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang,
	Anatoly Burakov, Ray Kinsella

Add helpers to get a rte_bus object details.
This will be used externally.
Internal users may still dereference a rte_bus object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v1:
- changed approach: only external users are updated,

---
 app/test-pmd/config.c                        |  4 +--
 app/test-pmd/testpmd.c                       |  4 +--
 app/test/test_devargs.c                      |  4 +--
 examples/multi_process/hotplug_mp/commands.c |  4 +--
 lib/eal/common/eal_common_bus.c              | 26 ++++++++++++--------
 lib/eal/include/rte_bus.h                    | 14 +++++++++++
 lib/eal/version.map                          |  3 +++
 7 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d988429f24..7bd28ee3e8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -642,7 +642,7 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
+		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
 			if (!dev->driver)
@@ -653,7 +653,7 @@ device_infos_display(const char *identifier)
 				continue;
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
-			printf("Bus name: %s", dev->bus->name);
+			printf("Bus name: %s", rte_bus_name(dev->bus));
 			printf("\nDriver name: %s", dev->driver->name);
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 510e0be624..c7d1fa2719 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3507,9 +3507,9 @@ detach_devargs(char *identifier)
 		}
 	}
 
-	if (rte_eal_hotplug_remove(da.bus->name, da.name) != 0) {
+	if (rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name) != 0) {
 		TESTPMD_LOG(ERR, "Failed to detach device %s(%s)\n",
-			    da.name, da.bus->name);
+			    da.name, rte_bus_name(da.bus));
 		rte_devargs_reset(&da);
 		return;
 	}
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 16621285d2..ac5bc34c18 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -98,9 +98,9 @@ test_valid_devargs_cases(const struct devargs_case *list, size_t n)
 			      list[i].bus_kv) != 0)
 			goto fail;
 		if (list[i].bus != NULL &&
-		    strcmp(da.bus->name, list[i].bus) != 0) {
+		    strcmp(rte_bus_name(da.bus), list[i].bus) != 0) {
 			printf("rte_devargs_parse(%s) bus name (%s) not expected (%s)\n",
-			       list[i].devargs, da.bus->name, list[i].bus);
+			       list[i].devargs, rte_bus_name(da.bus), list[i].bus);
 			goto fail;
 		}
 		if ((list[i].class_kv > 0 || list[i].class != NULL) &&
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index da8b5e5924..88f44e00a0 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -126,7 +126,7 @@ static void cmd_dev_attach_parsed(void *parsed_result,
 		return;
 	}
 
-	if (!rte_eal_hotplug_add(da.bus->name, da.name, da.args))
+	if (!rte_eal_hotplug_add(rte_bus_name(da.bus), da.name, da.args))
 		cmdline_printf(cl, "attached device %s\n", da.name);
 	else
 		cmdline_printf(cl, "failed to attached device %s\n",
@@ -173,7 +173,7 @@ static void cmd_dev_detach_parsed(void *parsed_result,
 	}
 
 	printf("detaching...\n");
-	if (!rte_eal_hotplug_remove(da.bus->name, da.name))
+	if (!rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name))
 		cmdline_printf(cl, "detached device %s\n",
 			da.name);
 	else
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index baa5b532af..cbf382f967 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -16,11 +16,17 @@
 static struct rte_bus_list rte_bus_list =
 	TAILQ_HEAD_INITIALIZER(rte_bus_list);
 
+const char *
+rte_bus_name(const struct rte_bus *bus)
+{
+	return bus->name;
+}
+
 void
 rte_bus_register(struct rte_bus *bus)
 {
 	RTE_VERIFY(bus);
-	RTE_VERIFY(bus->name && strlen(bus->name));
+	RTE_VERIFY(rte_bus_name(bus) && strlen(rte_bus_name(bus)));
 	/* A bus should mandatorily have the scan implemented */
 	RTE_VERIFY(bus->scan);
 	RTE_VERIFY(bus->probe);
@@ -29,14 +35,14 @@ rte_bus_register(struct rte_bus *bus)
 	RTE_VERIFY(!bus->plug || bus->unplug);
 
 	TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", rte_bus_name(bus));
 }
 
 void
 rte_bus_unregister(struct rte_bus *bus)
 {
 	TAILQ_REMOVE(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", rte_bus_name(bus));
 }
 
 /* Scan all the buses for registered devices */
@@ -50,7 +56,7 @@ rte_bus_scan(void)
 		ret = bus->scan();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	return 0;
@@ -64,7 +70,7 @@ rte_bus_probe(void)
 	struct rte_bus *bus, *vbus = NULL;
 
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
-		if (!strcmp(bus->name, "vdev")) {
+		if (!strcmp(rte_bus_name(bus), "vdev")) {
 			vbus = bus;
 			continue;
 		}
@@ -72,14 +78,14 @@ rte_bus_probe(void)
 		ret = bus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				vbus->name);
+				rte_bus_name(vbus));
 	}
 
 	return 0;
@@ -92,7 +98,7 @@ bus_dump_one(FILE *f, struct rte_bus *bus)
 	int ret;
 
 	/* For now, dump only the bus name */
-	ret = fprintf(f, " %s\n", bus->name);
+	ret = fprintf(f, " %s\n", rte_bus_name(bus));
 
 	/* Error in case of inability in writing to stream */
 	if (ret < 0)
@@ -163,7 +169,7 @@ cmp_bus_name(const struct rte_bus *bus, const void *_name)
 {
 	const char *name = _name;
 
-	return strcmp(bus->name, name);
+	return strcmp(rte_bus_name(bus), name);
 }
 
 struct rte_bus *
@@ -213,7 +219,7 @@ rte_bus_get_iommu_class(void)
 
 		bus_iova_mode = bus->get_iommu_class();
 		RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n",
-			bus->name,
+			rte_bus_name(bus),
 			bus_iova_mode == RTE_IOVA_DC ? "DC" :
 			(bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA"));
 		if (bus_iova_mode == RTE_IOVA_PA)
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 17edaa37c9..3848b44db0 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -266,6 +266,20 @@ struct rte_bus {
 
 };
 
+/**
+ * Retrieve a bus name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure.
+ * @return
+ *   A pointer to the bus name string.
+ */
+__rte_experimental
+const char *rte_bus_name(const struct rte_bus *bus);
+
 /**
  * Register a Bus handler.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..aa53064db1 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_bus_name;
 };
 
 INTERNAL {
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 21/27] bus: hide bus object
  2022-09-05  8:39 ` David Marchand
                     ` (19 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 20/27] bus: introduce accessors David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 22/27] dev: introduce driver accessors David Marchand
                     ` (5 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Anatoly Burakov,
	Stephen Hemminger, Long Li, Matan Azrad, Viacheslav Ovsiienko,
	Kevin Laatz, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Ferruh Yigit,
	Andrew Rybchenko, Reshma Pattan

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_bus objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

Changes since RFC v1:
- update all existing users of the public header to use the internal one,

---
 app/test/test_devargs.c                  |   2 +-
 app/test/test_vdev.c                     |   2 +-
 doc/guides/rel_notes/deprecation.rst     |   6 -
 doc/guides/rel_notes/release_22_11.rst   |   6 +
 drivers/bus/auxiliary/auxiliary_common.c |   2 +-
 drivers/bus/auxiliary/auxiliary_params.c |   2 +-
 drivers/bus/auxiliary/private.h          |   2 +-
 drivers/bus/dpaa/dpaa_bus.c              |   2 +-
 drivers/bus/fslmc/fslmc_bus.c            |   2 +-
 drivers/bus/fslmc/private.h              |   2 +-
 drivers/bus/ifpga/ifpga_bus.c            |   2 +-
 drivers/bus/pci/linux/pci_vfio.c         |   2 +-
 drivers/bus/pci/pci_common.c             |   2 +-
 drivers/bus/pci/pci_params.c             |   2 +-
 drivers/bus/pci/private.h                |   2 +-
 drivers/bus/vdev/vdev.c                  |   2 +-
 drivers/bus/vmbus/private.h              |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c    |   2 +-
 drivers/dma/idxd/idxd_bus.c              |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c  |   2 +-
 drivers/net/failsafe/failsafe.c          |   2 +-
 drivers/net/failsafe/failsafe_eal.c      |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c         |   2 +-
 drivers/net/netvsc/hn_ethdev.c           |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c    |   2 +-
 drivers/net/virtio/virtio_pci.c          |   2 +-
 drivers/raw/ioat/idxd_bus.c              |   2 +-
 lib/eal/common/eal_common_bus.c          |   2 +-
 lib/eal/common/eal_common_dev.c          |   2 +-
 lib/eal/common/eal_common_devargs.c      |   2 +-
 lib/eal/common/hotplug_mp.c              |   2 +-
 lib/eal/include/bus_driver.h             | 296 +++++++++++++++++++++++
 lib/eal/include/meson.build              |   4 +
 lib/eal/include/rte_bus.h                | 278 +--------------------
 lib/eal/linux/eal_dev.c                  |   2 +-
 lib/eal/version.map                      |   8 +-
 lib/ethdev/rte_ethdev.c                  |   2 +-
 lib/pcapng/rte_pcapng.c                  |   2 +-
 38 files changed, 343 insertions(+), 319 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..0a4c34a1ad 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 5eeff3106d..1904e76e44 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 5b4ffc992d..98a00da385 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,12 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* bus: The ``rte_bus`` object will be made opaque in DPDK 22.11.
-  The goal is to remove it from the public ABI and make this object extendable.
-  As a side effect, registering a bus will be marked as an internal API:
-  external users may still register their bus using a new driver header
-  (see ``enable_driver_sdk`` meson option).
-
 * drivers: As a follow-up of the work on the ``rte_bus`` object,
   the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
   their bus-specific counterparts) will be made opaque in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index e08a548285..36df0ccf93 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,6 +88,12 @@ API Changes
   in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
   to update their code.
 
+* bus: Registering a bus has been marked as an internal API.
+  External users may still register their bus using the ``bus_driver.h``
+  driver header (see ``enable_driver_sdk`` meson option).
+  The ``rte_bus`` object is now opaque and must be manipulated through added
+  accessors.
+
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 6cf6c170ec..259ff152c4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -12,7 +12,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 0289777922..a889e392c6 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 3f49f62493..3dee13e1d1 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "bus_auxiliary_driver.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 1ac6aa314f..682427ba2c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -29,7 +29,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index b9b0981329..8503004e3d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 60d68155e1..6f14085d98 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef BUS_FSLMC_PRIVATE_H
 #define BUS_FSLMC_PRIVATE_H
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 27e2de7072..bb943b58b5 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index cd0d0b1670..fab3483d9f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_vfio.h>
 #include <rte_eal.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 0d61d49287..c26aacd364 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_lcore.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 61a868707f..39d702a418 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 4e40a2ed85..fddf49251d 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7d78cf93bc..809a8bb08f 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 3d233fa83c..e33424675c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e82cb881bf..73178ce0f3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 1a86eb3c00..6553166f5c 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 5d4d52c341..32811403b4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..d71b512f81 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,7 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index efb262e368..4f0a6f4d55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 188d92ffac..ccc06bdda6 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 65043a04eb..dc90569df1 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..9cf4d760b4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -9,7 +9,7 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "virtio_pci.h"
 #include "virtio_logs.h"
diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 539f51b1b1..f32d811055 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include "ioat_private.h"
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..62a598957c 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..03e6e59baf 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..5202bd5658 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..d2e615a736
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,296 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_devargs;
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+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);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_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 */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 3848b44db0..dfe756fb11 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,284 +20,21 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-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);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_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 */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * Retrieve a bus name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param bus
  *   A pointer to a rte_bus structure.
  * @return
  *   A pointer to the bus name string.
  */
-__rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -387,17 +124,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..098a2c3076 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -13,7 +13,7 @@
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index aa53064db1..6ec15f1147 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -12,10 +12,9 @@ DPDK_23 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
+	rte_bus_name;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -424,14 +423,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_bus_name;
 };
 
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9e358d187a..0c2c1088c0 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..72aabd4dd0 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 22/27] dev: introduce driver accessors
  2022-09-05  8:39 ` David Marchand
                     ` (20 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 21/27] bus: hide bus object David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 23/27] dev: hide driver object David Marchand
                     ` (4 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Ray Kinsella,
	Ferruh Yigit, Andrew Rybchenko

Prepare for making the driver object opaque by adding accessors.
Update existing "external" users.
Internal users may still dereference a rte_driver object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/config.c           |  2 +-
 lib/eal/common/eal_common_dev.c |  6 ++++++
 lib/eal/include/rte_dev.h       | 15 +++++++++++++++
 lib/eal/version.map             |  3 +++
 lib/ethdev/rte_ethdev.h         |  2 +-
 5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7bd28ee3e8..6510f29c76 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,7 +654,7 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
 			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", dev->driver->name);
+			printf("\nDriver name: %s", rte_driver_name(dev->driver));
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
 			printf("\nConnect to socket: %d", dev->numa_node);
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 62a598957c..16c5aef1d8 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -19,6 +19,12 @@
 #include "eal_private.h"
 #include "hotplug_mp.h"
 
+const char *
+rte_driver_name(const struct rte_driver *driver)
+{
+	return driver->name;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 2743c09320..ddea163cca 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -76,6 +76,21 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * Retrieve a driver name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param driver
+ *   A pointer to a driver structure.
+ * @return
+ *   A pointer to the driver name string.
+ */
+__rte_experimental
+const char *
+rte_driver_name(const struct rte_driver *driver);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 6ec15f1147..d10fd89458 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -423,6 +423,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 41d37e41b5..7556b94602 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = dev->device->driver->name
+ * driver_name = rte_driver_name(dev->device->driver)
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 23/27] dev: hide driver object
  2022-09-05  8:39 ` David Marchand
                     ` (21 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 22/27] dev: introduce driver accessors David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-06  6:05     ` [EXT] " Akhil Goyal
  2022-09-06  6:46     ` Gujjar, Abhinandan S
  2022-09-05  8:39   ` [PATCH v5 24/27] dev: introduce device accessors David Marchand
                     ` (3 subsequent siblings)
  26 siblings, 2 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Jay Jayatheerthan, Ajit Khaparde,
	Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Kevin Laatz, Timothy McDaniel, Jerin Jacob,
	Elena Agostini, Ciara Loftus, Qi Zhang, Shepard Siegel, Ed Czeck,
	John Miller, Steven Webster, Matt Peters, Rasesh Mody,
	Shahed Shaikh, Somnath Kotur, Rahul Lakkireddy, Simei Su,
	Wenjun Wu, Marcin Wojtas, Michal Krawczyk, Shai Brandes,
	Evgeny Schemeilin, Igor Chauskin, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Yuying Zhang, Beilei Xing, Jingjing Wu,
	Qiming Yang, Matan Azrad, Viacheslav Ovsiienko, Chaoyong He,
	Niklas Soderlund, Harman Kalra, Devendra Singh Rawat,
	Andrew Rybchenko, Maciej Czekaj, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Ori Kam,
	Akhil Goyal, Chengwen Feng, Ray Kinsella, Ferruh Yigit,
	Abhinandan Gujjar, Olivier Matz, Reshma Pattan

Make rte_driver opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_driver definition.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_driver objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/release_22_11.rst        |  2 ++
 drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
 drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
 drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
 drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
 drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
 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/pci/bus_pci_driver.h              |  2 +-
 drivers/bus/pci/pci_params.c                  |  2 +-
 drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
 drivers/bus/vdev/vdev.c                       |  2 +-
 drivers/bus/vdev/vdev_params.c                |  2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
 drivers/common/qat/qat_qp.c                   |  2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
 drivers/dma/idxd/idxd_bus.c                   |  1 +
 drivers/event/dlb2/dlb2.c                     |  2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
 drivers/event/octeontx/ssovf_evdev.c          |  2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
 drivers/gpu/cuda/cuda.c                       |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
 drivers/net/ark/ark_global.h                  |  2 +-
 drivers/net/avp/avp_ethdev.c                  |  2 +-
 drivers/net/axgbe/axgbe_common.h              |  2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
 drivers/net/cxgbe/base/t4_hw.c                |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                |  2 +-
 drivers/net/cxgbe/sge.c                       |  2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
 drivers/net/e1000/em_ethdev.c                 |  2 +-
 drivers/net/e1000/igb_ethdev.c                |  2 +-
 drivers/net/e1000/igb_flow.c                  |  2 +-
 drivers/net/ena/ena_ethdev.h                  |  2 +-
 drivers/net/enic/enic_ethdev.c                |  2 +-
 drivers/net/enic/enic_vf_representor.c        |  2 +-
 drivers/net/failsafe/failsafe_private.h       |  2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
 drivers/net/i40e/i40e_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_vchnl.c                 |  2 +-
 drivers/net/ice/ice_dcf.c                     |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
 drivers/net/mlx4/mlx4.c                       |  2 +-
 drivers/net/netvsc/hn_ethdev.c                |  2 +-
 drivers/net/netvsc/hn_nvs.c                   |  2 +-
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/netvsc/hn_rxtx.c                  |  2 +-
 drivers/net/nfp/nfp_common.c                  |  2 +-
 drivers/net/nfp/nfp_ethdev.c                  |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
 drivers/net/qede/qede_ethdev.h                |  2 +-
 drivers/net/sfc/sfc_ethdev.c                  |  2 +-
 drivers/net/sfc/sfc_sw_stats.c                |  2 +-
 drivers/net/sfc/sfc_sw_stats.h                |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
 lib/compressdev/rte_compressdev.c             |  2 +-
 lib/compressdev/rte_compressdev_pmd.c         |  2 +-
 lib/compressdev/rte_compressdev_pmd.h         |  1 +
 lib/cryptodev/cryptodev_pmd.c                 |  2 +-
 lib/cryptodev/cryptodev_pmd.h                 |  1 +
 lib/cryptodev/rte_cryptodev.c                 |  2 +-
 lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
 lib/eal/common/eal_common_dev.c               |  2 +-
 lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
 lib/eal/include/meson.build                   |  1 +
 lib/eal/include/rte_dev.h                     | 15 ++--------
 lib/eal/version.map                           |  4 +--
 lib/ethdev/ethdev_driver.h                    |  1 +
 lib/eventdev/eventdev_pmd.h                   |  2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
 lib/eventdev/rte_eventdev.c                   |  2 +-
 lib/gpudev/gpudev_driver.h                    |  2 +-
 lib/mempool/rte_mempool_ops.c                 |  2 +-
 lib/pcapng/rte_pcapng.c                       |  2 +-
 lib/rawdev/rte_rawdev.c                       |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
 lib/security/rte_security.c                   |  2 +-
 115 files changed, 144 insertions(+), 122 deletions(-)
 create mode 100644 lib/eal/include/dev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 36df0ccf93..4e20345b7a 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,6 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` 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).
+  The ``rte_driver`` object is now opaque and must be manipulated through added
+  accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 801e8920df..e2d9409185 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_byteorder.h>
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index c1d877c87f..51dd090c1b 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index f16814e241..036579e3ec 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a889e392c6..e4c7ee0c3b 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <bus_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1c2d2c04af..58fb7c7f69 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -25,7 +25,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index cf66fc0c53..26a83b2cdf 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -7,7 +7,7 @@
 #define BUS_DPAA_DRIVER_H
 
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 798ddebf3a..7ac5fe6ff1 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -29,7 +29,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8604e43947..5966776a85 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -28,7 +28,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index cfe4280f87..d7f6e45b7d 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -18,7 +18,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_pool_ops.h>
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index b7d81b518c..07256ed7ec 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <fslmc_logs.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 071b0d297d..4aec7b2cd8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -30,7 +30,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index 223e34bcba..65e2d799c3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "private.h"
 #include <fslmc_logs.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b5c7dee617..0f2f9b5101 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_compat.h>
 
 /** Pathname of PCI devices directory. */
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 39d702a418..d24cc201b8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -6,7 +6,7 @@
 
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 36748cdfae..bc7e30d7c6 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 
 #include <rte_bus_vdev.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 809a8bb08f..b176b658fc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 2c72614776..2d10a1e8ad 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index 3424e791c9..e2475a642d 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_bus_vmbus.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 struct vmbus_channel;
 struct vmbus_mon_page;
diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
index 7ffde5f4c8..85d6ddfcf4 100644
--- a/drivers/common/qat/dev/qat_dev_gen4.c
+++ b/drivers/common/qat/dev/qat_dev_gen4.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "qat_device.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 5916e745e2..9cbd19a481 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 7d657d81bc..445a3baa67 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
index 61d457f4e0..d1ede5e990 100644
--- a/drivers/crypto/bcmfs/bcmfs_qp.c
+++ b/drivers/crypto/bcmfs/bcmfs_qp.c
@@ -8,7 +8,7 @@
 #include <rte_atomic.h>
 #include <rte_bitmap.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_prefetch.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
index bc7fb67218..78272d616c 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
@@ -4,7 +4,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 6c3e45e333..013f3be1e6 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 
 #include "ccp_crypto.h"
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 3fd9f3c426..db11ac7444 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn10k_cryptodev.h"
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index bd425f95ff..4cfc1f2150 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn9k_cryptodev.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0cce861899..3b13578de0 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_common.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7e554cb2b1..c6bd785262 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -19,7 +19,7 @@
 #include <rte_security_driver.h>
 #endif
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 83ae6b6be9..11b559e025 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -5,7 +5,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index e30dcfc281..9b7b16c6e3 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -9,6 +9,7 @@
 #include <libgen.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 5a443acff8..759578378f 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -17,7 +17,7 @@
 #include <rte_config.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 9f8c6cd8b8..71ac141b66 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -15,7 +15,7 @@
 
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
 #include <rte_ring.h>
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index aa403f9e06..8e470584ea 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 08df6e223a..1001297cda 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <bus_fslmc_driver.h>
 #include <rte_lcore.h>
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 3882a9cf1d..a68d3ac154 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index fe157c59d5..99fa326ad5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <ethdev_driver.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 6bd8fec6d4..8513b9a013 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -12,7 +12,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 2be7b8d2df..a552aabeb8 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -8,7 +8,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <gpudev_driver.h>
 
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 56c629c681..84371d5d1a 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -20,7 +20,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include "rte_dpaa2_mempool.h"
 
 #include "fslmc_vfio.h"
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fd7be47311..9957de2314 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -24,7 +24,7 @@
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 748db590c1..71d0b53e03 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_version.h>
 
 #include "ark_pktdir.h"
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7c0cb666fb..b2a08f5635 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_cycles.h>
 #include <rte_spinlock.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index b9ebf64fb8..a5d11c5832 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -33,7 +33,7 @@
 #include <rte_memzone.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_pci.h>
 #include <rte_common.h>
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f36ad30e17..4448cf2de2 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -9,7 +9,7 @@
 #include "bnx2x_rxtx.h"
 
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53f..1460dce2ab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef04c..fd1506ddd4 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -7,7 +7,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 384080e6d3..bed755f5d9 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -18,7 +18,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_byteorder.h>
 
 #include "common.h"
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index fd71a50a58..45bbeaef0c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -31,7 +31,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "cxgbe.h"
 #include "cxgbe_pfvf.h"
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3c02c98b3d..f8dd833032 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -31,7 +31,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "base/common.h"
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5d91355c9a..5b13cb5c94 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -30,7 +30,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 9509f6e8a3..4d33b51fea 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <dpaa2_pmd_logs.h>
 #include <dpaa2_hw_pvt.h>
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index f876f4790c..37a8b43114 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 #include "rte_dpaa2_mempool.h"
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 932570c6e0..fbfdf360d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -14,7 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7b9c528d13..9436a95ac8 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hexdump.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
index ba0d500f74..63463c4fbf 100644
--- a/drivers/net/dpaa2/dpaa2_sparser.c
+++ b/drivers/net/dpaa2/dpaa2_sparser.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <fslmc_vfio.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 409de50083..8ee9be12ad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 43979992d3..d6bcc5bf58 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index e46697b6a1..b775310651 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -21,7 +21,7 @@
 #include <rte_eal.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 4709675af8..4d27fba585 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -14,7 +14,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_timer.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 
 #include "ena_com.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 998436e5e8..cdf0915591 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 7312c411bd..46f85964e9 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -7,7 +7,7 @@
 
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index a80f5e2caf..53a451c1b1 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -11,7 +11,7 @@
 #include <pthread.h>
 
 #include <rte_atomic.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_devargs.h>
 #include <rte_flow.h>
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8bbd8b445d..7adb20bff9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_spinlock.h>
 #include <rte_kvargs.h>
 #include <rte_vect.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bdc453ec1..67111ac251 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -23,7 +23,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_alarm.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_hash_crc.h>
 #include <rte_bitmap.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..ef2ab06475 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,7 +24,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 21bd1e2193..15f695682d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,7 +19,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..1c3d22ae0f 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -21,7 +21,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "ice_dcf.h"
 #include "ice_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 0da267db1f..dee712af98 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -18,7 +18,7 @@
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <iavf_devids.h>
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 552e41692c..04c9ce78a2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..67373a7b78 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -27,7 +27,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 910b76a92c..7e7e1824ef 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ccc06bdda6..d0bbc0a4c0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -30,7 +30,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 817fb06dfb..7db82af9f3 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -28,7 +28,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 20f75a17b0..e6f1f28768 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -26,7 +26,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 61cf374224..bc6f60c64a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -25,7 +25,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 #include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c792..eaafe11fb9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -19,7 +19,7 @@
 #include <rte_debug.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e588..47359501bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_common.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9ada22e2ff..0eee191566 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -15,7 +15,7 @@
 #include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index a38b701183..b781bcdcfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -13,7 +13,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ip.h>
 
 /* ecore includes */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 506c62a726..2ec743ebce 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -7,7 +7,7 @@
  * for Solarflare) and Solarflare Communications, Inc.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 81f5aa3cc4..3ae5023b6f 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2021 Xilinx, Inc.
  */
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_bitmap.h>
 
 #include "sfc.h"
diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
index 1abded8018..d9738e5214 100644
--- a/drivers/net/sfc/sfc_sw_stats.h
+++ b/drivers/net/sfc/sfc_sw_stats.h
@@ -5,7 +5,7 @@
 #ifndef _SFC_SW_STATS_H
 #define _SFC_SW_STATS_H
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "sfc.h"
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 28183ec740..9f57cb1a20 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index dc90569df1..c3e045d892 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -27,7 +27,7 @@
 #include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d180162abd..edf3becd32 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -24,7 +24,7 @@
 #include <rte_memory.h>
 #include <rte_eal_paging.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 2b9e35cef5..abc63b0935 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -16,7 +16,7 @@
 
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "virtio.h"
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 101b1cb500..fd946dec5c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/vmxnet3_defs.h"
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index db029cbf34..909fb8faab 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -3,7 +3,7 @@
  */
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 6831cc8d20..5dd5bbb652 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index fc257c5f44..8ef7a6b127 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_rawdev.h>
 #include <bus_vdev_driver.h>
 #include <rte_test.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 6ab62a12fc..92cf5f495e 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -11,7 +11,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_glue.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index e997bd01ed..cf2c20a704 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 9bfae077db..41f1415bea 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
index 9fabc399c5..72e52f876f 100644
--- a/lib/compressdev/rte_compressdev_pmd.h
+++ b/lib/compressdev/rte_compressdev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 
 #include "rte_compressdev.h"
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 75d0075b86..f07b92dfd7 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..96d7e225b0 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 6250302f3b..29c9c55131 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -13,7 +13,7 @@
 
 #include <rte_log.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index 82ab7a8cc7..acd7f71cd1 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -14,7 +14,7 @@
  * by any application.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_dmadev.h"
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 16c5aef1d8..98f3c78795 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -9,7 +9,7 @@
 
 #include <bus_driver.h>
 #include <rte_class.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_errno.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
new file mode 100644
index 0000000000..015188abd5
--- /dev/null
+++ b/lib/eal/include/dev_driver.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef DEV_DRIVER_H
+#define DEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include <rte_dev.h>
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+	const char *name;                   /**< Driver name. */
+	const char *alias;              /**< Driver alias. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEV_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index 77d8621a51..cfcd40aaed 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -57,6 +57,7 @@ headers += files(
 
 driver_sdk_headers = files(
         'bus_driver.h',
+        'dev_driver.h',
 )
 
 # special case install the generic headers, since they go in a subdir
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ddea163cca..7214f5d7fb 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,8 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_driver;
+
 /**
  * The device event type.
  */
@@ -67,27 +69,14 @@ struct rte_mem_resource {
 	void *addr;         /**< Virtual address, NULL when not mapped. */
 };
 
-/**
- * A structure describing a device driver.
- */
-struct rte_driver {
-	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
-	const char *name;                   /**< Driver name. */
-	const char *alias;              /**< Driver alias. */
-};
-
 /**
  * Retrieve a driver name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param driver
  *   A pointer to a driver structure.
  * @return
  *   A pointer to the driver name string.
  */
-__rte_experimental
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index d10fd89458..8b53a1d258 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -37,6 +37,7 @@ DPDK_23 {
 	rte_devargs_parsef;
 	rte_devargs_remove;
 	rte_devargs_type_count;
+	rte_driver_name;
 	rte_dump_physmem_layout;
 	rte_dump_stack;
 	rte_dump_tailq;
@@ -423,9 +424,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..47a55a419e 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -19,6 +19,7 @@ extern "C" {
  *
  */
 
+#include <dev_driver.h>
 #include <rte_ethdev.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..def6cd0876 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 4938b4ee07..a8ef5bac06 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 8e81cf774d..29515401bd 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -9,7 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_log.h>
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 79b905e9fc..bbb027aa0c 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 0e55b00bfe..23972b3dbd 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_gpudev.h"
 
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index ac32c4bb72..3b43edc548 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -9,7 +9,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_mempool_trace.h"
 
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 72aabd4dd0..af2b814251 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -14,7 +14,7 @@
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index e157d65332..569e836560 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_telemetry.h>
diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 3b7be57d3e..a51944c8ff 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -19,7 +19,7 @@ extern "C" {
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 1a2a408f0e..94160f4177 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -5,7 +5,7 @@
  */
 
 #include <rte_cryptodev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_telemetry.h>
 #include "rte_security.h"
 #include "rte_security_driver.h"
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 24/27] dev: introduce device accessors
  2022-09-05  8:39 ` David Marchand
                     ` (22 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 23/27] dev: hide driver object David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 25/27] dev: provide bus specific information David Marchand
                     ` (2 subsequent siblings)
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Maryam Tahhan, Reshma Pattan,
	Aman Singh, Yuying Zhang, Maxime Coquelin, Chenbo Xia,
	Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

Prepare for making the device object opaque by adding accessors.
Update existing "external" users.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v4:
- updated test_vdev.c,

Changes since RFC v2:
- added rte_dev_devargs,
- updated testpmd,

---
 app/proc-info/main.c               |  6 +--
 app/test-pmd/config.c              | 18 +++----
 app/test-pmd/testpmd.c             |  6 +--
 app/test/test_vdev.c               |  4 +-
 examples/ethtool/lib/rte_ethtool.c |  2 +-
 examples/l3fwd/l3fwd_em.c          |  4 +-
 examples/l3fwd/l3fwd_fib.c         |  8 +--
 examples/l3fwd/l3fwd_lpm.c         |  4 +-
 examples/vdpa/main.c               | 16 +++---
 lib/eal/common/eal_common_dev.c    | 30 ++++++++++++
 lib/eal/include/rte_dev.h          | 78 ++++++++++++++++++++++++++++++
 lib/eal/version.map                |  7 +++
 lib/ethdev/rte_ethdev.h            |  2 +-
 13 files changed, 150 insertions(+), 35 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 1bfba5f60d..d52ac8a038 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -755,7 +755,7 @@ show_port(void)
 		}
 
 		printf("\t  -- driver %s device %s socket %d\n",
-		       dev_info.driver_name, dev_info.device->name,
+		       dev_info.driver_name, rte_dev_name(dev_info.device),
 		       rte_eth_dev_socket_id(i));
 
 		ret = rte_eth_dev_owner_get(i, &owner);
@@ -1254,7 +1254,7 @@ show_crypto(void)
 		       rte_cryptodev_name_get(i),
 		       dev_info.driver_name,
 		       dev_info.driver_id,
-		       dev_info.device->numa_node,
+		       rte_dev_numa_node(dev_info.device),
 		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
@@ -1466,7 +1466,7 @@ dump_regs(char *file_prefix)
 			else
 				printf("Device (%s) regs dumped successfully, "
 					"driver:%s version:0X%08X\n",
-					dev_info.device->name,
+					rte_dev_name(dev_info.device),
 					dev_info.driver_name, reg_info.version);
 
 			fclose(fp_regs);
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 6510f29c76..de74690f06 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -645,19 +645,19 @@ device_infos_display(const char *identifier)
 		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
-			if (!dev->driver)
+			if (rte_dev_driver(dev) == NULL)
 				continue;
 			/* Check for matching device if identifier is present */
 			if (identifier &&
-			    strncmp(da.name, dev->name, strlen(dev->name)))
+			    strncmp(da.name, rte_dev_name(dev), strlen(rte_dev_name(dev))))
 				continue;
 			printf("\n%s Infos for device %s %s\n",
-			       info_border, dev->name, info_border);
-			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", rte_driver_name(dev->driver));
+			       info_border, rte_dev_name(dev), info_border);
+			printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev)));
+			printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev)));
 			printf("\nDevargs: %s",
-			       dev->devargs ? dev->devargs->args : "");
-			printf("\nConnect to socket: %d", dev->numa_node);
+			       rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : "");
+			printf("\nConnect to socket: %d", rte_dev_numa_node(dev));
 			printf("\n");
 
 			/* List ports with matching device name */
@@ -802,8 +802,8 @@ port_infos_display(portid_t port_id)
 	else
 		printf("\nFirmware-version: %s", "not available");
 
-	if (dev_info.device->devargs && dev_info.device->devargs->args)
-		printf("\nDevargs: %s", dev_info.device->devargs->args);
+	if (rte_dev_devargs(dev_info.device) && rte_dev_devargs(dev_info.device)->args)
+		printf("\nDevargs: %s", rte_dev_devargs(dev_info.device)->args);
 	printf("\nConnect to socket: %u", port->socket_id);
 
 	if (port_numa[port_id] != NUMA_NO_CONFIG) {
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c7d1fa2719..a399193e53 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1057,7 +1057,7 @@ dma_unmap_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
 			TESTPMD_LOG(DEBUG,
 				    "unable to DMA unmap addr 0x%p "
 				    "for device %s\n",
-				    memhdr->addr, dev_info.device->name);
+				    memhdr->addr, rte_dev_name(dev_info.device));
 		}
 	}
 	ret = rte_extmem_unregister(memhdr->addr, memhdr->len);
@@ -1098,7 +1098,7 @@ dma_map_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
 			TESTPMD_LOG(DEBUG,
 				    "unable to DMA map addr 0x%p "
 				    "for device %s\n",
-				    memhdr->addr, dev_info.device->name);
+				    memhdr->addr, rte_dev_name(dev_info.device));
 		}
 	}
 }
@@ -3441,7 +3441,7 @@ detach_device(struct rte_device *dev)
 	}
 
 	if (rte_dev_remove(dev) < 0) {
-		TESTPMD_LOG(ERR, "Failed to detach device %s\n", dev->name);
+		TESTPMD_LOG(ERR, "Failed to detach device %s\n", rte_dev_name(dev));
 		return;
 	}
 	remove_invalid_ports();
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 1904e76e44..9f0e6c4b99 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -23,7 +23,7 @@ static const char * const valid_keys[] = {
 static int
 cmp_dev_name(const struct rte_device *dev, const void *name)
 {
-	return strcmp(dev->name, name);
+	return strcmp(rte_dev_name(dev), name);
 }
 
 static int
@@ -39,7 +39,7 @@ cmp_dev_match(const struct rte_device *dev, const void *_kvlist)
 
 	/* if key is present in kvlist and does not match, filter device */
 	name = rte_kvargs_get(kvlist, key);
-	if (name != NULL && strcmp(name, dev->name))
+	if (name != NULL && strcmp(name, rte_dev_name(dev)) != 0)
 		return -1;
 
 	return 0;
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 88dc917b73..33acc5e3cc 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -49,7 +49,7 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	strlcpy(drvinfo->bus_info, dev_info.device->name,
+	strlcpy(drvinfo->bus_info, rte_dev_name(dev_info.device),
 		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index 10be24c61d..0531282a1f 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -403,7 +403,7 @@ populate_ipv4_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v4[i].v4_key.port_dst,
 			   em_route_base_v4[i].v4_key.port_src,
 			   em_route_base_v4[i].v4_key.proto,
-		       em_route_base_v4[i].if_out, dev_info.device->name);
+		       em_route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 " keys\n",
 		(uint64_t)route_num_v4);
@@ -455,7 +455,7 @@ populate_ipv6_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v6[i].v6_key.port_dst,
 			   em_route_base_v6[i].v6_key.port_src,
 			   em_route_base_v6[i].v6_key.proto,
-		       em_route_base_v6[i].if_out, dev_info.device->name);
+		       em_route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 "keys\n",
 		(uint64_t)route_num_v6);
diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index e02e4b3f5a..b82e0c0354 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -640,11 +640,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v4[i].depth,
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv4 route added to port %d [%s]\n",
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 	/* >8 End of setup fib. */
@@ -695,11 +695,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v6[i].depth,
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv6 route added to port %d [%s]\n",
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 }
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index d1b850dd5b..22d7f61a42 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -598,7 +598,7 @@ setup_lpm(const int socketid)
 		printf("LPM: Adding route %s / %d (%d) [%s]\n",
 		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 		       route_base_v4[i].depth,
-		       route_base_v4[i].if_out, dev_info.device->name);
+		       route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 
 	/* create the LPM6 table */
@@ -642,7 +642,7 @@ setup_lpm(const int socketid)
 		       inet_ntop(AF_INET6, route_base_v6[i].ip_8, abuf,
 				 sizeof(abuf)),
 		       route_base_v6[i].depth,
-		       route_base_v6[i].if_out, dev_info.device->name);
+		       route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 }
 
diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 7e11ef4e26..ee240dd15a 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -119,7 +119,7 @@ new_device(int vid)
 				"Failed to get generic device for port %d\n", i);
 			continue;
 		}
-		printf("\nnew port %s, device : %s\n", ifname, dev->name);
+		printf("\nnew port %s, device : %s\n", ifname, rte_dev_name(dev));
 		vports[i].vid = vid;
 		break;
 	}
@@ -149,7 +149,7 @@ destroy_device(int vid)
 			continue;
 		}
 
-		printf("\ndestroy port %s, device: %s\n", ifname, dev->name);
+		printf("\ndestroy port %s, device: %s\n", ifname, rte_dev_name(dev));
 		break;
 	}
 }
@@ -353,23 +353,23 @@ static void cmd_list_vdpa_devices_parsed(
 
 	cmdline_printf(cl, "device name\tqueue num\tsupported features\n");
 	RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-		vdev = rte_vdpa_find_device_by_name(dev->name);
+		vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 		if (!vdev)
 			continue;
 		if (rte_vdpa_get_queue_num(vdev, &queue_num) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa queue number "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		if (rte_vdpa_get_features(vdev, &features) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa features "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		cmdline_printf(cl, "%s\t\t%" PRIu32 "\t\t0x%" PRIx64 "\n",
-			dev->name, queue_num, features);
+			rte_dev_name(dev), queue_num, features);
 	}
 }
 
@@ -606,10 +606,10 @@ main(int argc, char *argv[])
 		cmdline_stdin_exit(cl);
 	} else {
 		RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-			vdev = rte_vdpa_find_device_by_name(dev->name);
+			vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 			if (vdev == NULL) {
 				rte_panic("Failed to find vDPA dev for %s\n",
-						dev->name);
+						rte_dev_name(dev));
 			}
 			vports[devcnt].dev = vdev;
 			snprintf(vports[devcnt].ifname, MAX_PATH_LEN, "%s%d",
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 98f3c78795..7b12d6e531 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -25,6 +25,36 @@ rte_driver_name(const struct rte_driver *driver)
 	return driver->name;
 }
 
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev)
+{
+	return dev->bus;
+}
+
+const struct rte_devargs *
+rte_dev_devargs(const struct rte_device *dev)
+{
+	return dev->devargs;
+}
+
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev)
+{
+	return dev->driver;
+}
+
+const char *
+rte_dev_name(const struct rte_device *dev)
+{
+	return dev->name;
+}
+
+int
+rte_dev_numa_node(const struct rte_device *dev)
+{
+	return dev->numa_node;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 7214f5d7fb..ce97ee1086 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,9 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_bus;
+struct rte_devargs;
+struct rte_device;
 struct rte_driver;
 
 /**
@@ -80,6 +83,81 @@ struct rte_mem_resource {
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
+/**
+ * Retrieve a device bus.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device bus.
+ */
+__rte_experimental
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev);
+
+/**
+ * Retrieve a device arguments.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device devargs.
+ */
+__rte_experimental
+const struct rte_devargs *
+rte_dev_devargs(const struct rte_device *dev);
+
+/**
+ * Retrieve a device driver.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device driver.
+ */
+__rte_experimental
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev);
+
+/**
+ * Retrieve a device name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device name.
+ */
+__rte_experimental
+const char *
+rte_dev_name(const struct rte_device *dev);
+
+/**
+ * Retrieve a device numa node.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device numa node.
+ */
+__rte_experimental
+int
+rte_dev_numa_node(const struct rte_device *dev);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 8b53a1d258..719789b8d1 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_dev_bus;
+	rte_dev_devargs;
+	rte_dev_driver;
+	rte_dev_name;
+	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 7556b94602..2e783536c1 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = rte_driver_name(dev->device->driver)
+ * driver_name = rte_driver_name(rte_dev_driver(dev->device));
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 25/27] dev: provide bus specific information
  2022-09-05  8:39 ` David Marchand
                     ` (23 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 24/27] dev: introduce device accessors David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 26/27] bus/pci: fill " David Marchand
  2022-09-05  8:39   ` [PATCH v5 27/27] dev: hide device object David Marchand
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Ray Kinsella

For diagnostic, it may be useful to provide a description of the device
with bus specific information.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v3:
- split patch in two, as per Thomas offlist request,

---
 app/test-pmd/config.c           |  2 ++
 lib/eal/common/eal_common_dev.c |  6 ++++++
 lib/eal/include/rte_dev.h       | 16 ++++++++++++++++
 lib/eal/version.map             |  1 +
 4 files changed, 25 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index de74690f06..c5e5a66fa4 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,6 +654,8 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, rte_dev_name(dev), info_border);
 			printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev)));
+			printf("\nBus information: %s",
+				rte_dev_bus_info(dev) ? rte_dev_bus_info(dev) : "");
 			printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev)));
 			printf("\nDevargs: %s",
 			       rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : "");
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 7b12d6e531..a190bd37af 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -31,6 +31,12 @@ rte_dev_bus(const struct rte_device *dev)
 	return dev->bus;
 }
 
+const char *
+rte_dev_bus_info(const struct rte_device *dev)
+{
+	return dev->bus_info;
+}
+
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev)
 {
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ce97ee1086..f010dd6441 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -98,6 +98,21 @@ __rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
+/**
+ * Retrieve bus specific information for a device.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A string describing this device or NULL if none is available.
+ */
+__rte_experimental
+const char *
+rte_dev_bus_info(const struct rte_device *dev);
+
 /**
  * Retrieve a device arguments.
  *
@@ -170,6 +185,7 @@ rte_dev_numa_node(const struct rte_device *dev);
 struct rte_device {
 	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
 	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
 	const struct rte_driver *driver; /**< Driver assigned after probing */
 	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
 	int numa_node;                /**< NUMA node connection */
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 719789b8d1..0cf321605e 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -427,6 +427,7 @@ EXPERIMENTAL {
 
 	# added in 22.11
 	rte_dev_bus;
+	rte_dev_bus_info;
 	rte_dev_devargs;
 	rte_dev_driver;
 	rte_dev_name;
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 26/27] bus/pci: fill bus specific information
  2022-09-05  8:39 ` David Marchand
                     ` (24 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 25/27] dev: provide bus specific information David Marchand
@ 2022-09-05  8:39   ` David Marchand
  2022-09-05  8:39   ` [PATCH v5 27/27] dev: hide device object David Marchand
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

For diagnostic, it may be useful to provide the PCI vendor and device
id.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v4:
- fixed Windows build issue (missing asprintf implementation),

---
 drivers/bus/pci/bsd/pci.c        |  8 +++---
 drivers/bus/pci/bus_pci_driver.h |  1 +
 drivers/bus/pci/linux/pci.c      | 24 ++++++++--------
 drivers/bus/pci/pci_common.c     | 48 ++++++++++++++++++++++++++++++--
 drivers/bus/pci/private.h        | 10 +++++--
 drivers/bus/pci/windows/pci.c    |  6 ++--
 6 files changed, 74 insertions(+), 23 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index bc560a2a56..844d145fed 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -248,7 +248,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	/* FreeBSD has no NUMA support (yet) */
 	dev->device.numa_node = 0;
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	/* FreeBSD has only one pass through driver */
 	dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
@@ -299,11 +299,11 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 			} else { /* already registered */
 				dev2->kdrv = dev->kdrv;
 				dev2->max_vfs = dev->max_vfs;
-				pci_name_set(dev2);
+				pci_common_set(dev2);
 				memmove(dev2->mem_resource,
 					dev->mem_resource,
 					sizeof(dev->mem_resource));
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
@@ -313,7 +313,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	return 0;
 
 skipdev:
-	free(dev);
+	pci_free(dev);
 	return 0;
 }
 
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index 0f2f9b5101..be32263a82 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -43,6 +43,7 @@ struct rte_pci_device {
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
 	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	char *bus_info;                     /**< PCI bus specific info */
 	struct rte_intr_handle *vfio_req_intr_handle;
 				/**< Handler of VFIO request interrupt */
 };
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index fa5d5e131d..c8703d52f3 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -226,7 +226,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* get vendor id */
 	snprintf(filename, sizeof(filename), "%s/vendor", dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.vendor_id = (uint16_t)tmp;
@@ -234,7 +234,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* get device id */
 	snprintf(filename, sizeof(filename), "%s/device", dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.device_id = (uint16_t)tmp;
@@ -243,7 +243,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/subsystem_vendor",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.subsystem_vendor_id = (uint16_t)tmp;
@@ -252,7 +252,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/subsystem_device",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.subsystem_device_id = (uint16_t)tmp;
@@ -261,7 +261,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/class",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	/* the least 24 bits are valid: class, subclass, program interface */
@@ -295,13 +295,13 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		dev->device.numa_node = 0;
 	}
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	/* parse resources */
 	snprintf(filename, sizeof(filename), "%s/resource", dirname);
 	if (pci_parse_sysfs_resource(filename, dev) < 0) {
 		RTE_LOG(ERR, EAL, "%s(): cannot parse resource\n", __func__);
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 
@@ -310,7 +310,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	ret = pci_get_kernel_driver_by_path(filename, driver, sizeof(driver));
 	if (ret < 0) {
 		RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 
@@ -324,7 +324,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		else
 			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
-		free(dev);
+		pci_free(dev);
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
@@ -346,7 +346,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 					dev2->kdrv = dev->kdrv;
 					dev2->max_vfs = dev->max_vfs;
 					dev2->id = dev->id;
-					pci_name_set(dev2);
+					pci_common_set(dev2);
 					memmove(dev2->mem_resource,
 						dev->mem_resource,
 						sizeof(dev->mem_resource));
@@ -376,10 +376,10 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 					else if (dev2->device.devargs !=
 						 dev->device.devargs) {
 						rte_devargs_remove(dev2->device.devargs);
-						pci_name_set(dev2);
+						pci_common_set(dev2);
 					}
 				}
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index c26aacd364..bb6275ee7f 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -44,6 +44,37 @@ const char *rte_pci_get_sysfs_path(void)
 	return path;
 }
 
+#ifdef RTE_EXEC_ENV_WINDOWS
+#define asprintf pci_asprintf
+
+static int
+pci_asprintf(char **buffer, const char *format, ...)
+{
+	int size, ret;
+	va_list arg;
+
+	va_start(arg, format);
+	size = vsnprintf(NULL, 0, format, arg);
+	va_end(arg);
+	if (size < 0)
+		return -1;
+	size++;
+
+	*buffer = malloc(size);
+	if (*buffer == NULL)
+		return -1;
+
+	va_start(arg, format);
+	ret = vsnprintf(*buffer, size, format, arg);
+	va_end(arg);
+	if (ret != size - 1) {
+		free(*buffer);
+		return -1;
+	}
+	return ret;
+}
+#endif /* RTE_EXEC_ENV_WINDOWS */
+
 static struct rte_devargs *
 pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
 {
@@ -59,7 +90,7 @@ pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
 }
 
 void
-pci_name_set(struct rte_pci_device *dev)
+pci_common_set(struct rte_pci_device *dev)
 {
 	struct rte_devargs *devargs;
 
@@ -80,6 +111,19 @@ pci_name_set(struct rte_pci_device *dev)
 	else
 		/* Otherwise, it uses the internal, canonical form. */
 		dev->device.name = dev->name;
+
+	if (asprintf(&dev->bus_info, "vendor_id=%"PRIx16", device_id=%"PRIx16,
+			dev->id.vendor_id, dev->id.device_id) != -1)
+		dev->device.bus_info = dev->bus_info;
+}
+
+void
+pci_free(struct rte_pci_device *dev)
+{
+	if (dev == NULL)
+		return;
+	free(dev->bus_info);
+	free(dev);
 }
 
 /* map a particular resource from a file */
@@ -604,7 +648,7 @@ pci_unplug(struct rte_device *dev)
 	if (ret == 0) {
 		rte_pci_remove_device(pdev);
 		rte_devargs_remove(dev->devargs);
-		free(pdev);
+		pci_free(pdev);
 	}
 	return ret;
 }
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index fddf49251d..c8161a1074 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -44,10 +44,16 @@ struct rte_pci_device;
 int rte_pci_scan(void);
 
 /**
- * Find the name of a PCI device.
+ * Set common internal information for a PCI device.
  */
 void
-pci_name_set(struct rte_pci_device *dev);
+pci_common_set(struct rte_pci_device *dev);
+
+/**
+ * Free a PCI device.
+ */
+void
+pci_free(struct rte_pci_device *dev);
 
 /**
  * Validate whether a device with given PCI address should be ignored or not.
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index f013b743b3..3f7a8b9432 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -382,7 +382,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 	dev->id = pci_id;
 	dev->max_vfs = 0; /* TODO: get max_vfs */
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	set_kernel_driver_type(device_info_data, dev);
 
@@ -410,7 +410,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 				dev2->max_vfs = dev->max_vfs;
 				memmove(dev2->mem_resource, dev->mem_resource,
 					sizeof(dev->mem_resource));
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
@@ -419,7 +419,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 
 	return 0;
 end:
-	free(dev);
+	pci_free(dev);
 	return ret;
 }
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v5 27/27] dev: hide device object
  2022-09-05  8:39 ` David Marchand
                     ` (25 preceding siblings ...)
  2022-09-05  8:39   ` [PATCH v5 26/27] bus/pci: fill " David Marchand
@ 2022-09-05  8:39   ` David Marchand
  26 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-05  8:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Ray Kinsella, Maxime Coquelin, Chenbo Xia

Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Some applications may have been dereferencing rte_device objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/deprecation.rst   |  7 -----
 doc/guides/rel_notes/release_22_11.rst |  4 +--
 lib/eal/common/eal_private.h           |  2 +-
 lib/eal/include/dev_driver.h           | 13 +++++++++
 lib/eal/include/rte_dev.h              | 37 --------------------------
 lib/eal/version.map                    | 14 +++++-----
 lib/vhost/vdpa.c                       |  1 +
 7 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 98a00da385..64668500c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,13 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* drivers: As a follow-up of the work on the ``rte_bus`` object,
-  the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
-  their bus-specific counterparts) will be made opaque in DPDK 22.11.
-  Registering a driver on a bus will be marked as an internal API:
-  external users may still register their drivers using the bus-specific
-  driver header (see ``enable_driver_sdk`` meson option).
-
 * bus: The ``dev->device.numa_node`` field is set by each bus driver for
   every device it manages to indicate on which NUMA node this device lies.
   When this information is unknown, the assigned value is not consistent
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4e20345b7a..43502349bd 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,8 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` 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).
-  The ``rte_driver`` object is now opaque and must be manipulated through added
-  accessors.
+  The ``rte_driver`` and ``rte_device`` objects are now opaque and must be
+  manipulated through added accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..5efa8c437e 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -21,6 +21,19 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index f010dd6441..dc1acc8953 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -86,90 +86,66 @@ rte_driver_name(const struct rte_driver *driver);
 /**
  * Retrieve a device bus.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device bus.
  */
-__rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
 /**
  * Retrieve bus specific information for a device.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A string describing this device or NULL if none is available.
  */
-__rte_experimental
 const char *
 rte_dev_bus_info(const struct rte_device *dev);
 
 /**
  * Retrieve a device arguments.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device devargs.
  */
-__rte_experimental
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev);
 
 /**
  * Retrieve a device driver.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device driver.
  */
-__rte_experimental
 const struct rte_driver *
 rte_dev_driver(const struct rte_device *dev);
 
 /**
  * Retrieve a device name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device name.
  */
-__rte_experimental
 const char *
 rte_dev_name(const struct rte_device *dev);
 
 /**
  * Retrieve a device numa node.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device numa node.
  */
-__rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
@@ -179,19 +155,6 @@ rte_dev_numa_node(const struct rte_device *dev);
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const char *bus_info;         /**< Device bus specific information */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 0cf321605e..3c14cf2724 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -26,7 +26,13 @@ DPDK_23 {
 	rte_delay_us_block;
 	rte_delay_us_callback_register;
 	rte_delay_us_sleep;
+	rte_dev_bus;
+	rte_dev_bus_info;
+	rte_dev_devargs;
+	rte_dev_driver;
 	rte_dev_is_probed;
+	rte_dev_name;
+	rte_dev_numa_node;
 	rte_dev_probe;
 	rte_dev_remove;
 	rte_devargs_add;
@@ -424,14 +430,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_dev_bus;
-	rte_dev_bus_info;
-	rte_dev_devargs;
-	rte_dev_driver;
-	rte_dev_name;
-	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index a6ca785b29..bb828577cb 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [EXT] [PATCH v5 23/27] dev: hide driver object
  2022-09-05  8:39   ` [PATCH v5 23/27] dev: hide driver object David Marchand
@ 2022-09-06  6:05     ` Akhil Goyal
  2022-09-06  6:46     ` Gujjar, Abhinandan S
  1 sibling, 0 replies; 231+ messages in thread
From: Akhil Goyal @ 2022-09-06  6:05 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, bruce.richardson, Jay Jayatheerthan, Ajit Khaparde,
	Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Kevin Laatz, Timothy McDaniel,
	Jerin Jacob Kollanukkaran, Elena Agostini, Ciara Loftus,
	Qi Zhang, Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Gaetan Rivet, Xiao Wang,
	Yuying Zhang, Beilei Xing, Jingjing Wu, Qiming Yang, Matan Azrad,
	Viacheslav Ovsiienko, Chaoyong He, Niklas Soderlund,
	Harman Kalra, Devendra Singh Rawat, Andrew Rybchenko,
	Maciej Czekaj [C],
	Maxime Coquelin, Chenbo Xia, Jochen Behrens, Jakub Palider,
	Tomasz Duszynski, Ori Kam, Chengwen Feng, Ray Kinsella,
	Ferruh Yigit, Abhinandan Gujjar, Olivier Matz, Reshma Pattan

> Make rte_driver opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Introduce a new driver header and move rte_driver definition.
> Update drivers and library to use the internal header.
> 
> Some applications may have been dereferencing rte_driver objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>

^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [EXT] [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-09-05  8:39   ` [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
@ 2022-09-06  6:11     ` Akhil Goyal
  0 siblings, 0 replies; 231+ messages in thread
From: Akhil Goyal @ 2022-09-06  6:11 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Fan Zhang, Ashish Gupta,
	Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Rosen Xu, Tianfei zhang,
	Sachin Saxena, Hemant Agrawal, Chengwen Feng, Kevin Laatz,
	Ferruh Yigit, Andrew Rybchenko, Abhinandan Gujjar,
	Jerin Jacob Kollanukkaran, Jay Jayatheerthan, Olivier Matz,
	Ori Kam, Maxime Coquelin, Chenbo Xia

> Those macros have no real value and are easily replaced with a simple
> if() block.
> 
> Existing users have been converted using a new cocci script.
> Deprecate them.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---


>  lib/cryptodev/rte_cryptodev.c                 |  43 ++-


>  lib/security/rte_security.c                   |   6 +-

For cryptodev and security
Acked-by: Akhil Goyal <gakhil@marvell.com>


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [PATCH v5 23/27] dev: hide driver object
  2022-09-05  8:39   ` [PATCH v5 23/27] dev: hide driver object David Marchand
  2022-09-06  6:05     ` [EXT] " Akhil Goyal
@ 2022-09-06  6:46     ` Gujjar, Abhinandan S
  1 sibling, 0 replies; 231+ messages in thread
From: Gujjar, Abhinandan S @ 2022-09-06  6:46 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, Richardson, Bruce, Jayatheerthan, Jay, Ajit Khaparde,
	Chautru, Nicolas, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Zhang, Roy Fan,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Laatz, Kevin, McDaniel, Timothy, Jerin Jacob,
	Elena Agostini, Loftus, Ciara, Zhang, Qi Z, Shepard Siegel,
	Ed Czeck, John Miller, Webster, Steven, Peters, Matt,
	Rasesh Mody, Shahed Shaikh, Somnath Kotur, Rahul Lakkireddy, Su,
	Simei, Wu, Wenjun1, Marcin Wojtas, Michal Krawczyk, Shai Brandes,
	Evgeny Schemeilin, Igor Chauskin, Daley, John, Hyong Youb Kim,
	Gaetan Rivet, Wang, Xiao W, Zhang, Yuying, Xing, Beilei, Wu,
	Jingjing, Yang, Qiming, Matan Azrad, Viacheslav Ovsiienko,
	Chaoyong He, Niklas Soderlund, Harman Kalra,
	Devendra Singh Rawat, Andrew Rybchenko, Maciej Czekaj,
	Maxime Coquelin, Xia, Chenbo, Jochen Behrens, Jakub Palider,
	Tomasz Duszynski, Ori Kam, Akhil Goyal, Chengwen Feng,
	Ray Kinsella, Ferruh Yigit, Matz, Olivier, Pattan,  Reshma

Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, September 5, 2022 2:09 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; Richardson, Bruce <bruce.richardson@intel.com>;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Ajit Khaparde
> <ajit.khaparde@broadcom.com>; Chautru, Nicolas
> <nicolas.chautru@intel.com>; Parav Pandit <parav@nvidia.com>; Xueming Li
> <xuemingl@nvidia.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Sachin Saxena <sachin.saxena@oss.nxp.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; Long Li <longli@microsoft.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; Sunila Sahu <ssahu@marvell.com>; Ashish Gupta
> <ashish.gupta@marvell.com>; Raveendra Padasalagi
> <raveendra.padasalagi@broadcom.com>; Vikas Gupta
> <vikas.gupta@broadcom.com>; Chandubabu Namburu <chandu@amd.com>;
> Ankur Dwivedi <adwivedi@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; Tejasree Kondoj <ktejasree@marvell.com>;
> Gagandeep Singh <g.singh@nxp.com>; Laatz, Kevin <kevin.laatz@intel.com>;
> McDaniel, Timothy <timothy.mcdaniel@intel.com>; Jerin Jacob
> <jerinj@marvell.com>; Elena Agostini <eagostini@nvidia.com>; Loftus, Ciara
> <ciara.loftus@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Shepard Siegel
> <shepard.siegel@atomicrules.com>; Ed Czeck <ed.czeck@atomicrules.com>;
> John Miller <john.miller@atomicrules.com>; Webster, Steven
> <steven.webster@windriver.com>; Peters, Matt <matt.peters@windriver.com>;
> Rasesh Mody <rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>;
> Somnath Kotur <somnath.kotur@broadcom.com>; Rahul Lakkireddy
> <rahul.lakkireddy@chelsio.com>; Su, Simei <simei.su@intel.com>; Wu,
> Wenjun1 <wenjun1.wu@intel.com>; Marcin Wojtas <mw@semihalf.com>;
> Michal Krawczyk <mk@semihalf.com>; Shai Brandes <shaibran@amazon.com>;
> Evgeny Schemeilin <evgenys@amazon.com>; Igor Chauskin
> <igorch@amazon.com>; Daley, John <johndale@cisco.com>; Hyong Youb Kim
> <hyonkim@cisco.com>; Gaetan Rivet <grive@u256.net>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Yang,
> Qiming <qiming.yang@intel.com>; Matan Azrad <matan@nvidia.com>;
> Viacheslav Ovsiienko <viacheslavo@nvidia.com>; Chaoyong He
> <chaoyong.he@corigine.com>; Niklas Soderlund
> <niklas.soderlund@corigine.com>; Harman Kalra <hkalra@marvell.com>;
> Devendra Singh Rawat <dsinghrawat@marvell.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Maciej Czekaj <mczekaj@marvell.com>;
> Maxime Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo
> <chenbo.xia@intel.com>; Jochen Behrens <jbehrens@vmware.com>; Jakub
> Palider <jpalider@marvell.com>; Tomasz Duszynski <tduszynski@marvell.com>;
> Ori Kam <orika@nvidia.com>; Akhil Goyal <gakhil@marvell.com>; Chengwen
> Feng <fengchengwen@huawei.com>; Ray Kinsella <mdr@ashroe.eu>; Ferruh
> Yigit <ferruh.yigit@xilinx.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Matz, Olivier <olivier.matz@6wind.com>;
> Pattan, Reshma <reshma.pattan@intel.com>
> Subject: [PATCH v5 23/27] dev: hide driver object
> 
> Make rte_driver opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Introduce a new driver header and move rte_driver definition.
> Update drivers and library to use the internal header.
> 
> Some applications may have been dereferencing rte_driver objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> Changes since RFC v2:
> - updated release notes,
> - marked accessors as stable,
> 
> ---
>  doc/guides/rel_notes/release_22_11.rst        |  2 ++
>  drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
>  .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
>  drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
>  drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
>  drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
>  drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
>  drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
>  drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
>  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/pci/bus_pci_driver.h              |  2 +-
>  drivers/bus/pci/pci_params.c                  |  2 +-
>  drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
>  drivers/bus/vdev/vdev.c                       |  2 +-
>  drivers/bus/vdev/vdev_params.c                |  2 +-
>  drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
>  drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
>  drivers/common/qat/qat_qp.c                   |  2 +-
>  drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
>  drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
>  drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
>  drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
>  drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
>  drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
>  drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
>  drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
>  drivers/dma/idxd/idxd_bus.c                   |  1 +
>  drivers/event/dlb2/dlb2.c                     |  2 +-
>  drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
>  drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
>  drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
>  drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
>  drivers/event/octeontx/ssovf_evdev.c          |  2 +-
>  drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
>  drivers/gpu/cuda/cuda.c                       |  2 +-
>  drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
>  drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
>  drivers/net/ark/ark_global.h                  |  2 +-
>  drivers/net/avp/avp_ethdev.c                  |  2 +-
>  drivers/net/axgbe/axgbe_common.h              |  2 +-
>  drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
>  drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
>  drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
>  drivers/net/cxgbe/base/t4_hw.c                |  2 +-
>  drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
>  drivers/net/cxgbe/cxgbe_main.c                |  2 +-
>  drivers/net/cxgbe/sge.c                       |  2 +-
>  drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
>  drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
>  drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
>  drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
>  drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
>  drivers/net/e1000/em_ethdev.c                 |  2 +-
>  drivers/net/e1000/igb_ethdev.c                |  2 +-
>  drivers/net/e1000/igb_flow.c                  |  2 +-
>  drivers/net/ena/ena_ethdev.h                  |  2 +-
>  drivers/net/enic/enic_ethdev.c                |  2 +-
>  drivers/net/enic/enic_vf_representor.c        |  2 +-
>  drivers/net/failsafe/failsafe_private.h       |  2 +-
>  drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
>  drivers/net/i40e/i40e_ethdev.c                |  2 +-
>  drivers/net/iavf/iavf_ethdev.c                |  2 +-
>  drivers/net/iavf/iavf_vchnl.c                 |  2 +-
>  drivers/net/ice/ice_dcf.c                     |  2 +-
>  drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
>  drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
>  drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
>  drivers/net/mlx4/mlx4.c                       |  2 +-
>  drivers/net/netvsc/hn_ethdev.c                |  2 +-
>  drivers/net/netvsc/hn_nvs.c                   |  2 +-
>  drivers/net/netvsc/hn_rndis.c                 |  2 +-
>  drivers/net/netvsc/hn_rxtx.c                  |  2 +-
>  drivers/net/nfp/nfp_common.c                  |  2 +-
>  drivers/net/nfp/nfp_ethdev.c                  |  2 +-
>  drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
>  drivers/net/qede/qede_ethdev.h                |  2 +-
>  drivers/net/sfc/sfc_ethdev.c                  |  2 +-
>  drivers/net/sfc/sfc_sw_stats.c                |  2 +-
>  drivers/net/sfc/sfc_sw_stats.h                |  2 +-
>  drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
>  drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
>  drivers/net/virtio/virtio_ethdev.c            |  2 +-
>  drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
>  drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
>  drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
>  drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
>  drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
>  drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
>  lib/compressdev/rte_compressdev.c             |  2 +-
>  lib/compressdev/rte_compressdev_pmd.c         |  2 +-
>  lib/compressdev/rte_compressdev_pmd.h         |  1 +
>  lib/cryptodev/cryptodev_pmd.c                 |  2 +-
>  lib/cryptodev/cryptodev_pmd.h                 |  1 +
>  lib/cryptodev/rte_cryptodev.c                 |  2 +-
>  lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
>  lib/eal/common/eal_common_dev.c               |  2 +-
>  lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
>  lib/eal/include/meson.build                   |  1 +
>  lib/eal/include/rte_dev.h                     | 15 ++--------
>  lib/eal/version.map                           |  4 +--
>  lib/ethdev/ethdev_driver.h                    |  1 +
>  lib/eventdev/eventdev_pmd.h                   |  2 +-
>  lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
>  lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
>  lib/eventdev/rte_eventdev.c                   |  2 +-
>  lib/gpudev/gpudev_driver.h                    |  2 +-
>  lib/mempool/rte_mempool_ops.c                 |  2 +-
>  lib/pcapng/rte_pcapng.c                       |  2 +-
>  lib/rawdev/rte_rawdev.c                       |  2 +-
>  lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
>  lib/security/rte_security.c                   |  2 +-
>  115 files changed, 144 insertions(+), 122 deletions(-)
>  create mode 100644 lib/eal/include/dev_driver.h
> 
> diff --git a/doc/guides/rel_notes/release_22_11.rst
> b/doc/guides/rel_notes/release_22_11.rst
> index 36df0ccf93..4e20345b7a 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -98,6 +98,8 @@ API Changes
>    ``vdev``, ``vmbus`` 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).
> +  The ``rte_driver`` object is now opaque and must be manipulated through
> added
> +  accessors.
> 
>  * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
> 
> diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c
> b/drivers/baseband/acc100/rte_acc100_pmd.c
> index 801e8920df..e2d9409185 100644
> --- a/drivers/baseband/acc100/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_byteorder.h>
> diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> index c1d877c87f..51dd090c1b 100644
> --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> index f16814e241..036579e3ec 100644
> --- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> +++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> @@ -6,7 +6,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> diff --git a/drivers/bus/auxiliary/auxiliary_params.c
> b/drivers/bus/auxiliary/auxiliary_params.c
> index a889e392c6..e4c7ee0c3b 100644
> --- a/drivers/bus/auxiliary/auxiliary_params.c
> +++ b/drivers/bus/auxiliary/auxiliary_params.c
> @@ -5,7 +5,7 @@
>  #include <string.h>
> 
>  #include <bus_driver.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_kvargs.h>
> 
> diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h
> b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> index 1c2d2c04af..58fb7c7f69 100644
> --- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
> +++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> @@ -25,7 +25,7 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_debug.h>
>  #include <rte_interrupts.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #define RTE_BUS_AUXILIARY_NAME "auxiliary"
> diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h
> b/drivers/bus/dpaa/bus_dpaa_driver.h
> index cf66fc0c53..26a83b2cdf 100644
> --- a/drivers/bus/dpaa/bus_dpaa_driver.h
> +++ b/drivers/bus/dpaa/bus_dpaa_driver.h
> @@ -7,7 +7,7 @@
>  #define BUS_DPAA_DRIVER_H
> 
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_mbuf_dyn.h>
>  #include <rte_mempool.h>
> 
> diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h
> b/drivers/bus/fslmc/bus_fslmc_driver.h
> index 798ddebf3a..7ac5fe6ff1 100644
> --- a/drivers/bus/fslmc/bus_fslmc_driver.h
> +++ b/drivers/bus/fslmc/bus_fslmc_driver.h
> @@ -29,7 +29,7 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_debug.h>
>  #include <rte_interrupts.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_tailq.h>
>  #include <rte_devargs.h>
>  #include <rte_mbuf.h>
> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
> index 8604e43947..5966776a85 100644
> --- a/drivers/bus/fslmc/fslmc_vfio.c
> +++ b/drivers/bus/fslmc/fslmc_vfio.c
> @@ -28,7 +28,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal_memconfig.h>
> 
>  #include "private.h"
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> index cfe4280f87..d7f6e45b7d 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> @@ -18,7 +18,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_mbuf_pool_ops.h>
> 
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> index b7d81b518c..07256ed7ec 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
> 
>  #include <fslmc_logs.h>
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> index 071b0d297d..4aec7b2cd8 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> @@ -30,7 +30,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <fslmc_logs.h>
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> index 223e34bcba..65e2d799c3 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
> @@ -10,7 +10,7 @@
>  #include <errno.h>
> 
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "private.h"
>  #include <fslmc_logs.h>
> diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
> index b5c7dee617..0f2f9b5101 100644
> --- a/drivers/bus/pci/bus_pci_driver.h
> +++ b/drivers/bus/pci/bus_pci_driver.h
> @@ -11,7 +11,7 @@ extern "C" {
>  #endif
> 
>  #include <rte_bus_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_compat.h>
> 
>  /** Pathname of PCI devices directory. */
> diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
> index 39d702a418..d24cc201b8 100644
> --- a/drivers/bus/pci/pci_params.c
> +++ b/drivers/bus/pci/pci_params.c
> @@ -6,7 +6,7 @@
> 
>  #include <bus_driver.h>
>  #include <rte_bus_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_kvargs.h>
>  #include <rte_devargs.h>
> diff --git a/drivers/bus/vdev/bus_vdev_driver.h
> b/drivers/bus/vdev/bus_vdev_driver.h
> index 36748cdfae..bc7e30d7c6 100644
> --- a/drivers/bus/vdev/bus_vdev_driver.h
> +++ b/drivers/bus/vdev/bus_vdev_driver.h
> @@ -11,7 +11,7 @@ extern "C" {
> 
>  #include <rte_bus_vdev.h>
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
> 
>  struct rte_vdev_device {
> diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
> index 809a8bb08f..b176b658fc 100644
> --- a/drivers/bus/vdev/vdev.c
> +++ b/drivers/bus/vdev/vdev.c
> @@ -11,7 +11,7 @@
>  #include <sys/queue.h>
> 
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_driver.h>
>  #include <rte_common.h>
>  #include <rte_devargs.h>
> diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
> index 2c72614776..2d10a1e8ad 100644
> --- a/drivers/bus/vdev/vdev_params.c
> +++ b/drivers/bus/vdev/vdev_params.c
> @@ -4,7 +4,7 @@
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
>  #include <rte_errno.h>
> 
> diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h
> b/drivers/bus/vmbus/bus_vmbus_driver.h
> index 3424e791c9..e2475a642d 100644
> --- a/drivers/bus/vmbus/bus_vmbus_driver.h
> +++ b/drivers/bus/vmbus/bus_vmbus_driver.h
> @@ -12,7 +12,7 @@ extern "C" {
> 
>  #include <rte_bus_vmbus.h>
>  #include <rte_compat.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  struct vmbus_channel;
>  struct vmbus_mon_page;
> diff --git a/drivers/common/qat/dev/qat_dev_gen4.c
> b/drivers/common/qat/dev/qat_dev_gen4.c
> index 7ffde5f4c8..85d6ddfcf4 100644
> --- a/drivers/common/qat/dev/qat_dev_gen4.c
> +++ b/drivers/common/qat/dev/qat_dev_gen4.c
> @@ -2,7 +2,7 @@
>   * Copyright(c) 2021 Intel Corporation
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "qat_device.h"
> diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
> index 5916e745e2..9cbd19a481 100644
> --- a/drivers/common/qat/qat_qp.c
> +++ b/drivers/common/qat/qat_qp.c
> @@ -4,7 +4,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_pci.h>
> diff --git a/drivers/compress/zlib/zlib_pmd_ops.c
> b/drivers/compress/zlib/zlib_pmd_ops.c
> index 7d657d81bc..445a3baa67 100644
> --- a/drivers/compress/zlib/zlib_pmd_ops.c
> +++ b/drivers/compress/zlib/zlib_pmd_ops.c
> @@ -4,7 +4,7 @@
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_common.h>
>  #include <rte_malloc.h>
> 
> diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c
> b/drivers/crypto/bcmfs/bcmfs_qp.c
> index 61d457f4e0..d1ede5e990 100644
> --- a/drivers/crypto/bcmfs/bcmfs_qp.c
> +++ b/drivers/crypto/bcmfs/bcmfs_qp.c
> @@ -8,7 +8,7 @@
>  #include <rte_atomic.h>
>  #include <rte_bitmap.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_prefetch.h>
> diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> index bc7fb67218..78272d616c 100644
> --- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> +++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
> @@ -4,7 +4,7 @@
>   */
> 
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_malloc.h>
>  #include <cryptodev_pmd.h>
> diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c
> b/drivers/crypto/ccp/rte_ccp_pmd.c
> index 6c3e45e333..013f3be1e6 100644
> --- a/drivers/crypto/ccp/rte_ccp_pmd.c
> +++ b/drivers/crypto/ccp/rte_ccp_pmd.c
> @@ -9,7 +9,7 @@
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
> 
>  #include "ccp_crypto.h"
> diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c
> b/drivers/crypto/cnxk/cn10k_cryptodev.c
> index 3fd9f3c426..db11ac7444 100644
> --- a/drivers/crypto/cnxk/cn10k_cryptodev.c
> +++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
> @@ -7,7 +7,7 @@
>  #include <rte_crypto.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "cn10k_cryptodev.h"
> diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c
> b/drivers/crypto/cnxk/cn9k_cryptodev.c
> index bd425f95ff..4cfc1f2150 100644
> --- a/drivers/crypto/cnxk/cn9k_cryptodev.c
> +++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
> @@ -7,7 +7,7 @@
>  #include <rte_crypto.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
> 
>  #include "cn9k_cryptodev.h"
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 0cce861899..3b13578de0 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_common.h>
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c
> b/drivers/crypto/dpaa_sec/dpaa_sec.c
> index 7e554cb2b1..c6bd785262 100644
> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c
> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
> @@ -19,7 +19,7 @@
>  #include <rte_security_driver.h>
>  #endif
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_io.h>
>  #include <rte_ip.h>
>  #include <rte_kvargs.h>
> diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> index 83ae6b6be9..11b559e025 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> @@ -5,7 +5,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_reorder.h>
> diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
> index e30dcfc281..9b7b16c6e3 100644
> --- a/drivers/dma/idxd/idxd_bus.c
> +++ b/drivers/dma/idxd/idxd_bus.c
> @@ -9,6 +9,7 @@
>  #include <libgen.h>
> 
>  #include <bus_driver.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_eal.h>
>  #include <rte_log.h>
> diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
> index 5a443acff8..759578378f 100644
> --- a/drivers/event/dlb2/dlb2.c
> +++ b/drivers/event/dlb2/dlb2.c
> @@ -17,7 +17,7 @@
>  #include <rte_config.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_eventdev.h>
>  #include <eventdev_pmd.h>
> diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
> index 9f8c6cd8b8..71ac141b66 100644
> --- a/drivers/event/dlb2/pf/dlb2_pf.c
> +++ b/drivers/event/dlb2/pf/dlb2_pf.c
> @@ -15,7 +15,7 @@
> 
>  #include <rte_debug.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_mbuf.h>
>  #include <rte_ring.h>
> diff --git a/drivers/event/dpaa/dpaa_eventdev.c
> b/drivers/event/dpaa/dpaa_eventdev.c
> index aa403f9e06..8e470584ea 100644
> --- a/drivers/event/dpaa/dpaa_eventdev.c
> +++ b/drivers/event/dpaa/dpaa_eventdev.c
> @@ -14,7 +14,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_lcore.h>
>  #include <rte_log.h>
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 08df6e223a..1001297cda 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -14,7 +14,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_lcore.h>
> diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> index 3882a9cf1d..a68d3ac154 100644
> --- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> +++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> @@ -17,7 +17,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
> 
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/event/octeontx/ssovf_evdev.c
> b/drivers/event/octeontx/ssovf_evdev.c
> index fe157c59d5..99fa326ad5 100644
> --- a/drivers/event/octeontx/ssovf_evdev.c
> +++ b/drivers/event/octeontx/ssovf_evdev.c
> @@ -7,7 +7,7 @@
>  #include <rte_common.h>
>  #include <cryptodev_pmd.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <ethdev_driver.h>
>  #include <rte_event_eth_rx_adapter.h>
> diff --git a/drivers/event/skeleton/skeleton_eventdev.c
> b/drivers/event/skeleton/skeleton_eventdev.c
> index 6bd8fec6d4..8513b9a013 100644
> --- a/drivers/event/skeleton/skeleton_eventdev.c
> +++ b/drivers/event/skeleton/skeleton_eventdev.c
> @@ -12,7 +12,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_log.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
> index 2be7b8d2df..a552aabeb8 100644
> --- a/drivers/gpu/cuda/cuda.c
> +++ b/drivers/gpu/cuda/cuda.c
> @@ -8,7 +8,7 @@
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <rte_byteorder.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <gpudev_driver.h>
> 
> diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> index 56c629c681..84371d5d1a 100644
> --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> @@ -20,7 +20,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include "rte_dpaa2_mempool.h"
> 
>  #include "fslmc_vfio.h"
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index fd7be47311..9957de2314 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -24,7 +24,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_branch_prediction.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_ether.h>
>  #include <rte_lcore.h>
> diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
> index 748db590c1..71d0b53e03 100644
> --- a/drivers/net/ark/ark_global.h
> +++ b/drivers/net/ark/ark_global.h
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_version.h>
> 
>  #include "ark_pktdir.h"
> diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
> index 7c0cb666fb..b2a08f5635 100644
> --- a/drivers/net/avp/avp_ethdev.c
> +++ b/drivers/net/avp/avp_ethdev.c
> @@ -22,7 +22,7 @@
>  #include <rte_cycles.h>
>  #include <rte_spinlock.h>
>  #include <rte_byteorder.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_io.h>
> diff --git a/drivers/net/axgbe/axgbe_common.h
> b/drivers/net/axgbe/axgbe_common.h
> index b9ebf64fb8..a5d11c5832 100644
> --- a/drivers/net/axgbe/axgbe_common.h
> +++ b/drivers/net/axgbe/axgbe_common.h
> @@ -33,7 +33,7 @@
>  #include <rte_memzone.h>
>  #include <rte_ether.h>
>  #include <rte_ethdev.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_pci.h>
>  #include <rte_common.h>
> diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c
> b/drivers/net/bnx2x/bnx2x_ethdev.c
> index f36ad30e17..4448cf2de2 100644
> --- a/drivers/net/bnx2x/bnx2x_ethdev.c
> +++ b/drivers/net/bnx2x/bnx2x_ethdev.c
> @@ -9,7 +9,7 @@
>  #include "bnx2x_rxtx.h"
> 
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_alarm.h>
> 
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index e275d3a53f..1460dce2ab 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -6,7 +6,7 @@
>  #include <inttypes.h>
>  #include <stdbool.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c
> b/drivers/net/bnxt/rte_pmd_bnxt.c
> index 77ecbef04c..fd1506ddd4 100644
> --- a/drivers/net/bnxt/rte_pmd_bnxt.c
> +++ b/drivers/net/bnxt/rte_pmd_bnxt.c
> @@ -7,7 +7,7 @@
>  #include <stdbool.h>
>  #include <unistd.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_cycles.h>
> diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
> index 384080e6d3..bed755f5d9 100644
> --- a/drivers/net/cxgbe/base/t4_hw.c
> +++ b/drivers/net/cxgbe/base/t4_hw.c
> @@ -18,7 +18,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_byteorder.h>
> 
>  #include "common.h"
> diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c
> b/drivers/net/cxgbe/cxgbe_ethdev.c
> index fd71a50a58..45bbeaef0c 100644
> --- a/drivers/net/cxgbe/cxgbe_ethdev.c
> +++ b/drivers/net/cxgbe/cxgbe_ethdev.c
> @@ -31,7 +31,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "cxgbe.h"
>  #include "cxgbe_pfvf.h"
> diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
> index 3c02c98b3d..f8dd833032 100644
> --- a/drivers/net/cxgbe/cxgbe_main.c
> +++ b/drivers/net/cxgbe/cxgbe_main.c
> @@ -31,7 +31,7 @@
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #include "base/common.h"
> diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
> index 5d91355c9a..5b13cb5c94 100644
> --- a/drivers/net/cxgbe/sge.c
> +++ b/drivers/net/cxgbe/sge.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "base/common.h"
>  #include "base/t4_regs.h"
> diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> index 9509f6e8a3..4d33b51fea 100644
> --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <dpaa2_pmd_logs.h>
>  #include <dpaa2_hw_pvt.h>
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c
> b/drivers/net/dpaa2/dpaa2_ethdev.c
> index f876f4790c..37a8b43114 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -15,7 +15,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_flow_driver.h>
>  #include "rte_dpaa2_mempool.h"
> diff --git a/drivers/net/dpaa2/dpaa2_recycle.c
> b/drivers/net/dpaa2/dpaa2_recycle.c
> index 932570c6e0..fbfdf360d1 100644
> --- a/drivers/net/dpaa2/dpaa2_recycle.c
> +++ b/drivers/net/dpaa2/dpaa2_recycle.c
> @@ -14,7 +14,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_fslmc_driver.h>
>  #include <rte_flow_driver.h>
> 
> diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
> index 7b9c528d13..9436a95ac8 100644
> --- a/drivers/net/dpaa2/dpaa2_rxtx.c
> +++ b/drivers/net/dpaa2/dpaa2_rxtx.c
> @@ -13,7 +13,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hexdump.h>
> 
>  #include <bus_fslmc_driver.h>
> diff --git a/drivers/net/dpaa2/dpaa2_sparser.c
> b/drivers/net/dpaa2/dpaa2_sparser.c
> index ba0d500f74..63463c4fbf 100644
> --- a/drivers/net/dpaa2/dpaa2_sparser.c
> +++ b/drivers/net/dpaa2/dpaa2_sparser.c
> @@ -7,7 +7,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <fslmc_logs.h>
>  #include <fslmc_vfio.h>
> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
> index 409de50083..8ee9be12ad 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -20,7 +20,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "e1000_logs.h"
>  #include "base/e1000_api.h"
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index 43979992d3..d6bcc5bf58 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -22,7 +22,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "e1000_logs.h"
>  #include "base/e1000_api.h"
> diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
> index e46697b6a1..b775310651 100644
> --- a/drivers/net/e1000/igb_flow.c
> +++ b/drivers/net/e1000/igb_flow.c
> @@ -21,7 +21,7 @@
>  #include <rte_eal.h>
>  #include <rte_atomic.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_flow.h>
>  #include <rte_flow_driver.h>
> 
> diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
> index 4709675af8..4d27fba585 100644
> --- a/drivers/net/ena/ena_ethdev.h
> +++ b/drivers/net/ena/ena_ethdev.h
> @@ -14,7 +14,7 @@
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <rte_timer.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_net.h>
> 
>  #include "ena_com.h"
> diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
> index 998436e5e8..cdf0915591 100644
> --- a/drivers/net/enic/enic_ethdev.c
> +++ b/drivers/net/enic/enic_ethdev.c
> @@ -6,7 +6,7 @@
>  #include <stdio.h>
>  #include <stdint.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_pci.h>
>  #include <bus_pci_driver.h>
>  #include <ethdev_driver.h>
> diff --git a/drivers/net/enic/enic_vf_representor.c
> b/drivers/net/enic/enic_vf_representor.c
> index 7312c411bd..46f85964e9 100644
> --- a/drivers/net/enic/enic_vf_representor.c
> +++ b/drivers/net/enic/enic_vf_representor.c
> @@ -7,7 +7,7 @@
> 
>  #include <bus_pci_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_flow_driver.h>
> diff --git a/drivers/net/failsafe/failsafe_private.h
> b/drivers/net/failsafe/failsafe_private.h
> index a80f5e2caf..53a451c1b1 100644
> --- a/drivers/net/failsafe/failsafe_private.h
> +++ b/drivers/net/failsafe/failsafe_private.h
> @@ -11,7 +11,7 @@
>  #include <pthread.h>
> 
>  #include <rte_atomic.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_flow.h>
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> b/drivers/net/fm10k/fm10k_ethdev.c
> index 8bbd8b445d..7adb20bff9 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -7,7 +7,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
>  #include <rte_string_fns.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_spinlock.h>
>  #include <rte_kvargs.h>
>  #include <rte_vect.h>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 7bdc453ec1..67111ac251 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -23,7 +23,7 @@
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
>  #include <rte_alarm.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_tailq.h>
>  #include <rte_hash_crc.h>
>  #include <rte_bitmap.h>
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 506fcff6e3..ef2ab06475 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -24,7 +24,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "iavf.h"
>  #include "iavf_rxtx.h"
> diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
> index 21bd1e2193..15f695682d 100644
> --- a/drivers/net/iavf/iavf_vchnl.c
> +++ b/drivers/net/iavf/iavf_vchnl.c
> @@ -19,7 +19,7 @@
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "iavf.h"
>  #include "iavf_rxtx.h"
> diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
> index 885d58c0f4..1c3d22ae0f 100644
> --- a/drivers/net/ice/ice_dcf.c
> +++ b/drivers/net/ice/ice_dcf.c
> @@ -21,7 +21,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "ice_dcf.h"
>  #include "ice_rxtx.h"
> diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
> index 0da267db1f..dee712af98 100644
> --- a/drivers/net/ice/ice_dcf_ethdev.c
> +++ b/drivers/net/ice/ice_dcf_ethdev.c
> @@ -18,7 +18,7 @@
>  #include <rte_kvargs.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <iavf_devids.h>
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 552e41692c..04c9ce78a2 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hash_crc.h>
>  #ifdef RTE_LIB_SECURITY
>  #include <rte_security_driver.h>
> diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
> index 368342872a..67373a7b78 100644
> --- a/drivers/net/ixgbe/ixgbe_flow.c
> +++ b/drivers/net/ixgbe/ixgbe_flow.c
> @@ -27,7 +27,7 @@
>  #include <ethdev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_random.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_hash_crc.h>
>  #include <rte_flow.h>
>  #include <rte_flow_driver.h>
> diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
> index 910b76a92c..7e7e1824ef 100644
> --- a/drivers/net/mlx4/mlx4.c
> +++ b/drivers/net/mlx4/mlx4.c
> @@ -31,7 +31,7 @@
>  #endif
> 
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
> index ccc06bdda6..d0bbc0a4c0 100644
> --- a/drivers/net/netvsc/hn_ethdev.c
> +++ b/drivers/net/netvsc/hn_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <rte_errno.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_driver.h>
>  #include <bus_vmbus_driver.h>
>  #include <rte_alarm.h>
> diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
> index 817fb06dfb..7db82af9f3 100644
> --- a/drivers/net/netvsc/hn_nvs.c
> +++ b/drivers/net/netvsc/hn_nvs.c
> @@ -28,7 +28,7 @@
>  #include <rte_cycles.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_vmbus_driver.h>
> 
>  #include "hn_logs.h"
> diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
> index 20f75a17b0..e6f1f28768 100644
> --- a/drivers/net/netvsc/hn_rndis.c
> +++ b/drivers/net/netvsc/hn_rndis.c
> @@ -26,7 +26,7 @@
>  #include <rte_cycles.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <bus_vmbus_driver.h>
> 
>  #include "hn_logs.h"
> diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
> index 61cf374224..bc6f60c64a 100644
> --- a/drivers/net/netvsc/hn_rxtx.c
> +++ b/drivers/net/netvsc/hn_rxtx.c
> @@ -25,7 +25,7 @@
>  #include <rte_errno.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_net.h>
>  #include <bus_vmbus_driver.h>
>  #include <rte_spinlock.h>
> diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
> index 0e55f0c792..eaafe11fb9 100644
> --- a/drivers/net/nfp/nfp_common.c
> +++ b/drivers/net/nfp/nfp_common.c
> @@ -19,7 +19,7 @@
>  #include <rte_debug.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ether.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
> index 5cdd34e588..47359501bc 100644
> --- a/drivers/net/nfp/nfp_ethdev.c
> +++ b/drivers/net/nfp/nfp_ethdev.c
> @@ -16,7 +16,7 @@
>  #include <rte_common.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ether.h>
>  #include <rte_malloc.h>
>  #include <rte_memzone.h>
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c
> b/drivers/net/octeontx/octeontx_ethdev.c
> index 9ada22e2ff..0eee191566 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -15,7 +15,7 @@
>  #include <bus_vdev_driver.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_kvargs.h>
>  #include <rte_malloc.h>
> diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
> index a38b701183..b781bcdcfd 100644
> --- a/drivers/net/qede/qede_ethdev.h
> +++ b/drivers/net/qede/qede_ethdev.h
> @@ -13,7 +13,7 @@
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_ip.h>
> 
>  /* ecore includes */
> diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
> index 506c62a726..2ec743ebce 100644
> --- a/drivers/net/sfc/sfc_ethdev.c
> +++ b/drivers/net/sfc/sfc_ethdev.c
> @@ -7,7 +7,7 @@
>   * for Solarflare) and Solarflare Communications, Inc.
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <ethdev_driver.h>
>  #include <ethdev_pci.h>
>  #include <rte_pci.h>
> diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
> index 81f5aa3cc4..3ae5023b6f 100644
> --- a/drivers/net/sfc/sfc_sw_stats.c
> +++ b/drivers/net/sfc/sfc_sw_stats.c
> @@ -2,7 +2,7 @@
>   *
>   * Copyright(c) 2021 Xilinx, Inc.
>   */
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_bitmap.h>
> 
>  #include "sfc.h"
> diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
> index 1abded8018..d9738e5214 100644
> --- a/drivers/net/sfc/sfc_sw_stats.h
> +++ b/drivers/net/sfc/sfc_sw_stats.h
> @@ -5,7 +5,7 @@
>  #ifndef _SFC_SW_STATS_H
>  #define _SFC_SW_STATS_H
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "sfc.h"
> 
> diff --git a/drivers/net/thunderx/nicvf_ethdev.c
> b/drivers/net/thunderx/nicvf_ethdev.c
> index 28183ec740..9f57cb1a20 100644
> --- a/drivers/net/thunderx/nicvf_ethdev.c
> +++ b/drivers/net/thunderx/nicvf_ethdev.c
> @@ -20,7 +20,7 @@
>  #include <rte_common.h>
>  #include <rte_cycles.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_ether.h>
>  #include <ethdev_driver.h>
> diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c
> b/drivers/net/vdev_netvsc/vdev_netvsc.c
> index dc90569df1..c3e045d892 100644
> --- a/drivers/net/vdev_netvsc/vdev_netvsc.c
> +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
> @@ -27,7 +27,7 @@
>  #include <bus_driver.h>
>  #include <bus_vdev_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_ethdev.h>
>  #include <rte_ether.h>
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index d180162abd..edf3becd32 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -24,7 +24,7 @@
>  #include <rte_memory.h>
>  #include <rte_eal_paging.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_cycles.h>
>  #include <rte_kvargs.h>
> 
> diff --git a/drivers/net/virtio/virtio_pci_ethdev.c
> b/drivers/net/virtio/virtio_pci_ethdev.c
> index 2b9e35cef5..abc63b0935 100644
> --- a/drivers/net/virtio/virtio_pci_ethdev.c
> +++ b/drivers/net/virtio/virtio_pci_ethdev.c
> @@ -16,7 +16,7 @@
> 
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_kvargs.h>
> 
>  #include "virtio.h"
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> index 101b1cb500..fd946dec5c 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> @@ -30,7 +30,7 @@
>  #include <ethdev_pci.h>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "base/vmxnet3_defs.h"
> 
> diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c
> b/drivers/raw/cnxk_bphy/cnxk_bphy.c
> index db029cbf34..909fb8faab 100644
> --- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
> +++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
> @@ -3,7 +3,7 @@
>   */
>  #include <bus_pci_driver.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_lcore.h>
>  #include <rte_pci.h>
> diff --git a/drivers/raw/skeleton/skeleton_rawdev.c
> b/drivers/raw/skeleton/skeleton_rawdev.c
> index 6831cc8d20..5dd5bbb652 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev.c
> @@ -13,7 +13,7 @@
>  #include <rte_byteorder.h>
>  #include <rte_common.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_kvargs.h>
>  #include <rte_log.h>
> diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c
> b/drivers/raw/skeleton/skeleton_rawdev_test.c
> index fc257c5f44..8ef7a6b127 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev_test.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
> @@ -6,7 +6,7 @@
>  #include <rte_mbuf.h>
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_rawdev.h>
>  #include <bus_vdev_driver.h>
>  #include <rte_test.h>
> diff --git a/drivers/regex/mlx5/mlx5_regex_control.c
> b/drivers/regex/mlx5/mlx5_regex_control.c
> index 6ab62a12fc..92cf5f495e 100644
> --- a/drivers/regex/mlx5/mlx5_regex_control.c
> +++ b/drivers/regex/mlx5/mlx5_regex_control.c
> @@ -11,7 +11,7 @@
>  #include <rte_regexdev.h>
>  #include <rte_regexdev_core.h>
>  #include <rte_regexdev_driver.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include <mlx5_common.h>
>  #include <mlx5_glue.h>
> diff --git a/lib/compressdev/rte_compressdev.c
> b/lib/compressdev/rte_compressdev.c
> index e997bd01ed..cf2c20a704 100644
> --- a/lib/compressdev/rte_compressdev.c
> +++ b/lib/compressdev/rte_compressdev.c
> @@ -8,7 +8,7 @@
> 
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
>  #include <rte_memzone.h>
> 
> diff --git a/lib/compressdev/rte_compressdev_pmd.c
> b/lib/compressdev/rte_compressdev_pmd.c
> index 9bfae077db..41f1415bea 100644
> --- a/lib/compressdev/rte_compressdev_pmd.c
> +++ b/lib/compressdev/rte_compressdev_pmd.c
> @@ -5,7 +5,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
>  #include <rte_kvargs.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_eal.h>
> 
>  #include "rte_compressdev_internal.h"
> diff --git a/lib/compressdev/rte_compressdev_pmd.h
> b/lib/compressdev/rte_compressdev_pmd.h
> index 9fabc399c5..72e52f876f 100644
> --- a/lib/compressdev/rte_compressdev_pmd.h
> +++ b/lib/compressdev/rte_compressdev_pmd.h
> @@ -19,6 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> +#include <dev_driver.h>
> 
>  #include "rte_compressdev.h"
>  #include "rte_compressdev_internal.h"
> diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
> index 75d0075b86..f07b92dfd7 100644
> --- a/lib/cryptodev/cryptodev_pmd.c
> +++ b/lib/cryptodev/cryptodev_pmd.c
> @@ -4,7 +4,7 @@
> 
>  #include <sys/queue.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
> index 3dcc3cb7ed..96d7e225b0 100644
> --- a/lib/cryptodev/cryptodev_pmd.h
> +++ b/lib/cryptodev/cryptodev_pmd.h
> @@ -19,6 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_log.h>
>  #include <rte_common.h>
> diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
> index 6250302f3b..29c9c55131 100644
> --- a/lib/cryptodev/rte_cryptodev.c
> +++ b/lib/cryptodev/rte_cryptodev.c
> @@ -13,7 +13,7 @@
> 
>  #include <rte_log.h>
>  #include <rte_debug.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memory.h>
>  #include <rte_memcpy.h>
>  #include <rte_memzone.h>
> diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
> index 82ab7a8cc7..acd7f71cd1 100644
> --- a/lib/dmadev/rte_dmadev_pmd.h
> +++ b/lib/dmadev/rte_dmadev_pmd.h
> @@ -14,7 +14,7 @@
>   * by any application.
>   */
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_dmadev.h"
> 
> diff --git a/lib/eal/common/eal_common_dev.c
> b/lib/eal/common/eal_common_dev.c
> index 16c5aef1d8..98f3c78795 100644
> --- a/lib/eal/common/eal_common_dev.c
> +++ b/lib/eal/common/eal_common_dev.c
> @@ -9,7 +9,7 @@
> 
>  #include <bus_driver.h>
>  #include <rte_class.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_devargs.h>
>  #include <rte_errno.h>
>  #include <rte_log.h>
> diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
> new file mode 100644
> index 0000000000..015188abd5
> --- /dev/null
> +++ b/lib/eal/include/dev_driver.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (c) 2022 Red Hat, Inc.
> + */
> +
> +#ifndef DEV_DRIVER_H
> +#define DEV_DRIVER_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +#include <rte_dev.h>
> +
> +/**
> + * A structure describing a device driver.
> + */
> +struct rte_driver {
> +	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
> +	const char *name;                   /**< Driver name. */
> +	const char *alias;              /**< Driver alias. */
> +};
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* DEV_DRIVER_H */
> diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
> index 77d8621a51..cfcd40aaed 100644
> --- a/lib/eal/include/meson.build
> +++ b/lib/eal/include/meson.build
> @@ -57,6 +57,7 @@ headers += files(
> 
>  driver_sdk_headers = files(
>          'bus_driver.h',
> +        'dev_driver.h',
>  )
> 
>  # special case install the generic headers, since they go in a subdir
> diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
> index ddea163cca..7214f5d7fb 100644
> --- a/lib/eal/include/rte_dev.h
> +++ b/lib/eal/include/rte_dev.h
> @@ -24,6 +24,8 @@ extern "C" {
>  #include <rte_compat.h>
>  #include <rte_log.h>
> 
> +struct rte_driver;
> +
>  /**
>   * The device event type.
>   */
> @@ -67,27 +69,14 @@ struct rte_mem_resource {
>  	void *addr;         /**< Virtual address, NULL when not mapped. */
>  };
> 
> -/**
> - * A structure describing a device driver.
> - */
> -struct rte_driver {
> -	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
> -	const char *name;                   /**< Driver name. */
> -	const char *alias;              /**< Driver alias. */
> -};
> -
>  /**
>   * Retrieve a driver name.
>   *
> - * @warning
> - * @b EXPERIMENTAL: this API may change without prior notice
> - *
>   * @param driver
>   *   A pointer to a driver structure.
>   * @return
>   *   A pointer to the driver name string.
>   */
> -__rte_experimental
>  const char *
>  rte_driver_name(const struct rte_driver *driver);
> 
> diff --git a/lib/eal/version.map b/lib/eal/version.map
> index d10fd89458..8b53a1d258 100644
> --- a/lib/eal/version.map
> +++ b/lib/eal/version.map
> @@ -37,6 +37,7 @@ DPDK_23 {
>  	rte_devargs_parsef;
>  	rte_devargs_remove;
>  	rte_devargs_type_count;
> +	rte_driver_name;
>  	rte_dump_physmem_layout;
>  	rte_dump_stack;
>  	rte_dump_tailq;
> @@ -423,9 +424,6 @@ EXPERIMENTAL {
>  	rte_thread_self;
>  	rte_thread_set_affinity_by_id;
>  	rte_thread_set_priority;
> -
> -	# added in 22.11
> -	rte_driver_name;
>  };
> 
>  INTERNAL {
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 5101868ea7..47a55a419e 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -19,6 +19,7 @@ extern "C" {
>   *
>   */
> 
> +#include <dev_driver.h>
>  #include <rte_ethdev.h>
> 
>  /**
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index 69402668d8..def6cd0876 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -22,7 +22,7 @@ extern "C" {
>  #include <rte_common.h>
>  #include <rte_compat.h>
>  #include <rte_config.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_log.h>
>  #include <rte_malloc.h>
>  #include <rte_mbuf.h>
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> b/lib/eventdev/rte_event_crypto_adapter.c
> index 4938b4ee07..a8ef5bac06 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -6,7 +6,7 @@
>  #include <string.h>
>  #include <stdbool.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_cryptodev.h>
>  #include <cryptodev_pmd.h>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> b/lib/eventdev/rte_event_eth_rx_adapter.c
> index 8e81cf774d..29515401bd 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -9,7 +9,7 @@
> 
>  #include <rte_cycles.h>
>  #include <rte_common.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <ethdev_driver.h>
>  #include <rte_log.h>
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 79b905e9fc..bbb027aa0c 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -12,7 +12,7 @@
> 
>  #include <rte_string_fns.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_memzone.h>
>  #include <rte_eal.h>
>  #include <rte_common.h>
> diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
> index 0e55b00bfe..23972b3dbd 100644
> --- a/lib/gpudev/gpudev_driver.h
> +++ b/lib/gpudev/gpudev_driver.h
> @@ -14,7 +14,7 @@
>  #include <stdint.h>
>  #include <sys/queue.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_gpudev.h"
> 
> diff --git a/lib/mempool/rte_mempool_ops.c
> b/lib/mempool/rte_mempool_ops.c
> index ac32c4bb72..3b43edc548 100644
> --- a/lib/mempool/rte_mempool_ops.c
> +++ b/lib/mempool/rte_mempool_ops.c
> @@ -9,7 +9,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_mempool.h>
>  #include <rte_errno.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
> 
>  #include "rte_mempool_trace.h"
> 
> diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
> index 72aabd4dd0..af2b814251 100644
> --- a/lib/pcapng/rte_pcapng.c
> +++ b/lib/pcapng/rte_pcapng.c
> @@ -14,7 +14,7 @@
>  #include <bus_driver.h>
>  #include <rte_common.h>
>  #include <rte_cycles.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_errno.h>
>  #include <rte_ethdev.h>
>  #include <rte_ether.h>
> diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
> index e157d65332..569e836560 100644
> --- a/lib/rawdev/rte_rawdev.c
> +++ b/lib/rawdev/rte_rawdev.c
> @@ -12,7 +12,7 @@
> 
>  #include <rte_string_fns.h>
>  #include <rte_log.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_common.h>
>  #include <rte_malloc.h>
>  #include <rte_telemetry.h>
> diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
> index 3b7be57d3e..a51944c8ff 100644
> --- a/lib/rawdev/rte_rawdev_pmd.h
> +++ b/lib/rawdev/rte_rawdev_pmd.h
> @@ -19,7 +19,7 @@ extern "C" {
> 
>  #include <string.h>
> 
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_malloc.h>
>  #include <rte_log.h>
>  #include <rte_common.h>
> diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
> index 1a2a408f0e..94160f4177 100644
> --- a/lib/security/rte_security.c
> +++ b/lib/security/rte_security.c
> @@ -5,7 +5,7 @@
>   */
> 
>  #include <rte_cryptodev.h>
> -#include <rte_dev.h>
> +#include <dev_driver.h>
>  #include <rte_telemetry.h>
>  #include "rte_security.h"
>  #include "rte_security_driver.h"
> --
> 2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-09-05  8:35   ` [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
@ 2022-09-06  8:24     ` Jayatheerthan, Jay
  0 siblings, 0 replies; 231+ messages in thread
From: Jayatheerthan, Jay @ 2022-09-06  8:24 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, Richardson, Bruce, Ray Kinsella, Zhang, Roy Fan,
	Ashish Gupta, Yang, Qiming, Wu, Wenjun1, Shijith Thotton,
	Srisivasubramanian Srinivasan, Xu, Rosen, Zhang, Tianfei,
	Sachin Saxena, Hemant Agrawal, Akhil Goyal, Chengwen Feng, Laatz,
	Kevin, Ferruh Yigit, Andrew Rybchenko, Gujjar, Abhinandan S,
	Jerin Jacob, Matz, Olivier, Ori Kam, Maxime Coquelin, Xia,
	Chenbo

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, September 5, 2022 2:05 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; Richardson, Bruce <bruce.richardson@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; Ashish Gupta <ashish.gupta@marvell.com>; Yang, Qiming <qiming.yang@intel.com>; Wu, Wenjun1
> <wenjun1.wu@intel.com>; Shijith Thotton <sthotton@marvell.com>; Srisivasubramanian Srinivasan <srinivasan@marvell.com>; Xu,
> Rosen <rosen.xu@intel.com>; Zhang, Tianfei <tianfei.zhang@intel.com>; Sachin Saxena <sachin.saxena@oss.nxp.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Akhil Goyal <gakhil@marvell.com>; Chengwen Feng <fengchengwen@huawei.com>; Laatz, Kevin
> <kevin.laatz@intel.com>; Ferruh Yigit <ferruh.yigit@xilinx.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>;
> Matz, Olivier <olivier.matz@6wind.com>; Ori Kam <orika@nvidia.com>; Maxime Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo
> <chenbo.xia@intel.com>
> Subject: [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros
> 
> Those macros have no real value and are easily replaced with a simple
> if() block.
> 
> Existing users have been converted using a new cocci script.
> Deprecate them.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  devtools/cocci/func_or_ret.cocci              |  12 +
>  doc/guides/rel_notes/deprecation.rst          |   4 +
>  doc/guides/rel_notes/release_22_11.rst        |   4 +
>  drivers/common/qat/qat_device.c               |   8 +-
>  drivers/common/qat/qat_qp.c                   |  31 +-
>  drivers/compress/qat/qat_comp_pmd.c           |   4 +-
>  .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
>  drivers/crypto/scheduler/scheduler_pmd_ops.c  |   6 +-
>  drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
>  drivers/net/liquidio/lio_ethdev.c             |   3 +-
>  drivers/raw/ifpga/ifpga_rawdev.c              |   6 +-
>  drivers/raw/skeleton/skeleton_rawdev.c        |  21 +-
>  lib/compressdev/rte_compressdev.c             |  47 +--
>  lib/cryptodev/rte_cryptodev.c                 |  43 ++-
>  lib/dmadev/rte_dmadev.c                       |  21 +-
>  lib/dmadev/rte_dmadev.h                       |  21 +-
>  lib/eal/include/rte_dev.h                     |   7 +-
>  lib/ethdev/ethdev_driver.c                    |  18 +-
>  lib/ethdev/ethdev_pci.h                       |   3 +-
>  lib/ethdev/rte_ethdev.c                       | 276 ++++++++++++------
>  lib/ethdev/rte_ethdev.h                       |   9 +-
>  lib/eventdev/rte_event_crypto_adapter.c       |  10 +-
>  lib/eventdev/rte_event_eth_rx_adapter.c       |  13 +-

Looks good to me.

Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

>  lib/eventdev/rte_eventdev.c                   |  62 ++--
>  lib/mempool/rte_mempool_ops.c                 |   3 +-
>  lib/rawdev/rte_rawdev.c                       |  75 +++--
>  lib/regexdev/rte_regexdev.c                   |  59 ++--
>  lib/regexdev/rte_regexdev.h                   |   6 +-
>  lib/security/rte_security.c                   |   6 +-
>  lib/vhost/vdpa.c                              |   9 +-
>  lib/vhost/vhost_user.c                        |   6 +-
>  31 files changed, 517 insertions(+), 285 deletions(-)
>  create mode 100644 devtools/cocci/func_or_ret.cocci
> 
> diff --git a/devtools/cocci/func_or_ret.cocci b/devtools/cocci/func_or_ret.cocci
> new file mode 100644
> index 0000000000..f23d60cc4e
> --- /dev/null
> +++ b/devtools/cocci/func_or_ret.cocci
> @@ -0,0 +1,12 @@
> +@@
> +expression cond, ret;
> +@@
> +-RTE_FUNC_PTR_OR_ERR_RET(cond, ret);
> ++if (cond == NULL)
> ++	return ret;
> +@@
> +expression cond;
> +@@
> +-RTE_FUNC_PTR_OR_RET(cond);
> ++if (cond == NULL)
> ++	return;
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index dba252067c..5b4ffc992d 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -14,6 +14,10 @@ Deprecation Notices
>  * kvargs: The function ``rte_kvargs_process`` will get a new parameter
>    for returning key match count. It will ease handling of no-match case.
> 
> +* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
> +  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
> +  to update their code.
> +
>  * eal: The function ``rte_eal_remote_launch`` will return new error codes
>    after read or write error on the pipe, instead of calling ``rte_panic``.
> 
> diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
> index 3cea3aa8eb..225a380de0 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -84,6 +84,10 @@ API Changes
>     Also, make sure to start the actual text at the margin.
>     =======================================================
> 
> +* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
> +  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
> +  to update their code.
> +
>  * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
> 
> 
> diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
> index db4b087d2b..30e5cdb573 100644
> --- a/drivers/common/qat/qat_device.c
> +++ b/drivers/common/qat/qat_device.c
> @@ -58,8 +58,8 @@ qat_pci_get_extra_size(enum qat_device_gen qat_dev_gen)
>  {
>  	struct qat_dev_hw_spec_funcs *ops_hw =
>  		qat_dev_hw_spec[qat_dev_gen];
> -	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_get_extra_size,
> -		-ENOTSUP);
> +	if (ops_hw->qat_dev_get_extra_size == NULL)
> +		return -ENOTSUP;
>  	return ops_hw->qat_dev_get_extra_size();
>  }
> 
> @@ -381,8 +381,8 @@ static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  		return -ENODEV;
> 
>  	ops_hw = qat_dev_hw_spec[qat_pci_dev->qat_dev_gen];
> -	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_reset_ring_pairs,
> -		-ENOTSUP);
> +	if (ops_hw->qat_dev_reset_ring_pairs == NULL)
> +		return -ENOTSUP;
>  	if (ops_hw->qat_dev_reset_ring_pairs(qat_pci_dev)) {
>  		QAT_LOG(ERR,
>  			"Cannot reset ring pairs, does pf driver supports pf2vf comms?"
> diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
> index 08ac91eac4..8674eccdca 100644
> --- a/drivers/common/qat/qat_qp.c
> +++ b/drivers/common/qat/qat_qp.c
> @@ -370,8 +370,8 @@ adf_queue_arb_enable(struct qat_pci_device *qat_dev, struct qat_queue *txq,
>  	struct qat_qp_hw_spec_funcs *ops =
>  		qat_qp_hw_spec[qat_dev->qat_dev_gen];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_enable,
> -			-ENOTSUP);
> +	if (ops->qat_qp_adf_arb_enable == NULL)
> +		return -ENOTSUP;
>  	ops->qat_qp_adf_arb_enable(txq, base_addr, lock);
>  	return 0;
>  }
> @@ -383,8 +383,8 @@ adf_queue_arb_disable(enum qat_device_gen qat_dev_gen, struct qat_queue *txq,
>  	struct qat_qp_hw_spec_funcs *ops =
>  		qat_qp_hw_spec[qat_dev_gen];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_disable,
> -			-ENOTSUP);
> +	if (ops->qat_qp_adf_arb_disable == NULL)
> +		return -ENOTSUP;
>  	ops->qat_qp_adf_arb_disable(txq, base_addr, lock);
>  	return 0;
>  }
> @@ -396,8 +396,8 @@ qat_qp_build_ring_base(struct qat_pci_device *qat_dev, void *io_addr,
>  	struct qat_qp_hw_spec_funcs *ops =
>  		qat_qp_hw_spec[qat_dev->qat_dev_gen];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_build_ring_base,
> -			-ENOTSUP);
> +	if (ops->qat_qp_build_ring_base == NULL)
> +		return -ENOTSUP;
>  	ops->qat_qp_build_ring_base(io_addr, queue);
>  	return 0;
>  }
> @@ -409,8 +409,8 @@ qat_qps_per_service(struct qat_pci_device *qat_dev,
>  	struct qat_qp_hw_spec_funcs *ops =
>  		qat_qp_hw_spec[qat_dev->qat_dev_gen];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_rings_per_service,
> -			-ENOTSUP);
> +	if (ops->qat_qp_rings_per_service == NULL)
> +		return -ENOTSUP;
>  	return ops->qat_qp_rings_per_service(qat_dev, service);
>  }
> 
> @@ -421,7 +421,8 @@ qat_qp_get_hw_data(struct qat_pci_device *qat_dev,
>  	struct qat_qp_hw_spec_funcs *ops =
>  		qat_qp_hw_spec[qat_dev->qat_dev_gen];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_get_hw_data, NULL);
> +	if (ops->qat_qp_get_hw_data == NULL)
> +		return NULL;
>  	return ops->qat_qp_get_hw_data(qat_dev, service, qp_id);
>  }
> 
> @@ -431,8 +432,8 @@ qat_read_qp_config(struct qat_pci_device *qat_dev)
>  	struct qat_dev_hw_spec_funcs *ops_hw =
>  		qat_dev_hw_spec[qat_dev->qat_dev_gen];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_read_config,
> -			-ENOTSUP);
> +	if (ops_hw->qat_dev_read_config == NULL)
> +		return -ENOTSUP;
>  	return ops_hw->qat_dev_read_config(qat_dev);
>  }
> 
> @@ -442,8 +443,8 @@ adf_configure_queues(struct qat_qp *qp, enum qat_device_gen qat_dev_gen)
>  	struct qat_qp_hw_spec_funcs *ops =
>  		qat_qp_hw_spec[qat_dev_gen];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_configure_queues,
> -			-ENOTSUP);
> +	if (ops->qat_qp_adf_configure_queues == NULL)
> +		return -ENOTSUP;
>  	ops->qat_qp_adf_configure_queues(qp);
>  	return 0;
>  }
> @@ -483,8 +484,8 @@ qat_qp_csr_setup(struct qat_pci_device *qat_dev,
>  	struct qat_qp_hw_spec_funcs *ops =
>  		qat_qp_hw_spec[qat_dev->qat_dev_gen];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_csr_setup,
> -			-ENOTSUP);
> +	if (ops->qat_qp_csr_setup == NULL)
> +		return -ENOTSUP;
>  	ops->qat_qp_csr_setup(qat_dev, io_addr, qp);
>  	return 0;
>  }
> diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
> index dc8db84a68..6fb8cf69be 100644
> --- a/drivers/compress/qat/qat_comp_pmd.c
> +++ b/drivers/compress/qat/qat_comp_pmd.c
> @@ -25,8 +25,8 @@ qat_comp_capabilities_info qat_comp_get_capa_info(
> 
>  	if (qat_dev_gen >= QAT_N_GENS)
>  		return ret;
> -	RTE_FUNC_PTR_OR_ERR_RET(qat_comp_gen_dev_ops[qat_dev_gen]
> -			.qat_comp_get_capabilities, ret);
> +	if (qat_comp_gen_dev_ops[qat_dev_gen].qat_comp_get_capabilities == NULL)
> +		return ret;
>  	return qat_comp_gen_dev_ops[qat_dev_gen]
>  			.qat_comp_get_capabilities(qat_dev);
>  }
> diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
> index 1e0c4fe464..258d6f8c43 100644
> --- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
> +++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
> @@ -541,7 +541,8 @@ rte_cryptodev_scheduler_option_set(uint8_t scheduler_id,
> 
>  	sched_ctx = dev->data->dev_private;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_set, -ENOTSUP);
> +	if (*sched_ctx->ops.option_set == NULL)
> +		return -ENOTSUP;
> 
>  	return (*sched_ctx->ops.option_set)(dev, option_type, option);
>  }
> @@ -571,7 +572,8 @@ rte_cryptodev_scheduler_option_get(uint8_t scheduler_id,
> 
>  	sched_ctx = dev->data->dev_private;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_get, -ENOTSUP);
> +	if (*sched_ctx->ops.option_get == NULL)
> +		return -ENOTSUP;
> 
>  	return (*sched_ctx->ops.option_get)(dev, option_type, option);
>  }
> diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> index f3a1bd626c..83ae6b6be9 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> @@ -160,7 +160,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
>  		return -1;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.worker_attach, -ENOTSUP);
> +	if (*sched_ctx->ops.worker_attach == NULL)
> +		return -ENOTSUP;
> 
>  	for (i = 0; i < sched_ctx->nb_workers; i++) {
>  		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
> @@ -171,7 +172,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
>  		}
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.scheduler_start, -ENOTSUP);
> +	if (*sched_ctx->ops.scheduler_start == NULL)
> +		return -ENOTSUP;
> 
>  	if ((*sched_ctx->ops.scheduler_start)(dev) < 0) {
>  		CR_SCHED_LOG(ERR, "Scheduler start failed");
> diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
> index 9729f8575f..89fe3a828a 100644
> --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
> +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
> @@ -291,7 +291,8 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
>  	if (on > 1)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
> +	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
> +		return -ENOTSUP;
> 
>  	/* The PF has 128 queue pairs and in SRIOV configuration
>  	 * those queues will be assigned to VF's, so RXDCTL
> diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
> index 90ffe31b9f..ebcfbb1a5c 100644
> --- a/drivers/net/liquidio/lio_ethdev.c
> +++ b/drivers/net/liquidio/lio_ethdev.c
> @@ -281,7 +281,8 @@ lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
>  	}
> 
>  	/* clear stored per queue stats */
> -	RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
> +	if (*eth_dev->dev_ops->stats_reset == NULL)
> +		return 0;
>  	return (*eth_dev->dev_ops->stats_reset)(eth_dev);
>  }
> 
> diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
> index 78a7123528..3b616c45ff 100644
> --- a/drivers/raw/ifpga/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga/ifpga_rawdev.c
> @@ -713,7 +713,8 @@ ifpga_rawdev_configure(const struct rte_rawdev *dev,
>  {
>  	IFPGA_RAWDEV_PMD_FUNC_TRACE();
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	return config ? 0 : 1;
>  }
> @@ -726,7 +727,8 @@ ifpga_rawdev_start(struct rte_rawdev *dev)
> 
>  	IFPGA_RAWDEV_PMD_FUNC_TRACE();
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	adapter = ifpga_rawdev_get_priv(dev);
>  	if (!adapter)
> diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
> index 16ecae3d92..72d3b69d75 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev.c
> @@ -76,7 +76,8 @@ static int skeleton_rawdev_configure(const struct rte_rawdev *dev,
> 
>  	SKELETON_PMD_FUNC_TRACE();
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	if (config == NULL || config_size != sizeof(*skeldev_conf)) {
>  		SKELETON_PMD_ERR("Invalid configuration");
> @@ -106,7 +107,8 @@ static int skeleton_rawdev_start(struct rte_rawdev *dev)
> 
>  	SKELETON_PMD_FUNC_TRACE();
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	skeldev = skeleton_rawdev_get_priv(dev);
> 
> @@ -169,7 +171,8 @@ static int skeleton_rawdev_close(struct rte_rawdev *dev)
> 
>  	SKELETON_PMD_FUNC_TRACE();
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	skeldev = skeleton_rawdev_get_priv(dev);
> 
> @@ -212,7 +215,8 @@ static int skeleton_rawdev_reset(struct rte_rawdev *dev)
> 
>  	SKELETON_PMD_FUNC_TRACE();
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	skeldev = skeleton_rawdev_get_priv(dev);
> 
> @@ -295,7 +299,8 @@ static int skeleton_rawdev_queue_release(struct rte_rawdev *dev,
> 
>  	SKELETON_PMD_FUNC_TRACE();
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	skeldev = skeleton_rawdev_get_priv(dev);
> 
> @@ -317,7 +322,8 @@ static uint16_t skeleton_rawdev_queue_count(struct rte_rawdev *dev)
> 
>  	SKELETON_PMD_FUNC_TRACE();
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	skeldev = skeleton_rawdev_get_priv(dev);
>  	return skeldev->num_queues;
> @@ -468,7 +474,8 @@ static int skeleton_rawdev_firmware_status_get(struct rte_rawdev *dev,
> 
>  	skeldev = skeleton_rawdev_get_priv(dev);
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
> +	if (dev == NULL)
> +		return -EINVAL;
> 
>  	if (status_info)
>  		memcpy(status_info, &skeldev->fw.firmware_state,
> diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
> index 22c438f2dd..5ddbc3f9c0 100644
> --- a/lib/compressdev/rte_compressdev.c
> +++ b/lib/compressdev/rte_compressdev.c
> @@ -315,7 +315,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
> 
>  	memset(&dev_info, 0, sizeof(struct rte_compressdev_info));
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
> +	if (*dev->dev_ops->dev_infos_get == NULL)
> +		return -ENOTSUP;
>  	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
> 
>  	if ((dev_info.max_nb_queue_pairs != 0) &&
> @@ -344,8 +345,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
> 
>  		qp = dev->data->queue_pairs;
> 
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
> -				-ENOTSUP);
> +		if (*dev->dev_ops->queue_pair_release == NULL)
> +			return -ENOTSUP;
> 
>  		for (i = nb_qpairs; i < old_nb_queues; i++) {
>  			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
> @@ -395,8 +396,8 @@ rte_compressdev_queue_pairs_release(struct rte_compressdev *dev)
>  	COMPRESSDEV_LOG(DEBUG, "Free %d queues pairs on device %u",
>  			dev->data->nb_queue_pairs, dev->data->dev_id);
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->queue_pair_release == NULL)
> +		return -ENOTSUP;
> 
>  	for (i = 0; i < num_qps; i++) {
>  		ret = (*dev->dev_ops->queue_pair_release)(dev, i);
> @@ -430,7 +431,8 @@ rte_compressdev_configure(uint8_t dev_id, struct rte_compressdev_config *config)
>  		return -EBUSY;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
> +	if (*dev->dev_ops->dev_configure == NULL)
> +		return -ENOTSUP;
> 
>  	/* Setup new number of queue pairs and reconfigure device. */
>  	diag = rte_compressdev_queue_pairs_config(dev, config->nb_queue_pairs,
> @@ -460,7 +462,8 @@ rte_compressdev_start(uint8_t dev_id)
> 
>  	dev = &rte_comp_devices[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
> +	if (*dev->dev_ops->dev_start == NULL)
> +		return -ENOTSUP;
> 
>  	if (dev->data->dev_started != 0) {
>  		COMPRESSDEV_LOG(ERR,
> @@ -489,7 +492,8 @@ rte_compressdev_stop(uint8_t dev_id)
> 
>  	dev = &rte_comp_devices[dev_id];
> 
> -	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
> +	if (*dev->dev_ops->dev_stop == NULL)
> +		return;
> 
>  	if (dev->data->dev_started == 0) {
>  		COMPRESSDEV_LOG(ERR,
> @@ -527,7 +531,8 @@ rte_compressdev_close(uint8_t dev_id)
>  	if (retval < 0)
>  		return retval;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
> +	if (*dev->dev_ops->dev_close == NULL)
> +		return -ENOTSUP;
>  	retval = (*dev->dev_ops->dev_close)(dev);
> 
>  	if (retval < 0)
> @@ -565,7 +570,8 @@ rte_compressdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
> +	if (*dev->dev_ops->queue_pair_setup == NULL)
> +		return -ENOTSUP;
> 
>  	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id,
>  			max_inflight_ops, socket_id);
> @@ -611,7 +617,8 @@ rte_compressdev_stats_get(uint8_t dev_id, struct rte_compressdev_stats *stats)
>  	dev = &rte_comp_devices[dev_id];
>  	memset(stats, 0, sizeof(*stats));
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
> +	if (*dev->dev_ops->stats_get == NULL)
> +		return -ENOTSUP;
>  	(*dev->dev_ops->stats_get)(dev, stats);
>  	return 0;
>  }
> @@ -628,7 +635,8 @@ rte_compressdev_stats_reset(uint8_t dev_id)
> 
>  	dev = &rte_comp_devices[dev_id];
> 
> -	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
> +	if (*dev->dev_ops->stats_reset == NULL)
> +		return;
>  	(*dev->dev_ops->stats_reset)(dev);
>  }
> 
> @@ -647,7 +655,8 @@ rte_compressdev_info_get(uint8_t dev_id, struct rte_compressdev_info *dev_info)
> 
>  	memset(dev_info, 0, sizeof(struct rte_compressdev_info));
> 
> -	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
> +	if (*dev->dev_ops->dev_infos_get == NULL)
> +		return;
>  	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
> 
>  	dev_info->driver_name = dev->device->driver->name;
> @@ -666,7 +675,8 @@ rte_compressdev_private_xform_create(uint8_t dev_id,
>  	if (xform == NULL || priv_xform == NULL || dev == NULL)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_create, -ENOTSUP);
> +	if (*dev->dev_ops->private_xform_create == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->private_xform_create)(dev, xform, priv_xform);
>  	if (ret < 0) {
>  		COMPRESSDEV_LOG(ERR,
> @@ -689,7 +699,8 @@ rte_compressdev_private_xform_free(uint8_t dev_id, void *priv_xform)
>  	if (dev == NULL || priv_xform == NULL)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_free, -ENOTSUP);
> +	if (*dev->dev_ops->private_xform_free == NULL)
> +		return -ENOTSUP;
>  	ret = dev->dev_ops->private_xform_free(dev, priv_xform);
>  	if (ret < 0) {
>  		COMPRESSDEV_LOG(ERR,
> @@ -714,7 +725,8 @@ rte_compressdev_stream_create(uint8_t dev_id,
>  	if (xform == NULL || dev == NULL || stream == NULL)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_create, -ENOTSUP);
> +	if (*dev->dev_ops->stream_create == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->stream_create)(dev, xform, stream);
>  	if (ret < 0) {
>  		COMPRESSDEV_LOG(ERR,
> @@ -738,7 +750,8 @@ rte_compressdev_stream_free(uint8_t dev_id, void *stream)
>  	if (dev == NULL || stream == NULL)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_free, -ENOTSUP);
> +	if (*dev->dev_ops->stream_free == NULL)
> +		return -ENOTSUP;
>  	ret = dev->dev_ops->stream_free(dev, stream);
>  	if (ret < 0) {
>  		COMPRESSDEV_LOG(ERR,
> diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
> index 42f3221052..6250302f3b 100644
> --- a/lib/cryptodev/rte_cryptodev.c
> +++ b/lib/cryptodev/rte_cryptodev.c
> @@ -978,7 +978,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
> 
>  	memset(&dev_info, 0, sizeof(struct rte_cryptodev_info));
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
> +	if (*dev->dev_ops->dev_infos_get == NULL)
> +		return -ENOTSUP;
>  	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
> 
>  	if (nb_qpairs > (dev_info.max_nb_queue_pairs)) {
> @@ -1007,8 +1008,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
> 
>  		qp = dev->data->queue_pairs;
> 
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
> -				-ENOTSUP);
> +		if (*dev->dev_ops->queue_pair_release == NULL)
> +			return -ENOTSUP;
> 
>  		for (i = nb_qpairs; i < old_nb_queues; i++) {
>  			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
> @@ -1041,7 +1042,8 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
>  		return -EBUSY;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
> +	if (*dev->dev_ops->dev_configure == NULL)
> +		return -ENOTSUP;
> 
>  	rte_spinlock_lock(&rte_cryptodev_callback_lock);
>  	cryptodev_cb_cleanup(dev);
> @@ -1083,7 +1085,8 @@ rte_cryptodev_start(uint8_t dev_id)
> 
>  	dev = &rte_crypto_devices[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
> +	if (*dev->dev_ops->dev_start == NULL)
> +		return -ENOTSUP;
> 
>  	if (dev->data->dev_started != 0) {
>  		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already started",
> @@ -1116,7 +1119,8 @@ rte_cryptodev_stop(uint8_t dev_id)
> 
>  	dev = &rte_crypto_devices[dev_id];
> 
> -	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
> +	if (*dev->dev_ops->dev_stop == NULL)
> +		return;
> 
>  	if (dev->data->dev_started == 0) {
>  		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already stopped",
> @@ -1163,7 +1167,8 @@ rte_cryptodev_close(uint8_t dev_id)
>  		}
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
> +	if (*dev->dev_ops->dev_close == NULL)
> +		return -ENOTSUP;
>  	retval = (*dev->dev_ops->dev_close)(dev);
>  	rte_cryptodev_trace_close(dev_id, retval);
> 
> @@ -1262,7 +1267,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
>  		return -EBUSY;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
> +	if (*dev->dev_ops->queue_pair_setup == NULL)
> +		return -ENOTSUP;
> 
>  	rte_cryptodev_trace_queue_pair_setup(dev_id, queue_pair_id, qp_conf);
>  	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
> @@ -1557,7 +1563,8 @@ rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
>  	dev = &rte_crypto_devices[dev_id];
>  	memset(stats, 0, sizeof(*stats));
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
> +	if (*dev->dev_ops->stats_get == NULL)
> +		return -ENOTSUP;
>  	(*dev->dev_ops->stats_get)(dev, stats);
>  	return 0;
>  }
> @@ -1574,7 +1581,8 @@ rte_cryptodev_stats_reset(uint8_t dev_id)
> 
>  	dev = &rte_crypto_devices[dev_id];
> 
> -	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
> +	if (*dev->dev_ops->stats_reset == NULL)
> +		return;
>  	(*dev->dev_ops->stats_reset)(dev);
>  }
> 
> @@ -1592,7 +1600,8 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
> 
>  	memset(dev_info, 0, sizeof(struct rte_cryptodev_info));
> 
> -	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
> +	if (*dev->dev_ops->dev_infos_get == NULL)
> +		return;
>  	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
> 
>  	dev_info->driver_name = dev->device->driver->name;
> @@ -1739,7 +1748,8 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
>  	if (index >= sess->nb_drivers)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
> +	if (*dev->dev_ops->sym_session_configure == NULL)
> +		return -ENOTSUP;
> 
>  	if (sess->sess_data[index].refcnt == 0) {
>  		ret = dev->dev_ops->sym_session_configure(dev, xforms,
> @@ -1968,7 +1978,8 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
>  	/* Clear device session pointer.*/
>  	memset(sess->sess_private_data, 0, session_priv_data_sz + sess->user_data_sz);
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_configure, -ENOTSUP);
> +	if (*dev->dev_ops->asym_session_configure == NULL)
> +		return -ENOTSUP;
> 
>  	if (sess->sess_private_data[0] == 0) {
>  		ret = dev->dev_ops->asym_session_configure(dev, xforms, sess);
> @@ -2007,7 +2018,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
>  	if (--sess->sess_data[driver_id].refcnt != 0)
>  		return -EBUSY;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
> +	if (*dev->dev_ops->sym_session_clear == NULL)
> +		return -ENOTSUP;
> 
>  	dev->dev_ops->sym_session_clear(dev, sess);
> 
> @@ -2054,7 +2066,8 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
>  	if (dev == NULL || sess == NULL)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_clear, -ENOTSUP);
> +	if (*dev->dev_ops->asym_session_clear == NULL)
> +		return -ENOTSUP;
> 
>  	dev->dev_ops->asym_session_clear(dev, sess);
> 
> diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
> index 174d4c40ae..d575c14493 100644
> --- a/lib/dmadev/rte_dmadev.c
> +++ b/lib/dmadev/rte_dmadev.c
> @@ -420,7 +420,8 @@ rte_dma_info_get(int16_t dev_id, struct rte_dma_info *dev_info)
>  	if (!rte_dma_is_valid(dev_id) || dev_info == NULL)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
> +	if (*dev->dev_ops->dev_info_get == NULL)
> +		return -ENOTSUP;
>  	memset(dev_info, 0, sizeof(struct rte_dma_info));
>  	ret = (*dev->dev_ops->dev_info_get)(dev, dev_info,
>  					    sizeof(struct rte_dma_info));
> @@ -472,7 +473,8 @@ rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
> +	if (*dev->dev_ops->dev_configure == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->dev_configure)(dev, dev_conf,
>  					     sizeof(struct rte_dma_conf));
>  	if (ret == 0)
> @@ -555,7 +557,8 @@ rte_dma_close(int16_t dev_id)
>  		return -EBUSY;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
> +	if (*dev->dev_ops->dev_close == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->dev_close)(dev);
>  	if (ret == 0)
>  		dma_release(dev);
> @@ -648,7 +651,8 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_setup, -ENOTSUP);
> +	if (*dev->dev_ops->vchan_setup == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->vchan_setup)(dev, vchan, conf,
>  					sizeof(struct rte_dma_vchan_conf));
>  }
> @@ -668,7 +672,8 @@ rte_dma_stats_get(int16_t dev_id, uint16_t vchan, struct rte_dma_stats *stats)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
> +	if (*dev->dev_ops->stats_get == NULL)
> +		return -ENOTSUP;
>  	memset(stats, 0, sizeof(struct rte_dma_stats));
>  	return (*dev->dev_ops->stats_get)(dev, vchan, stats,
>  					  sizeof(struct rte_dma_stats));
> @@ -689,7 +694,8 @@ rte_dma_stats_reset(int16_t dev_id, uint16_t vchan)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
> +	if (*dev->dev_ops->stats_reset == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->stats_reset)(dev, vchan);
>  }
> 
> @@ -706,7 +712,8 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_status, -ENOTSUP);
> +	if (*dev->dev_ops->vchan_status == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->vchan_status)(dev, vchan, status);
>  }
> 
> diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
> index e7f992b734..e61d71959e 100644
> --- a/lib/dmadev/rte_dmadev.h
> +++ b/lib/dmadev/rte_dmadev.h
> @@ -860,7 +860,8 @@ rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst,
>  #ifdef RTE_DMADEV_DEBUG
>  	if (!rte_dma_is_valid(dev_id) || length == 0)
>  		return -EINVAL;
> -	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy, -ENOTSUP);
> +	if (*obj->copy == NULL)
> +		return -ENOTSUP;
>  #endif
> 
>  	return (*obj->copy)(obj->dev_private, vchan, src, dst, length, flags);
> @@ -911,7 +912,8 @@ rte_dma_copy_sg(int16_t dev_id, uint16_t vchan, struct rte_dma_sge *src,
>  	if (!rte_dma_is_valid(dev_id) || src == NULL || dst == NULL ||
>  	    nb_src == 0 || nb_dst == 0)
>  		return -EINVAL;
> -	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy_sg, -ENOTSUP);
> +	if (*obj->copy_sg == NULL)
> +		return -ENOTSUP;
>  #endif
> 
>  	return (*obj->copy_sg)(obj->dev_private, vchan, src, dst, nb_src,
> @@ -957,7 +959,8 @@ rte_dma_fill(int16_t dev_id, uint16_t vchan, uint64_t pattern,
>  #ifdef RTE_DMADEV_DEBUG
>  	if (!rte_dma_is_valid(dev_id) || length == 0)
>  		return -EINVAL;
> -	RTE_FUNC_PTR_OR_ERR_RET(*obj->fill, -ENOTSUP);
> +	if (*obj->fill == NULL)
> +		return -ENOTSUP;
>  #endif
> 
>  	return (*obj->fill)(obj->dev_private, vchan, pattern, dst, length,
> @@ -990,7 +993,8 @@ rte_dma_submit(int16_t dev_id, uint16_t vchan)
>  #ifdef RTE_DMADEV_DEBUG
>  	if (!rte_dma_is_valid(dev_id))
>  		return -EINVAL;
> -	RTE_FUNC_PTR_OR_ERR_RET(*obj->submit, -ENOTSUP);
> +	if (*obj->submit == NULL)
> +		return -ENOTSUP;
>  #endif
> 
>  	return (*obj->submit)(obj->dev_private, vchan);
> @@ -1033,7 +1037,8 @@ rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls,
>  #ifdef RTE_DMADEV_DEBUG
>  	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0)
>  		return 0;
> -	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed, 0);
> +	if (*obj->completed == NULL)
> +		return 0;
>  #endif
> 
>  	/* Ensure the pointer values are non-null to simplify drivers.
> @@ -1095,7 +1100,8 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
>  #ifdef RTE_DMADEV_DEBUG
>  	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0 || status == NULL)
>  		return 0;
> -	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed_status, 0);
> +	if (*obj->completed_status == NULL)
> +		return 0;
>  #endif
> 
>  	if (last_idx == NULL)
> @@ -1129,7 +1135,8 @@ rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan)
>  #ifdef RTE_DMADEV_DEBUG
>  	if (!rte_dma_is_valid(dev_id))
>  		return 0;
> -	RTE_FUNC_PTR_OR_ERR_RET(*obj->burst_capacity, 0);
> +	if (*obj->burst_capacity == NULL)
> +		return 0;
>  #endif
>  	return (*obj->burst_capacity)(obj->dev_private, vchan);
>  }
> diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
> index e6ff1218f9..2743c09320 100644
> --- a/lib/eal/include/rte_dev.h
> +++ b/lib/eal/include/rte_dev.h
> @@ -20,6 +20,7 @@ extern "C" {
>  #include <stdio.h>
> 
>  #include <rte_config.h>
> +#include <rte_common.h>
>  #include <rte_compat.h>
>  #include <rte_log.h>
> 
> @@ -37,12 +38,14 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
>  					void *cb_arg);
> 
>  /* Macros to check for invalid function pointers */
> -#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> +#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \
> +do { \
>  	if ((func) == NULL) \
>  		return retval; \
>  } while (0)
> 
> -#define RTE_FUNC_PTR_OR_RET(func) do { \
> +#define RTE_FUNC_PTR_OR_RET(func) RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET) \
> +do { \
>  	if ((func) == NULL) \
>  		return; \
>  } while (0)
> diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
> index a285f213f0..24a3969225 100644
> --- a/lib/ethdev/ethdev_driver.c
> +++ b/lib/ethdev/ethdev_driver.c
> @@ -264,7 +264,8 @@ rte_eth_dev_create(struct rte_device *device, const char *name,
>  	struct rte_eth_dev *ethdev;
>  	int retval;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_init, -EINVAL);
> +	if (*ethdev_init == NULL)
> +		return -EINVAL;
> 
>  	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
>  		ethdev = rte_eth_dev_allocate(name);
> @@ -328,7 +329,8 @@ rte_eth_dev_destroy(struct rte_eth_dev *ethdev,
>  	if (!ethdev)
>  		return -ENODEV;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_uninit, -EINVAL);
> +	if (*ethdev_uninit == NULL)
> +		return -EINVAL;
> 
>  	ret = ethdev_uninit(ethdev);
>  	if (ret)
> @@ -558,8 +560,8 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
> 
>  	/* No need to check the validity again. */
>  	dev = &rte_eth_devices[cur_port];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_bind,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->hairpin_queue_peer_bind == NULL)
> +		return -ENOTSUP;
> 
>  	return (*dev->dev_ops->hairpin_queue_peer_bind)(dev, cur_queue,
>  							peer_info, direction);
> @@ -573,8 +575,8 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
> 
>  	/* No need to check the validity again. */
>  	dev = &rte_eth_devices[cur_port];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_unbind,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->hairpin_queue_peer_unbind == NULL)
> +		return -ENOTSUP;
> 
>  	return (*dev->dev_ops->hairpin_queue_peer_unbind)(dev, cur_queue,
>  							  direction);
> @@ -594,8 +596,8 @@ rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
> 
>  	/* No need to check the validity again. */
>  	dev = &rte_eth_devices[peer_port];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_update,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->hairpin_queue_peer_update == NULL)
> +		return -ENOTSUP;
> 
>  	return (*dev->dev_ops->hairpin_queue_peer_update)(dev, peer_queue,
>  					cur_info, peer_info, direction);
> diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
> index 0549842709..a268507801 100644
> --- a/lib/ethdev/ethdev_pci.h
> +++ b/lib/ethdev/ethdev_pci.h
> @@ -130,7 +130,8 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
>  	if (!eth_dev)
>  		return -ENOMEM;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
> +	if (*dev_init == NULL)
> +		return -EINVAL;
>  	ret = dev_init(eth_dev);
>  	if (ret)
>  		rte_eth_dev_release_port(eth_dev);
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 1979dc0850..9d6f460726 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -719,7 +719,8 @@ rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
>  	if (ret != 0)
>  		return ret;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
> +	if (*dev->dev_ops->rx_queue_start == NULL)
> +		return -ENOTSUP;
> 
>  	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
>  		RTE_ETHDEV_LOG(INFO,
> @@ -751,7 +752,8 @@ rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id)
>  	if (ret != 0)
>  		return ret;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
> +	if (*dev->dev_ops->rx_queue_stop == NULL)
> +		return -ENOTSUP;
> 
>  	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
>  		RTE_ETHDEV_LOG(INFO,
> @@ -790,7 +792,8 @@ rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id)
>  	if (ret != 0)
>  		return ret;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
> +	if (*dev->dev_ops->tx_queue_start == NULL)
> +		return -ENOTSUP;
> 
>  	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
>  		RTE_ETHDEV_LOG(INFO,
> @@ -822,7 +825,8 @@ rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id)
>  	if (ret != 0)
>  		return ret;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
> +	if (*dev->dev_ops->tx_queue_stop == NULL)
> +		return -ENOTSUP;
> 
>  	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
>  		RTE_ETHDEV_LOG(INFO,
> @@ -1077,7 +1081,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
> +	if (*dev->dev_ops->dev_configure == NULL)
> +		return -ENOTSUP;
> 
>  	if (dev->data->dev_started) {
>  		RTE_ETHDEV_LOG(ERR,
> @@ -1447,7 +1452,8 @@ rte_eth_dev_start(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
> +	if (*dev->dev_ops->dev_start == NULL)
> +		return -ENOTSUP;
> 
>  	if (dev->data->dev_configured == 0) {
>  		RTE_ETHDEV_LOG(INFO,
> @@ -1493,7 +1499,8 @@ rte_eth_dev_start(uint16_t port_id)
>  	}
> 
>  	if (dev->data->dev_conf.intr_conf.lsc == 0) {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
> +		if (*dev->dev_ops->link_update == NULL)
> +			return -ENOTSUP;
>  		(*dev->dev_ops->link_update)(dev, 0);
>  	}
> 
> @@ -1513,7 +1520,8 @@ rte_eth_dev_stop(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
> +	if (*dev->dev_ops->dev_stop == NULL)
> +		return -ENOTSUP;
> 
>  	if (dev->data->dev_started == 0) {
>  		RTE_ETHDEV_LOG(INFO,
> @@ -1541,7 +1549,8 @@ rte_eth_dev_set_link_up(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
> +	if (*dev->dev_ops->dev_set_link_up == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->dev_set_link_up)(dev));
>  }
> 
> @@ -1553,7 +1562,8 @@ rte_eth_dev_set_link_down(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
> +	if (*dev->dev_ops->dev_set_link_down == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev));
>  }
> 
> @@ -1579,7 +1589,8 @@ rte_eth_dev_close(uint16_t port_id)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
> +	if (*dev->dev_ops->dev_close == NULL)
> +		return -ENOTSUP;
>  	*lasterr = (*dev->dev_ops->dev_close)(dev);
>  	if (*lasterr != 0)
>  		lasterr = &binerr;
> @@ -1599,7 +1610,8 @@ rte_eth_dev_reset(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
> +	if (*dev->dev_ops->dev_reset == NULL)
> +		return -ENOTSUP;
> 
>  	ret = rte_eth_dev_stop(port_id);
>  	if (ret != 0) {
> @@ -1624,7 +1636,8 @@ rte_eth_dev_is_removed(uint16_t port_id)
>  	if (dev->state == RTE_ETH_DEV_REMOVED)
>  		return 1;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->is_removed, 0);
> +	if (*dev->dev_ops->is_removed == NULL)
> +		return 0;
> 
>  	ret = dev->dev_ops->is_removed(dev);
>  	if (ret != 0)
> @@ -1725,7 +1738,8 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
> +	if (*dev->dev_ops->rx_queue_setup == NULL)
> +		return -ENOTSUP;
> 
>  	ret = rte_eth_dev_info_get(port_id, &dev_info);
>  	if (ret != 0)
> @@ -1928,8 +1942,8 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
>  	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
>  	if (ret != 0)
>  		return ret;
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_hairpin_queue_setup,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->rx_hairpin_queue_setup == NULL)
> +		return -ENOTSUP;
>  	/* if nb_rx_desc is zero use max number of desc from the driver. */
>  	if (nb_rx_desc == 0)
>  		nb_rx_desc = cap.max_nb_desc;
> @@ -1990,7 +2004,8 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
> +	if (*dev->dev_ops->tx_queue_setup == NULL)
> +		return -ENOTSUP;
> 
>  	ret = rte_eth_dev_info_get(port_id, &dev_info);
>  	if (ret != 0)
> @@ -2094,8 +2109,8 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
>  	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
>  	if (ret != 0)
>  		return ret;
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_hairpin_queue_setup,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->tx_hairpin_queue_setup == NULL)
> +		return -ENOTSUP;
>  	/* if nb_rx_desc is zero use max number of desc from the driver. */
>  	if (nb_tx_desc == 0)
>  		nb_tx_desc = cap.max_nb_desc;
> @@ -2152,7 +2167,8 @@ rte_eth_hairpin_bind(uint16_t tx_port, uint16_t rx_port)
>  		return -EBUSY;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_bind, -ENOTSUP);
> +	if (*dev->dev_ops->hairpin_bind == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->hairpin_bind)(dev, rx_port);
>  	if (ret != 0)
>  		RTE_ETHDEV_LOG(ERR, "Failed to bind hairpin Tx %d"
> @@ -2176,7 +2192,8 @@ rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port)
>  		return -EBUSY;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_unbind, -ENOTSUP);
> +	if (*dev->dev_ops->hairpin_unbind == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->hairpin_unbind)(dev, rx_port);
>  	if (ret != 0)
>  		RTE_ETHDEV_LOG(ERR, "Failed to unbind hairpin Tx %d"
> @@ -2210,8 +2227,8 @@ rte_eth_hairpin_get_peer_ports(uint16_t port_id, uint16_t *peer_ports,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_get_peer_ports,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->hairpin_get_peer_ports == NULL)
> +		return -ENOTSUP;
> 
>  	ret = (*dev->dev_ops->hairpin_get_peer_ports)(dev, peer_ports,
>  						      len, direction);
> @@ -2282,7 +2299,8 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_done_cleanup, -ENOTSUP);
> +	if (*dev->dev_ops->tx_done_cleanup == NULL)
> +		return -ENOTSUP;
> 
>  	/* Call driver to free pending mbufs. */
>  	ret = (*dev->dev_ops->tx_done_cleanup)(dev->data->tx_queues[queue_id],
> @@ -2302,7 +2320,8 @@ rte_eth_promiscuous_enable(uint16_t port_id)
>  	if (dev->data->promiscuous == 1)
>  		return 0;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
> +	if (*dev->dev_ops->promiscuous_enable == NULL)
> +		return -ENOTSUP;
> 
>  	diag = (*dev->dev_ops->promiscuous_enable)(dev);
>  	dev->data->promiscuous = (diag == 0) ? 1 : 0;
> @@ -2322,7 +2341,8 @@ rte_eth_promiscuous_disable(uint16_t port_id)
>  	if (dev->data->promiscuous == 0)
>  		return 0;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
> +	if (*dev->dev_ops->promiscuous_disable == NULL)
> +		return -ENOTSUP;
> 
>  	dev->data->promiscuous = 0;
>  	diag = (*dev->dev_ops->promiscuous_disable)(dev);
> @@ -2355,7 +2375,8 @@ rte_eth_allmulticast_enable(uint16_t port_id)
>  	if (dev->data->all_multicast == 1)
>  		return 0;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_enable, -ENOTSUP);
> +	if (*dev->dev_ops->allmulticast_enable == NULL)
> +		return -ENOTSUP;
>  	diag = (*dev->dev_ops->allmulticast_enable)(dev);
>  	dev->data->all_multicast = (diag == 0) ? 1 : 0;
> 
> @@ -2374,7 +2395,8 @@ rte_eth_allmulticast_disable(uint16_t port_id)
>  	if (dev->data->all_multicast == 0)
>  		return 0;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_disable, -ENOTSUP);
> +	if (*dev->dev_ops->allmulticast_disable == NULL)
> +		return -ENOTSUP;
>  	dev->data->all_multicast = 0;
>  	diag = (*dev->dev_ops->allmulticast_disable)(dev);
>  	if (diag != 0)
> @@ -2411,7 +2433,8 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link)
>  	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
>  		rte_eth_linkstatus_get(dev, eth_link);
>  	else {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
> +		if (*dev->dev_ops->link_update == NULL)
> +			return -ENOTSUP;
>  		(*dev->dev_ops->link_update)(dev, 1);
>  		*eth_link = dev->data->dev_link;
>  	}
> @@ -2436,7 +2459,8 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link)
>  	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
>  		rte_eth_linkstatus_get(dev, eth_link);
>  	else {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
> +		if (*dev->dev_ops->link_update == NULL)
> +			return -ENOTSUP;
>  		(*dev->dev_ops->link_update)(dev, 0);
>  		*eth_link = dev->data->dev_link;
>  	}
> @@ -2513,7 +2537,8 @@ rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats)
> 
>  	memset(stats, 0, sizeof(*stats));
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
> +	if (*dev->dev_ops->stats_get == NULL)
> +		return -ENOTSUP;
>  	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
>  	return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats));
>  }
> @@ -2527,7 +2552,8 @@ rte_eth_stats_reset(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
> +	if (*dev->dev_ops->stats_reset == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->stats_reset)(dev);
>  	if (ret != 0)
>  		return eth_err(port_id, ret);
> @@ -3043,7 +3069,8 @@ eth_dev_set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id,
>  	if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
> +	if (*dev->dev_ops->queue_stats_mapping_set == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->queue_stats_mapping_set) (dev, queue_id, stat_idx, is_rx);
>  }
> 
> @@ -3080,7 +3107,8 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
> +	if (*dev->dev_ops->fw_version_get == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->fw_version_get)(dev,
>  							fw_version, fw_size));
>  }
> @@ -3121,7 +3149,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
>  		RTE_ETHER_CRC_LEN;
>  	dev_info->max_mtu = UINT16_MAX;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
> +	if (*dev->dev_ops->dev_infos_get == NULL)
> +		return -ENOTSUP;
>  	diag = (*dev->dev_ops->dev_infos_get)(dev, dev_info);
>  	if (diag != 0) {
>  		/* Cleanup already filled in device information */
> @@ -3182,7 +3211,8 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_supported_ptypes_get, 0);
> +	if (*dev->dev_ops->dev_supported_ptypes_get == NULL)
> +		return 0;
>  	all_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev);
> 
>  	if (!all_ptypes)
> @@ -3360,7 +3390,8 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
> 
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
> +	if (*dev->dev_ops->mtu_set == NULL)
> +		return -ENOTSUP;
> 
>  	/*
>  	 * Check if the device supports dev_infos_get, if it does not
> @@ -3413,7 +3444,8 @@ rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
>  			port_id, vlan_id);
>  		return -EINVAL;
>  	}
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
> +	if (*dev->dev_ops->vlan_filter_set == NULL)
> +		return -ENOTSUP;
> 
>  	ret = (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
>  	if (ret == 0) {
> @@ -3448,7 +3480,8 @@ rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
> +	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
> +		return -ENOTSUP;
>  	(*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on);
> 
>  	return 0;
> @@ -3464,7 +3497,8 @@ rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
> +	if (*dev->dev_ops->vlan_tpid_set == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->vlan_tpid_set)(dev, vlan_type,
>  							       tpid));
>  }
> @@ -3549,7 +3583,8 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
> +	if (*dev->dev_ops->vlan_offload_set == NULL)
> +		return -ENOTSUP;
>  	dev->data->dev_conf.rxmode.offloads = dev_offloads;
>  	ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);
>  	if (ret) {
> @@ -3594,7 +3629,8 @@ rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
> +	if (*dev->dev_ops->vlan_pvid_set == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->vlan_pvid_set)(dev, pvid, on));
>  }
> 
> @@ -3613,7 +3649,8 @@ rte_eth_dev_flow_ctrl_get(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
> +	if (*dev->dev_ops->flow_ctrl_get == NULL)
> +		return -ENOTSUP;
>  	memset(fc_conf, 0, sizeof(*fc_conf));
>  	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf));
>  }
> @@ -3638,7 +3675,8 @@ rte_eth_dev_flow_ctrl_set(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
> +	if (*dev->dev_ops->flow_ctrl_set == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf));
>  }
> 
> @@ -3899,7 +3937,8 @@ rte_eth_dev_rss_reta_update(uint16_t port_id,
>  		return -ENOTSUP;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
> +	if (*dev->dev_ops->reta_update == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->reta_update)(dev, reta_conf,
>  							     reta_size));
>  }
> @@ -3927,7 +3966,8 @@ rte_eth_dev_rss_reta_query(uint16_t port_id,
>  	if (ret < 0)
>  		return ret;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
> +	if (*dev->dev_ops->reta_query == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->reta_query)(dev, reta_conf,
>  							    reta_size));
>  }
> @@ -3971,7 +4011,8 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
>  		return -ENOTSUP;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
> +	if (*dev->dev_ops->rss_hash_update == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
>  								 rss_conf));
>  }
> @@ -3992,7 +4033,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
> +	if (*dev->dev_ops->rss_hash_conf_get == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev,
>  								   rss_conf));
>  }
> @@ -4018,7 +4060,8 @@ rte_eth_dev_udp_tunnel_port_add(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP);
> +	if (*dev->dev_ops->udp_tunnel_port_add == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_add)(dev,
>  								udp_tunnel));
>  }
> @@ -4044,7 +4087,8 @@ rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP);
> +	if (*dev->dev_ops->udp_tunnel_port_del == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_del)(dev,
>  								udp_tunnel));
>  }
> @@ -4057,7 +4101,8 @@ rte_eth_led_on(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
> +	if (*dev->dev_ops->dev_led_on == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->dev_led_on)(dev));
>  }
> 
> @@ -4069,7 +4114,8 @@ rte_eth_led_off(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
> +	if (*dev->dev_ops->dev_led_off == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev));
>  }
> 
> @@ -4091,7 +4137,8 @@ rte_eth_fec_get_capability(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get_capability, -ENOTSUP);
> +	if (*dev->dev_ops->fec_get_capability == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->fec_get_capability)(dev, speed_fec_capa, num);
> 
>  	return ret;
> @@ -4112,7 +4159,8 @@ rte_eth_fec_get(uint16_t port_id, uint32_t *fec_capa)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get, -ENOTSUP);
> +	if (*dev->dev_ops->fec_get == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->fec_get)(dev, fec_capa));
>  }
> 
> @@ -4124,7 +4172,8 @@ rte_eth_fec_set(uint16_t port_id, uint32_t fec_capa)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_set, -ENOTSUP);
> +	if (*dev->dev_ops->fec_set == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->fec_set)(dev, fec_capa));
>  }
> 
> @@ -4173,7 +4222,8 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
> +	if (*dev->dev_ops->mac_addr_add == NULL)
> +		return -ENOTSUP;
> 
>  	if (rte_is_zero_ether_addr(addr)) {
>  		RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n",
> @@ -4231,7 +4281,8 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
> +	if (*dev->dev_ops->mac_addr_remove == NULL)
> +		return -ENOTSUP;
> 
>  	index = eth_dev_get_mac_addr_index(port_id, addr);
>  	if (index == 0) {
> @@ -4273,7 +4324,8 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)
>  	if (!rte_is_valid_assigned_ether_addr(addr))
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
> +	if (*dev->dev_ops->mac_addr_set == NULL)
> +		return -ENOTSUP;
> 
>  	ret = (*dev->dev_ops->mac_addr_set)(dev, addr);
>  	if (ret < 0)
> @@ -4359,7 +4411,8 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr,
>  		}
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
> +	if (*dev->dev_ops->uc_hash_table_set == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
>  	if (ret == 0) {
>  		/* Update address in NIC data structure */
> @@ -4382,7 +4435,8 @@ rte_eth_dev_uc_all_hash_table_set(uint16_t port_id, uint8_t on)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
> +	if (*dev->dev_ops->uc_all_hash_table_set == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->uc_all_hash_table_set)(dev,
>  								       on));
>  }
> @@ -4418,7 +4472,8 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
> +	if (*dev->dev_ops->set_queue_rate_limit == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->set_queue_rate_limit)(dev,
>  							queue_idx, tx_rate));
>  }
> @@ -4444,7 +4499,8 @@ int rte_eth_rx_avail_thresh_set(uint16_t port_id, uint16_t queue_id,
>  			port_id);
>  		return -EINVAL;
>  	}
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_set, -ENOTSUP);
> +	if (*dev->dev_ops->rx_queue_avail_thresh_set == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_set)(dev,
>  							     queue_id, avail_thresh));
>  }
> @@ -4462,7 +4518,8 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,
>  	if (*queue_id >= dev->data->nb_rx_queues)
>  		*queue_id = 0;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_query, -ENOTSUP);
> +	if (*dev->dev_ops->rx_queue_avail_thresh_query == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_query)(dev,
>  							     queue_id, avail_thresh));
>  }
> @@ -4736,7 +4793,8 @@ rte_eth_dev_rx_intr_enable(uint16_t port_id,
>  	if (ret != 0)
>  		return ret;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
> +	if (*dev->dev_ops->rx_queue_intr_enable == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id));
>  }
> 
> @@ -4754,7 +4812,8 @@ rte_eth_dev_rx_intr_disable(uint16_t port_id,
>  	if (ret != 0)
>  		return ret;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
> +	if (*dev->dev_ops->rx_queue_intr_disable == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id));
>  }
> 
> @@ -5018,7 +5077,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
> +	if (*dev->dev_ops->rxq_info_get == NULL)
> +		return -ENOTSUP;
> 
>  	memset(qinfo, 0, sizeof(*qinfo));
>  	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
> @@ -5063,7 +5123,8 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
> +	if (*dev->dev_ops->txq_info_get == NULL)
> +		return -ENOTSUP;
> 
>  	memset(qinfo, 0, sizeof(*qinfo));
>  	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
> @@ -5093,7 +5154,8 @@ rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_burst_mode_get, -ENOTSUP);
> +	if (*dev->dev_ops->rx_burst_mode_get == NULL)
> +		return -ENOTSUP;
>  	memset(mode, 0, sizeof(*mode));
>  	return eth_err(port_id,
>  		       dev->dev_ops->rx_burst_mode_get(dev, queue_id, mode));
> @@ -5120,7 +5182,8 @@ rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_burst_mode_get, -ENOTSUP);
> +	if (*dev->dev_ops->tx_burst_mode_get == NULL)
> +		return -ENOTSUP;
>  	memset(mode, 0, sizeof(*mode));
>  	return eth_err(port_id,
>  		       dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode));
> @@ -5147,7 +5210,8 @@ rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_monitor_addr, -ENOTSUP);
> +	if (*dev->dev_ops->get_monitor_addr == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id,
>  		dev->dev_ops->get_monitor_addr(dev->data->rx_queues[queue_id], pmc));
>  }
> @@ -5162,7 +5226,8 @@ rte_eth_dev_set_mc_addr_list(uint16_t port_id,
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
> +	if (*dev->dev_ops->set_mc_addr_list == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, dev->dev_ops->set_mc_addr_list(dev,
>  						mc_addr_set, nb_mc_addr));
>  }
> @@ -5175,7 +5240,8 @@ rte_eth_timesync_enable(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
> +	if (*dev->dev_ops->timesync_enable == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->timesync_enable)(dev));
>  }
> 
> @@ -5187,7 +5253,8 @@ rte_eth_timesync_disable(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
> +	if (*dev->dev_ops->timesync_disable == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->timesync_disable)(dev));
>  }
> 
> @@ -5207,7 +5274,8 @@ rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
> +	if (*dev->dev_ops->timesync_read_rx_timestamp == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->timesync_read_rx_timestamp)
>  				(dev, timestamp, flags));
>  }
> @@ -5228,7 +5296,8 @@ rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
> +	if (*dev->dev_ops->timesync_read_tx_timestamp == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->timesync_read_tx_timestamp)
>  				(dev, timestamp));
>  }
> @@ -5241,7 +5310,8 @@ rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
> +	if (*dev->dev_ops->timesync_adjust_time == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->timesync_adjust_time)(dev, delta));
>  }
> 
> @@ -5260,7 +5330,8 @@ rte_eth_timesync_read_time(uint16_t port_id, struct timespec *timestamp)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
> +	if (*dev->dev_ops->timesync_read_time == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->timesync_read_time)(dev,
>  								timestamp));
>  }
> @@ -5280,7 +5351,8 @@ rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
> +	if (*dev->dev_ops->timesync_write_time == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->timesync_write_time)(dev,
>  								timestamp));
>  }
> @@ -5299,7 +5371,8 @@ rte_eth_read_clock(uint16_t port_id, uint64_t *clock)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->read_clock, -ENOTSUP);
> +	if (*dev->dev_ops->read_clock == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->read_clock)(dev, clock));
>  }
> 
> @@ -5318,7 +5391,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
> +	if (*dev->dev_ops->get_reg == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->get_reg)(dev, info));
>  }
> 
> @@ -5330,7 +5404,8 @@ rte_eth_dev_get_eeprom_length(uint16_t port_id)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
> +	if (*dev->dev_ops->get_eeprom_length == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->get_eeprom_length)(dev));
>  }
> 
> @@ -5349,7 +5424,8 @@ rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
> +	if (*dev->dev_ops->get_eeprom == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->get_eeprom)(dev, info));
>  }
> 
> @@ -5368,7 +5444,8 @@ rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
> +	if (*dev->dev_ops->set_eeprom == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->set_eeprom)(dev, info));
>  }
> 
> @@ -5388,7 +5465,8 @@ rte_eth_dev_get_module_info(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_info, -ENOTSUP);
> +	if (*dev->dev_ops->get_module_info == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->get_module_info)(dev, modinfo);
>  }
> 
> @@ -5422,7 +5500,8 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_eeprom, -ENOTSUP);
> +	if (*dev->dev_ops->get_module_eeprom == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->get_module_eeprom)(dev, info);
>  }
> 
> @@ -5444,7 +5523,8 @@ rte_eth_dev_get_dcb_info(uint16_t port_id,
> 
>  	memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
> +	if (*dev->dev_ops->get_dcb_info == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->get_dcb_info)(dev, dcb_info));
>  }
> 
> @@ -5500,7 +5580,8 @@ rte_eth_dev_hairpin_capability_get(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_cap_get, -ENOTSUP);
> +	if (*dev->dev_ops->hairpin_cap_get == NULL)
> +		return -ENOTSUP;
>  	memset(cap, 0, sizeof(*cap));
>  	return eth_err(port_id, (*dev->dev_ops->hairpin_cap_get)(dev, cap));
>  }
> @@ -5775,7 +5856,8 @@ rte_eth_representor_info_get(uint16_t port_id,
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->representor_info_get, -ENOTSUP);
> +	if (*dev->dev_ops->representor_info_get == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->representor_info_get)(dev, info));
>  }
> 
> @@ -5799,7 +5881,8 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_metadata_negotiate, -ENOTSUP);
> +	if (*dev->dev_ops->rx_metadata_negotiate == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id,
>  		       (*dev->dev_ops->rx_metadata_negotiate)(dev, features));
>  }
> @@ -5826,8 +5909,8 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_capability_get,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->ip_reassembly_capability_get == NULL)
> +		return -ENOTSUP;
>  	memset(reassembly_capa, 0, sizeof(struct rte_eth_ip_reassembly_params));
> 
>  	return eth_err(port_id, (*dev->dev_ops->ip_reassembly_capability_get)
> @@ -5856,8 +5939,8 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_get,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->ip_reassembly_conf_get == NULL)
> +		return -ENOTSUP;
>  	memset(conf, 0, sizeof(struct rte_eth_ip_reassembly_params));
>  	return eth_err(port_id,
>  		       (*dev->dev_ops->ip_reassembly_conf_get)(dev, conf));
> @@ -5894,8 +5977,8 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_set,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->ip_reassembly_conf_set == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id,
>  		       (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf));
>  }
> @@ -5913,7 +5996,8 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP);
> +	if (*dev->dev_ops->eth_dev_priv_dump == NULL)
> +		return -ENOTSUP;
>  	return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file));
>  }
> 
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index de9e970d4d..41d37e41b5 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -5710,7 +5710,8 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
>  	qd = p->rxq.data[queue_id];
> 
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> -	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_queue_count, -ENOTSUP);
> +	if (*p->rx_queue_count == NULL)
> +		return -ENOTSUP;
>  	if (qd == NULL)
>  		return -EINVAL;
> 
> @@ -5784,7 +5785,8 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
>  	if (qd == NULL)
>  		return -ENODEV;
>  #endif
> -	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_descriptor_status, -ENOTSUP);
> +	if (*p->rx_descriptor_status == NULL)
> +		return -ENOTSUP;
>  	return (*p->rx_descriptor_status)(qd, offset);
>  }
> 
> @@ -5854,7 +5856,8 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
>  	if (qd == NULL)
>  		return -ENODEV;
>  #endif
> -	RTE_FUNC_PTR_OR_ERR_RET(*p->tx_descriptor_status, -ENOTSUP);
> +	if (*p->tx_descriptor_status == NULL)
> +		return -ENOTSUP;
>  	return (*p->tx_descriptor_status)(qd, offset);
>  }
> 
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
> index 7c695176f4..4938b4ee07 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -974,9 +974,8 @@ rte_event_crypto_adapter_queue_pair_add(uint8_t id,
>  	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW) ||
>  	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
>  	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
> -		RTE_FUNC_PTR_OR_ERR_RET(
> -			*dev->dev_ops->crypto_adapter_queue_pair_add,
> -			-ENOTSUP);
> +		if (*dev->dev_ops->crypto_adapter_queue_pair_add == NULL)
> +			return -ENOTSUP;
>  		if (dev_info->qpairs == NULL) {
>  			dev_info->qpairs =
>  			    rte_zmalloc_socket(adapter->mem_name,
> @@ -1076,9 +1075,8 @@ rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id,
>  	if ((cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
>  	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
>  	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
> -		RTE_FUNC_PTR_OR_ERR_RET(
> -			*dev->dev_ops->crypto_adapter_queue_pair_del,
> -			-ENOTSUP);
> +		if (*dev->dev_ops->crypto_adapter_queue_pair_del == NULL)
> +			return -ENOTSUP;
>  		ret = (*dev->dev_ops->crypto_adapter_queue_pair_del)(dev,
>  						dev_info->dev,
>  						queue_pair_id);
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index bf8741d2ea..8e81cf774d 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -2655,8 +2655,8 @@ rte_event_eth_rx_adapter_queue_add(uint8_t id,
>  	dev_info = &rx_adapter->eth_devices[eth_dev_id];
> 
>  	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_add,
> -					-ENOTSUP);
> +		if (*dev->dev_ops->eth_rx_adapter_queue_add == NULL)
> +			return -ENOTSUP;
>  		if (dev_info->rx_queue == NULL) {
>  			dev_info->rx_queue =
>  			    rte_zmalloc_socket(rx_adapter->mem_name,
> @@ -2750,8 +2750,8 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
>  	dev_info = &rx_adapter->eth_devices[eth_dev_id];
> 
>  	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_del,
> -				 -ENOTSUP);
> +		if (*dev->dev_ops->eth_rx_adapter_queue_del == NULL)
> +			return -ENOTSUP;
>  		ret = (*dev->dev_ops->eth_rx_adapter_queue_del)(dev,
>  						&rte_eth_devices[eth_dev_id],
>  						rx_queue_id);
> @@ -2861,9 +2861,8 @@ rte_event_eth_rx_adapter_vector_limits_get(
>  	}
> 
>  	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
> -		RTE_FUNC_PTR_OR_ERR_RET(
> -			*dev->dev_ops->eth_rx_adapter_vector_limits_get,
> -			-ENOTSUP);
> +		if (*dev->dev_ops->eth_rx_adapter_vector_limits_get == NULL)
> +			return -ENOTSUP;
>  		ret = dev->dev_ops->eth_rx_adapter_vector_limits_get(
>  			dev, &rte_eth_devices[eth_port_id], limits);
>  	} else {
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 1dc4f966be..79b905e9fc 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -92,7 +92,8 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info)
> 
>  	memset(dev_info, 0, sizeof(struct rte_event_dev_info));
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
> +	if (*dev->dev_ops->dev_infos_get == NULL)
> +		return -ENOTSUP;
>  	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
> 
>  	dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns;
> @@ -216,7 +217,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
> 
>  	if (nb_queues != 0) {
>  		queues_cfg = dev->data->queues_cfg;
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
> +		if (*dev->dev_ops->queue_release == NULL)
> +			return -ENOTSUP;
> 
>  		for (i = nb_queues; i < old_nb_queues; i++)
>  			(*dev->dev_ops->queue_release)(dev, i);
> @@ -229,7 +231,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
>  				sizeof(queues_cfg[0]) * new_qs);
>  		}
>  	} else {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
> +		if (*dev->dev_ops->queue_release == NULL)
> +			return -ENOTSUP;
> 
>  		for (i = nb_queues; i < old_nb_queues; i++)
>  			(*dev->dev_ops->queue_release)(dev, i);
> @@ -254,7 +257,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
>  			 dev->data->dev_id);
> 
>  	if (nb_ports != 0) { /* re-config */
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
> +		if (*dev->dev_ops->port_release == NULL)
> +			return -ENOTSUP;
> 
>  		ports = dev->data->ports;
>  		ports_cfg = dev->data->ports_cfg;
> @@ -279,7 +283,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
>  					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
>  		}
>  	} else {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
> +		if (*dev->dev_ops->port_release == NULL)
> +			return -ENOTSUP;
> 
>  		ports = dev->data->ports;
>  		for (i = nb_ports; i < old_nb_ports; i++) {
> @@ -303,8 +308,10 @@ rte_event_dev_configure(uint8_t dev_id,
>  	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_eventdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
> +	if (*dev->dev_ops->dev_infos_get == NULL)
> +		return -ENOTSUP;
> +	if (*dev->dev_ops->dev_configure == NULL)
> +		return -ENOTSUP;
> 
>  	if (dev->data->dev_started) {
>  		RTE_EDEV_LOG_ERR(
> @@ -509,7 +516,8 @@ rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
> +	if (*dev->dev_ops->queue_def_conf == NULL)
> +		return -ENOTSUP;
>  	memset(queue_conf, 0, sizeof(struct rte_event_queue_conf));
>  	(*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf);
>  	return 0;
> @@ -595,11 +603,12 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
>  		return -EBUSY;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
> +	if (*dev->dev_ops->queue_setup == NULL)
> +		return -ENOTSUP;
> 
>  	if (queue_conf == NULL) {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf,
> -					-ENOTSUP);
> +		if (*dev->dev_ops->queue_def_conf == NULL)
> +			return -ENOTSUP;
>  		(*dev->dev_ops->queue_def_conf)(dev, queue_id, &def_conf);
>  		queue_conf = &def_conf;
>  	}
> @@ -635,7 +644,8 @@ rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
>  		return -EINVAL;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf, -ENOTSUP);
> +	if (*dev->dev_ops->port_def_conf == NULL)
> +		return -ENOTSUP;
>  	memset(port_conf, 0, sizeof(struct rte_event_port_conf));
>  	(*dev->dev_ops->port_def_conf)(dev, port_id, port_conf);
>  	return 0;
> @@ -706,11 +716,12 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
>  		return -EBUSY;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_setup, -ENOTSUP);
> +	if (*dev->dev_ops->port_setup == NULL)
> +		return -ENOTSUP;
> 
>  	if (port_conf == NULL) {
> -		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf,
> -					-ENOTSUP);
> +		if (*dev->dev_ops->port_def_conf == NULL)
> +			return -ENOTSUP;
>  		(*dev->dev_ops->port_def_conf)(dev, port_id, &def_conf);
>  		port_conf = &def_conf;
>  	}
> @@ -896,7 +907,8 @@ rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
>  		return -ENOTSUP;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
> +	if (*dev->dev_ops->queue_attr_set == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->queue_attr_set)(dev, queue_id, attr_id,
>  					       attr_value);
>  }
> @@ -1045,7 +1057,8 @@ rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id)
>  	 * This allows PMDs which handle unlink synchronously to not implement
>  	 * this function at all.
>  	 */
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_unlinks_in_progress, 0);
> +	if (*dev->dev_ops->port_unlinks_in_progress == NULL)
> +		return 0;
> 
>  	return (*dev->dev_ops->port_unlinks_in_progress)(dev,
>  			dev->data->ports[port_id]);
> @@ -1087,7 +1100,8 @@ rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
> 
>  	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_eventdevs[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timeout_ticks, -ENOTSUP);
> +	if (*dev->dev_ops->timeout_ticks == NULL)
> +		return -ENOTSUP;
> 
>  	if (timeout_ticks == NULL)
>  		return -EINVAL;
> @@ -1119,7 +1133,8 @@ rte_event_dev_dump(uint8_t dev_id, FILE *f)
> 
>  	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_eventdevs[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
> +	if (*dev->dev_ops->dump == NULL)
> +		return -ENOTSUP;
>  	if (f == NULL)
>  		return -EINVAL;
> 
> @@ -1285,7 +1300,8 @@ rte_event_dev_start(uint8_t dev_id)
> 
>  	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_eventdevs[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
> +	if (*dev->dev_ops->dev_start == NULL)
> +		return -ENOTSUP;
> 
>  	if (dev->data->dev_started != 0) {
>  		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already started",
> @@ -1331,7 +1347,8 @@ rte_event_dev_stop(uint8_t dev_id)
> 
>  	RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id);
>  	dev = &rte_eventdevs[dev_id];
> -	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
> +	if (*dev->dev_ops->dev_stop == NULL)
> +		return;
> 
>  	if (dev->data->dev_started == 0) {
>  		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already stopped",
> @@ -1352,7 +1369,8 @@ rte_event_dev_close(uint8_t dev_id)
> 
>  	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_eventdevs[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
> +	if (*dev->dev_ops->dev_close == NULL)
> +		return -ENOTSUP;
> 
>  	/* Device must be stopped before it can be closed */
>  	if (dev->data->dev_started == 1) {
> diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
> index 2d36dee8f0..ac32c4bb72 100644
> --- a/lib/mempool/rte_mempool_ops.c
> +++ b/lib/mempool/rte_mempool_ops.c
> @@ -154,7 +154,8 @@ rte_mempool_ops_get_info(const struct rte_mempool *mp,
> 
>  	ops = rte_mempool_get_ops(mp->ops_index);
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(ops->get_info, -ENOTSUP);
> +	if (ops->get_info == NULL)
> +		return -ENOTSUP;
>  	return ops->get_info(mp, info);
>  }
> 
> diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
> index 2f0a4f132e..e157d65332 100644
> --- a/lib/rawdev/rte_rawdev.c
> +++ b/lib/rawdev/rte_rawdev.c
> @@ -71,12 +71,14 @@ rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info,
>  	int ret = 0;
> 
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
> -	RTE_FUNC_PTR_OR_ERR_RET(dev_info, -EINVAL);
> +	if (dev_info == NULL)
> +		return -EINVAL;
> 
>  	rawdev = &rte_rawdevs[dev_id];
> 
>  	if (dev_info->dev_private != NULL) {
> -		RTE_FUNC_PTR_OR_ERR_RET(*rawdev->dev_ops->dev_info_get, -ENOTSUP);
> +		if (*rawdev->dev_ops->dev_info_get == NULL)
> +			return -ENOTSUP;
>  		ret = (*rawdev->dev_ops->dev_info_get)(rawdev,
>  				dev_info->dev_private,
>  				dev_private_size);
> @@ -97,11 +99,13 @@ rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf,
>  	int diag;
> 
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
> -	RTE_FUNC_PTR_OR_ERR_RET(dev_conf, -EINVAL);
> +	if (dev_conf == NULL)
> +		return -EINVAL;
> 
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
> +	if (*dev->dev_ops->dev_configure == NULL)
> +		return -ENOTSUP;
> 
>  	if (dev->started) {
>  		RTE_RDEV_ERR(
> @@ -131,7 +135,8 @@ rte_rawdev_queue_conf_get(uint16_t dev_id,
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
> +	if (*dev->dev_ops->queue_def_conf == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf,
>  			queue_conf_size);
>  }
> @@ -147,7 +152,8 @@ rte_rawdev_queue_setup(uint16_t dev_id,
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
> +	if (*dev->dev_ops->queue_setup == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf,
>  			queue_conf_size);
>  }
> @@ -160,7 +166,8 @@ rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
> +	if (*dev->dev_ops->queue_release == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->queue_release)(dev, queue_id);
>  }
> 
> @@ -172,7 +179,8 @@ rte_rawdev_queue_count(uint16_t dev_id)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_count, -ENOTSUP);
> +	if (*dev->dev_ops->queue_count == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->queue_count)(dev);
>  }
> 
> @@ -186,7 +194,8 @@ rte_rawdev_get_attr(uint16_t dev_id,
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_get, -ENOTSUP);
> +	if (*dev->dev_ops->attr_get == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->attr_get)(dev, attr_name, attr_value);
>  }
> 
> @@ -200,7 +209,8 @@ rte_rawdev_set_attr(uint16_t dev_id,
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_set, -ENOTSUP);
> +	if (*dev->dev_ops->attr_set == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->attr_set)(dev, attr_name, attr_value);
>  }
> 
> @@ -215,7 +225,8 @@ rte_rawdev_enqueue_buffers(uint16_t dev_id,
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->enqueue_bufs, -ENOTSUP);
> +	if (*dev->dev_ops->enqueue_bufs == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->enqueue_bufs)(dev, buffers, count, context);
>  }
> 
> @@ -230,7 +241,8 @@ rte_rawdev_dequeue_buffers(uint16_t dev_id,
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dequeue_bufs, -ENOTSUP);
> +	if (*dev->dev_ops->dequeue_bufs == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->dequeue_bufs)(dev, buffers, count, context);
>  }
> 
> @@ -242,7 +254,8 @@ rte_rawdev_dump(uint16_t dev_id, FILE *f)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
> +	if (*dev->dev_ops->dump == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->dump)(dev, f);
>  }
> 
> @@ -251,7 +264,8 @@ xstats_get_count(uint16_t dev_id)
>  {
>  	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
> +	if (*dev->dev_ops->xstats_get_names == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->xstats_get_names)(dev, NULL, 0);
>  }
> 
> @@ -273,7 +287,8 @@ rte_rawdev_xstats_names_get(uint16_t dev_id,
> 
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
> +	if (*dev->dev_ops->xstats_get_names == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->xstats_get_names)(dev, xstats_names, size);
>  }
> 
> @@ -287,7 +302,8 @@ rte_rawdev_xstats_get(uint16_t dev_id,
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
>  	const struct rte_rawdev *dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get, -ENOTSUP);
> +	if (*dev->dev_ops->xstats_get == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->xstats_get)(dev, ids, values, n);
>  }
> 
> @@ -306,7 +322,8 @@ rte_rawdev_xstats_by_name_get(uint16_t dev_id,
>  		id = &temp; /* driver never gets a NULL value */
> 
>  	/* implemented by driver */
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_by_name, -ENOTSUP);
> +	if (*dev->dev_ops->xstats_get_by_name == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->xstats_get_by_name)(dev, name, id);
>  }
> 
> @@ -317,7 +334,8 @@ rte_rawdev_xstats_reset(uint16_t dev_id,
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_reset, -ENOTSUP);
> +	if (*dev->dev_ops->xstats_reset == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids);
>  }
> 
> @@ -327,7 +345,8 @@ rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_status_get, -ENOTSUP);
> +	if (*dev->dev_ops->firmware_status_get == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->firmware_status_get)(dev, status_info);
>  }
> 
> @@ -337,7 +356,8 @@ rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_version_get, -ENOTSUP);
> +	if (*dev->dev_ops->firmware_version_get == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->firmware_version_get)(dev, version_info);
>  }
> 
> @@ -350,7 +370,8 @@ rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image)
>  	if (!firmware_image)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
> +	if (*dev->dev_ops->firmware_load == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->firmware_load)(dev, firmware_image);
>  }
> 
> @@ -360,7 +381,8 @@ rte_rawdev_firmware_unload(uint16_t dev_id)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
> +	if (*dev->dev_ops->firmware_load == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->firmware_unload)(dev);
>  }
> 
> @@ -370,7 +392,8 @@ rte_rawdev_selftest(uint16_t dev_id)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
> +	if (*dev->dev_ops->dev_selftest == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->dev_selftest)(dev_id);
>  }
> 
> @@ -435,7 +458,8 @@ rte_rawdev_close(uint16_t dev_id)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
> +	if (*dev->dev_ops->dev_close == NULL)
> +		return -ENOTSUP;
>  	/* Device must be stopped before it can be closed */
>  	if (dev->started == 1) {
>  		RTE_RDEV_ERR("Device %u must be stopped before closing",
> @@ -454,7 +478,8 @@ rte_rawdev_reset(uint16_t dev_id)
>  	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_rawdevs[dev_id];
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
> +	if (*dev->dev_ops->dev_reset == NULL)
> +		return -ENOTSUP;
>  	/* Reset is not dependent on state of the device */
>  	return (*dev->dev_ops->dev_reset)(dev);
>  }
> diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
> index 02a388bc5d..caec069182 100644
> --- a/lib/regexdev/rte_regexdev.c
> +++ b/lib/regexdev/rte_regexdev.c
> @@ -189,7 +189,8 @@ regexdev_info_get(uint8_t dev_id, struct rte_regexdev_info *dev_info)
>  	if (dev_info == NULL)
>  		return -EINVAL;
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
> +	if (*dev->dev_ops->dev_info_get == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->dev_info_get)(dev, dev_info);
> 
>  }
> @@ -211,7 +212,8 @@ rte_regexdev_configure(uint8_t dev_id, const struct rte_regexdev_config *cfg)
>  	if (cfg == NULL)
>  		return -EINVAL;
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
> +	if (*dev->dev_ops->dev_configure == NULL)
> +		return -ENOTSUP;
>  	if (dev->data->dev_started) {
>  		RTE_REGEXDEV_LOG
>  			(ERR, "Dev %u must be stopped to allow configuration\n",
> @@ -301,7 +303,8 @@ rte_regexdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_qp_setup, -ENOTSUP);
> +	if (*dev->dev_ops->dev_qp_setup == NULL)
> +		return -ENOTSUP;
>  	if (dev->data->dev_started) {
>  		RTE_REGEXDEV_LOG
>  			(ERR, "Dev %u must be stopped to allow configuration\n",
> @@ -332,7 +335,8 @@ rte_regexdev_start(uint8_t dev_id)
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
> +	if (*dev->dev_ops->dev_start == NULL)
> +		return -ENOTSUP;
>  	ret = (*dev->dev_ops->dev_start)(dev);
>  	if (ret == 0)
>  		dev->data->dev_started = 1;
> @@ -346,7 +350,8 @@ rte_regexdev_stop(uint8_t dev_id)
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
> +	if (*dev->dev_ops->dev_stop == NULL)
> +		return -ENOTSUP;
>  	(*dev->dev_ops->dev_stop)(dev);
>  	dev->data->dev_started = 0;
>  	return 0;
> @@ -359,7 +364,8 @@ rte_regexdev_close(uint8_t dev_id)
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
> +	if (*dev->dev_ops->dev_close == NULL)
> +		return -ENOTSUP;
>  	(*dev->dev_ops->dev_close)(dev);
>  	dev->data->dev_started = 0;
>  	dev->state = RTE_REGEXDEV_UNUSED;
> @@ -374,7 +380,8 @@ rte_regexdev_attr_get(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_get, -ENOTSUP);
> +	if (*dev->dev_ops->dev_attr_get == NULL)
> +		return -ENOTSUP;
>  	if (attr_value == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
>  				 dev_id);
> @@ -391,7 +398,8 @@ rte_regexdev_attr_set(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_set, -ENOTSUP);
> +	if (*dev->dev_ops->dev_attr_set == NULL)
> +		return -ENOTSUP;
>  	if (attr_value == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
>  				 dev_id);
> @@ -409,7 +417,8 @@ rte_regexdev_rule_db_update(uint8_t dev_id,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_update, -ENOTSUP);
> +	if (*dev->dev_ops->dev_rule_db_update == NULL)
> +		return -ENOTSUP;
>  	if (rules == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
>  				 dev_id);
> @@ -425,8 +434,8 @@ rte_regexdev_rule_db_compile_activate(uint8_t dev_id)
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_compile_activate,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->dev_rule_db_compile_activate == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->dev_rule_db_compile_activate)(dev);
>  }
> 
> @@ -438,8 +447,8 @@ rte_regexdev_rule_db_import(uint8_t dev_id, const char *rule_db,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_import,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->dev_db_import == NULL)
> +		return -ENOTSUP;
>  	if (rule_db == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
>  				 dev_id);
> @@ -455,8 +464,8 @@ rte_regexdev_rule_db_export(uint8_t dev_id, char *rule_db)
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_export,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->dev_db_export == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->dev_db_export)(dev, rule_db);
>  }
> 
> @@ -468,8 +477,8 @@ rte_regexdev_xstats_names_get(uint8_t dev_id,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_names_get,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->dev_xstats_names_get == NULL)
> +		return -ENOTSUP;
>  	if (xstats_map == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d xstats map can't be NULL\n",
>  				 dev_id);
> @@ -486,7 +495,8 @@ rte_regexdev_xstats_get(uint8_t dev_id, const uint16_t *ids,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_get, -ENOTSUP);
> +	if (*dev->dev_ops->dev_xstats_get == NULL)
> +		return -ENOTSUP;
>  	if (ids == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
>  		return -EINVAL;
> @@ -506,8 +516,8 @@ rte_regexdev_xstats_by_name_get(uint8_t dev_id, const char *name,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_by_name_get,
> -				-ENOTSUP);
> +	if (*dev->dev_ops->dev_xstats_by_name_get == NULL)
> +		return -ENOTSUP;
>  	if (name == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d name can't be NULL\n", dev_id);
>  		return -EINVAL;
> @@ -531,7 +541,8 @@ rte_regexdev_xstats_reset(uint8_t dev_id, const uint16_t *ids,
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_reset, -ENOTSUP);
> +	if (*dev->dev_ops->dev_xstats_reset == NULL)
> +		return -ENOTSUP;
>  	if (ids == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
>  		return -EINVAL;
> @@ -546,7 +557,8 @@ rte_regexdev_selftest(uint8_t dev_id)
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
> +	if (*dev->dev_ops->dev_selftest == NULL)
> +		return -ENOTSUP;
>  	return (*dev->dev_ops->dev_selftest)(dev);
>  }
> 
> @@ -557,7 +569,8 @@ rte_regexdev_dump(uint8_t dev_id, FILE *f)
> 
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
>  	dev = &rte_regex_devices[dev_id];
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_dump, -ENOTSUP);
> +	if (*dev->dev_ops->dev_dump == NULL)
> +		return -ENOTSUP;
>  	if (f == NULL) {
>  		RTE_REGEXDEV_LOG(ERR, "Dev %d file can't be NULL\n", dev_id);
>  		return -EINVAL;
> diff --git a/lib/regexdev/rte_regexdev.h b/lib/regexdev/rte_regexdev.h
> index 3bce8090f6..6061e648b1 100644
> --- a/lib/regexdev/rte_regexdev.h
> +++ b/lib/regexdev/rte_regexdev.h
> @@ -1473,7 +1473,8 @@ rte_regexdev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
>  	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
>  #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->enqueue, -ENOTSUP);
> +	if (*dev->enqueue == NULL)
> +		return -ENOTSUP;
>  	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
>  		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
>  		return -EINVAL;
> @@ -1532,7 +1533,8 @@ rte_regexdev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
>  	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
>  #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
>  	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
> -	RTE_FUNC_PTR_OR_ERR_RET(*dev->dequeue, -ENOTSUP);
> +	if (*dev->dequeue == NULL)
> +		return -ENOTSUP;
>  	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
>  		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
>  		return -EINVAL;
> diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
> index 4f5e4b4d49..1a2a408f0e 100644
> --- a/lib/security/rte_security.c
> +++ b/lib/security/rte_security.c
> @@ -131,7 +131,8 @@ __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
>  	RTE_PTR_OR_ERR_RET(instance, -EINVAL);
>  	RTE_PTR_OR_ERR_RET(instance->ops, -EINVAL);
>  #endif
> -	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->set_pkt_metadata, -ENOTSUP);
> +	if (*instance->ops->set_pkt_metadata == NULL)
> +		return -ENOTSUP;
>  	return instance->ops->set_pkt_metadata(instance->device,
>  					       sess, m, params);
>  }
> @@ -145,7 +146,8 @@ __rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md)
>  	RTE_PTR_OR_ERR_RET(instance, NULL);
>  	RTE_PTR_OR_ERR_RET(instance->ops, NULL);
>  #endif
> -	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_userdata, NULL);
> +	if (*instance->ops->get_userdata == NULL)
> +		return NULL;
>  	if (instance->ops->get_userdata(instance->device, md, &userdata))
>  		return NULL;
> 
> diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
> index b2a2919fc0..a6ca785b29 100644
> --- a/lib/vhost/vdpa.c
> +++ b/lib/vhost/vdpa.c
> @@ -266,7 +266,8 @@ rte_vdpa_get_stats_names(struct rte_vdpa_device *dev,
>  	if (!dev)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats_names, -ENOTSUP);
> +	if (dev->ops->get_stats_names == NULL)
> +		return -ENOTSUP;
> 
>  	return dev->ops->get_stats_names(dev, stats_names, size);
>  }
> @@ -278,7 +279,8 @@ rte_vdpa_get_stats(struct rte_vdpa_device *dev, uint16_t qid,
>  	if (!dev || !stats || !n)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats, -ENOTSUP);
> +	if (dev->ops->get_stats == NULL)
> +		return -ENOTSUP;
> 
>  	return dev->ops->get_stats(dev, qid, stats, n);
>  }
> @@ -289,7 +291,8 @@ rte_vdpa_reset_stats(struct rte_vdpa_device *dev, uint16_t qid)
>  	if (!dev)
>  		return -EINVAL;
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->reset_stats, -ENOTSUP);
> +	if (dev->ops->reset_stats == NULL)
> +		return -ENOTSUP;
> 
>  	return dev->ops->reset_stats(dev, qid);
>  }
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 4ad28bac45..0ae059ad29 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -3381,8 +3381,10 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable)
>  		q_last = qid;
>  	}
> 
> -	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_vfio_device_fd, -ENOTSUP);
> -	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_notify_area, -ENOTSUP);
> +	if (vdpa_dev->ops->get_vfio_device_fd == NULL)
> +		return -ENOTSUP;
> +	if (vdpa_dev->ops->get_notify_area == NULL)
> +		return -ENOTSUP;
> 
>  	vfio_device_fd = vdpa_dev->ops->get_vfio_device_fd(vid);
>  	if (vfio_device_fd < 0)
> --
> 2.37.2


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 00/27] Bus and device cleanup for 22.11
  2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
                   ` (15 preceding siblings ...)
  2022-09-05  8:39 ` David Marchand
@ 2022-09-14  7:58 ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 01/27] devtools: forbid inclusions of driver only headers David Marchand
                     ` (27 more replies)
  16 siblings, 28 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

The rte_bus, rte_driver and rte_device objects are part of the public
ABI and this has proved to be a problem when needing to extend them.
This series hides them, and mark associated driver only API as internal.

A good amount of the patches are preparation work on rte_bus.h,
rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
between them.

PCI bus specific handling are removed from testpmd, unit tests and
examples.

After this series, driver-only API headers for registering to buses are
not exported anymore, unless the enable_driver_sdk meson option is
selected.

New accessors for rte_bus, rte_driver and rte_device have been added,
marked with an experimental tag first when introducing them, and later
in the series marked as stable since external users will want to use
those drop-in replacements right away.

A check is added to ensure we won't pollute app/ and examples/ again,
though some unit tests are left intentionnally untouched as they test
some internals of DPDK.

Changes since v5:
- fixed Windows build (bis...),

Changes since v4:
- (hopefully, because I can't test) fixed Windows build,
- dropped unneeded change in vdev unit test,

Changes since RFC v3:
- marked the series as non-RFC,
- rebased on v22.11-rc0,
- marked RTE_FUNC_PTR_* macros as deprecated,
- split the bus specific patch in two patches,

Changes since RFC v2:
- added check for additions of include .*_(driver|pmd)\.h in apps and
  examples,
- dropped legacy/debug testpmd commands to read PCI BAR0 registers,
- dropped patches on bbdev, ethdev, rawdev driver headers for now,
- reordered patches and separated changes per bus type to ease review,
- added more accessor for device,
- introduced rte_dev_bus_info to provide a Bus specific description of
  a device, a first use is for providing a PCI device vendor / device
  identifiers that are otherwise unavailable through a generic existing
  API,

Changes since RFC v1:
- added two more cleanups (new patch 3 and 4) for unit test and examples
  relying on PCI specific info,
- went on with masking rte_driver and rte_device too,


-- 
David Marchand

David Marchand (27):
  devtools: forbid inclusions of driver only headers
  common/mlx5: rework check on driver registration
  raw/ifpga: remove PCI bus accessor
  app/testpmd: drop PCI register commands
  kni: stop populating PCI info in examples
  examples/ethtool: prefer device name
  dev: hide debug messages in device iterator
  eal: deprecate RTE_FUNC_PTR_* macros
  devargs: remove dependency on bus header
  build: export drivers headers
  bus/auxiliary: make driver-only headers private
  bus/dpaa: make driver-only headers private
  bus/fslmc: make driver-only headers private
  bus/ifpga: cleanup exported symbols
  bus/ifpga: make driver-only headers private
  bus/pci: make driver-only headers private
  bus/vdev: make driver-only headers private
  bus/vmbus: make driver-only headers private
  bus: move IOVA definition from header
  bus: introduce accessors
  bus: hide bus object
  dev: introduce driver accessors
  dev: hide driver object
  dev: introduce device accessors
  dev: provide bus specific information
  bus/pci: fill bus specific information
  dev: hide device object

 app/proc-info/main.c                          |   6 +-
 app/test-compress-perf/comp_perf_options.h    |   2 +
 app/test-pmd/cmdline.c                        | 339 +-----------------
 app/test-pmd/config.c                         | 222 +-----------
 app/test-pmd/csumonly.c                       |   1 -
 app/test-pmd/flowgen.c                        |   1 -
 app/test-pmd/iofwd.c                          |   1 -
 app/test-pmd/macfwd.c                         |   1 -
 app/test-pmd/macswap.c                        |   1 -
 app/test-pmd/meson.build                      |   2 +-
 app/test-pmd/parameters.c                     |   1 -
 app/test-pmd/rxonly.c                         |   1 -
 app/test-pmd/testpmd.c                        |  12 +-
 app/test-pmd/testpmd.h                        |  72 +---
 app/test-pmd/txonly.c                         |   1 -
 app/test/test_devargs.c                       |   6 +-
 app/test/test_kni.c                           |  30 --
 app/test/test_vdev.c                          |   5 +-
 app/test/virtual_pmd.c                        |   2 +-
 devtools/checkpatches.sh                      |   8 +
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |  20 +-
 doc/guides/rel_notes/release_22_11.rst        |  19 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  81 -----
 drivers/baseband/acc100/rte_acc100_pmd.c      |   4 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   4 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/auxiliary/auxiliary_common.c      |   5 +-
 drivers/bus/auxiliary/auxiliary_params.c      |   5 +-
 ...bus_auxiliary.h => bus_auxiliary_driver.h} |  26 +-
 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 +-
 drivers/bus/dpaa/base/qbman/qman.c            |   2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     |  25 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  22 +-
 .../fslmc/{rte_fslmc.h => bus_fslmc_driver.h} |  30 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  14 +-
 drivers/bus/fslmc/fslmc_vfio.c                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   4 +-
 drivers/bus/fslmc/private.h                   |  27 ++
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}   |  18 +-
 drivers/bus/ifpga/ifpga_bus.c                 |  21 +-
 drivers/bus/ifpga/ifpga_common.c              |  88 -----
 drivers/bus/ifpga/ifpga_common.h              |  54 ++-
 drivers/bus/ifpga/meson.build                 |   4 +-
 drivers/bus/ifpga/version.map                 |   4 +-
 drivers/bus/pci/bsd/pci.c                     |  11 +-
 drivers/bus/pci/bus_pci_driver.h              | 201 +++++++++++
 drivers/bus/pci/linux/pci.c                   |  27 +-
 drivers/bus/pci/linux/pci_vfio.c              |   2 +-
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |  53 ++-
 drivers/bus/pci/pci_params.c                  |   4 +-
 drivers/bus/pci/private.h                     |  29 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +----------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   7 +-
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 -------
 drivers/bus/vdev/vdev.c                       |  12 +-
 drivers/bus/vdev/vdev_params.c                |   3 +-
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          | 106 ++++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |   1 -
 drivers/bus/vmbus/meson.build                 |   1 +
 drivers/bus/vmbus/private.h                   |  20 +-
 drivers/bus/vmbus/rte_bus_vmbus.h             | 104 ------
 drivers/bus/vmbus/version.map                 |   9 +-
 drivers/bus/vmbus/vmbus_bufring.c             |   1 -
 drivers/bus/vmbus/vmbus_channel.c             |   1 -
 drivers/bus/vmbus/vmbus_common.c              |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c          |   1 -
 drivers/common/cnxk/roc_platform.h            |   2 +-
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  12 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   4 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/mlx5_common_private.h     |   2 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |   2 +-
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |  35 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |   1 +
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |   2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   6 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   4 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |   4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c   |   2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |   4 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   8 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |   2 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_bus.c                   |   3 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dlb2/dlb2.c                     |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   4 +-
 drivers/event/dpaa/dpaa_eventdev.c            |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   4 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev.c          |   4 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   4 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   4 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/meson.build                           |   4 +
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   4 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/ark/ark_global.h                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   4 +-
 drivers/net/axgbe/axgbe_common.h              |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/base/t4_hw.c                |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   4 +-
 drivers/net/cxgbe/cxgbe_main.c                |   2 +-
 drivers/net/cxgbe/sge.c                       |   2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |   2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 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             |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |   4 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   4 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   4 +-
 drivers/net/e1000/igb_flow.c                  |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   4 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   4 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   4 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/failsafe/failsafe_eal.c           |   1 +
 drivers/net/failsafe/failsafe_private.h       |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   2 +-
 drivers/net/iavf/iavf_vchnl.c                 |   2 +-
 drivers/net/ice/ice_dcf.c                     |   2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   4 +-
 drivers/net/ipn3ke/ipn3ke_flow.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |   2 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mlx4/mlx4.c                       |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   5 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/netvsc/hn_ethdev.c                |   5 +-
 drivers/net/netvsc/hn_nvs.c                   |   4 +-
 drivers/net/netvsc/hn_rndis.c                 |   4 +-
 drivers/net/netvsc/hn_rxtx.c                  |   4 +-
 drivers/net/netvsc/hn_vf.c                    |   4 +-
 drivers/net/nfp/nfp_common.c                  |   2 +-
 drivers/net/nfp/nfp_ethdev.c                  |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   4 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/qede/qede_ethdev.h                |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   4 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/sfc/sfc_sw_stats.c                |   2 +-
 drivers/net/sfc/sfc_sw_stats.h                |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   4 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_ethdev.c            |   2 +-
 drivers/net/virtio/virtio_pci.c               |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   4 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   4 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   4 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   4 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   4 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |  21 +-
 drivers/raw/ifpga/ifpga_rawdev.h              |   1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   8 +-
 drivers/raw/ifpga/rte_pmd_ifpga.h             |  10 -
 drivers/raw/ifpga/version.map                 |   1 -
 drivers/raw/ioat/idxd_bus.c                   |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  25 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   4 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 examples/ethtool/lib/rte_ethtool.c            |  17 +-
 examples/ip_pipeline/kni.c                    |  10 -
 examples/l3fwd/l3fwd_em.c                     |   4 +-
 examples/l3fwd/l3fwd_fib.c                    |   8 +-
 examples/l3fwd/l3fwd_lpm.c                    |   4 +-
 examples/multi_process/hotplug_mp/commands.c  |   6 +-
 examples/vdpa/main.c                          |  16 +-
 lib/compressdev/rte_compressdev.c             |  48 ++-
 lib/compressdev/rte_compressdev_pmd.c         |   1 +
 lib/compressdev/rte_compressdev_pmd.h         |   1 +
 lib/cryptodev/cryptodev_pmd.c                 |   2 +
 lib/cryptodev/cryptodev_pmd.h                 |   1 +
 lib/cryptodev/rte_cryptodev.c                 |  45 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/dmadev/rte_dmadev_pmd.h                   |   2 +-
 lib/eal/common/eal_common_bus.c               |  28 +-
 lib/eal/common/eal_common_dev.c               |  53 ++-
 lib/eal/common/eal_common_devargs.c           |   2 +-
 lib/eal/common/eal_private.h                  |   2 +-
 lib/eal/common/eal_thread.h                   |   1 +
 lib/eal/common/hotplug_mp.c                   |   1 +
 lib/eal/include/bus_driver.h                  | 296 +++++++++++++++
 lib/eal/include/dev_driver.h                  |  41 +++
 lib/eal/include/meson.build                   |   5 +
 lib/eal/include/rte_bus.h                     | 290 +--------------
 lib/eal/include/rte_dev.h                     | 104 ++++--
 lib/eal/include/rte_devargs.h                 |   4 +-
 lib/eal/include/rte_eal.h                     |  15 +-
 lib/eal/include/rte_lcore.h                   |   2 +
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/version.map                           |  12 +-
 lib/eal/windows/eal.c                         |   1 +
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_driver.h                    |   1 +
 lib/ethdev/ethdev_pci.h                       |   5 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/ethdev/rte_ethdev.c                       | 277 +++++++++-----
 lib/ethdev/rte_ethdev.h                       |  11 +-
 lib/eventdev/eventdev_pmd.h                   |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  12 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  15 +-
 lib/eventdev/rte_eventdev.c                   |  64 ++--
 lib/gpudev/gpudev_driver.h                    |   2 +-
 lib/mempool/rte_mempool_ops.c                 |   5 +-
 lib/pcapng/rte_pcapng.c                       |   3 +-
 lib/rawdev/rte_rawdev.c                       |  77 ++--
 lib/rawdev/rte_rawdev_pmd.h                   |   2 +-
 lib/regexdev/rte_regexdev.c                   |  59 +--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   8 +-
 lib/vhost/vdpa.c                              |  10 +-
 lib/vhost/vhost_user.c                        |   6 +-
 367 files changed, 2226 insertions(+), 2490 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci
 rename drivers/bus/auxiliary/{rte_bus_auxiliary.h => bus_auxiliary_driver.h} (90%)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)
 rename drivers/bus/fslmc/{rte_fslmc.h => bus_fslmc_driver.h} (88%)
 create mode 100644 drivers/bus/fslmc/private.h
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c
 create mode 100644 drivers/bus/pci/bus_pci_driver.h
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h
 create mode 100644 lib/eal/include/bus_driver.h
 create mode 100644 lib/eal/include/dev_driver.h

-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 01/27] devtools: forbid inclusions of driver only headers
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 02/27] common/mlx5: rework check on driver registration David Marchand
                     ` (26 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Let's be good citizens and enforce not using driver only headers in our
own examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 1edc5810ad..0e82c01947 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -142,6 +142,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid inclusion of driver specific headers in apps and examples
+	awk -v FOLDERS='app examples' \
+		-v EXPRESSIONS='include.*_driver\\.h include.*_pmd\\.h' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using driver specific headers in applications' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# SVG must be included with wildcard extension to allow conversion
 	awk -v FOLDERS='doc' \
 		-v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 02/27] common/mlx5: rework check on driver registration
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  2022-09-14  7:58   ` [PATCH v6 01/27] devtools: forbid inclusions of driver only headers David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor David Marchand
                     ` (25 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Matan Azrad, Viacheslav Ovsiienko

Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@ static struct rte_auxiliary_driver mlx5_auxiliary_driver = {
 	.dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-	if (mlx5_auxiliary_driver.bus == NULL)
+	if (!mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_register(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = true;
+	}
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-	if (mlx5_auxiliary_driver.bus != NULL)
+	if (mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = false;
+	}
 }
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  2022-09-14  7:58   ` [PATCH v6 01/27] devtools: forbid inclusions of driver only headers David Marchand
  2022-09-14  7:58   ` [PATCH v6 02/27] common/mlx5: rework check on driver registration David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 04/27] app/testpmd: drop PCI register commands David Marchand
                     ` (24 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:
- updated release notes,

---
 doc/guides/rel_notes/deprecation.rst   |  3 ---
 doc/guides/rel_notes/release_22_11.rst |  2 ++
 drivers/raw/ifpga/ifpga_rawdev.c       |  7 +------
 drivers/raw/ifpga/ifpga_rawdev.h       |  1 -
 drivers/raw/ifpga/rte_pmd_ifpga.c      |  6 ------
 drivers/raw/ifpga/rte_pmd_ifpga.h      | 10 ----------
 drivers/raw/ifpga/version.map          |  1 -
 7 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index e7583cae4c..dba252067c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -228,9 +228,6 @@ Deprecation Notices
 * raw/dpaa2_cmdif: The ``dpaa2_cmdif`` rawdev driver will be deprecated
   in DPDK 22.11, as it is no longer in use, no active user known.
 
-* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` will be removed
-  in DPDK 22.11.
-
 * raw/ioat: The ``ioat`` rawdev driver has been deprecated, since it's
   functionality is provided through the new ``dmadev`` infrastructure.
   To continue to use hardware previously supported by the ``ioat`` rawdev driver,
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..3cea3aa8eb 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
+
 
 ABI Changes
 -----------
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8c05302a65..78a7123528 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
@@ -1888,11 +1888,6 @@ RTE_PMD_REGISTER_PARAM_STRING(ifpga_rawdev_cfg,
 	"port=<int> "
 	"afu_bts=<path>");
 
-struct rte_pci_bus *ifpga_get_pci_bus(void)
-{
-	return rte_ifpga_rawdev_pmd.bus;
-}
-
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file)
 {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 4c191190ca..0fb66cbaae 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -91,7 +91,6 @@ int
 ifpga_unregister_msix_irq(struct ifpga_rawdev *dev, enum ifpga_irq_type type,
 		int vec_start, rte_intr_callback_fn handler, void *arg);
 
-struct rte_pci_bus *ifpga_get_pci_bus(void);
 int ifpga_rawdev_partial_reconfigure(struct rte_rawdev *dev, int port,
 	const char *file);
 void ifpga_rawdev_cleanup(void);
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 23146432c2..1ca248123b 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -402,12 +402,6 @@ rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page)
 	return opae_mgr_reload(adapter->mgr, type, page);
 }
 
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void)
-{
-	return ifpga_get_pci_bus();
-}
-
 int
 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file)
 {
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.h b/drivers/raw/ifpga/rte_pmd_ifpga.h
index 3fa5d3435a..791543f2cd 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.h
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.h
@@ -220,16 +220,6 @@ rte_pmd_ifpga_reboot_try(uint16_t dev_id);
 int
 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
 
-/**
- * Get PCI bus the Intel FPGA driver register to
- *
- * @return
- *   - (valid pointer) if successful.
- *   - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
- */
-const struct rte_pci_bus *
-rte_pmd_ifpga_get_pci_bus(void);
-
 /**
  * Perform PR (partial reconfiguration) on specified Intel FPGA device
  *
diff --git a/drivers/raw/ifpga/version.map b/drivers/raw/ifpga/version.map
index f5c3959b7f..916da8a4f2 100644
--- a/drivers/raw/ifpga/version.map
+++ b/drivers/raw/ifpga/version.map
@@ -3,7 +3,6 @@ DPDK_23 {
 
 	rte_pmd_ifpga_cleanup;
 	rte_pmd_ifpga_get_dev_id;
-	rte_pmd_ifpga_get_pci_bus;
 	rte_pmd_ifpga_get_phy_info;
 	rte_pmd_ifpga_get_property;
 	rte_pmd_ifpga_get_rsu_status;
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 04/27] app/testpmd: drop PCI register commands
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (2 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 05/27] kni: stop populating PCI info in examples David Marchand
                     ` (23 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang

Those commands date back to the early stages of DPDK when only PCI
devices were supported.
At the time, developers may have used those commands to help in
debugging their buggy^Wwork in progress drivers.

Removing them, we can drop the dependency on the PCI bus and library and
make testpmd bus agnostic.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/cmdline.c                      | 339 +-------------------
 app/test-pmd/config.c                       | 195 -----------
 app/test-pmd/csumonly.c                     |   1 -
 app/test-pmd/flowgen.c                      |   1 -
 app/test-pmd/iofwd.c                        |   1 -
 app/test-pmd/macfwd.c                       |   1 -
 app/test-pmd/macswap.c                      |   1 -
 app/test-pmd/meson.build                    |   2 +-
 app/test-pmd/parameters.c                   |   1 -
 app/test-pmd/rxonly.c                       |   1 -
 app/test-pmd/testpmd.c                      |   1 -
 app/test-pmd/testpmd.h                      |  72 +----
 app/test-pmd/txonly.c                       |   1 -
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  81 -----
 14 files changed, 4 insertions(+), 694 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b4fe9dfb17..4697b7c494 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -28,7 +28,6 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -89,7 +88,6 @@ static void cmd_help_brief_parsed(__rte_unused void *parsed_result,
 		"information.\n"
 		"    help config                     : Configuration information.\n"
 		"    help ports                      : Configuring ports.\n"
-		"    help registers                  : Reading and setting port registers.\n"
 		"    help filters                    : Filters configuration help.\n"
 		"    help traffic_management         : Traffic Management commands.\n"
 		"    help devices                    : Device related commands.\n"
@@ -799,34 +797,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 		);
 	}
 
-	if (show_all || !strcmp(res->section, "registers")) {
-
-		cmdline_printf(
-			cl,
-			"\n"
-			"Registers:\n"
-			"----------\n\n"
-
-			"read reg (port_id) (address)\n"
-			"    Display value of a port register.\n\n"
-
-			"read regfield (port_id) (address) (bit_x) (bit_y)\n"
-			"    Display a port register bit field.\n\n"
-
-			"read regbit (port_id) (address) (bit_x)\n"
-			"    Display a single port register bit.\n\n"
-
-			"write reg (port_id) (address) (value)\n"
-			"    Set value of a port register.\n\n"
-
-			"write regfield (port_id) (address) (bit_x) (bit_y)"
-			" (value)\n"
-			"    Set bit field of a port register.\n\n"
-
-			"write regbit (port_id) (address) (bit_x) (value)\n"
-			"    Set single bit value of a port register.\n\n"
-		);
-	}
 	if (show_all || !strcmp(res->section, "filters")) {
 
 		cmdline_printf(
@@ -1077,13 +1047,13 @@ static cmdline_parse_token_string_t cmd_help_long_help =
 
 static cmdline_parse_token_string_t cmd_help_long_section =
 	TOKEN_STRING_INITIALIZER(struct cmd_help_long_result, section,
-		"all#control#display#config#ports#registers#"
+		"all#control#display#config#ports#"
 		"filters#traffic_management#devices#drivers");
 
 static cmdline_parse_inst_t cmd_help_long = {
 	.f = cmd_help_long_parsed,
 	.data = NULL,
-	.help_str = "help all|control|display|config|ports|register|"
+	.help_str = "help all|control|display|config|ports|"
 		"filters|traffic_management|devices|drivers: "
 		"Show help",
 	.tokens = {
@@ -7390,305 +7360,6 @@ static cmdline_parse_inst_t cmd_showfwdall = {
 	},
 };
 
-/* *** READ PORT REGISTER *** */
-struct cmd_read_reg_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-};
-
-static void
-cmd_read_reg_parsed(void *parsed_result,
-		    __rte_unused struct cmdline *cl,
-		    __rte_unused void *data)
-{
-	struct cmd_read_reg_result *res = parsed_result;
-	port_reg_display(res->port_id, res->reg_off);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_read_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, reg_off, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_read_reg = {
-	.f = cmd_read_reg_parsed,
-	.data = NULL,
-	.help_str = "read reg <port_id> <reg_off>",
-	.tokens = {
-		(void *)&cmd_read_reg_read,
-		(void *)&cmd_read_reg_reg,
-		(void *)&cmd_read_reg_port_id,
-		(void *)&cmd_read_reg_reg_off,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT FIELD *** */
-struct cmd_read_reg_bit_field_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-};
-
-static void
-cmd_read_reg_bit_field_parsed(void *parsed_result,
-			      __rte_unused struct cmdline *cl,
-			      __rte_unused void *data)
-{
-	struct cmd_read_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_display(res->port_id, res->reg_off,
-				   res->bit1_pos, res->bit2_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result, read,
-				 "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_read_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit_field = {
-	.f = cmd_read_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "read regfield <port_id> <reg_off> <bit_x> <bit_y>: "
-	"Read register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_field_read,
-		(void *)&cmd_read_reg_bit_field_regfield,
-		(void *)&cmd_read_reg_bit_field_port_id,
-		(void *)&cmd_read_reg_bit_field_reg_off,
-		(void *)&cmd_read_reg_bit_field_bit1_pos,
-		(void *)&cmd_read_reg_bit_field_bit2_pos,
-		NULL,
-	},
-};
-
-/* *** READ PORT REGISTER BIT *** */
-struct cmd_read_reg_bit_result {
-	cmdline_fixed_string_t read;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-};
-
-static void
-cmd_read_reg_bit_parsed(void *parsed_result,
-			__rte_unused struct cmdline *cl,
-			__rte_unused void *data)
-{
-	struct cmd_read_reg_bit_result *res = parsed_result;
-	port_reg_bit_display(res->port_id, res->reg_off, res->bit_pos);
-}
-
-static cmdline_parse_token_string_t cmd_read_reg_bit_read =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result, read, "read");
-static cmdline_parse_token_string_t cmd_read_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_read_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_read_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_read_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_read_reg_bit = {
-	.f = cmd_read_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "read regbit <port_id> <reg_off> <bit_x>: 0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_read_reg_bit_read,
-		(void *)&cmd_read_reg_bit_regbit,
-		(void *)&cmd_read_reg_bit_port_id,
-		(void *)&cmd_read_reg_bit_reg_off,
-		(void *)&cmd_read_reg_bit_bit_pos,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER *** */
-struct cmd_write_reg_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t reg;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_parsed(void *parsed_result,
-		     __rte_unused struct cmdline *cl,
-		     __rte_unused void *data)
-{
-	struct cmd_write_reg_result *res = parsed_result;
-	port_reg_set(res->port_id, res->reg_off, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, write, "write");
-static cmdline_parse_token_string_t cmd_write_reg_reg =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, reg, "reg");
-static cmdline_parse_token_num_t cmd_write_reg_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, reg_off, RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, value, RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg = {
-	.f = cmd_write_reg_parsed,
-	.data = NULL,
-	.help_str = "write reg <port_id> <reg_off> <reg_value>",
-	.tokens = {
-		(void *)&cmd_write_reg_write,
-		(void *)&cmd_write_reg_reg,
-		(void *)&cmd_write_reg_port_id,
-		(void *)&cmd_write_reg_reg_off,
-		(void *)&cmd_write_reg_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT FIELD *** */
-struct cmd_write_reg_bit_field_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regfield;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit1_pos;
-	uint8_t bit2_pos;
-	uint32_t value;
-};
-
-static void
-cmd_write_reg_bit_field_parsed(void *parsed_result,
-			       __rte_unused struct cmdline *cl,
-			       __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_field_result *res = parsed_result;
-	port_reg_bit_field_set(res->port_id, res->reg_off,
-			  res->bit1_pos, res->bit2_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_field_regfield =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result,
-				 regfield, "regfield");
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, port_id,
-			      RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, reg_off,
-			      RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit1_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit1_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_bit2_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit2_pos,
-			      RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_field_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, value,
-			      RTE_UINT32);
-
-static cmdline_parse_inst_t cmd_write_reg_bit_field = {
-	.f = cmd_write_reg_bit_field_parsed,
-	.data = NULL,
-	.help_str = "write regfield <port_id> <reg_off> <bit_x> <bit_y> "
-		"<reg_value>: "
-		"Set register bit field between bit_x and bit_y included",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_field_write,
-		(void *)&cmd_write_reg_bit_field_regfield,
-		(void *)&cmd_write_reg_bit_field_port_id,
-		(void *)&cmd_write_reg_bit_field_reg_off,
-		(void *)&cmd_write_reg_bit_field_bit1_pos,
-		(void *)&cmd_write_reg_bit_field_bit2_pos,
-		(void *)&cmd_write_reg_bit_field_value,
-		NULL,
-	},
-};
-
-/* *** WRITE PORT REGISTER BIT *** */
-struct cmd_write_reg_bit_result {
-	cmdline_fixed_string_t write;
-	cmdline_fixed_string_t regbit;
-	portid_t port_id;
-	uint32_t reg_off;
-	uint8_t bit_pos;
-	uint8_t value;
-};
-
-static void
-cmd_write_reg_bit_parsed(void *parsed_result,
-			 __rte_unused struct cmdline *cl,
-			 __rte_unused void *data)
-{
-	struct cmd_write_reg_bit_result *res = parsed_result;
-	port_reg_bit_set(res->port_id, res->reg_off, res->bit_pos, res->value);
-}
-
-static cmdline_parse_token_string_t cmd_write_reg_bit_write =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result, write,
-				 "write");
-static cmdline_parse_token_string_t cmd_write_reg_bit_regbit =
-	TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result,
-				 regbit, "regbit");
-static cmdline_parse_token_num_t cmd_write_reg_bit_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, port_id,
-				 RTE_UINT16);
-static cmdline_parse_token_num_t cmd_write_reg_bit_reg_off =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, reg_off,
-				 RTE_UINT32);
-static cmdline_parse_token_num_t cmd_write_reg_bit_bit_pos =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, bit_pos,
-				 RTE_UINT8);
-static cmdline_parse_token_num_t cmd_write_reg_bit_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, value,
-				 RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_write_reg_bit = {
-	.f = cmd_write_reg_bit_parsed,
-	.data = NULL,
-	.help_str = "write regbit <port_id> <reg_off> <bit_x> 0|1: "
-		"0 <= bit_x <= 31",
-	.tokens = {
-		(void *)&cmd_write_reg_bit_write,
-		(void *)&cmd_write_reg_bit_regbit,
-		(void *)&cmd_write_reg_bit_port_id,
-		(void *)&cmd_write_reg_bit_reg_off,
-		(void *)&cmd_write_reg_bit_bit_pos,
-		(void *)&cmd_write_reg_bit_value,
-		NULL,
-	},
-};
-
 /* *** READ A RING DESCRIPTOR OF A PORT RX/TX QUEUE *** */
 struct cmd_read_rxd_txd_result {
 	cmdline_fixed_string_t read;
@@ -14222,12 +13893,6 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_queue_priority_flow_control_set,
 	(cmdline_parse_inst_t *)&cmd_config_dcb,
-	(cmdline_parse_inst_t *)&cmd_read_reg,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_read_reg_bit,
-	(cmdline_parse_inst_t *)&cmd_write_reg,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit_field,
-	(cmdline_parse_inst_t *)&cmd_write_reg_bit,
 	(cmdline_parse_inst_t *)&cmd_read_rxd_txd,
 	(cmdline_parse_inst_t *)&cmd_stop,
 	(cmdline_parse_inst_t *)&cmd_mac_addr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a2939867c4..3a53b616d8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -31,7 +31,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
@@ -1138,200 +1137,6 @@ vlan_id_is_invalid(uint16_t vlan_id)
 	return 1;
 }
 
-static int
-port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	uint64_t pci_len;
-
-	if (reg_off & 0x3) {
-		fprintf(stderr,
-			"Port register offset 0x%X not aligned on a 4-byte boundary\n",
-			(unsigned int)reg_off);
-		return 1;
-	}
-
-	if (!ports[port_id].dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 1;
-	}
-
-	pci_len = pci_dev->mem_resource[0].len;
-	if (reg_off >= pci_len) {
-		fprintf(stderr,
-			"Port %d: register offset %u (0x%X) out of port PCI resource (length=%"PRIu64")\n",
-			port_id, (unsigned int)reg_off, (unsigned int)reg_off,
-			pci_len);
-		return 1;
-	}
-	return 0;
-}
-
-static int
-reg_bit_pos_is_invalid(uint8_t bit_pos)
-{
-	if (bit_pos <= 31)
-		return 0;
-	fprintf(stderr, "Invalid bit position %d (must be <= 31)\n", bit_pos);
-	return 1;
-}
-
-#define display_port_and_reg_off(port_id, reg_off) \
-	printf("port %d PCI register at offset 0x%X: ", (port_id), (reg_off))
-
-static inline void
-display_port_reg_value(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("0x%08X (%u)\n", (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x)
-{
-	uint32_t reg_v;
-
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_x))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bit %d=%d\n", bit_x, (int) ((reg_v & (1 << bit_x)) >> bit_x));
-}
-
-void
-port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-			   uint8_t bit1_pos, uint8_t bit2_pos)
-{
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v >>= l_bit;
-	if (h_bit < 31)
-		reg_v &= ((1 << (h_bit - l_bit + 1)) - 1);
-	display_port_and_reg_off(port_id, (unsigned)reg_off);
-	printf("bits[%d, %d]=0x%0*X (%u)\n", l_bit, h_bit,
-	       ((h_bit - l_bit) / 4) + 1, (unsigned)reg_v, (unsigned)reg_v);
-}
-
-void
-port_reg_display(portid_t port_id, uint32_t reg_off)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		 uint8_t bit_v)
-{
-	uint32_t reg_v;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit_pos))
-		return;
-	if (bit_v > 1) {
-		fprintf(stderr, "Invalid bit value %d (must be 0 or 1)\n",
-			(int) bit_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	if (bit_v == 0)
-		reg_v &= ~(1 << bit_pos);
-	else
-		reg_v |= (1 << bit_pos);
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-		       uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value)
-{
-	uint32_t max_v;
-	uint32_t reg_v;
-	uint8_t  l_bit;
-	uint8_t  h_bit;
-
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	if (reg_bit_pos_is_invalid(bit1_pos))
-		return;
-	if (reg_bit_pos_is_invalid(bit2_pos))
-		return;
-	if (bit1_pos > bit2_pos)
-		l_bit = bit2_pos, h_bit = bit1_pos;
-	else
-		l_bit = bit1_pos, h_bit = bit2_pos;
-
-	if ((h_bit - l_bit) < 31)
-		max_v = (1 << (h_bit - l_bit + 1)) - 1;
-	else
-		max_v = 0xFFFFFFFF;
-
-	if (value > max_v) {
-		fprintf(stderr, "Invalid value %u (0x%x) must be < %u (0x%x)\n",
-				(unsigned)value, (unsigned)value,
-				(unsigned)max_v, (unsigned)max_v);
-		return;
-	}
-	reg_v = port_id_pci_reg_read(port_id, reg_off);
-	reg_v &= ~(max_v << l_bit); /* Keep unchanged bits */
-	reg_v |= (value << l_bit); /* Set changed bits */
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
-void
-port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
-{
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
-	if (port_reg_off_is_invalid(port_id, reg_off))
-		return;
-	port_id_pci_reg_write(port_id, reg_off, reg_v);
-	display_port_reg_value(port_id, reg_off, reg_v);
-}
-
 static uint32_t
 eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
 {
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 1a3fd9ce8a..144f28819c 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 1e01120ae9..fd6abc0f41 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c
index 71849aaf96..8fafdec548 100644
--- a/app/test-pmd/iofwd.c
+++ b/app/test-pmd/iofwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index 79c9241d00..beb220fbb4 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index acb0fd7fb4..4f8deb3382 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 74399178dd..8488efc138 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON')
     ext_deps += jansson_dep
 endif
 
-deps += ['ethdev', 'cmdline', 'bus_pci']
+deps += ['ethdev', 'cmdline']
 if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
     deps += 'crypto_scheduler'
 endif
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e3c9757f3f..c77624302f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -33,7 +33,6 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 04457010f4..d528d4f34e 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index addcbcac85..ee686393c5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -42,7 +42,6 @@
 #include <rte_mbuf.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_dev.h>
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index fb2f5195d3..e4ba7147a3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -7,8 +7,6 @@
 
 #include <stdbool.h>
 
-#include <rte_pci.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
@@ -267,7 +265,7 @@ struct port_txqueue {
  * The data structure associated with each port.
  */
 struct rte_port {
-	struct rte_eth_dev_info dev_info;   /**< PCI info + driver name */
+	struct rte_eth_dev_info dev_info;   /**< Device info + driver name */
 	struct rte_eth_conf     dev_conf;   /**< Port configuration. */
 	struct rte_ether_addr       eth_addr;   /**< Port ethernet address */
 	struct rte_eth_stats    stats;      /**< Last port statistics */
@@ -801,65 +799,6 @@ mbuf_pool_find(unsigned int sock_id, uint16_t idx)
 	return rte_mempool_lookup((const char *)pool_name);
 }
 
-/**
- * Read/Write operations on a PCI register of a port.
- */
-static inline uint32_t
-port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-	uint32_t reg_v;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return 0;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return 0;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	reg_v = *((volatile uint32_t *)reg_addr);
-	return rte_le_to_cpu_32(reg_v);
-}
-
-#define port_id_pci_reg_read(pt_id, reg_off) \
-	port_pci_reg_read(&ports[(pt_id)], (reg_off))
-
-static inline void
-port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
-{
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
-	void *reg_addr;
-
-	if (!port->dev_info.device) {
-		fprintf(stderr, "Invalid device\n");
-		return;
-	}
-
-	bus = rte_bus_find_by_device(port->dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
-	} else {
-		fprintf(stderr, "Not a PCI device\n");
-		return;
-	}
-
-	reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
-	*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
-}
-
-#define port_id_pci_reg_write(pt_id, reg_off, reg_value) \
-	port_pci_reg_write(&ports[(pt_id)], (reg_off), (reg_value))
-
 static inline void
 get_start_cycles(uint64_t *start_tsc)
 {
@@ -922,15 +861,6 @@ void update_fwd_ports(portid_t new_pid);
 void set_fwd_eth_peer(portid_t port_id, char *peer_addr);
 
 void port_mtu_set(portid_t port_id, uint16_t mtu);
-void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos);
-void port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
-		      uint8_t bit_v);
-void port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
-				uint8_t bit1_pos, uint8_t bit2_pos);
-void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
-			    uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
-void port_reg_display(portid_t port_id, uint32_t reg_off);
-void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
 int port_action_handle_create(portid_t port_id, uint32_t id,
 			      const struct rte_flow_indir_action_conf *conf,
 			      const struct rte_flow_action *action);
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index e1bc78b73d..021624952d 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -28,7 +28,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ip.h>
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 330e34427d..7dacd6fb04 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -55,7 +55,6 @@ These are divided into sections and can be accessed using help, help section or
            help display                    : Displaying port, stats and config information.
            help config                     : Configuration information.
            help ports                      : Configuring ports.
-           help registers                  : Reading and setting port registers.
            help filters                    : Filters configuration help.
            help traffic_management         : Traffic Management commands.
            help devices                    : Device related commands.
@@ -2356,86 +2355,6 @@ manage link bonding devices from within testpmd interactive prompt.
 
 See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information.
 
-Register Functions
-------------------
-
-The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
-This is mainly useful for debugging purposes.
-Reference should be made to the appropriate datasheet for the network card for details on the register addresses
-and fields that can be accessed.
-
-read reg
-~~~~~~~~
-
-Display the value of a port register::
-
-   testpmd> read reg (port_id) (address)
-
-For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
-
-   testpmd> read reg 0 0xEE00
-   port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
-
-read regfield
-~~~~~~~~~~~~~
-
-Display a port register bit field::
-
-   testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
-
-For example, reading the lowest two bits from the register in the example above::
-
-   testpmd> read regfield 0 0xEE00 0 1
-   port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
-
-read regbit
-~~~~~~~~~~~
-
-Display a single port register bit::
-
-   testpmd> read regbit (port_id) (address) (bit_x)
-
-For example, reading the lowest bit from the register in the example above::
-
-   testpmd> read regbit 0 0xEE00 0
-   port 0 PCI register at offset 0xEE00: bit 0=1
-
-write reg
-~~~~~~~~~
-
-Set the value of a port register::
-
-   testpmd> write reg (port_id) (address) (value)
-
-For example, to clear a register::
-
-   testpmd> write reg 0 0xEE00 0x0
-   port 0 PCI register at offset 0xEE00: 0x00000000 (0)
-
-write regfield
-~~~~~~~~~~~~~~
-
-Set bit field of a port register::
-
-   testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
-
-For example, writing to the register cleared in the example above::
-
-   testpmd> write regfield 0 0xEE00 0 1 2
-   port 0 PCI register at offset 0xEE00: 0x00000002 (2)
-
-write regbit
-~~~~~~~~~~~~
-
-Set single bit value of a port register::
-
-   testpmd> write regbit (port_id) (address) (bit_x) (value)
-
-For example, to set the high bit in the register from the example above::
-
-   testpmd> write regbit 0 0xEE00 31 1
-   port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
-
 Traffic Metering and Policing
 -----------------------------
 
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 05/27] kni: stop populating PCI info in examples
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (3 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 04/27] app/testpmd: drop PCI register commands David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 06/27] examples/ethtool: prefer device name David Marchand
                     ` (22 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Cristian Dumitrescu

addr and id fields are deprecated and are not used in the kni library.
Stop populating them in the in-tree examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_kni.c        | 30 ------------------------------
 examples/ip_pipeline/kni.c | 10 ----------
 2 files changed, 40 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 622315c8b1..4039da0b08 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -25,7 +25,6 @@ test_kni(void)
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
@@ -426,8 +425,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 
 	if (!mp)
 		return -1;
@@ -443,13 +440,6 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
 
 	/* core id 1 configured for kernel thread */
@@ -545,8 +535,6 @@ test_kni(void)
 	struct rte_kni_conf conf;
 	struct rte_eth_dev_info info;
 	struct rte_kni_ops ops;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus;
 	FILE *fd;
 	DIR *dir;
 	char buf[16];
@@ -645,15 +633,6 @@ test_kni(void)
 		return -1;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
@@ -689,15 +668,6 @@ test_kni(void)
 		goto fail;
 	}
 
-	if (info.device)
-		bus = rte_bus_find_by_device(info.device);
-	else
-		bus = NULL;
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(info.device);
-		conf.addr = pci_dev->addr;
-		conf.id = pci_dev->id;
-	}
 	conf.group_id = port_id;
 	conf.mbuf_size = MAX_PACKET_SZ;
 
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index a2d3331cb0..cd02c39478 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include <rte_ethdev.h>
-#include <rte_bus_pci.h>
 #include <rte_string_fns.h>
 
 #include "kni.h"
@@ -107,8 +106,6 @@ kni_create(const char *name, struct kni_params *params)
 	struct mempool *mempool;
 	struct link *link;
 	struct rte_kni *k;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int ret;
 
 	/* Check input params */
@@ -134,13 +131,6 @@ kni_create(const char *name, struct kni_params *params)
 	kni_conf.core_id = params->thread_id;
 	kni_conf.group_id = link->port_id;
 	kni_conf.mbuf_size = mempool->buffer_size;
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		kni_conf.addr = pci_dev->addr;
-		kni_conf.id = pci_dev->id;
-	}
 
 	memset(&kni_ops, 0, sizeof(kni_ops));
 	kni_ops.port_id = link->port_id;
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 06/27] examples/ethtool: prefer device name
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (4 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 05/27] kni: stop populating PCI info in examples David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 07/27] dev: hide debug messages in device iterator David Marchand
                     ` (21 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Rely on the generic device name rather than restrict to only supporting
PCI devices.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/ethtool/lib/rte_ethtool.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index ffaad96498..88dc917b73 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -8,7 +8,6 @@
 #include <rte_version.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
 #ifdef RTE_NET_IXGBE
 #include <rte_pmd_ixgbe.h>
 #endif
@@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 {
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
-	const struct rte_pci_device *pci_dev;
-	const struct rte_bus *bus = NULL;
 	int n;
 	int ret;
 
@@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	/* TODO: replace bus_info by rte_devargs.name */
-	if (dev_info.device)
-		bus = rte_bus_find_by_device(dev_info.device);
-	if (bus && !strcmp(bus->name, "pci")) {
-		pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
-			"%04x:%02x:%02x.%x",
-			pci_dev->addr.domain, pci_dev->addr.bus,
-			pci_dev->addr.devid, pci_dev->addr.function);
-	} else {
-		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
-	}
+	strlcpy(drvinfo->bus_info, dev_info.device->name,
+		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
 	rte_eth_dev_get_reg_info(port_id, &reg_info);
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 07/27] dev: hide debug messages in device iterator
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (5 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 06/27] examples/ethtool: prefer device name David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
                     ` (20 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang

For any bus that does not support device iteration, rte_dev_iterator_init
both returned an error code and logged an error message.
An application (like testpmd) that only wants to list devices, would have
no choice but to inspect a bus object to avoid spewing error logs.

Make those log messages debug level, and remove the check in testpmd.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/config.c           | 4 ----
 lib/eal/common/eal_common_dev.c | 7 +++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3a53b616d8..bc73819183 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -641,10 +641,6 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		/* Skip buses that don't have iterate method */
-		if (!next->dev_iterate)
-			continue;
-
 		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 9d913e5478..b6f0392f30 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -592,18 +592,17 @@ rte_dev_iterator_init(struct rte_dev_iterator *it,
 	 * one layer specified.
 	 */
 	if (bus == NULL && cls == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Either bus or class must be specified.\n");
+		RTE_LOG(DEBUG, EAL, "Either bus or class must be specified.\n");
 		rte_errno = EINVAL;
 		goto get_out;
 	}
 	if (bus != NULL && bus->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Bus %s not supported\n", bus->name);
+		RTE_LOG(DEBUG, EAL, "Bus %s not supported\n", bus->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
 	if (cls != NULL && cls->dev_iterate == NULL) {
-		RTE_LOG(ERR, EAL, "Class %s not supported\n", cls->name);
+		RTE_LOG(DEBUG, EAL, "Class %s not supported\n", cls->name);
 		rte_errno = ENOTSUP;
 		goto get_out;
 	}
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (6 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 07/27] dev: hide debug messages in device iterator David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-10-26  9:04     ` Morten Brørup
  2022-09-14  7:58   ` [PATCH v6 09/27] devargs: remove dependency on bus header David Marchand
                     ` (19 subsequent siblings)
  27 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Fan Zhang, Ashish Gupta,
	Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Rosen Xu, Tianfei zhang,
	Sachin Saxena, Hemant Agrawal, Akhil Goyal, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Abhinandan Gujjar,
	Jerin Jacob, Jay Jayatheerthan, Olivier Matz, Ori Kam,
	Maxime Coquelin, Chenbo Xia

Those macros have no real value and are easily replaced with a simple
if() block.

Existing users have been converted using a new cocci script.
Deprecate them.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/cocci/func_or_ret.cocci              |  12 +
 doc/guides/rel_notes/deprecation.rst          |   4 +
 doc/guides/rel_notes/release_22_11.rst        |   4 +
 drivers/common/qat/qat_device.c               |   8 +-
 drivers/common/qat/qat_qp.c                   |  31 +-
 drivers/compress/qat/qat_comp_pmd.c           |   4 +-
 .../scheduler/rte_cryptodev_scheduler.c       |   6 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |   6 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.c             |   3 +-
 drivers/net/liquidio/lio_ethdev.c             |   3 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   6 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  21 +-
 lib/compressdev/rte_compressdev.c             |  47 +--
 lib/cryptodev/rte_cryptodev.c                 |  43 ++-
 lib/dmadev/rte_dmadev.c                       |  21 +-
 lib/dmadev/rte_dmadev.h                       |  21 +-
 lib/eal/include/rte_dev.h                     |   7 +-
 lib/ethdev/ethdev_driver.c                    |  18 +-
 lib/ethdev/ethdev_pci.h                       |   3 +-
 lib/ethdev/rte_ethdev.c                       | 276 ++++++++++++------
 lib/ethdev/rte_ethdev.h                       |   9 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  10 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  13 +-
 lib/eventdev/rte_eventdev.c                   |  62 ++--
 lib/mempool/rte_mempool_ops.c                 |   3 +-
 lib/rawdev/rte_rawdev.c                       |  75 +++--
 lib/regexdev/rte_regexdev.c                   |  59 ++--
 lib/regexdev/rte_regexdev.h                   |   6 +-
 lib/security/rte_security.c                   |   6 +-
 lib/vhost/vdpa.c                              |   9 +-
 lib/vhost/vhost_user.c                        |   6 +-
 31 files changed, 517 insertions(+), 285 deletions(-)
 create mode 100644 devtools/cocci/func_or_ret.cocci

diff --git a/devtools/cocci/func_or_ret.cocci b/devtools/cocci/func_or_ret.cocci
new file mode 100644
index 0000000000..f23d60cc4e
--- /dev/null
+++ b/devtools/cocci/func_or_ret.cocci
@@ -0,0 +1,12 @@
+@@
+expression cond, ret;
+@@
+-RTE_FUNC_PTR_OR_ERR_RET(cond, ret);
++if (cond == NULL)
++	return ret;
+@@
+expression cond;
+@@
+-RTE_FUNC_PTR_OR_RET(cond);
++if (cond == NULL)
++	return;
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index dba252067c..5b4ffc992d 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -14,6 +14,10 @@ Deprecation Notices
 * kvargs: The function ``rte_kvargs_process`` will get a new parameter
   for returning key match count. It will ease handling of no-match case.
 
+* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
+  to update their code.
+
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 3cea3aa8eb..225a380de0 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,10 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: RTE_FUNC_PTR_OR_* macros have been marked deprecated and will be removed
+  in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
+  to update their code.
+
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
 
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index db4b087d2b..30e5cdb573 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -58,8 +58,8 @@ qat_pci_get_extra_size(enum qat_device_gen qat_dev_gen)
 {
 	struct qat_dev_hw_spec_funcs *ops_hw =
 		qat_dev_hw_spec[qat_dev_gen];
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_get_extra_size,
-		-ENOTSUP);
+	if (ops_hw->qat_dev_get_extra_size == NULL)
+		return -ENOTSUP;
 	return ops_hw->qat_dev_get_extra_size();
 }
 
@@ -381,8 +381,8 @@ static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		return -ENODEV;
 
 	ops_hw = qat_dev_hw_spec[qat_pci_dev->qat_dev_gen];
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_reset_ring_pairs,
-		-ENOTSUP);
+	if (ops_hw->qat_dev_reset_ring_pairs == NULL)
+		return -ENOTSUP;
 	if (ops_hw->qat_dev_reset_ring_pairs(qat_pci_dev)) {
 		QAT_LOG(ERR,
 			"Cannot reset ring pairs, does pf driver supports pf2vf comms?"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 08ac91eac4..8674eccdca 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -370,8 +370,8 @@ adf_queue_arb_enable(struct qat_pci_device *qat_dev, struct qat_queue *txq,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_enable,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_arb_enable == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_arb_enable(txq, base_addr, lock);
 	return 0;
 }
@@ -383,8 +383,8 @@ adf_queue_arb_disable(enum qat_device_gen qat_dev_gen, struct qat_queue *txq,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_arb_disable,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_arb_disable == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_arb_disable(txq, base_addr, lock);
 	return 0;
 }
@@ -396,8 +396,8 @@ qat_qp_build_ring_base(struct qat_pci_device *qat_dev, void *io_addr,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_build_ring_base,
-			-ENOTSUP);
+	if (ops->qat_qp_build_ring_base == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_build_ring_base(io_addr, queue);
 	return 0;
 }
@@ -409,8 +409,8 @@ qat_qps_per_service(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_rings_per_service,
-			-ENOTSUP);
+	if (ops->qat_qp_rings_per_service == NULL)
+		return -ENOTSUP;
 	return ops->qat_qp_rings_per_service(qat_dev, service);
 }
 
@@ -421,7 +421,8 @@ qat_qp_get_hw_data(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_get_hw_data, NULL);
+	if (ops->qat_qp_get_hw_data == NULL)
+		return NULL;
 	return ops->qat_qp_get_hw_data(qat_dev, service, qp_id);
 }
 
@@ -431,8 +432,8 @@ qat_read_qp_config(struct qat_pci_device *qat_dev)
 	struct qat_dev_hw_spec_funcs *ops_hw =
 		qat_dev_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops_hw->qat_dev_read_config,
-			-ENOTSUP);
+	if (ops_hw->qat_dev_read_config == NULL)
+		return -ENOTSUP;
 	return ops_hw->qat_dev_read_config(qat_dev);
 }
 
@@ -442,8 +443,8 @@ adf_configure_queues(struct qat_qp *qp, enum qat_device_gen qat_dev_gen)
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_adf_configure_queues,
-			-ENOTSUP);
+	if (ops->qat_qp_adf_configure_queues == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_adf_configure_queues(qp);
 	return 0;
 }
@@ -483,8 +484,8 @@ qat_qp_csr_setup(struct qat_pci_device *qat_dev,
 	struct qat_qp_hw_spec_funcs *ops =
 		qat_qp_hw_spec[qat_dev->qat_dev_gen];
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->qat_qp_csr_setup,
-			-ENOTSUP);
+	if (ops->qat_qp_csr_setup == NULL)
+		return -ENOTSUP;
 	ops->qat_qp_csr_setup(qat_dev, io_addr, qp);
 	return 0;
 }
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index dc8db84a68..6fb8cf69be 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -25,8 +25,8 @@ qat_comp_capabilities_info qat_comp_get_capa_info(
 
 	if (qat_dev_gen >= QAT_N_GENS)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(qat_comp_gen_dev_ops[qat_dev_gen]
-			.qat_comp_get_capabilities, ret);
+	if (qat_comp_gen_dev_ops[qat_dev_gen].qat_comp_get_capabilities == NULL)
+		return ret;
 	return qat_comp_gen_dev_ops[qat_dev_gen]
 			.qat_comp_get_capabilities(qat_dev);
 }
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 1e0c4fe464..258d6f8c43 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -541,7 +541,8 @@ rte_cryptodev_scheduler_option_set(uint8_t scheduler_id,
 
 	sched_ctx = dev->data->dev_private;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_set, -ENOTSUP);
+	if (*sched_ctx->ops.option_set == NULL)
+		return -ENOTSUP;
 
 	return (*sched_ctx->ops.option_set)(dev, option_type, option);
 }
@@ -571,7 +572,8 @@ rte_cryptodev_scheduler_option_get(uint8_t scheduler_id,
 
 	sched_ctx = dev->data->dev_private;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.option_get, -ENOTSUP);
+	if (*sched_ctx->ops.option_get == NULL)
+		return -ENOTSUP;
 
 	return (*sched_ctx->ops.option_get)(dev, option_type, option);
 }
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index f3a1bd626c..83ae6b6be9 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -160,7 +160,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
 		return -1;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.worker_attach, -ENOTSUP);
+	if (*sched_ctx->ops.worker_attach == NULL)
+		return -ENOTSUP;
 
 	for (i = 0; i < sched_ctx->nb_workers; i++) {
 		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
@@ -171,7 +172,8 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*sched_ctx->ops.scheduler_start, -ENOTSUP);
+	if (*sched_ctx->ops.scheduler_start == NULL)
+		return -ENOTSUP;
 
 	if ((*sched_ctx->ops.scheduler_start)(dev) < 0) {
 		CR_SCHED_LOG(ERR, "Scheduler start failed");
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f8575f..89fe3a828a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -291,7 +291,8 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 	if (on > 1)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
+		return -ENOTSUP;
 
 	/* The PF has 128 queue pairs and in SRIOV configuration
 	 * those queues will be assigned to VF's, so RXDCTL
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 90ffe31b9f..ebcfbb1a5c 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -281,7 +281,8 @@ lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
 	}
 
 	/* clear stored per queue stats */
-	RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
+	if (*eth_dev->dev_ops->stats_reset == NULL)
+		return 0;
 	return (*eth_dev->dev_ops->stats_reset)(eth_dev);
 }
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 78a7123528..3b616c45ff 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -713,7 +713,8 @@ ifpga_rawdev_configure(const struct rte_rawdev *dev,
 {
 	IFPGA_RAWDEV_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	return config ? 0 : 1;
 }
@@ -726,7 +727,8 @@ ifpga_rawdev_start(struct rte_rawdev *dev)
 
 	IFPGA_RAWDEV_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	adapter = ifpga_rawdev_get_priv(dev);
 	if (!adapter)
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 16ecae3d92..72d3b69d75 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -76,7 +76,8 @@ static int skeleton_rawdev_configure(const struct rte_rawdev *dev,
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	if (config == NULL || config_size != sizeof(*skeldev_conf)) {
 		SKELETON_PMD_ERR("Invalid configuration");
@@ -106,7 +107,8 @@ static int skeleton_rawdev_start(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -169,7 +171,8 @@ static int skeleton_rawdev_close(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -212,7 +215,8 @@ static int skeleton_rawdev_reset(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -295,7 +299,8 @@ static int skeleton_rawdev_queue_release(struct rte_rawdev *dev,
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
@@ -317,7 +322,8 @@ static uint16_t skeleton_rawdev_queue_count(struct rte_rawdev *dev)
 
 	SKELETON_PMD_FUNC_TRACE();
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 	return skeldev->num_queues;
@@ -468,7 +474,8 @@ static int skeleton_rawdev_firmware_status_get(struct rte_rawdev *dev,
 
 	skeldev = skeleton_rawdev_get_priv(dev);
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+	if (dev == NULL)
+		return -EINVAL;
 
 	if (status_info)
 		memcpy(status_info, &skeldev->fw.firmware_state,
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 22c438f2dd..5ddbc3f9c0 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -315,7 +315,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
 
 	memset(&dev_info, 0, sizeof(struct rte_compressdev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
 	if ((dev_info.max_nb_queue_pairs != 0) &&
@@ -344,8 +345,8 @@ rte_compressdev_queue_pairs_config(struct rte_compressdev *dev,
 
 		qp = dev->data->queue_pairs;
 
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+		if (*dev->dev_ops->queue_pair_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_qpairs; i < old_nb_queues; i++) {
 			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -395,8 +396,8 @@ rte_compressdev_queue_pairs_release(struct rte_compressdev *dev)
 	COMPRESSDEV_LOG(DEBUG, "Free %d queues pairs on device %u",
 			dev->data->nb_queue_pairs, dev->data->dev_id);
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+	if (*dev->dev_ops->queue_pair_release == NULL)
+		return -ENOTSUP;
 
 	for (i = 0; i < num_qps; i++) {
 		ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -430,7 +431,8 @@ rte_compressdev_configure(uint8_t dev_id, struct rte_compressdev_config *config)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	/* Setup new number of queue pairs and reconfigure device. */
 	diag = rte_compressdev_queue_pairs_config(dev, config->nb_queue_pairs,
@@ -460,7 +462,8 @@ rte_compressdev_start(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -489,7 +492,8 @@ rte_compressdev_stop(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -527,7 +531,8 @@ rte_compressdev_close(uint8_t dev_id)
 	if (retval < 0)
 		return retval;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	retval = (*dev->dev_ops->dev_close)(dev);
 
 	if (retval < 0)
@@ -565,7 +570,8 @@ rte_compressdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_pair_setup == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id,
 			max_inflight_ops, socket_id);
@@ -611,7 +617,8 @@ rte_compressdev_stats_get(uint8_t dev_id, struct rte_compressdev_stats *stats)
 	dev = &rte_comp_devices[dev_id];
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->stats_get)(dev, stats);
 	return 0;
 }
@@ -628,7 +635,8 @@ rte_compressdev_stats_reset(uint8_t dev_id)
 
 	dev = &rte_comp_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return;
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -647,7 +655,8 @@ rte_compressdev_info_get(uint8_t dev_id, struct rte_compressdev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_compressdev_info));
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->driver_name = dev->device->driver->name;
@@ -666,7 +675,8 @@ rte_compressdev_private_xform_create(uint8_t dev_id,
 	if (xform == NULL || priv_xform == NULL || dev == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_create, -ENOTSUP);
+	if (*dev->dev_ops->private_xform_create == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->private_xform_create)(dev, xform, priv_xform);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -689,7 +699,8 @@ rte_compressdev_private_xform_free(uint8_t dev_id, void *priv_xform)
 	if (dev == NULL || priv_xform == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->private_xform_free, -ENOTSUP);
+	if (*dev->dev_ops->private_xform_free == NULL)
+		return -ENOTSUP;
 	ret = dev->dev_ops->private_xform_free(dev, priv_xform);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -714,7 +725,8 @@ rte_compressdev_stream_create(uint8_t dev_id,
 	if (xform == NULL || dev == NULL || stream == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_create, -ENOTSUP);
+	if (*dev->dev_ops->stream_create == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->stream_create)(dev, xform, stream);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
@@ -738,7 +750,8 @@ rte_compressdev_stream_free(uint8_t dev_id, void *stream)
 	if (dev == NULL || stream == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stream_free, -ENOTSUP);
+	if (*dev->dev_ops->stream_free == NULL)
+		return -ENOTSUP;
 	ret = dev->dev_ops->stream_free(dev, stream);
 	if (ret < 0) {
 		COMPRESSDEV_LOG(ERR,
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..6250302f3b 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -978,7 +978,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
 
 	memset(&dev_info, 0, sizeof(struct rte_cryptodev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
 	if (nb_qpairs > (dev_info.max_nb_queue_pairs)) {
@@ -1007,8 +1008,8 @@ rte_cryptodev_queue_pairs_config(struct rte_cryptodev *dev, uint16_t nb_qpairs,
 
 		qp = dev->data->queue_pairs;
 
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_release,
-				-ENOTSUP);
+		if (*dev->dev_ops->queue_pair_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_qpairs; i < old_nb_queues; i++) {
 			ret = (*dev->dev_ops->queue_pair_release)(dev, i);
@@ -1041,7 +1042,8 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	rte_spinlock_lock(&rte_cryptodev_callback_lock);
 	cryptodev_cb_cleanup(dev);
@@ -1083,7 +1085,8 @@ rte_cryptodev_start(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already started",
@@ -1116,7 +1119,8 @@ rte_cryptodev_stop(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		CDEV_LOG_ERR("Device with dev_id=%" PRIu8 " already stopped",
@@ -1163,7 +1167,8 @@ rte_cryptodev_close(uint8_t dev_id)
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	retval = (*dev->dev_ops->dev_close)(dev);
 	rte_cryptodev_trace_close(dev_id, retval);
 
@@ -1262,7 +1267,8 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_pair_setup == NULL)
+		return -ENOTSUP;
 
 	rte_cryptodev_trace_queue_pair_setup(dev_id, queue_pair_id, qp_conf);
 	return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf,
@@ -1557,7 +1563,8 @@ rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
 	dev = &rte_crypto_devices[dev_id];
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->stats_get)(dev, stats);
 	return 0;
 }
@@ -1574,7 +1581,8 @@ rte_cryptodev_stats_reset(uint8_t dev_id)
 
 	dev = &rte_crypto_devices[dev_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return;
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -1592,7 +1600,8 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_cryptodev_info));
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->driver_name = dev->device->driver->name;
@@ -1739,7 +1748,8 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 	if (index >= sess->nb_drivers)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
+	if (*dev->dev_ops->sym_session_configure == NULL)
+		return -ENOTSUP;
 
 	if (sess->sess_data[index].refcnt == 0) {
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
@@ -1968,7 +1978,8 @@ rte_cryptodev_asym_session_create(uint8_t dev_id,
 	/* Clear device session pointer.*/
 	memset(sess->sess_private_data, 0, session_priv_data_sz + sess->user_data_sz);
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_configure, -ENOTSUP);
+	if (*dev->dev_ops->asym_session_configure == NULL)
+		return -ENOTSUP;
 
 	if (sess->sess_private_data[0] == 0) {
 		ret = dev->dev_ops->asym_session_configure(dev, xforms, sess);
@@ -2007,7 +2018,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
 	if (--sess->sess_data[driver_id].refcnt != 0)
 		return -EBUSY;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
+	if (*dev->dev_ops->sym_session_clear == NULL)
+		return -ENOTSUP;
 
 	dev->dev_ops->sym_session_clear(dev, sess);
 
@@ -2054,7 +2066,8 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, void *sess)
 	if (dev == NULL || sess == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_clear, -ENOTSUP);
+	if (*dev->dev_ops->asym_session_clear == NULL)
+		return -ENOTSUP;
 
 	dev->dev_ops->asym_session_clear(dev, sess);
 
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..d575c14493 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -420,7 +420,8 @@ rte_dma_info_get(int16_t dev_id, struct rte_dma_info *dev_info)
 	if (!rte_dma_is_valid(dev_id) || dev_info == NULL)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_info_get == NULL)
+		return -ENOTSUP;
 	memset(dev_info, 0, sizeof(struct rte_dma_info));
 	ret = (*dev->dev_ops->dev_info_get)(dev, dev_info,
 					    sizeof(struct rte_dma_info));
@@ -472,7 +473,8 @@ rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_configure)(dev, dev_conf,
 					     sizeof(struct rte_dma_conf));
 	if (ret == 0)
@@ -555,7 +557,8 @@ rte_dma_close(int16_t dev_id)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_close)(dev);
 	if (ret == 0)
 		dma_release(dev);
@@ -648,7 +651,8 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_setup, -ENOTSUP);
+	if (*dev->dev_ops->vchan_setup == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->vchan_setup)(dev, vchan, conf,
 					sizeof(struct rte_dma_vchan_conf));
 }
@@ -668,7 +672,8 @@ rte_dma_stats_get(int16_t dev_id, uint16_t vchan, struct rte_dma_stats *stats)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	memset(stats, 0, sizeof(struct rte_dma_stats));
 	return (*dev->dev_ops->stats_get)(dev, vchan, stats,
 					  sizeof(struct rte_dma_stats));
@@ -689,7 +694,8 @@ rte_dma_stats_reset(int16_t dev_id, uint16_t vchan)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->stats_reset)(dev, vchan);
 }
 
@@ -706,7 +712,8 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_status, -ENOTSUP);
+	if (*dev->dev_ops->vchan_status == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->vchan_status)(dev, vchan, status);
 }
 
diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
index e7f992b734..e61d71959e 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -860,7 +860,8 @@ rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || length == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy, -ENOTSUP);
+	if (*obj->copy == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->copy)(obj->dev_private, vchan, src, dst, length, flags);
@@ -911,7 +912,8 @@ rte_dma_copy_sg(int16_t dev_id, uint16_t vchan, struct rte_dma_sge *src,
 	if (!rte_dma_is_valid(dev_id) || src == NULL || dst == NULL ||
 	    nb_src == 0 || nb_dst == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->copy_sg, -ENOTSUP);
+	if (*obj->copy_sg == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->copy_sg)(obj->dev_private, vchan, src, dst, nb_src,
@@ -957,7 +959,8 @@ rte_dma_fill(int16_t dev_id, uint16_t vchan, uint64_t pattern,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || length == 0)
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->fill, -ENOTSUP);
+	if (*obj->fill == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->fill)(obj->dev_private, vchan, pattern, dst, length,
@@ -990,7 +993,8 @@ rte_dma_submit(int16_t dev_id, uint16_t vchan)
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id))
 		return -EINVAL;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->submit, -ENOTSUP);
+	if (*obj->submit == NULL)
+		return -ENOTSUP;
 #endif
 
 	return (*obj->submit)(obj->dev_private, vchan);
@@ -1033,7 +1037,8 @@ rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0)
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed, 0);
+	if (*obj->completed == NULL)
+		return 0;
 #endif
 
 	/* Ensure the pointer values are non-null to simplify drivers.
@@ -1095,7 +1100,8 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id) || nb_cpls == 0 || status == NULL)
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->completed_status, 0);
+	if (*obj->completed_status == NULL)
+		return 0;
 #endif
 
 	if (last_idx == NULL)
@@ -1129,7 +1135,8 @@ rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan)
 #ifdef RTE_DMADEV_DEBUG
 	if (!rte_dma_is_valid(dev_id))
 		return 0;
-	RTE_FUNC_PTR_OR_ERR_RET(*obj->burst_capacity, 0);
+	if (*obj->burst_capacity == NULL)
+		return 0;
 #endif
 	return (*obj->burst_capacity)(obj->dev_private, vchan);
 }
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index e6ff1218f9..2743c09320 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -20,6 +20,7 @@ extern "C" {
 #include <stdio.h>
 
 #include <rte_config.h>
+#include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_log.h>
 
@@ -37,12 +38,14 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					void *cb_arg);
 
 /* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \
+do { \
 	if ((func) == NULL) \
 		return retval; \
 } while (0)
 
-#define RTE_FUNC_PTR_OR_RET(func) do { \
+#define RTE_FUNC_PTR_OR_RET(func) RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET) \
+do { \
 	if ((func) == NULL) \
 		return; \
 } while (0)
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
index a285f213f0..24a3969225 100644
--- a/lib/ethdev/ethdev_driver.c
+++ b/lib/ethdev/ethdev_driver.c
@@ -264,7 +264,8 @@ rte_eth_dev_create(struct rte_device *device, const char *name,
 	struct rte_eth_dev *ethdev;
 	int retval;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_init, -EINVAL);
+	if (*ethdev_init == NULL)
+		return -EINVAL;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		ethdev = rte_eth_dev_allocate(name);
@@ -328,7 +329,8 @@ rte_eth_dev_destroy(struct rte_eth_dev *ethdev,
 	if (!ethdev)
 		return -ENODEV;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_uninit, -EINVAL);
+	if (*ethdev_uninit == NULL)
+		return -EINVAL;
 
 	ret = ethdev_uninit(ethdev);
 	if (ret)
@@ -558,8 +560,8 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[cur_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_bind,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_bind == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_bind)(dev, cur_queue,
 							peer_info, direction);
@@ -573,8 +575,8 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[cur_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_unbind,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_unbind == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_unbind)(dev, cur_queue,
 							  direction);
@@ -594,8 +596,8 @@ rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
 
 	/* No need to check the validity again. */
 	dev = &rte_eth_devices[peer_port];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_queue_peer_update,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_queue_peer_update == NULL)
+		return -ENOTSUP;
 
 	return (*dev->dev_ops->hairpin_queue_peer_update)(dev, peer_queue,
 					cur_info, peer_info, direction);
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 0549842709..a268507801 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -130,7 +130,8 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
 	if (!eth_dev)
 		return -ENOMEM;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
+	if (*dev_init == NULL)
+		return -EINVAL;
 	ret = dev_init(eth_dev);
 	if (ret)
 		rte_eth_dev_release_port(eth_dev);
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0850..9d6f460726 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -719,7 +719,8 @@ rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_start == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -751,7 +752,8 @@ rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_stop == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -790,7 +792,8 @@ rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_start == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -822,7 +825,8 @@ rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id)
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_stop == NULL)
+		return -ENOTSUP;
 
 	if (rte_eth_dev_is_tx_hairpin_queue(dev, tx_queue_id)) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1077,7 +1081,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started) {
 		RTE_ETHDEV_LOG(ERR,
@@ -1447,7 +1452,8 @@ rte_eth_dev_start(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1493,7 +1499,8 @@ rte_eth_dev_start(uint16_t port_id)
 	}
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 0);
 	}
 
@@ -1513,7 +1520,8 @@ rte_eth_dev_stop(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started == 0) {
 		RTE_ETHDEV_LOG(INFO,
@@ -1541,7 +1549,8 @@ rte_eth_dev_set_link_up(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
+	if (*dev->dev_ops->dev_set_link_up == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_set_link_up)(dev));
 }
 
@@ -1553,7 +1562,8 @@ rte_eth_dev_set_link_down(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
+	if (*dev->dev_ops->dev_set_link_down == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev));
 }
 
@@ -1579,7 +1589,8 @@ rte_eth_dev_close(uint16_t port_id)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	*lasterr = (*dev->dev_ops->dev_close)(dev);
 	if (*lasterr != 0)
 		lasterr = &binerr;
@@ -1599,7 +1610,8 @@ rte_eth_dev_reset(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_reset == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_stop(port_id);
 	if (ret != 0) {
@@ -1624,7 +1636,8 @@ rte_eth_dev_is_removed(uint16_t port_id)
 	if (dev->state == RTE_ETH_DEV_REMOVED)
 		return 1;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->is_removed, 0);
+	if (*dev->dev_ops->is_removed == NULL)
+		return 0;
 
 	ret = dev->dev_ops->is_removed(dev);
 	if (ret != 0)
@@ -1725,7 +1738,8 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_setup == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
@@ -1928,8 +1942,8 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
 	if (ret != 0)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_hairpin_queue_setup,
-				-ENOTSUP);
+	if (*dev->dev_ops->rx_hairpin_queue_setup == NULL)
+		return -ENOTSUP;
 	/* if nb_rx_desc is zero use max number of desc from the driver. */
 	if (nb_rx_desc == 0)
 		nb_rx_desc = cap.max_nb_desc;
@@ -1990,7 +2004,8 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->tx_queue_setup == NULL)
+		return -ENOTSUP;
 
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
@@ -2094,8 +2109,8 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 	ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
 	if (ret != 0)
 		return ret;
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_hairpin_queue_setup,
-				-ENOTSUP);
+	if (*dev->dev_ops->tx_hairpin_queue_setup == NULL)
+		return -ENOTSUP;
 	/* if nb_rx_desc is zero use max number of desc from the driver. */
 	if (nb_tx_desc == 0)
 		nb_tx_desc = cap.max_nb_desc;
@@ -2152,7 +2167,8 @@ rte_eth_hairpin_bind(uint16_t tx_port, uint16_t rx_port)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_bind, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_bind == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->hairpin_bind)(dev, rx_port);
 	if (ret != 0)
 		RTE_ETHDEV_LOG(ERR, "Failed to bind hairpin Tx %d"
@@ -2176,7 +2192,8 @@ rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port)
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_unbind, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_unbind == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->hairpin_unbind)(dev, rx_port);
 	if (ret != 0)
 		RTE_ETHDEV_LOG(ERR, "Failed to unbind hairpin Tx %d"
@@ -2210,8 +2227,8 @@ rte_eth_hairpin_get_peer_ports(uint16_t port_id, uint16_t *peer_ports,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_get_peer_ports,
-				-ENOTSUP);
+	if (*dev->dev_ops->hairpin_get_peer_ports == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->hairpin_get_peer_ports)(dev, peer_ports,
 						      len, direction);
@@ -2282,7 +2299,8 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_done_cleanup, -ENOTSUP);
+	if (*dev->dev_ops->tx_done_cleanup == NULL)
+		return -ENOTSUP;
 
 	/* Call driver to free pending mbufs. */
 	ret = (*dev->dev_ops->tx_done_cleanup)(dev->data->tx_queues[queue_id],
@@ -2302,7 +2320,8 @@ rte_eth_promiscuous_enable(uint16_t port_id)
 	if (dev->data->promiscuous == 1)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
+	if (*dev->dev_ops->promiscuous_enable == NULL)
+		return -ENOTSUP;
 
 	diag = (*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = (diag == 0) ? 1 : 0;
@@ -2322,7 +2341,8 @@ rte_eth_promiscuous_disable(uint16_t port_id)
 	if (dev->data->promiscuous == 0)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
+	if (*dev->dev_ops->promiscuous_disable == NULL)
+		return -ENOTSUP;
 
 	dev->data->promiscuous = 0;
 	diag = (*dev->dev_ops->promiscuous_disable)(dev);
@@ -2355,7 +2375,8 @@ rte_eth_allmulticast_enable(uint16_t port_id)
 	if (dev->data->all_multicast == 1)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_enable, -ENOTSUP);
+	if (*dev->dev_ops->allmulticast_enable == NULL)
+		return -ENOTSUP;
 	diag = (*dev->dev_ops->allmulticast_enable)(dev);
 	dev->data->all_multicast = (diag == 0) ? 1 : 0;
 
@@ -2374,7 +2395,8 @@ rte_eth_allmulticast_disable(uint16_t port_id)
 	if (dev->data->all_multicast == 0)
 		return 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_disable, -ENOTSUP);
+	if (*dev->dev_ops->allmulticast_disable == NULL)
+		return -ENOTSUP;
 	dev->data->all_multicast = 0;
 	diag = (*dev->dev_ops->allmulticast_disable)(dev);
 	if (diag != 0)
@@ -2411,7 +2433,8 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link)
 	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
 		rte_eth_linkstatus_get(dev, eth_link);
 	else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 1);
 		*eth_link = dev->data->dev_link;
 	}
@@ -2436,7 +2459,8 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link)
 	if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
 		rte_eth_linkstatus_get(dev, eth_link);
 	else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		if (*dev->dev_ops->link_update == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->link_update)(dev, 0);
 		*eth_link = dev->data->dev_link;
 	}
@@ -2513,7 +2537,8 @@ rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats)
 
 	memset(stats, 0, sizeof(*stats));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	if (*dev->dev_ops->stats_get == NULL)
+		return -ENOTSUP;
 	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
 	return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats));
 }
@@ -2527,7 +2552,8 @@ rte_eth_stats_reset(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
+	if (*dev->dev_ops->stats_reset == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->stats_reset)(dev);
 	if (ret != 0)
 		return eth_err(port_id, ret);
@@ -3043,7 +3069,8 @@ eth_dev_set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id,
 	if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+	if (*dev->dev_ops->queue_stats_mapping_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_stats_mapping_set) (dev, queue_id, stat_idx, is_rx);
 }
 
@@ -3080,7 +3107,8 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	if (*dev->dev_ops->fw_version_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fw_version_get)(dev,
 							fw_version, fw_size));
 }
@@ -3121,7 +3149,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
 		RTE_ETHER_CRC_LEN;
 	dev_info->max_mtu = UINT16_MAX;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	diag = (*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	if (diag != 0) {
 		/* Cleanup already filled in device information */
@@ -3182,7 +3211,8 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_supported_ptypes_get, 0);
+	if (*dev->dev_ops->dev_supported_ptypes_get == NULL)
+		return 0;
 	all_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev);
 
 	if (!all_ptypes)
@@ -3360,7 +3390,8 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
+	if (*dev->dev_ops->mtu_set == NULL)
+		return -ENOTSUP;
 
 	/*
 	 * Check if the device supports dev_infos_get, if it does not
@@ -3413,7 +3444,8 @@ rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
 			port_id, vlan_id);
 		return -EINVAL;
 	}
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_filter_set == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
 	if (ret == 0) {
@@ -3448,7 +3480,8 @@ rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_strip_queue_set == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on);
 
 	return 0;
@@ -3464,7 +3497,8 @@ rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_tpid_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->vlan_tpid_set)(dev, vlan_type,
 							       tpid));
 }
@@ -3549,7 +3583,8 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_offload_set == NULL)
+		return -ENOTSUP;
 	dev->data->dev_conf.rxmode.offloads = dev_offloads;
 	ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);
 	if (ret) {
@@ -3594,7 +3629,8 @@ rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
+	if (*dev->dev_ops->vlan_pvid_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->vlan_pvid_set)(dev, pvid, on));
 }
 
@@ -3613,7 +3649,8 @@ rte_eth_dev_flow_ctrl_get(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
+	if (*dev->dev_ops->flow_ctrl_get == NULL)
+		return -ENOTSUP;
 	memset(fc_conf, 0, sizeof(*fc_conf));
 	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf));
 }
@@ -3638,7 +3675,8 @@ rte_eth_dev_flow_ctrl_set(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
+	if (*dev->dev_ops->flow_ctrl_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf));
 }
 
@@ -3899,7 +3937,8 @@ rte_eth_dev_rss_reta_update(uint16_t port_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
+	if (*dev->dev_ops->reta_update == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->reta_update)(dev, reta_conf,
 							     reta_size));
 }
@@ -3927,7 +3966,8 @@ rte_eth_dev_rss_reta_query(uint16_t port_id,
 	if (ret < 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
+	if (*dev->dev_ops->reta_query == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->reta_query)(dev, reta_conf,
 							    reta_size));
 }
@@ -3971,7 +4011,8 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
+	if (*dev->dev_ops->rss_hash_update == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
 								 rss_conf));
 }
@@ -3992,7 +4033,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
+	if (*dev->dev_ops->rss_hash_conf_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev,
 								   rss_conf));
 }
@@ -4018,7 +4060,8 @@ rte_eth_dev_udp_tunnel_port_add(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP);
+	if (*dev->dev_ops->udp_tunnel_port_add == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_add)(dev,
 								udp_tunnel));
 }
@@ -4044,7 +4087,8 @@ rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP);
+	if (*dev->dev_ops->udp_tunnel_port_del == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_del)(dev,
 								udp_tunnel));
 }
@@ -4057,7 +4101,8 @@ rte_eth_led_on(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
+	if (*dev->dev_ops->dev_led_on == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_led_on)(dev));
 }
 
@@ -4069,7 +4114,8 @@ rte_eth_led_off(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
+	if (*dev->dev_ops->dev_led_off == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev));
 }
 
@@ -4091,7 +4137,8 @@ rte_eth_fec_get_capability(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get_capability, -ENOTSUP);
+	if (*dev->dev_ops->fec_get_capability == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->fec_get_capability)(dev, speed_fec_capa, num);
 
 	return ret;
@@ -4112,7 +4159,8 @@ rte_eth_fec_get(uint16_t port_id, uint32_t *fec_capa)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get, -ENOTSUP);
+	if (*dev->dev_ops->fec_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fec_get)(dev, fec_capa));
 }
 
@@ -4124,7 +4172,8 @@ rte_eth_fec_set(uint16_t port_id, uint32_t fec_capa)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_set, -ENOTSUP);
+	if (*dev->dev_ops->fec_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->fec_set)(dev, fec_capa));
 }
 
@@ -4173,7 +4222,8 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_add == NULL)
+		return -ENOTSUP;
 
 	if (rte_is_zero_ether_addr(addr)) {
 		RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n",
@@ -4231,7 +4281,8 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_remove == NULL)
+		return -ENOTSUP;
 
 	index = eth_dev_get_mac_addr_index(port_id, addr);
 	if (index == 0) {
@@ -4273,7 +4324,8 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)
 	if (!rte_is_valid_assigned_ether_addr(addr))
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
+	if (*dev->dev_ops->mac_addr_set == NULL)
+		return -ENOTSUP;
 
 	ret = (*dev->dev_ops->mac_addr_set)(dev, addr);
 	if (ret < 0)
@@ -4359,7 +4411,8 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr,
 		}
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
+	if (*dev->dev_ops->uc_hash_table_set == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
 	if (ret == 0) {
 		/* Update address in NIC data structure */
@@ -4382,7 +4435,8 @@ rte_eth_dev_uc_all_hash_table_set(uint16_t port_id, uint8_t on)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
+	if (*dev->dev_ops->uc_all_hash_table_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->uc_all_hash_table_set)(dev,
 								       on));
 }
@@ -4418,7 +4472,8 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
+	if (*dev->dev_ops->set_queue_rate_limit == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->set_queue_rate_limit)(dev,
 							queue_idx, tx_rate));
 }
@@ -4444,7 +4499,8 @@ int rte_eth_rx_avail_thresh_set(uint16_t port_id, uint16_t queue_id,
 			port_id);
 		return -EINVAL;
 	}
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_set, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_avail_thresh_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_set)(dev,
 							     queue_id, avail_thresh));
 }
@@ -4462,7 +4518,8 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,
 	if (*queue_id >= dev->data->nb_rx_queues)
 		*queue_id = 0;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_avail_thresh_query, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_avail_thresh_query == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_avail_thresh_query)(dev,
 							     queue_id, avail_thresh));
 }
@@ -4736,7 +4793,8 @@ rte_eth_dev_rx_intr_enable(uint16_t port_id,
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_intr_enable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id));
 }
 
@@ -4754,7 +4812,8 @@ rte_eth_dev_rx_intr_disable(uint16_t port_id,
 	if (ret != 0)
 		return ret;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
+	if (*dev->dev_ops->rx_queue_intr_disable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id));
 }
 
@@ -5018,7 +5077,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+	if (*dev->dev_ops->rxq_info_get == NULL)
+		return -ENOTSUP;
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
@@ -5063,7 +5123,8 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+	if (*dev->dev_ops->txq_info_get == NULL)
+		return -ENOTSUP;
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
@@ -5093,7 +5154,8 @@ rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_burst_mode_get, -ENOTSUP);
+	if (*dev->dev_ops->rx_burst_mode_get == NULL)
+		return -ENOTSUP;
 	memset(mode, 0, sizeof(*mode));
 	return eth_err(port_id,
 		       dev->dev_ops->rx_burst_mode_get(dev, queue_id, mode));
@@ -5120,7 +5182,8 @@ rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_burst_mode_get, -ENOTSUP);
+	if (*dev->dev_ops->tx_burst_mode_get == NULL)
+		return -ENOTSUP;
 	memset(mode, 0, sizeof(*mode));
 	return eth_err(port_id,
 		       dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode));
@@ -5147,7 +5210,8 @@ rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_monitor_addr, -ENOTSUP);
+	if (*dev->dev_ops->get_monitor_addr == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		dev->dev_ops->get_monitor_addr(dev->data->rx_queues[queue_id], pmc));
 }
@@ -5162,7 +5226,8 @@ rte_eth_dev_set_mc_addr_list(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
+	if (*dev->dev_ops->set_mc_addr_list == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, dev->dev_ops->set_mc_addr_list(dev,
 						mc_addr_set, nb_mc_addr));
 }
@@ -5175,7 +5240,8 @@ rte_eth_timesync_enable(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
+	if (*dev->dev_ops->timesync_enable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_enable)(dev));
 }
 
@@ -5187,7 +5253,8 @@ rte_eth_timesync_disable(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
+	if (*dev->dev_ops->timesync_disable == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_disable)(dev));
 }
 
@@ -5207,7 +5274,8 @@ rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_rx_timestamp == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_rx_timestamp)
 				(dev, timestamp, flags));
 }
@@ -5228,7 +5296,8 @@ rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_tx_timestamp == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_tx_timestamp)
 				(dev, timestamp));
 }
@@ -5241,7 +5310,8 @@ rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_adjust_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_adjust_time)(dev, delta));
 }
 
@@ -5260,7 +5330,8 @@ rte_eth_timesync_read_time(uint16_t port_id, struct timespec *timestamp)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_read_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_read_time)(dev,
 								timestamp));
 }
@@ -5280,7 +5351,8 @@ rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
+	if (*dev->dev_ops->timesync_write_time == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->timesync_write_time)(dev,
 								timestamp));
 }
@@ -5299,7 +5371,8 @@ rte_eth_read_clock(uint16_t port_id, uint64_t *clock)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->read_clock, -ENOTSUP);
+	if (*dev->dev_ops->read_clock == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->read_clock)(dev, clock));
 }
 
@@ -5318,7 +5391,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
+	if (*dev->dev_ops->get_reg == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_reg)(dev, info));
 }
 
@@ -5330,7 +5404,8 @@ rte_eth_dev_get_eeprom_length(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
+	if (*dev->dev_ops->get_eeprom_length == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_eeprom_length)(dev));
 }
 
@@ -5349,7 +5424,8 @@ rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->get_eeprom == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_eeprom)(dev, info));
 }
 
@@ -5368,7 +5444,8 @@ rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->set_eeprom == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->set_eeprom)(dev, info));
 }
 
@@ -5388,7 +5465,8 @@ rte_eth_dev_get_module_info(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_info, -ENOTSUP);
+	if (*dev->dev_ops->get_module_info == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->get_module_info)(dev, modinfo);
 }
 
@@ -5422,7 +5500,8 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_eeprom, -ENOTSUP);
+	if (*dev->dev_ops->get_module_eeprom == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->get_module_eeprom)(dev, info);
 }
 
@@ -5444,7 +5523,8 @@ rte_eth_dev_get_dcb_info(uint16_t port_id,
 
 	memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
+	if (*dev->dev_ops->get_dcb_info == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->get_dcb_info)(dev, dcb_info));
 }
 
@@ -5500,7 +5580,8 @@ rte_eth_dev_hairpin_capability_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_cap_get, -ENOTSUP);
+	if (*dev->dev_ops->hairpin_cap_get == NULL)
+		return -ENOTSUP;
 	memset(cap, 0, sizeof(*cap));
 	return eth_err(port_id, (*dev->dev_ops->hairpin_cap_get)(dev, cap));
 }
@@ -5775,7 +5856,8 @@ rte_eth_representor_info_get(uint16_t port_id,
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->representor_info_get, -ENOTSUP);
+	if (*dev->dev_ops->representor_info_get == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->representor_info_get)(dev, info));
 }
 
@@ -5799,7 +5881,8 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_metadata_negotiate, -ENOTSUP);
+	if (*dev->dev_ops->rx_metadata_negotiate == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		       (*dev->dev_ops->rx_metadata_negotiate)(dev, features));
 }
@@ -5826,8 +5909,8 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_capability_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_capability_get == NULL)
+		return -ENOTSUP;
 	memset(reassembly_capa, 0, sizeof(struct rte_eth_ip_reassembly_params));
 
 	return eth_err(port_id, (*dev->dev_ops->ip_reassembly_capability_get)
@@ -5856,8 +5939,8 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_conf_get == NULL)
+		return -ENOTSUP;
 	memset(conf, 0, sizeof(struct rte_eth_ip_reassembly_params));
 	return eth_err(port_id,
 		       (*dev->dev_ops->ip_reassembly_conf_get)(dev, conf));
@@ -5894,8 +5977,8 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_set,
-				-ENOTSUP);
+	if (*dev->dev_ops->ip_reassembly_conf_set == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id,
 		       (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf));
 }
@@ -5913,7 +5996,8 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP);
+	if (*dev->dev_ops->eth_dev_priv_dump == NULL)
+		return -ENOTSUP;
 	return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file));
 }
 
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index de9e970d4d..41d37e41b5 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -5710,7 +5710,8 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
 	qd = p->rxq.data[queue_id];
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_queue_count, -ENOTSUP);
+	if (*p->rx_queue_count == NULL)
+		return -ENOTSUP;
 	if (qd == NULL)
 		return -EINVAL;
 
@@ -5784,7 +5785,8 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
 	if (qd == NULL)
 		return -ENODEV;
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*p->rx_descriptor_status, -ENOTSUP);
+	if (*p->rx_descriptor_status == NULL)
+		return -ENOTSUP;
 	return (*p->rx_descriptor_status)(qd, offset);
 }
 
@@ -5854,7 +5856,8 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
 	if (qd == NULL)
 		return -ENODEV;
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*p->tx_descriptor_status, -ENOTSUP);
+	if (*p->tx_descriptor_status == NULL)
+		return -ENOTSUP;
 	return (*p->tx_descriptor_status)(qd, offset);
 }
 
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7c695176f4..4938b4ee07 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -974,9 +974,8 @@ rte_event_crypto_adapter_queue_pair_add(uint8_t id,
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW) ||
 	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->crypto_adapter_queue_pair_add,
-			-ENOTSUP);
+		if (*dev->dev_ops->crypto_adapter_queue_pair_add == NULL)
+			return -ENOTSUP;
 		if (dev_info->qpairs == NULL) {
 			dev_info->qpairs =
 			    rte_zmalloc_socket(adapter->mem_name,
@@ -1076,9 +1075,8 @@ rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id,
 	if ((cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
 	    (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
 	     adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->crypto_adapter_queue_pair_del,
-			-ENOTSUP);
+		if (*dev->dev_ops->crypto_adapter_queue_pair_del == NULL)
+			return -ENOTSUP;
 		ret = (*dev->dev_ops->crypto_adapter_queue_pair_del)(dev,
 						dev_info->dev,
 						queue_pair_id);
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bf8741d2ea..8e81cf774d 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2655,8 +2655,8 @@ rte_event_eth_rx_adapter_queue_add(uint8_t id,
 	dev_info = &rx_adapter->eth_devices[eth_dev_id];
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_add,
-					-ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_queue_add == NULL)
+			return -ENOTSUP;
 		if (dev_info->rx_queue == NULL) {
 			dev_info->rx_queue =
 			    rte_zmalloc_socket(rx_adapter->mem_name,
@@ -2750,8 +2750,8 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
 	dev_info = &rx_adapter->eth_devices[eth_dev_id];
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_adapter_queue_del,
-				 -ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_queue_del == NULL)
+			return -ENOTSUP;
 		ret = (*dev->dev_ops->eth_rx_adapter_queue_del)(dev,
 						&rte_eth_devices[eth_dev_id],
 						rx_queue_id);
@@ -2861,9 +2861,8 @@ rte_event_eth_rx_adapter_vector_limits_get(
 	}
 
 	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-		RTE_FUNC_PTR_OR_ERR_RET(
-			*dev->dev_ops->eth_rx_adapter_vector_limits_get,
-			-ENOTSUP);
+		if (*dev->dev_ops->eth_rx_adapter_vector_limits_get == NULL)
+			return -ENOTSUP;
 		ret = dev->dev_ops->eth_rx_adapter_vector_limits_get(
 			dev, &rte_eth_devices[eth_port_id], limits);
 	} else {
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 1dc4f966be..79b905e9fc 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -92,7 +92,8 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info)
 
 	memset(dev_info, 0, sizeof(struct rte_event_dev_info));
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 
 	dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns;
@@ -216,7 +217,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 
 	if (nb_queues != 0) {
 		queues_cfg = dev->data->queues_cfg;
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+		if (*dev->dev_ops->queue_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
@@ -229,7 +231,8 @@ event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 				sizeof(queues_cfg[0]) * new_qs);
 		}
 	} else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+		if (*dev->dev_ops->queue_release == NULL)
+			return -ENOTSUP;
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
@@ -254,7 +257,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 			 dev->data->dev_id);
 
 	if (nb_ports != 0) { /* re-config */
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
+		if (*dev->dev_ops->port_release == NULL)
+			return -ENOTSUP;
 
 		ports = dev->data->ports;
 		ports_cfg = dev->data->ports_cfg;
@@ -279,7 +283,8 @@ event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 	} else {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
+		if (*dev->dev_ops->port_release == NULL)
+			return -ENOTSUP;
 
 		ports = dev->data->ports;
 		for (i = nb_ports; i < old_nb_ports; i++) {
@@ -303,8 +308,10 @@ rte_event_dev_configure(uint8_t dev_id,
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_infos_get == NULL)
+		return -ENOTSUP;
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started) {
 		RTE_EDEV_LOG_ERR(
@@ -509,7 +516,8 @@ rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->queue_def_conf == NULL)
+		return -ENOTSUP;
 	memset(queue_conf, 0, sizeof(struct rte_event_queue_conf));
 	(*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf);
 	return 0;
@@ -595,11 +603,12 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_setup == NULL)
+		return -ENOTSUP;
 
 	if (queue_conf == NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf,
-					-ENOTSUP);
+		if (*dev->dev_ops->queue_def_conf == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->queue_def_conf)(dev, queue_id, &def_conf);
 		queue_conf = &def_conf;
 	}
@@ -635,7 +644,8 @@ rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->port_def_conf == NULL)
+		return -ENOTSUP;
 	memset(port_conf, 0, sizeof(struct rte_event_port_conf));
 	(*dev->dev_ops->port_def_conf)(dev, port_id, port_conf);
 	return 0;
@@ -706,11 +716,12 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		return -EBUSY;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_setup, -ENOTSUP);
+	if (*dev->dev_ops->port_setup == NULL)
+		return -ENOTSUP;
 
 	if (port_conf == NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_def_conf,
-					-ENOTSUP);
+		if (*dev->dev_ops->port_def_conf == NULL)
+			return -ENOTSUP;
 		(*dev->dev_ops->port_def_conf)(dev, port_id, &def_conf);
 		port_conf = &def_conf;
 	}
@@ -896,7 +907,8 @@ rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
 		return -ENOTSUP;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
+	if (*dev->dev_ops->queue_attr_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_attr_set)(dev, queue_id, attr_id,
 					       attr_value);
 }
@@ -1045,7 +1057,8 @@ rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id)
 	 * This allows PMDs which handle unlink synchronously to not implement
 	 * this function at all.
 	 */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_unlinks_in_progress, 0);
+	if (*dev->dev_ops->port_unlinks_in_progress == NULL)
+		return 0;
 
 	return (*dev->dev_ops->port_unlinks_in_progress)(dev,
 			dev->data->ports[port_id]);
@@ -1087,7 +1100,8 @@ rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timeout_ticks, -ENOTSUP);
+	if (*dev->dev_ops->timeout_ticks == NULL)
+		return -ENOTSUP;
 
 	if (timeout_ticks == NULL)
 		return -EINVAL;
@@ -1119,7 +1133,8 @@ rte_event_dev_dump(uint8_t dev_id, FILE *f)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+	if (*dev->dev_ops->dump == NULL)
+		return -ENOTSUP;
 	if (f == NULL)
 		return -EINVAL;
 
@@ -1285,7 +1300,8 @@ rte_event_dev_start(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 
 	if (dev->data->dev_started != 0) {
 		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already started",
@@ -1331,7 +1347,8 @@ rte_event_dev_stop(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return;
 
 	if (dev->data->dev_started == 0) {
 		RTE_EDEV_LOG_ERR("Device with dev_id=%" PRIu8 "already stopped",
@@ -1352,7 +1369,8 @@ rte_event_dev_close(uint8_t dev_id)
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 
 	/* Device must be stopped before it can be closed */
 	if (dev->data->dev_started == 1) {
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 2d36dee8f0..ac32c4bb72 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -154,7 +154,8 @@ rte_mempool_ops_get_info(const struct rte_mempool *mp,
 
 	ops = rte_mempool_get_ops(mp->ops_index);
 
-	RTE_FUNC_PTR_OR_ERR_RET(ops->get_info, -ENOTSUP);
+	if (ops->get_info == NULL)
+		return -ENOTSUP;
 	return ops->get_info(mp, info);
 }
 
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index 2f0a4f132e..e157d65332 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -71,12 +71,14 @@ rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info,
 	int ret = 0;
 
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(dev_info, -EINVAL);
+	if (dev_info == NULL)
+		return -EINVAL;
 
 	rawdev = &rte_rawdevs[dev_id];
 
 	if (dev_info->dev_private != NULL) {
-		RTE_FUNC_PTR_OR_ERR_RET(*rawdev->dev_ops->dev_info_get, -ENOTSUP);
+		if (*rawdev->dev_ops->dev_info_get == NULL)
+			return -ENOTSUP;
 		ret = (*rawdev->dev_ops->dev_info_get)(rawdev,
 				dev_info->dev_private,
 				dev_private_size);
@@ -97,11 +99,13 @@ rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf,
 	int diag;
 
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(dev_conf, -EINVAL);
+	if (dev_conf == NULL)
+		return -EINVAL;
 
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 
 	if (dev->started) {
 		RTE_RDEV_ERR(
@@ -131,7 +135,8 @@ rte_rawdev_queue_conf_get(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP);
+	if (*dev->dev_ops->queue_def_conf == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf,
 			queue_conf_size);
 }
@@ -147,7 +152,8 @@ rte_rawdev_queue_setup(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_setup, -ENOTSUP);
+	if (*dev->dev_ops->queue_setup == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf,
 			queue_conf_size);
 }
@@ -160,7 +166,8 @@ rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
+	if (*dev->dev_ops->queue_release == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_release)(dev, queue_id);
 }
 
@@ -172,7 +179,8 @@ rte_rawdev_queue_count(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_count, -ENOTSUP);
+	if (*dev->dev_ops->queue_count == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->queue_count)(dev);
 }
 
@@ -186,7 +194,8 @@ rte_rawdev_get_attr(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_get, -ENOTSUP);
+	if (*dev->dev_ops->attr_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->attr_get)(dev, attr_name, attr_value);
 }
 
@@ -200,7 +209,8 @@ rte_rawdev_set_attr(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->attr_set, -ENOTSUP);
+	if (*dev->dev_ops->attr_set == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->attr_set)(dev, attr_name, attr_value);
 }
 
@@ -215,7 +225,8 @@ rte_rawdev_enqueue_buffers(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->enqueue_bufs, -ENOTSUP);
+	if (*dev->dev_ops->enqueue_bufs == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->enqueue_bufs)(dev, buffers, count, context);
 }
 
@@ -230,7 +241,8 @@ rte_rawdev_dequeue_buffers(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dequeue_bufs, -ENOTSUP);
+	if (*dev->dev_ops->dequeue_bufs == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dequeue_bufs)(dev, buffers, count, context);
 }
 
@@ -242,7 +254,8 @@ rte_rawdev_dump(uint16_t dev_id, FILE *f)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP);
+	if (*dev->dev_ops->dump == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dump)(dev, f);
 }
 
@@ -251,7 +264,8 @@ xstats_get_count(uint16_t dev_id)
 {
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_names == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_names)(dev, NULL, 0);
 }
 
@@ -273,7 +287,8 @@ rte_rawdev_xstats_names_get(uint16_t dev_id,
 
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_names == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_names)(dev, xstats_names, size);
 }
 
@@ -287,7 +302,8 @@ rte_rawdev_xstats_get(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
 	const struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get)(dev, ids, values, n);
 }
 
@@ -306,7 +322,8 @@ rte_rawdev_xstats_by_name_get(uint16_t dev_id,
 		id = &temp; /* driver never gets a NULL value */
 
 	/* implemented by driver */
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_by_name, -ENOTSUP);
+	if (*dev->dev_ops->xstats_get_by_name == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_get_by_name)(dev, name, id);
 }
 
@@ -317,7 +334,8 @@ rte_rawdev_xstats_reset(uint16_t dev_id,
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_reset, -ENOTSUP);
+	if (*dev->dev_ops->xstats_reset == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids);
 }
 
@@ -327,7 +345,8 @@ rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_status_get, -ENOTSUP);
+	if (*dev->dev_ops->firmware_status_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_status_get)(dev, status_info);
 }
 
@@ -337,7 +356,8 @@ rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_version_get, -ENOTSUP);
+	if (*dev->dev_ops->firmware_version_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_version_get)(dev, version_info);
 }
 
@@ -350,7 +370,8 @@ rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image)
 	if (!firmware_image)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
+	if (*dev->dev_ops->firmware_load == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_load)(dev, firmware_image);
 }
 
@@ -360,7 +381,8 @@ rte_rawdev_firmware_unload(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP);
+	if (*dev->dev_ops->firmware_load == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->firmware_unload)(dev);
 }
 
@@ -370,7 +392,8 @@ rte_rawdev_selftest(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	struct rte_rawdev *dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+	if (*dev->dev_ops->dev_selftest == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_selftest)(dev_id);
 }
 
@@ -435,7 +458,8 @@ rte_rawdev_close(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	/* Device must be stopped before it can be closed */
 	if (dev->started == 1) {
 		RTE_RDEV_ERR("Device %u must be stopped before closing",
@@ -454,7 +478,8 @@ rte_rawdev_reset(uint16_t dev_id)
 	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_rawdevs[dev_id];
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_reset == NULL)
+		return -ENOTSUP;
 	/* Reset is not dependent on state of the device */
 	return (*dev->dev_ops->dev_reset)(dev);
 }
diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
index 02a388bc5d..caec069182 100644
--- a/lib/regexdev/rte_regexdev.c
+++ b/lib/regexdev/rte_regexdev.c
@@ -189,7 +189,8 @@ regexdev_info_get(uint8_t dev_id, struct rte_regexdev_info *dev_info)
 	if (dev_info == NULL)
 		return -EINVAL;
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_info_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_info_get == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_info_get)(dev, dev_info);
 
 }
@@ -211,7 +212,8 @@ rte_regexdev_configure(uint8_t dev_id, const struct rte_regexdev_config *cfg)
 	if (cfg == NULL)
 		return -EINVAL;
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	if (*dev->dev_ops->dev_configure == NULL)
+		return -ENOTSUP;
 	if (dev->data->dev_started) {
 		RTE_REGEXDEV_LOG
 			(ERR, "Dev %u must be stopped to allow configuration\n",
@@ -301,7 +303,8 @@ rte_regexdev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_qp_setup, -ENOTSUP);
+	if (*dev->dev_ops->dev_qp_setup == NULL)
+		return -ENOTSUP;
 	if (dev->data->dev_started) {
 		RTE_REGEXDEV_LOG
 			(ERR, "Dev %u must be stopped to allow configuration\n",
@@ -332,7 +335,8 @@ rte_regexdev_start(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	if (*dev->dev_ops->dev_start == NULL)
+		return -ENOTSUP;
 	ret = (*dev->dev_ops->dev_start)(dev);
 	if (ret == 0)
 		dev->data->dev_started = 1;
@@ -346,7 +350,8 @@ rte_regexdev_stop(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
+	if (*dev->dev_ops->dev_stop == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_stop)(dev);
 	dev->data->dev_started = 0;
 	return 0;
@@ -359,7 +364,8 @@ rte_regexdev_close(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
+	if (*dev->dev_ops->dev_close == NULL)
+		return -ENOTSUP;
 	(*dev->dev_ops->dev_close)(dev);
 	dev->data->dev_started = 0;
 	dev->state = RTE_REGEXDEV_UNUSED;
@@ -374,7 +380,8 @@ rte_regexdev_attr_get(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_attr_get == NULL)
+		return -ENOTSUP;
 	if (attr_value == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
 				 dev_id);
@@ -391,7 +398,8 @@ rte_regexdev_attr_set(uint8_t dev_id, enum rte_regexdev_attr_id attr_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_attr_set, -ENOTSUP);
+	if (*dev->dev_ops->dev_attr_set == NULL)
+		return -ENOTSUP;
 	if (attr_value == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d attribute value can't be NULL\n",
 				 dev_id);
@@ -409,7 +417,8 @@ rte_regexdev_rule_db_update(uint8_t dev_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_update, -ENOTSUP);
+	if (*dev->dev_ops->dev_rule_db_update == NULL)
+		return -ENOTSUP;
 	if (rules == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
 				 dev_id);
@@ -425,8 +434,8 @@ rte_regexdev_rule_db_compile_activate(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_rule_db_compile_activate,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_rule_db_compile_activate == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_rule_db_compile_activate)(dev);
 }
 
@@ -438,8 +447,8 @@ rte_regexdev_rule_db_import(uint8_t dev_id, const char *rule_db,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_import,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_db_import == NULL)
+		return -ENOTSUP;
 	if (rule_db == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d rules can't be NULL\n",
 				 dev_id);
@@ -455,8 +464,8 @@ rte_regexdev_rule_db_export(uint8_t dev_id, char *rule_db)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_db_export,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_db_export == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_db_export)(dev, rule_db);
 }
 
@@ -468,8 +477,8 @@ rte_regexdev_xstats_names_get(uint8_t dev_id,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_names_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_names_get == NULL)
+		return -ENOTSUP;
 	if (xstats_map == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d xstats map can't be NULL\n",
 				 dev_id);
@@ -486,7 +495,8 @@ rte_regexdev_xstats_get(uint8_t dev_id, const uint16_t *ids,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_get, -ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_get == NULL)
+		return -ENOTSUP;
 	if (ids == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -506,8 +516,8 @@ rte_regexdev_xstats_by_name_get(uint8_t dev_id, const char *name,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_by_name_get,
-				-ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_by_name_get == NULL)
+		return -ENOTSUP;
 	if (name == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d name can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -531,7 +541,8 @@ rte_regexdev_xstats_reset(uint8_t dev_id, const uint16_t *ids,
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_xstats_reset, -ENOTSUP);
+	if (*dev->dev_ops->dev_xstats_reset == NULL)
+		return -ENOTSUP;
 	if (ids == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d ids can't be NULL\n", dev_id);
 		return -EINVAL;
@@ -546,7 +557,8 @@ rte_regexdev_selftest(uint8_t dev_id)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+	if (*dev->dev_ops->dev_selftest == NULL)
+		return -ENOTSUP;
 	return (*dev->dev_ops->dev_selftest)(dev);
 }
 
@@ -557,7 +569,8 @@ rte_regexdev_dump(uint8_t dev_id, FILE *f)
 
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_regex_devices[dev_id];
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_dump, -ENOTSUP);
+	if (*dev->dev_ops->dev_dump == NULL)
+		return -ENOTSUP;
 	if (f == NULL) {
 		RTE_REGEXDEV_LOG(ERR, "Dev %d file can't be NULL\n", dev_id);
 		return -EINVAL;
diff --git a/lib/regexdev/rte_regexdev.h b/lib/regexdev/rte_regexdev.h
index 3bce8090f6..6061e648b1 100644
--- a/lib/regexdev/rte_regexdev.h
+++ b/lib/regexdev/rte_regexdev.h
@@ -1473,7 +1473,8 @@ rte_regexdev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
 #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->enqueue, -ENOTSUP);
+	if (*dev->enqueue == NULL)
+		return -ENOTSUP;
 	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
 		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
 		return -EINVAL;
@@ -1532,7 +1533,8 @@ rte_regexdev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
 	struct rte_regexdev *dev = &rte_regex_devices[dev_id];
 #ifdef RTE_LIBRTE_REGEXDEV_DEBUG
 	RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dequeue, -ENOTSUP);
+	if (*dev->dequeue == NULL)
+		return -ENOTSUP;
 	if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
 		RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
 		return -EINVAL;
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..1a2a408f0e 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -131,7 +131,8 @@ __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
 	RTE_PTR_OR_ERR_RET(instance, -EINVAL);
 	RTE_PTR_OR_ERR_RET(instance->ops, -EINVAL);
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->set_pkt_metadata, -ENOTSUP);
+	if (*instance->ops->set_pkt_metadata == NULL)
+		return -ENOTSUP;
 	return instance->ops->set_pkt_metadata(instance->device,
 					       sess, m, params);
 }
@@ -145,7 +146,8 @@ __rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md)
 	RTE_PTR_OR_ERR_RET(instance, NULL);
 	RTE_PTR_OR_ERR_RET(instance->ops, NULL);
 #endif
-	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_userdata, NULL);
+	if (*instance->ops->get_userdata == NULL)
+		return NULL;
 	if (instance->ops->get_userdata(instance->device, md, &userdata))
 		return NULL;
 
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index b2a2919fc0..a6ca785b29 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -266,7 +266,8 @@ rte_vdpa_get_stats_names(struct rte_vdpa_device *dev,
 	if (!dev)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats_names, -ENOTSUP);
+	if (dev->ops->get_stats_names == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->get_stats_names(dev, stats_names, size);
 }
@@ -278,7 +279,8 @@ rte_vdpa_get_stats(struct rte_vdpa_device *dev, uint16_t qid,
 	if (!dev || !stats || !n)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->get_stats, -ENOTSUP);
+	if (dev->ops->get_stats == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->get_stats(dev, qid, stats, n);
 }
@@ -289,7 +291,8 @@ rte_vdpa_reset_stats(struct rte_vdpa_device *dev, uint16_t qid)
 	if (!dev)
 		return -EINVAL;
 
-	RTE_FUNC_PTR_OR_ERR_RET(dev->ops->reset_stats, -ENOTSUP);
+	if (dev->ops->reset_stats == NULL)
+		return -ENOTSUP;
 
 	return dev->ops->reset_stats(dev, qid);
 }
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 4ad28bac45..0ae059ad29 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -3381,8 +3381,10 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable)
 		q_last = qid;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_vfio_device_fd, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_notify_area, -ENOTSUP);
+	if (vdpa_dev->ops->get_vfio_device_fd == NULL)
+		return -ENOTSUP;
+	if (vdpa_dev->ops->get_notify_area == NULL)
+		return -ENOTSUP;
 
 	vfio_device_fd = vdpa_dev->ops->get_vfio_device_fd(vid);
 	if (vfio_device_fd < 0)
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 09/27] devargs: remove dependency on bus header
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (7 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 10/27] build: export drivers headers David Marchand
                     ` (18 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

We don't need to include rte_bus.h in rte_devargs.h.
Only a forward declaration of rte_bus and an inclusion of rte_dev.h are
needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_vdev.c          | 1 +
 lib/eal/include/rte_devargs.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 720722c363..5eeff3106d 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/lib/eal/include/rte_devargs.h b/lib/eal/include/rte_devargs.h
index 37a0f042ab..38dee2f288 100644
--- a/lib/eal/include/rte_devargs.h
+++ b/lib/eal/include/rte_devargs.h
@@ -22,7 +22,9 @@ extern "C" {
 
 #include <stdio.h>
 #include <rte_compat.h>
-#include <rte_bus.h>
+#include <rte_dev.h>
+
+struct rte_bus;
 
 /**
  * Bus type key in global devargs syntax.
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 10/27] build: export drivers headers
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (8 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 09/27] devargs: remove dependency on bus header David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 11/27] bus/auxiliary: make driver-only headers private David Marchand
                     ` (17 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

Same as for device classes, external DPDK users may need to include some
bus headers for their out of tree drivers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/meson.build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/meson.build b/drivers/meson.build
index 376a64f4da..f6ba5ba4fb 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -91,6 +91,7 @@ foreach subpath:subdirs
         name = drv
         sources = []
         headers = []
+        driver_sdk_headers = [] # public headers included by drivers
         objs = []
         cflags = default_cflags
         includes = [include_directories(drv_path)]
@@ -160,6 +161,9 @@ foreach subpath:subdirs
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         install_headers(headers)
+        if get_option('enable_driver_sdk')
+            install_headers(driver_sdk_headers)
+        endif
 
         # generate pmdinfo sources by building a temporary
         # lib and then running pmdinfogen on the contents of
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 11/27] bus/auxiliary: make driver-only headers private
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (9 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 10/27] build: export drivers headers David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 12/27] bus/dpaa: " David Marchand
                     ` (16 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Parav Pandit, Xueming Li, Ray Kinsella,
	Matan Azrad, Viacheslav Ovsiienko

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 <david.marchand@redhat.com>
---
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 <rte_devargs.h>
 
 #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 <rte_kvargs.h>
 
 #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 <stdint.h>
 #include <inttypes.h>
 
+#include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 
 #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 <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <eal_filesystem.h>
 
-#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 <stdio.h>
 #include <sys/queue.h>
 
-#include "rte_bus_auxiliary.h"
+#include <rte_bus.h>
+
+#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 <rte_malloc.h>
 #include <rte_errno.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #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 <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <rte_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 
 #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 <ethdev_pci.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_auxiliary.h>
+#include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 12/27] bus/dpaa: make driver-only headers private
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (10 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 11/27] bus/auxiliary: make driver-only headers private David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 13/27] bus/fslmc: " David Marchand
                     ` (15 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Hemant Agrawal, Sachin Saxena, Gagandeep Singh

The dpaa 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.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 drivers/bus/dpaa/base/qbman/qman.c            |  2 +-
 .../{rte_dpaa_bus.h => bus_dpaa_driver.h}     | 25 ++++++-------------
 drivers/bus/dpaa/dpaa_bus.c                   | 20 +++++++--------
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c     |  2 +-
 drivers/dma/dpaa/dpaa_qdma.c                  |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/mempool/dpaa/dpaa_mempool.h           |  2 +-
 drivers/net/dpaa/dpaa_ethdev.c                |  2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |  2 +-
 10 files changed, 26 insertions(+), 35 deletions(-)
 rename drivers/bus/dpaa/{rte_dpaa_bus.h => bus_dpaa_driver.h} (92%)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 447c091770..3949bf8712 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -7,7 +7,7 @@
 
 #include "qman.h"
 #include <rte_branch_prediction.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_eventdev.h>
 #include <rte_byteorder.h>
 
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/bus_dpaa_driver.h
similarity index 92%
rename from drivers/bus/dpaa/rte_dpaa_bus.h
rename to drivers/bus/dpaa/bus_dpaa_driver.h
index 1f04d9ebd3..cf66fc0c53 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -3,12 +3,14 @@
  *   Copyright 2017-2022 NXP
  *
  */
-#ifndef __RTE_DPAA_BUS_H__
-#define __RTE_DPAA_BUS_H__
+#ifndef BUS_DPAA_DRIVER_H
+#define BUS_DPAA_DRIVER_H
 
-#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
+
 #include <dpaax_iova_table.h>
 
 #include <dpaa_of.h>
@@ -73,24 +75,12 @@ extern unsigned int dpaa_svr_family;
 struct rte_dpaa_device;
 struct rte_dpaa_driver;
 
-/* DPAA Device and Driver lists for DPAA bus */
-TAILQ_HEAD(rte_dpaa_device_list, rte_dpaa_device);
-TAILQ_HEAD(rte_dpaa_driver_list, rte_dpaa_driver);
-
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
 	FSL_DPAA_QDMA
 };
 
-struct rte_dpaa_bus {
-	struct rte_bus bus;
-	struct rte_dpaa_device_list device_list;
-	struct rte_dpaa_driver_list driver_list;
-	int device_count;
-	int detected;
-};
-
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
@@ -119,7 +109,6 @@ typedef int (*rte_dpaa_remove_t)(struct rte_dpaa_device *dpaa_dev);
 struct rte_dpaa_driver {
 	TAILQ_ENTRY(rte_dpaa_driver) next;
 	struct rte_driver driver;
-	struct rte_dpaa_bus *dpaa_bus;
 	enum rte_dpaa_type drv_type;
 	rte_dpaa_probe_t probe;
 	rte_dpaa_remove_t remove;
@@ -166,6 +155,7 @@ extern struct dpaa_memseg_list rte_dpaa_memsegs;
 /* Either iterate over the list of internal memseg references or fallback to
  * EAL memseg based iova2virt.
  */
+__rte_internal
 static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 {
 	struct dpaa_memseg *ms;
@@ -192,6 +182,7 @@ static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 	return va;
 }
 
+__rte_internal
 static inline rte_iova_t
 rte_dpaa_mem_vtop(void *vaddr)
 {
@@ -263,4 +254,4 @@ struct fm_eth_port_cfg *dpaa_get_eth_port_cfg(int dev_id);
 }
 #endif
 
-#endif /* __RTE_DPAA_BUS_H__ */
+#endif /* BUS_DPAA_DRIVER_H */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e442bc4c33..1ac6aa314f 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,7 +34,7 @@
 #include <rte_mbuf_dyn.h>
 
 #include <dpaa_of.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaax_iova_table.h>
 
@@ -43,6 +43,14 @@
 #include <fsl_bman.h>
 #include <netcfg.h>
 
+struct rte_dpaa_bus {
+	struct rte_bus bus;
+	TAILQ_HEAD(, rte_dpaa_device) device_list;
+	TAILQ_HEAD(, rte_dpaa_driver) driver_list;
+	int device_count;
+	int detected;
+};
+
 static struct rte_dpaa_bus rte_dpaa_bus;
 struct netcfg_info *dpaa_netcfg;
 
@@ -520,23 +528,15 @@ rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
 	BUS_INIT_FUNC_TRACE();
 
 	TAILQ_INSERT_TAIL(&rte_dpaa_bus.driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = &rte_dpaa_bus;
 }
 
 /* un-register a dpaa bus based dpaa driver */
 void
 rte_dpaa_driver_unregister(struct rte_dpaa_driver *driver)
 {
-	struct rte_dpaa_bus *dpaa_bus;
-
 	BUS_INIT_FUNC_TRACE();
 
-	dpaa_bus = driver->dpaa_bus;
-
-	TAILQ_REMOVE(&dpaa_bus->driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = NULL;
+	TAILQ_REMOVE(&rte_dpaa_bus.driver_list, driver, next);
 }
 
 static int
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 05415dbf3b..7e554cb2b1 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -41,7 +41,7 @@
 #include <desc/pdcp.h>
 #include <desc/sdap.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_event.h>
 #include <dpaa_sec_log.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index d081953e26..29c5935739 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -15,7 +15,7 @@
 #include <desc/algo.h>
 #include <desc/ipsec.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_log.h>
 
diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c
index 9386fe5698..10e65ef1d7 100644
--- a/drivers/dma/dpaa/dpaa_qdma.c
+++ b/drivers/dma/dpaa/dpaa_qdma.c
@@ -2,7 +2,7 @@
  * Copyright 2021 NXP
  */
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dmadev_pmd.h>
 
 #include "dpaa_qdma.h"
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index ff6cc0be18..aa403f9e06 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -29,7 +29,7 @@
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_event_eth_tx_adapter.h>
 #include <cryptodev_pmd.h>
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h
index dc0058e6dd..3f0eafa7dd 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.h
+++ b/drivers/mempool/dpaa/dpaa_mempool.h
@@ -14,7 +14,7 @@
 
 #include <rte_mempool.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 
 #include <fsl_usd.h>
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index e5a072cf49..f21cbba0d9 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -33,7 +33,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <rte_dpaa_logs.h>
 #include <dpaa_mempool.h>
 
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 956fe946fa..20b75efb63 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -37,7 +37,7 @@
 
 #include "dpaa_ethdev.h"
 #include "dpaa_rxtx.h"
-#include <rte_dpaa_bus.h>
+#include <bus_dpaa_driver.h>
 #include <dpaa_mempool.h>
 
 #include <qman.h>
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 13/27] bus/fslmc: make driver-only headers private
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (11 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 12/27] bus/dpaa: " David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 14/27] bus/ifpga: cleanup exported symbols David Marchand
                     ` (14 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Hemant Agrawal, Sachin Saxena, Gagandeep Singh

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.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@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.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 14/27] bus/ifpga: cleanup exported symbols
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (12 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 13/27] bus/fslmc: " David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 15/27] bus/ifpga: make driver-only headers private David Marchand
                     ` (13 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

Remove unused symbols (exposed only in an internal header which
guarantees that no application out there relied on them).

Remove rte_ prefix and inline the rest to avoid having to expose them as
global symbols for a relatively small added value.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
 drivers/bus/ifpga/ifpga_bus.c    | 13 +++--
 drivers/bus/ifpga/ifpga_common.c | 88 --------------------------------
 drivers/bus/ifpga/ifpga_common.h | 54 ++++++++++++++++----
 drivers/bus/ifpga/meson.build    |  2 +-
 drivers/bus/ifpga/version.map    |  2 -
 drivers/raw/ifpga/ifpga_rawdev.c |  2 +-
 6 files changed, 53 insertions(+), 108 deletions(-)
 delete mode 100644 drivers/bus/ifpga/ifpga_common.c

diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index e005f2cb70..b1e9eb7cc4 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -117,9 +117,9 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-		&rte_ifpga_get_integer32_arg, &afu_pr_conf.afu_id.port) < 0) {
-			IFPGA_BUS_ERR("error to parse %s",
-				     IFPGA_ARG_PORT);
+				ifpga_get_integer32_arg,
+				&afu_pr_conf.afu_id.port) < 0) {
+			IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_PORT);
 			goto end;
 		}
 	} else {
@@ -130,9 +130,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 
 	if (rte_kvargs_count(kvlist, IFPGA_AFU_BTS) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_AFU_BTS,
-				       &rte_ifpga_get_string_arg, &path) < 0) {
-			IFPGA_BUS_ERR("Failed to parse %s",
-				     IFPGA_AFU_BTS);
+				ifpga_get_string_arg, &path) < 0) {
+			IFPGA_BUS_ERR("Failed to parse %s", IFPGA_AFU_BTS);
 			goto end;
 		}
 		afu_pr_conf.pr_enable = 1;
@@ -228,7 +227,7 @@ ifpga_scan(void)
 
 		if (rte_kvargs_count(kvlist, IFPGA_ARG_NAME) == 1) {
 			if (rte_kvargs_process(kvlist, IFPGA_ARG_NAME,
-				       &rte_ifpga_get_string_arg, &name) < 0) {
+					ifpga_get_string_arg, &name) < 0) {
 				IFPGA_BUS_ERR("error to parse %s",
 				     IFPGA_ARG_NAME);
 				goto end;
diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c
deleted file mode 100644
index 78e2eaee4e..0000000000
--- a/drivers/bus/ifpga/ifpga_common.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2018 Intel Corporation
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/queue.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <rte_errno.h>
-#include <rte_bus.h>
-#include <rte_per_lcore.h>
-#include <rte_memory.h>
-#include <rte_memzone.h>
-#include <rte_eal.h>
-#include <rte_common.h>
-
-#include <rte_devargs.h>
-#include <rte_kvargs.h>
-#include <rte_alarm.h>
-
-#include "rte_bus_ifpga.h"
-#include "ifpga_logs.h"
-#include "ifpga_common.h"
-
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(char **)extra_args = strdup(value);
-
-	if (!*(char **)extra_args)
-		return -ENOMEM;
-
-	return 0;
-}
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(int *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args)
-{
-	if (!value || !extra_args)
-		return -EINVAL;
-
-	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
-}
-int ifpga_get_unsigned_long(const char *str, int base)
-{
-	unsigned long num;
-	char *end = NULL;
-
-	errno = 0;
-
-	num = strtoul(str, &end, base);
-	if ((str[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0))
-		return -1;
-
-	return num;
-}
-
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1)
-{
-	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
-		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
-		(afu_id0->port == afu_id1->port)) {
-		return 0;
-	} else
-		return 1;
-}
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index f9254b9d5d..bb6524030f 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -5,14 +5,50 @@
 #ifndef _IFPGA_COMMON_H_
 #define _IFPGA_COMMON_H_
 
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_integer64_arg(const char *key __rte_unused,
-	const char *value, void *extra_args);
-int ifpga_get_unsigned_long(const char *str, int base);
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
-	const struct rte_afu_id *afu_id1);
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_bus_ifpga.h>
+#include <rte_common.h>
+
+static inline int
+ifpga_get_string_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(char **)extra_args = strdup(value);
+
+	if (!*(char **)extra_args)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static inline int
+ifpga_get_integer32_arg(const char *key __rte_unused, const char *value,
+	void *extra_args)
+{
+	if (!value || !extra_args)
+		return -EINVAL;
+
+	*(int *)extra_args = strtoull(value, NULL, 0);
+
+	return 0;
+}
+
+static inline int
+ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
+	const struct rte_afu_id *afu_id1)
+{
+	if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
+		(afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
+		(afu_id0->port == afu_id1->port)) {
+		return 0;
+	} else
+		return 1;
+}
 
 #endif /* _IFPGA_COMMON_H_ */
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index cc5047e3ce..9d56a4bb2b 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -9,4 +9,4 @@ endif
 
 deps += ['pci', 'kvargs', 'rawdev']
 headers = files('rte_bus_ifpga.h')
-sources = files('ifpga_common.c', 'ifpga_bus.c')
+sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index c0a1eecae8..da7f92c2a0 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -4,8 +4,6 @@ DPDK_23 {
 	rte_ifpga_driver_register;
 	rte_ifpga_driver_unregister;
 	rte_ifpga_find_afu_by_name;
-	rte_ifpga_get_integer32_arg;
-	rte_ifpga_get_string_arg;
 
 	local: *;
 };
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 3b616c45ff..153203a42f 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1754,7 +1754,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs,
 
 	if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
 		if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
-			&rte_ifpga_get_integer32_arg, &port) < 0) {
+				ifpga_get_integer32_arg, &port) < 0) {
 			IFPGA_RAWDEV_PMD_ERR("error to parse %s",
 				IFPGA_ARG_PORT);
 			goto end;
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 15/27] bus/ifpga: make driver-only headers private
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (13 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 14/27] bus/ifpga: cleanup exported symbols David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 16/27] bus/pci: " David Marchand
                     ` (12 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Rosen Xu, Ray Kinsella, Tianfei zhang

The ifpga bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- 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 <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst         |  2 +-
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}    | 18 ++++++++----------
 drivers/bus/ifpga/ifpga_bus.c                  |  6 +++---
 drivers/bus/ifpga/ifpga_common.h               |  2 +-
 drivers/bus/ifpga/meson.build                  |  2 +-
 drivers/bus/ifpga/version.map                  |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c             |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h             |  2 +-
 drivers/net/ipn3ke/ipn3ke_flow.c               |  2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c        |  2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                 |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h               |  2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c             |  2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c              |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c               |  2 +-
 17 files changed, 26 insertions(+), 28 deletions(-)
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 9fd95e13dd..2f2bd2b086 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,7 +88,7 @@ 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``,
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``
   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).
diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/bus_ifpga_driver.h
similarity index 91%
rename from drivers/bus/ifpga/rte_bus_ifpga.h
rename to drivers/bus/ifpga/bus_ifpga_driver.h
index 007ad19875..7b75c2ddbc 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -2,8 +2,8 @@
  * Copyright(c) 2010-2018 Intel Corporation
  */
 
-#ifndef _RTE_BUS_IFPGA_H_
-#define _RTE_BUS_IFPGA_H_
+#ifndef BUS_IFPGA_DRIVER_H
+#define BUS_IFPGA_DRIVER_H
 
 /**
  * @file
@@ -15,23 +15,17 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#include <rte_bus.h>
+#include <rte_compat.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
 
-/** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
 
 /* Forward declarations */
 struct rte_afu_device;
 struct rte_afu_driver;
 
-/** Double linked list of Intel FPGA AFU device. */
-RTE_TAILQ_HEAD(ifpga_afu_dev_list, rte_afu_device);
-/** Double linked list of Intel FPGA AFU device drivers. */
-RTE_TAILQ_HEAD(ifpga_afu_drv_list, rte_afu_driver);
-
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
 struct rte_afu_uuid {
@@ -112,6 +106,7 @@ struct rte_afu_driver {
 	const struct rte_afu_uuid *id_table;    /**< AFU uuid within FPGA. */
 };
 
+__rte_internal
 static inline const char *
 rte_ifpga_device_name(const struct rte_afu_device *afu)
 {
@@ -126,6 +121,7 @@ rte_ifpga_device_name(const struct rte_afu_device *afu)
  * @param name
  *   A pointer to AFU name string.
  */
+__rte_internal
 struct rte_afu_device *
 rte_ifpga_find_afu_by_name(const char *name);
 
@@ -136,6 +132,7 @@ rte_ifpga_find_afu_by_name(const char *name);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be registered.
  */
+__rte_internal
 void rte_ifpga_driver_register(struct rte_afu_driver *driver);
 
 /**
@@ -145,6 +142,7 @@ void rte_ifpga_driver_register(struct rte_afu_driver *driver);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be unregistered.
  */
+__rte_internal
 void rte_ifpga_driver_unregister(struct rte_afu_driver *driver);
 
 #define RTE_PMD_REGISTER_AFU(nm, afudrv)\
@@ -164,4 +162,4 @@ static const char *afudrvinit_ ## nm ## _alias = RTE_STR(alias)
 }
 #endif /* __cplusplus */
 
-#endif /* _RTE_BUS_IFPGA_H_ */
+#endif /* BUS_IFPGA_DRIVER_H */
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index b1e9eb7cc4..27e2de7072 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -28,7 +28,7 @@
 
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_logs.h"
 #include "ifpga_common.h"
 
@@ -37,9 +37,9 @@
  */
 static struct rte_bus rte_ifpga_bus;
 
-static struct ifpga_afu_dev_list ifpga_afu_dev_list =
+static TAILQ_HEAD(, rte_afu_device) ifpga_afu_dev_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_dev_list);
-static struct ifpga_afu_drv_list ifpga_afu_drv_list =
+static TAILQ_HEAD(, rte_afu_driver) ifpga_afu_drv_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_drv_list);
 
 
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index bb6524030f..a41a1628f5 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_common.h>
 
 static inline int
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index 9d56a4bb2b..dedc94db2d 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -8,5 +8,5 @@ if is_windows
 endif
 
 deps += ['pci', 'kvargs', 'rawdev']
-headers = files('rte_bus_ifpga.h')
+driver_sdk_headers += files('bus_ifpga_driver.h')
 sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index da7f92c2a0..3d1943afe4 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -1,4 +1,4 @@
-DPDK_23 {
+INTERNAL {
 	global:
 
 	rte_ifpga_driver_register;
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 550a8b0466..2e39113941 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 58fcc50c57..dbf57f9ba8 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -24,7 +24,7 @@
 #include <rte_spinlock.h>
 
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_tm_driver.h>
 
 #define IPN3KE_TM_SCRATCH_RW 0
diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c
index 66ae31a5a9..5b57ee9341 100644
--- a/drivers/net/ipn3ke/ipn3ke_flow.c
+++ b/drivers/net/ipn3ke/ipn3ke_flow.c
@@ -20,7 +20,7 @@
 #include <rte_tailq.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index abbecfdf2e..2f088d767f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 6a9b98fd7f..2f242b678a 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/raw/ifpga/afu_pmd_core.h b/drivers/raw/ifpga/afu_pmd_core.h
index 91118a19ab..ab5a228147 100644
--- a/drivers/raw/ifpga/afu_pmd_core.h
+++ b/drivers/raw/ifpga/afu_pmd_core.h
@@ -15,7 +15,7 @@ extern "C" {
 
 #include <rte_spinlock.h>
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "ifpga_rawdev.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index 102de50812..eca1edc270 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index 8b2c85b5f8..da0aba6e00 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 0f57a03b0e..3c41aa9ee8 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 5120df5f77..b7438bd372 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 153203a42f..32de5ff0ce 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -35,7 +35,7 @@
 #include "base/ifpga_api.h"
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_common.h"
 #include "ifpga_logs.h"
 #include "ifpga_rawdev.h"
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 16/27] bus/pci: make driver-only headers private
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (14 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 15/27] bus/ifpga: make driver-only headers private David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 17/27] bus/vdev: " David Marchand
                     ` (11 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ajit Khaparde, Rosen Xu,
	Nicolas Chautru, Ray Kinsella, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Matan Azrad, Viacheslav Ovsiienko,
	Fan Zhang, Andrew Rybchenko, Ashish Gupta, Chandubabu Namburu,
	Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Nagadheeraj Rottela, Srikanth Jampala, Jay Zhou,
	Radha Mohan Chintakuntla, Veerasenareddy Burru, Chengwen Feng,
	Kevin Laatz, Conor Walsh, Timothy McDaniel, Jerin Jacob,
	Pavan Nikhilesh, Elena Agostini, Ashwin Sekhar T K, Harman Kalra,
	Shepard Siegel, Ed Czeck, John Miller, Steven Webster,
	Matt Peters, Rasesh Mody, Shahed Shaikh, Somnath Kotur,
	Chas Williams, Min Hu (Connor),
	Rahul Lakkireddy, Simei Su, Wenjun Wu, Marcin Wojtas,
	Michal Krawczyk, Shai Brandes, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Dongdong Liu, Yisen Zhuang, Yuying Zhang,
	Beilei Xing, Junfeng Guo, Andrew Boyer, Qiming Yang,
	Stephen Hemminger, Long Li, Jiawen Wu, Devendra Singh Rawat,
	Maciej Czekaj, Jian Wang, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Tianfei zhang,
	Jingjing Wu, Ori Kam, Xiao Wang, Vijay Kumar Srivastava,
	Ferruh Yigit

The pci 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 <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 app/test/virtual_pmd.c                        |   2 +-
 doc/guides/rel_notes/release_22_11.rst        |   2 +-
 drivers/baseband/acc100/rte_acc100_pmd.c      |   2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |   2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   2 +-
 drivers/bus/pci/bsd/pci.c                     |   3 -
 drivers/bus/pci/bus_pci_driver.h              | 200 +++++++++++++++++
 drivers/bus/pci/linux/pci.c                   |   3 -
 drivers/bus/pci/meson.build                   |   1 +
 drivers/bus/pci/pci_common.c                  |   2 -
 drivers/bus/pci/private.h                     |  19 +-
 drivers/bus/pci/rte_bus_pci.h                 | 201 +-----------------
 drivers/bus/pci/version.map                   |  11 +-
 drivers/bus/pci/windows/pci.c                 |   1 +
 drivers/bus/pci/windows/pci_netuio.c          |   1 +
 drivers/common/cnxk/roc_platform.h            |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |   2 +-
 drivers/common/mlx5/linux/mlx5_common_os.h    |   2 +-
 drivers/common/mlx5/mlx5_common.h             |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c         |   3 +-
 drivers/common/mlx5/windows/mlx5_common_os.c  |   2 +-
 drivers/common/qat/qat_device.h               |   2 +-
 drivers/common/qat/qat_qp.c                   |   2 +-
 drivers/common/sfc_efx/sfc_efx.h              |   2 +-
 drivers/compress/mlx5/mlx5_compress.c         |   2 +-
 drivers/compress/octeontx/otx_zip.h           |   2 +-
 drivers/compress/qat/qat_comp.c               |   2 +-
 drivers/crypto/ccp/ccp_dev.h                  |   2 +-
 drivers/crypto/ccp/ccp_pci.h                  |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |   2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |   2 +-
 drivers/crypto/mlx5/mlx5_crypto.c             |   2 +-
 drivers/crypto/nitrox/nitrox_device.h         |   2 +-
 drivers/crypto/octeontx/otx_cryptodev.c       |   2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c   |   2 +-
 drivers/crypto/qat/qat_sym.c                  |   2 +-
 drivers/crypto/virtio/virtio_cryptodev.c      |   2 +-
 drivers/crypto/virtio/virtio_pci.c            |   1 -
 drivers/crypto/virtio/virtio_pci.h            |   2 +-
 drivers/dma/cnxk/cnxk_dmadev.c                |   3 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |   2 +-
 drivers/dma/idxd/idxd_pci.c                   |   2 +-
 drivers/dma/ioat/ioat_dmadev.c                |   2 +-
 drivers/event/dlb2/pf/dlb2_main.h             |   2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |   2 +-
 drivers/event/octeontx/ssovf_probe.c          |   2 +-
 drivers/event/octeontx/timvf_probe.c          |   2 +-
 drivers/gpu/cuda/cuda.c                       |   2 +-
 drivers/mempool/cnxk/cnxk_mempool.c           |   2 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   2 +-
 drivers/net/ark/ark_ethdev.c                  |   2 +-
 drivers/net/avp/avp_ethdev.c                  |   2 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnxt/bnxt.h                       |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c       |   3 +-
 drivers/net/cxgbe/base/adapter.h              |   2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |   2 +-
 drivers/net/e1000/em_ethdev.c                 |   2 +-
 drivers/net/e1000/em_rxtx.c                   |   2 +-
 drivers/net/e1000/igb_ethdev.c                |   2 +-
 drivers/net/e1000/igb_pf.c                    |   2 +-
 drivers/net/ena/ena_ethdev.h                  |   2 +-
 drivers/net/enic/base/vnic_dev.h              |   2 +-
 drivers/net/enic/enic_ethdev.c                |   2 +-
 drivers/net/enic/enic_main.c                  |   2 +-
 drivers/net/enic/enic_vf_representor.c        |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c       |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c      |   2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c          |   2 +-
 drivers/net/hns3/hns3_common.c                |   2 +-
 drivers/net/hns3/hns3_ethdev.c                |   2 +-
 drivers/net/hns3/hns3_rxtx.c                  |   2 +-
 drivers/net/i40e/i40e_ethdev.c                |   2 +-
 drivers/net/i40e/i40e_vf_representor.c        |   2 +-
 drivers/net/igc/igc_ethdev.c                  |   2 +-
 drivers/net/ionic/ionic.h                     |   2 +-
 drivers/net/ionic/ionic_ethdev.c              |   2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |   2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |   2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h              |   2 +-
 drivers/net/mlx4/mlx4_ethdev.c                |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c              |   3 +-
 drivers/net/mlx5/mlx5.c                       |   2 +-
 drivers/net/mlx5/mlx5_ethdev.c                |   2 +-
 drivers/net/mlx5/mlx5_flow_dv.c               |   2 +-
 drivers/net/mlx5/mlx5_txq.c                   |   2 +-
 drivers/net/netvsc/hn_vf.c                    |   2 +-
 drivers/net/ngbe/base/ngbe_osdep.h            |   2 +-
 drivers/net/ngbe/ngbe_pf.c                    |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c    |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c    |   2 +-
 drivers/net/qede/base/bcm_osal.h              |   2 +-
 drivers/net/sfc/sfc.h                         |   2 +-
 drivers/net/sfc/sfc_ethdev.c                  |   2 +-
 drivers/net/sfc/sfc_sriov.c                   |   2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |   2 +-
 drivers/net/txgbe/txgbe_ethdev.h              |   2 +-
 drivers/net/txgbe/txgbe_flow.c                |   2 +-
 drivers/net/txgbe/txgbe_pf.c                  |   2 +-
 drivers/net/virtio/virtio_pci.h               |   2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c         |   2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c         |   2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c           |   2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c            |   2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/ifpga/rte_pmd_ifpga.c             |   2 +-
 drivers/raw/ioat/idxd_pci.c                   |   2 +-
 drivers/raw/ioat/ioat_rawdev.c                |   2 +-
 drivers/raw/ntb/ntb.c                         |   2 +-
 drivers/raw/ntb/ntb_hw_intel.c                |   2 +-
 drivers/regex/mlx5/mlx5_regex.c               |   2 +-
 drivers/regex/mlx5/mlx5_regex_fastpath.c      |   2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h           |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |   2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c                 |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.h                   |   2 +-
 lib/ethdev/ethdev_pci.h                       |   2 +-
 lib/eventdev/eventdev_pmd_pci.h               |   2 +-
 128 files changed, 350 insertions(+), 331 deletions(-)
 create mode 100644 drivers/bus/pci/bus_pci_driver.h

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index cd4611ab48..2b55c85fd8 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 2f2bd2b086..8fa4cf468d 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,7 +88,7 @@ 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``, ``ifpga``
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``
   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).
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index a8482bd411..801e8920df 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -14,7 +14,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_hexdump.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
 #endif
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 82ae6ba678..c1d877c87f 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index 21d35292a3..f16814e241 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -11,7 +11,7 @@
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #ifdef RTE_BBDEV_OFFLOAD_COST
 #include <rte_cycles.h>
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 9a11f99ae3..bc560a2a56 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -28,7 +28,6 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
@@ -48,8 +47,6 @@
  * PCI probing under BSD.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /* Map pci device */
 int
 rte_pci_map_device(struct rte_pci_device *dev)
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
new file mode 100644
index 0000000000..b5c7dee617
--- /dev/null
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -0,0 +1,200 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2015 Intel Corporation.
+ * Copyright 2013-2014 6WIND S.A.
+ */
+
+#ifndef BUS_PCI_DRIVER_H
+#define BUS_PCI_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_pci.h>
+#include <rte_dev.h>
+#include <rte_compat.h>
+
+/** Pathname of PCI devices directory. */
+__rte_internal
+const char *rte_pci_get_sysfs_path(void);
+
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* no attached driver */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
+};
+
+/**
+ * A structure describing a PCI device.
+ */
+struct rte_pci_device {
+	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
+	struct rte_device device;           /**< Inherit core device */
+	struct rte_pci_addr addr;           /**< PCI location. */
+	struct rte_pci_id id;               /**< PCI ID. */
+	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
+					    /**< PCI Memory Resource */
+	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
+	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
+	uint16_t max_vfs;                   /**< sriov enable if not zero */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
+	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	struct rte_intr_handle *vfio_req_intr_handle;
+				/**< Handler of VFIO request interrupt */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_pci_device.
+ */
+#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
+
+#define RTE_DEV_TO_PCI_CONST(ptr) \
+	container_of(ptr, const struct rte_pci_device, device)
+
+#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
+
+#ifdef __cplusplus
+/** C++ macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev) \
+	RTE_CLASS_ANY_ID,         \
+	(vend),                   \
+	(dev),                    \
+	RTE_PCI_ANY_ID,           \
+	RTE_PCI_ANY_ID
+#else
+/** Macro used to help building up tables of device IDs */
+#define RTE_PCI_DEVICE(vend, dev)          \
+	.class_id = RTE_CLASS_ANY_ID,      \
+	.vendor_id = (vend),               \
+	.device_id = (dev),                \
+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
+	.subsystem_device_id = RTE_PCI_ANY_ID
+#endif
+
+/**
+ * Initialisation function for the driver called during PCI probing.
+ */
+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
+
+/**
+ * Uninitialisation function for the driver called during hotplugging.
+ */
+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the PCI device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A structure describing a PCI driver.
+ */
+struct rte_pci_driver {
+	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
+	struct rte_driver driver;          /**< Inherit core driver. */
+	rte_pci_probe_t *probe;            /**< Device probe function. */
+	rte_pci_remove_t *remove;          /**< Device remove function. */
+	pci_dma_map_t *dma_map;		   /**< device dma map function. */
+	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
+	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
+	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
+};
+
+/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
+#define RTE_PCI_DRV_NEED_MAPPING 0x0001
+/** Device needs PCI BAR mapping with enabled write combining (wc) */
+#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
+/** Device already probed can be probed again to check for new ports. */
+#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
+/** Device driver supports link state interrupt */
+#define RTE_PCI_DRV_INTR_LSC	0x0008
+/** Device driver supports device removal interrupt */
+#define RTE_PCI_DRV_INTR_RMV 0x0010
+/** Device driver needs to keep mapped resources if unsupported dev detected */
+#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
+
+/**
+ * Register a PCI driver.
+ *
+ * @param driver
+ *   A pointer to a rte_pci_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_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) \
+{\
+	(pci_drv).driver.name = RTE_STR(nm);\
+	rte_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.
+ */
+__rte_internal
+void rte_pci_unregister(struct rte_pci_driver *driver);
+
+/*
+ * A structure used to access io resources for a pci device.
+ * rte_pci_ioport is arch, os, driver specific, and should not be used outside
+ * of pci ioport api.
+ */
+struct rte_pci_ioport {
+	struct rte_pci_device *dev;
+	uint64_t base;
+	uint64_t len; /* only filled for memory mapped ports */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_PCI_DRIVER_H */
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index e521459870..fa5d5e131d 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -6,7 +6,6 @@
 #include <dirent.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_malloc.h>
@@ -24,8 +23,6 @@
  * PCI probing using Linux sysfs.
  */
 
-extern struct rte_pci_bus rte_pci_bus;
-
 static int
 pci_get_kernel_driver_by_path(const char *filename, char *dri_name,
 			      size_t len)
diff --git a/drivers/bus/pci/meson.build b/drivers/bus/pci/meson.build
index 81c7e94c00..f50f039a68 100644
--- a/drivers/bus/pci/meson.build
+++ b/drivers/bus/pci/meson.build
@@ -3,6 +3,7 @@
 
 deps += ['pci']
 headers = files('rte_bus_pci.h')
+driver_sdk_headers = files('bus_pci_driver.h')
 sources = files('pci_common.c',
     'pci_params.c')
 if is_linux
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 37ab879779..0d61d49287 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -443,7 +443,6 @@ void
 rte_pci_register(struct rte_pci_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = &rte_pci_bus;
 }
 
 /* unregister a driver */
@@ -451,7 +450,6 @@ void
 rte_pci_unregister(struct rte_pci_driver *driver)
 {
 	TAILQ_REMOVE(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to PCI bus */
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 0fbef8e1d8..4e40a2ed85 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,12 +8,29 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
+/**
+ * Structure describing the PCI bus
+ */
+struct rte_pci_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_pci_device) device_list; /**< List of PCI devices */
+	RTE_TAILQ_HEAD(, rte_pci_driver) driver_list; /**< List of PCI drivers */
+};
+
 extern struct rte_pci_bus rte_pci_bus;
 
+/* PCI Bus iterators */
+#define FOREACH_DEVICE_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_PCIBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+
 struct rte_pci_driver;
 struct rte_pci_device;
 
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1c6a8fdd7b..60e50ca875 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -24,176 +24,15 @@ extern "C" {
 
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 
-/** Pathname of PCI devices directory. */
-const char *rte_pci_get_sysfs_path(void);
-
 /* Forward declarations */
 struct rte_pci_device;
 struct rte_pci_driver;
-
-/** List of PCI devices */
-RTE_TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
-/** List of PCI drivers */
-RTE_TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
-
-/* PCI Bus iterators */
-#define FOREACH_DEVICE_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_PCIBUS(p)	\
-		RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+struct rte_pci_ioport;
 
 struct rte_devargs;
 
-enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
-	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
-	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
-	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
-	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
-	RTE_PCI_KDRV_NONE,         /* no attached driver */
-	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
-};
-
-/**
- * A structure describing a PCI device.
- */
-struct rte_pci_device {
-	RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
-	struct rte_device device;           /**< Inherit core device */
-	struct rte_pci_addr addr;           /**< PCI location. */
-	struct rte_pci_id id;               /**< PCI ID. */
-	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
-					    /**< PCI Memory Resource */
-	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
-	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
-	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
-	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
-	struct rte_intr_handle *vfio_req_intr_handle;
-				/**< Handler of VFIO request interrupt */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_pci_device.
- */
-#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
-
-#define RTE_DEV_TO_PCI_CONST(ptr) \
-	container_of(ptr, const struct rte_pci_device, device)
-
-#define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
-
-#ifdef __cplusplus
-/** C++ macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev) \
-	RTE_CLASS_ANY_ID,         \
-	(vend),                   \
-	(dev),                    \
-	RTE_PCI_ANY_ID,           \
-	RTE_PCI_ANY_ID
-#else
-/** Macro used to help building up tables of device IDs */
-#define RTE_PCI_DEVICE(vend, dev)          \
-	.class_id = RTE_CLASS_ANY_ID,      \
-	.vendor_id = (vend),               \
-	.device_id = (dev),                \
-	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
-	.subsystem_device_id = RTE_PCI_ANY_ID
-#endif
-
-/**
- * Initialisation function for the driver called during PCI probing.
- */
-typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
-
-/**
- * Uninitialisation function for the driver called during hotplugging.
- */
-typedef int (rte_pci_remove_t)(struct rte_pci_device *);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_map_t)(struct rte_pci_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the PCI device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A structure describing a PCI driver.
- */
-struct rte_pci_driver {
-	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
-	struct rte_driver driver;          /**< Inherit core driver. */
-	struct rte_pci_bus *bus;           /**< PCI bus reference. */
-	rte_pci_probe_t *probe;            /**< Device probe function. */
-	rte_pci_remove_t *remove;          /**< Device remove function. */
-	pci_dma_map_t *dma_map;		   /**< device dma map function. */
-	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
-	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
-	uint32_t drv_flags;                /**< Flags RTE_PCI_DRV_*. */
-};
-
-/**
- * Structure describing the PCI bus
- */
-struct rte_pci_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_pci_device_list device_list;  /**< List of PCI devices */
-	struct rte_pci_driver_list driver_list;  /**< List of PCI drivers */
-};
-
-/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
-#define RTE_PCI_DRV_NEED_MAPPING 0x0001
-/** Device needs PCI BAR mapping with enabled write combining (wc) */
-#define RTE_PCI_DRV_WC_ACTIVATE 0x0002
-/** Device already probed can be probed again to check for new ports. */
-#define RTE_PCI_DRV_PROBE_AGAIN 0x0004
-/** Device driver supports link state interrupt */
-#define RTE_PCI_DRV_INTR_LSC	0x0008
-/** Device driver supports device removal interrupt */
-#define RTE_PCI_DRV_INTR_RMV 0x0010
-/** Device driver needs to keep mapped resources if unsupported dev detected */
-#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040
-
 /**
  * Map the PCI device resources in user space virtual memory address
  *
@@ -261,33 +100,6 @@ off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap);
 __rte_experimental
 int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable);
 
-/**
- * Register a PCI driver.
- *
- * @param driver
- *   A pointer to a rte_pci_driver structure describing the driver
- *   to be registered.
- */
-void rte_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) \
-{\
-	(pci_drv).driver.name = RTE_STR(nm);\
-	rte_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_pci_unregister(struct rte_pci_driver *driver);
-
 /**
  * Read PCI config space.
  *
@@ -322,17 +134,6 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 int rte_pci_write_config(const struct rte_pci_device *device,
 		const void *buf, size_t len, off_t offset);
 
-/**
- * A structure used to access io resources for a pci device.
- * rte_pci_ioport is arch, os, driver specific, and should not be used outside
- * of pci ioport api.
- */
-struct rte_pci_ioport {
-	struct rte_pci_device *dev;
-	uint64_t base;
-	uint64_t len; /* only filled for memory mapped ports */
-};
-
 /**
  * Initialize a rte_pci_ioport object for a pci device io resource.
  *
diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map
index 3d5c2f3068..161ab86d3b 100644
--- a/drivers/bus/pci/version.map
+++ b/drivers/bus/pci/version.map
@@ -2,16 +2,13 @@ DPDK_23 {
 	global:
 
 	rte_pci_dump;
-	rte_pci_get_sysfs_path;
 	rte_pci_ioport_map;
 	rte_pci_ioport_read;
 	rte_pci_ioport_unmap;
 	rte_pci_ioport_write;
 	rte_pci_map_device;
 	rte_pci_read_config;
-	rte_pci_register;
 	rte_pci_unmap_device;
-	rte_pci_unregister;
 	rte_pci_write_config;
 
 	local: *;
@@ -25,3 +22,11 @@ EXPERIMENTAL {
 	# added in 21.08
 	rte_pci_set_bus_master;
 };
+
+INTERNAL {
+	global:
+
+	rte_pci_get_sysfs_path;
+	rte_pci_register;
+	rte_pci_unregister;
+};
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 7bf091158b..f013b743b3 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -9,6 +9,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_bus_pci.h>
 
 #include "private.h"
 #include "pci_netuio.h"
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index 5460399eea..314bbcf547 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 #include <rte_log.h>
 #include <rte_eal.h>
+#include <rte_bus_pci.h>
 
 #ifdef __MINGW32__
 #include <ddk/ndisguid.h>
diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h
index 502f243a81..a7cbe444ae 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -7,7 +7,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bitmap.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c
index b42102e84c..aafff60eeb 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -15,7 +15,7 @@
 
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 
 #include "mlx5_common.h"
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h
index 479bb3c7cb..81702b8768 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.h
+++ b/drivers/common/mlx5/linux/mlx5_common_os.h
@@ -9,7 +9,7 @@
 #include <malloc.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_log.h>
diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
index 63f31437da..629a639a81 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -8,7 +8,7 @@
 #include <stdio.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_rwlock.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 66626953f1..e82cb881bf 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,8 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
 #include "mlx5_common_private.h"
diff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c
index f2fc7cd494..2b6058eb3e 100644
--- a/drivers/common/mlx5/windows/mlx5_common_os.c
+++ b/drivers/common/mlx5/windows/mlx5_common_os.c
@@ -7,7 +7,7 @@
 #include <stdio.h>
 
 #include <rte_mempool.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_errno.h>
 
diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h
index e1a32a7e87..d1512f3b89 100644
--- a/drivers/common/qat/qat_device.h
+++ b/drivers/common/qat/qat_device.h
@@ -4,7 +4,7 @@
 #ifndef _QAT_DEVICE_H_
 #define _QAT_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "qat_common.h"
 #include "qat_logs.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 8674eccdca..5916e745e2 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
diff --git a/drivers/common/sfc_efx/sfc_efx.h b/drivers/common/sfc_efx/sfc_efx.h
index c16eca60f3..d3ea586cb8 100644
--- a/drivers/common/sfc_efx/sfc_efx.h
+++ b/drivers/common/sfc_efx/sfc_efx.h
@@ -10,7 +10,7 @@
 #ifndef _SFC_EFX_H_
 #define _SFC_EFX_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "efx.h"
 #include "efsys.h"
diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c
index d64a628c74..3d2c45fcee 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -5,7 +5,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h
index 46c80c8dc2..cdef8cc6cb 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -7,7 +7,7 @@
 
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_comp.h>
 #include <rte_compressdev.h>
 #include <rte_compressdev_pmd.h>
diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index e8f57c3cc4..fe4a4999c6 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_hexdump.h>
 #include <rte_comp.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_memcpy.h>
 #include <rte_common.h>
diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h
index 2a205cd446..9deaae7980 100644
--- a/drivers/crypto/ccp/ccp_dev.h
+++ b/drivers/crypto/ccp/ccp_dev.h
@@ -10,7 +10,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_atomic.h>
 #include <rte_byteorder.h>
 #include <rte_io.h>
diff --git a/drivers/crypto/ccp/ccp_pci.h b/drivers/crypto/ccp/ccp_pci.h
index 7ed3bac406..6736bf8ad3 100644
--- a/drivers/crypto/ccp/ccp_pci.h
+++ b/drivers/crypto/ccp/ccp_pci.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
 #define PROC_MODULES "/proc/modules"
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a35a8cd775..4957f11e97 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_bus_vdev.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 1e0a7b91c9..3fd9f3c426 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index 54cd77e575..bd425f95ff 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index eb7616257e..dc8e291f50 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -7,7 +7,7 @@
 #include <rte_eal_paging.h>
 #include <rte_errno.h>
 #include <rte_log.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/crypto/nitrox/nitrox_device.h b/drivers/crypto/nitrox/nitrox_device.h
index 6b8095f42b..1ff7c59b63 100644
--- a/drivers/crypto/nitrox/nitrox_device.h
+++ b/drivers/crypto/nitrox/nitrox_device.h
@@ -5,7 +5,7 @@
 #ifndef _NITROX_DEVICE_H_
 #define _NITROX_DEVICE_H_
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 struct nitrox_sym_device;
diff --git a/drivers/crypto/octeontx/otx_cryptodev.c b/drivers/crypto/octeontx/otx_cryptodev.c
index 337d06aab8..b5ab937c3a 100644
--- a/drivers/crypto/octeontx/otx_cryptodev.c
+++ b/drivers/crypto/octeontx/otx_cryptodev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium, Inc
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_log.h>
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 7aee67ab09..11840f5ecf 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eventdev.h>
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index db6316fbe9..f3a99ae15c 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -7,7 +7,7 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_crypto_sym.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 
 #include "qat_sym.h"
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index ed64866758..21bd996064 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <rte_errno.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_eal.h>
diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c
index ae069794a6..95a43c8801 100644
--- a/drivers/crypto/virtio/virtio_pci.c
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -10,7 +10,6 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
 
 #include "virtio_pci.h"
 #include "virtqueue.h"
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
index 0a7ea1bb64..41949c3d13 100644
--- a/drivers/crypto/virtio/virtio_pci.h
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 
 #include <rte_eal_paging.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cryptodev.h>
 
 #include "virtio_crypto.h"
diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c
index 2824c1b44f..9f0de60861 100644
--- a/drivers/dma/cnxk/cnxk_dmadev.c
+++ b/drivers/dma/cnxk/cnxk_dmadev.c
@@ -5,8 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index 9494b60779..0e11ca14cc 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c
index 2f8ec06d9e..781fa02db3 100644
--- a/drivers/dma/idxd/idxd_pci.c
+++ b/drivers/dma/idxd/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_devargs.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
index a230496b11..5906eb45aa 100644
--- a/drivers/dma/ioat/ioat_dmadev.c
+++ b/drivers/dma/ioat/ioat_dmadev.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_malloc.h>
 #include <rte_prefetch.h>
diff --git a/drivers/event/dlb2/pf/dlb2_main.h b/drivers/event/dlb2/pf/dlb2_main.h
index 9eeda482a3..5aa51b1616 100644
--- a/drivers/event/dlb2/pf/dlb2_main.h
+++ b/drivers/event/dlb2/pf/dlb2_main.h
@@ -9,7 +9,7 @@
 #include <rte_log.h>
 #include <rte_spinlock.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include "base/dlb2_hw_types.h"
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index dd3f2b8ece..9f8c6cd8b8 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -25,7 +25,7 @@
 #include <rte_cycles.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
 #include <eventdev_pmd_pci.h>
diff --git a/drivers/event/octeontx/ssovf_probe.c b/drivers/event/octeontx/ssovf_probe.c
index 4da7d1ae45..2c9601a8ff 100644
--- a/drivers/event/octeontx/ssovf_probe.c
+++ b/drivers/event/octeontx/ssovf_probe.c
@@ -7,7 +7,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "octeontx_mbox.h"
 #include "ssovf_evdev.h"
diff --git a/drivers/event/octeontx/timvf_probe.c b/drivers/event/octeontx/timvf_probe.c
index 59bba31e8e..7ce3eddd7e 100644
--- a/drivers/event/octeontx/timvf_probe.c
+++ b/drivers/event/octeontx/timvf_probe.c
@@ -5,7 +5,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <octeontx_mbox.h>
 
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 664605d9fb..2be7b8d2df 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -6,7 +6,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_byteorder.h>
 #include <rte_dev.h>
 
diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index 54a1a7d3ae..78caf987d0 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_atomic.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 8fd9edced2..1513c632c6 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -13,7 +13,7 @@
 
 #include <rte_atomic.h>
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index e8e4092be6..c654a229f7 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7ac55584ff..7c0cb666fb 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index d7e1729e68..89414ac88a 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -16,7 +16,7 @@
 
 #include <rte_byteorder.h>
 #include <rte_spinlock.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_io.h>
 
 #include "bnx2x_osal.h"
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e86e51e1fa..c9aa45ed3b 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 5406e1c934..1a86eb3c00 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,8 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index 1c016a7115..16cbc1a345 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -8,7 +8,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index cf9a2fdc19..fd71a50a58 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_tailq.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 794496abfc..409de50083 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index cea5b490ba..d48fd52404 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -18,7 +18,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a9c18b27e8..43979992d3 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 3f3fd0d61e..c7588ea57e 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -10,7 +10,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 0db0918b43..4709675af8 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -12,7 +12,7 @@
 #include <ethdev_pci.h>
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_timer.h>
 #include <rte_dev.h>
 #include <rte_net.h>
diff --git a/drivers/net/enic/base/vnic_dev.h b/drivers/net/enic/base/vnic_dev.h
index 4b9f75b65f..44ca5c739f 100644
--- a/drivers/net/enic/base/vnic_dev.h
+++ b/drivers/net/enic/base/vnic_dev.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "enic_compat.h"
 #include "vnic_resource.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index a8d470e8ac..998436e5e8 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9f351de72e..19a99a82c5 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 1ad6ad3dfb..7312c411bd 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c
index 5eb022297e..818698dcb3 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwdev.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c
@@ -3,7 +3,7 @@
  */
 
 #include<ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index 26fa1e27d4..2d3f192b21 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_csr.h"
diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index ad5db9f1de..4aa3fa6adc 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Huawei Technologies Co., Ltd
  */
-#include<rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "hinic_compat.h"
 #include "hinic_pmd_hwdev.h"
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 35788f46eb..7aa5e7d8e9 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 424205356e..e8e5aa2c86 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_kvargs.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
 
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6b1d1a5fb1..144daf1636 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_alarm.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_pci.h>
 
 #include "hns3_ethdev.h"
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 95f711e7eb..cd0c91f3a3 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018-2021 HiSilicon Limited.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_geneve.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 67d79de08d..7bdc453ec1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 7f8e81858e..cc0f992453 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Intel Corporation.
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 7f221a5d34..e3727b7b41 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -7,7 +7,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h
index 49b90d1b7c..a55202b178 100644
--- a/drivers/net/ionic/ionic.h
+++ b/drivers/net/ionic/ionic.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "ionic_dev.h"
 #include "ionic_if.h"
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 28280c5377..d72033c32c 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 2e39113941..70a06a3b15 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -4,7 +4,7 @@
 
 #include <stdint.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 2f088d767f..2ef96a984a 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <unistd.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 2f242b678a..0260227900 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f31bbb7895..552e41692c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index cc6049a66a..ff34fd1515 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index ce74c51ce2..bb1dd33e7c 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -32,7 +32,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_ether.h>
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index aaf636aa0d..661d362dc0 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -25,7 +25,7 @@
 #include <time.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index c9ed38ef7c..efb262e368 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,8 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <rte_bus.h>
+#include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 998846adbe..30923b0732 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 05c919ed39..a5c7ca8c52 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -11,7 +11,7 @@
 #include <errno.h>
 
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index bee9363515..e122b39cb3 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -15,7 +15,7 @@
 #include <rte_flow_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_ip.h>
 #include <rte_gre.h>
 #include <rte_vxlan.h>
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 0140f8b3b2..9150ced72d 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -13,7 +13,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_eal_paging.h>
 
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 62948bf889..cce0a79edb 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h
index bf1fa30312..8783fce4dd 100644
--- a/drivers/net/ngbe/base/ngbe_osdep.h
+++ b/drivers/net/ngbe/base/ngbe_osdep.h
@@ -19,7 +19,7 @@
 #include <rte_config.h>
 #include <rte_io.h>
 #include <rte_ether.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../ngbe_logs.h"
 
diff --git a/drivers/net/ngbe/ngbe_pf.c b/drivers/net/ngbe/ngbe_pf.c
index 12a18de31d..947ae7fe94 100644
--- a/drivers/net/ngbe/ngbe_pf.c
+++ b/drivers/net/ngbe/ngbe_pf.c
@@ -6,7 +6,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/ngbe.h"
 #include "ngbe_ethdev.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c
index 0ddff54886..6a48a22de6 100644
--- a/drivers/net/octeontx/base/octeontx_pkivf.c
+++ b/drivers/net/octeontx/base/octeontx_pkivf.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_eal.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "../octeontx_logs.h"
 #include "octeontx_io.h"
diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c
index bf28bc7992..5d445dfb49 100644
--- a/drivers/net/octeontx/base/octeontx_pkovf.c
+++ b/drivers/net/octeontx/base/octeontx_pkovf.c
@@ -10,7 +10,7 @@
 #include <rte_cycles.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_spinlock.h>
 
 #include "../octeontx_logs.h"
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 9ea579bfc8..67e7f759fe 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -20,7 +20,7 @@
 #include <rte_ether.h>
 #include <rte_io.h>
 #include <rte_version.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 /* Forward declaration */
 struct ecore_dev;
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index a0979618be..0a1e224fa2 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -13,7 +13,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 39f85e8b84..506c62a726 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_ether.h>
diff --git a/drivers/net/sfc/sfc_sriov.c b/drivers/net/sfc/sfc_sriov.c
index 385b172e2e..009b884d8d 100644
--- a/drivers/net/sfc/sfc_sriov.c
+++ b/drivers/net/sfc/sfc_sriov.c
@@ -8,7 +8,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc.h"
 #include "sfc_log.h"
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 262c024560..28183ec740 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -32,7 +32,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index 262dbb5e38..6fb22ca7d9 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -20,7 +20,7 @@
 #include <rte_ethdev_core.h>
 #include <rte_hash.h>
 #include <rte_hash_crc.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index d0093c0163..f19bdf36dc 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -4,7 +4,7 @@
  */
 
 #include <sys/queue.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c
index 0b82fb1a88..176f79005c 100644
--- a/drivers/net/txgbe/txgbe_pf.c
+++ b/drivers/net/txgbe/txgbe_pf.c
@@ -20,7 +20,7 @@
 #include <rte_memcpy.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "base/txgbe.h"
 #include "txgbe_ethdev.h"
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 11e25a0142..6d4a8712c2 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <ethdev_driver.h>
 
 #include "virtio.h"
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 1f6bdeddda..2b9e35cef5 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -11,7 +11,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_errno.h>
 
 #include <rte_memory.h>
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 2af67dc0a3..101b1cb500 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -19,7 +19,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index 349d551839..db029cbf34 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_eal.h>
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
index 26def43564..2d8466ef91 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
index bbe7f74def..b424d6127d 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_irq.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(C) 2021 Marvell.
  */
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index eca1edc270..859f28dcc1 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index da0aba6e00..c7c5cda48c 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 3c41aa9ee8..a1db533eeb 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -17,7 +17,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index b7438bd372..67b3941265 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -18,7 +18,7 @@
 #include <rte_memcpy.h>
 #include <rte_io.h>
 #include <rte_vfio.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 32de5ff0ce..ec86bfdb0c 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -16,7 +16,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 #include <rte_alarm.h>
 #include <rte_interrupts.h>
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 1ca248123b..a47d5a0350 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 #include "rte_pmd_ifpga.h"
diff --git a/drivers/raw/ioat/idxd_pci.c b/drivers/raw/ioat/idxd_pci.c
index 13515dbc6c..90ec0222e6 100644
--- a/drivers/raw/ioat/idxd_pci.c
+++ b/drivers/raw/ioat/idxd_pci.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_devargs.h>
 
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 11341fcf5d..f58006bbda 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -3,7 +3,7 @@
  */
 
 #include <rte_cycles.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index f5e773c53b..76e98fe515 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_mbuf.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_memzone.h>
 #include <rte_memcpy.h>
 #include <rte_rawdev.h>
diff --git a/drivers/raw/ntb/ntb_hw_intel.c b/drivers/raw/ntb/ntb_hw_intel.c
index 20cdb761a3..9b4465176a 100644
--- a/drivers/raw/ntb/ntb_hw_intel.c
+++ b/drivers/raw/ntb/ntb_hw_intel.c
@@ -8,7 +8,7 @@
 #include <rte_io.h>
 #include <rte_eal.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
 
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index 9f79c6907c..4c20daac94 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -9,7 +9,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_common_mr.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c
index 9a2db7e43f..0a8c83fe14 100644
--- a/drivers/regex/mlx5/mlx5_regex_fastpath.c
+++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c
@@ -10,7 +10,7 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_pci.h>
 #include <rte_regexdev_driver.h>
 #include <rte_mbuf.h>
diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h
index 3d567695cc..6444d7f72c 100644
--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h
+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h
@@ -10,7 +10,7 @@
 
 #include <rte_cycles.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_log.h>
 #include <rte_io.h>
 
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index ac42de9c79..d5ac583589 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -14,7 +14,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_vhost.h>
 #include <rte_vdpa.h>
 #include <vdpa_driver.h>
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index 91af792a3a..026daa3f24 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -13,7 +13,7 @@
 #include <rte_log.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_eal_paging.h>
 
 #include <mlx5_glue.h>
diff --git a/drivers/vdpa/sfc/sfc_vdpa.h b/drivers/vdpa/sfc/sfc_vdpa.h
index daeb27d4cd..b25eb3a5fe 100644
--- a/drivers/vdpa/sfc/sfc_vdpa.h
+++ b/drivers/vdpa/sfc/sfc_vdpa.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "sfc_efx.h"
 #include "sfc_efx_mcdi.h"
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index a268507801..94b8fba5d7 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 #include <rte_config.h>
 #include <ethdev_driver.h>
 
diff --git a/lib/eventdev/eventdev_pmd_pci.h b/lib/eventdev/eventdev_pmd_pci.h
index 24b56faaa9..7bbec40c71 100644
--- a/lib/eventdev/eventdev_pmd_pci.h
+++ b/lib/eventdev/eventdev_pmd_pci.h
@@ -23,7 +23,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
-#include <rte_bus_pci.h>
+#include <bus_pci_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 17/27] bus/vdev: make driver-only headers private
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (15 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 16/27] bus/pci: " David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 18/27] bus/vmbus: " David Marchand
                     ` (10 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Rosen Xu, Ruifeng Wang,
	Gagandeep Singh, Hemant Agrawal, Nicolas Chautru, Ray Kinsella,
	Lee Daly, Fan Zhang, Ashish Gupta, Sunila Sahu, Ajit Khaparde,
	Raveendra Padasalagi, Vikas Gupta, Chandubabu Namburu,
	Pablo de Lara, Michael Shamis, Liron Himi, Chengwen Feng,
	Kevin Laatz, Sachin Saxena, Jerin Jacob, Liang Ma,
	Peter Mccarthy, Harry van Haaren, John W. Linville, Ciara Loftus,
	Qi Zhang, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Jakub Grajciar, Zyta Szpak, Tetsuya Mukawa,
	Harman Kalra, Jasvinder Singh, Cristian Dumitrescu, Matan Azrad,
	Maxime Coquelin, Chenbo Xia, Jakub Palider, Tomasz Duszynski,
	Tianfei zhang, Ferruh Yigit, Andrew Rybchenko

The vdev 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 <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
Changes since v4:
- dropped unnneeded change on test_vdev.c,

Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst        |   4 +-
 drivers/baseband/la12xx/bbdev_la12xx.c        |   2 +-
 drivers/baseband/null/bbdev_null.c            |   2 +-
 .../baseband/turbo_sw/bbdev_turbo_software.c  |   2 +-
 drivers/bus/vdev/bus_vdev_driver.h            | 151 ++++++++++++++++++
 drivers/bus/vdev/meson.build                  |   1 +
 drivers/bus/vdev/rte_bus_vdev.h               | 134 ----------------
 drivers/bus/vdev/vdev.c                       |   8 +-
 drivers/bus/vdev/vdev_params.c                |   1 -
 drivers/bus/vdev/version.map                  |   9 +-
 drivers/compress/isal/isal_compress_pmd.c     |   2 +-
 drivers/compress/zlib/zlib_pmd.c              |   2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c          |   2 +-
 drivers/crypto/bcmfs/bcmfs_device.h           |   2 +-
 drivers/crypto/caam_jr/caam_jr.c              |   2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.c    |   2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |   2 +-
 drivers/crypto/ipsec_mb/pmd_kasumi.c          |   2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c           |   2 +-
 drivers/crypto/null/null_crypto_pmd.c         |   2 +-
 drivers/crypto/openssl/rte_openssl_pmd.c      |   2 +-
 drivers/crypto/scheduler/scheduler_pmd.c      |   2 +-
 drivers/dma/skeleton/skeleton_dmadev.c        |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   2 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |   2 +-
 drivers/event/octeontx/ssovf_evdev.c          |   2 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |   2 +-
 drivers/event/opdl/opdl_evdev.c               |   2 +-
 drivers/event/opdl/opdl_evdev_init.c          |   2 +-
 drivers/event/opdl/opdl_test.c                |   2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |   2 +-
 drivers/event/sw/sw_evdev.c                   |   2 +-
 drivers/event/sw/sw_evdev_selftest.c          |   2 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |   2 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   2 +-
 drivers/net/failsafe/failsafe.c               |   3 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |   2 +-
 drivers/net/kni/rte_eth_kni.c                 |   2 +-
 drivers/net/memif/memif_socket.c              |   2 +-
 drivers/net/memif/rte_eth_memif.c             |   2 +-
 drivers/net/mvneta/mvneta_ethdev.c            |   2 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |   2 +-
 drivers/net/null/rte_eth_null.c               |   2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |   2 +-
 drivers/net/pcap/pcap_ethdev.c                |   2 +-
 drivers/net/pfe/pfe_ethdev.c                  |   2 +-
 drivers/net/ring/rte_eth_ring.c               |   2 +-
 drivers/net/softnic/rte_eth_softnic.c         |   2 +-
 drivers/net/tap/rte_eth_tap.c                 |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |   2 +-
 drivers/net/vhost/rte_eth_vhost.c             |   2 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   2 +-
 drivers/raw/cnxk_gpio/cnxk_gpio.c             |   2 +-
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c         |   2 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |   2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |   2 +-
 lib/ethdev/ethdev_vdev.h                      |   2 +-
 lib/eventdev/eventdev_pmd_vdev.h              |   2 +-
 62 files changed, 220 insertions(+), 199 deletions(-)
 create mode 100644 drivers/bus/vdev/bus_vdev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8fa4cf468d..bafd99c39e 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,8 +88,8 @@ 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``, ``ifpga``, ``pci``
-  buses has been marked as an internal API.
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
+  ``vdev`` 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).
 
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index 4d1bd16751..f0927d9fca 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -10,7 +10,7 @@
 #include <dirent.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c
index 248e12987f..e76ef2313f 100644
--- a/drivers/baseband/null/bbdev_null.c
+++ b/drivers/baseband/null/bbdev_null.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
index af7bc416f9..e8d0c43e6f 100644
--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
new file mode 100644
index 0000000000..36748cdfae
--- /dev/null
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -0,0 +1,151 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ */
+
+#ifndef BUS_VDEV_DRIVER_H
+#define BUS_VDEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vdev.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
+	struct rte_device device;               /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+	container_of(ptr, struct rte_vdev_device, device)
+
+#define RTE_DEV_TO_VDEV_CONST(ptr) \
+	container_of(ptr, const struct rte_vdev_device, device)
+
+#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.name)
+		return dev->device.name;
+	return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+	if (dev && dev->device.devargs)
+		return dev->device.devargs->args;
+	return "";
+}
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * Driver-specific DMA mapping. After a successful call the device
+ * will be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be mapped.
+ * @param iova
+ *   Starting IOVA address of memory to be mapped.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
+			    uint64_t iova, size_t len);
+
+/**
+ * Driver-specific DMA un-mapping. After a successful call the device
+ * will not be able to read/write from/to this segment.
+ *
+ * @param dev
+ *   Pointer to the Virtual device.
+ * @param addr
+ *   Starting virtual address of memory to be unmapped.
+ * @param iova
+ *   Starting IOVA address of memory to be unmapped.
+ * @param len
+ *   Length of memory segment being unmapped.
+ * @return
+ *   - 0 On success.
+ *   - Negative value and rte_errno is set otherwise.
+ */
+typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
+			      uint64_t iova, size_t len);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+	struct rte_driver driver;        /**< Inherited general driver. */
+	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
+	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
+	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
+	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
+	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
+};
+
+/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
+#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vdev_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+static const char *vdrvinit_ ## nm ## _alias;\
+RTE_INIT(vdrvinitfn_ ##vdrv)\
+{\
+	(vdrv).driver.name = RTE_STR(nm);\
+	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+	rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VDEV_DRIVER_H */
diff --git a/drivers/bus/vdev/meson.build b/drivers/bus/vdev/meson.build
index 8adf674530..1532ed4f35 100644
--- a/drivers/bus/vdev/meson.build
+++ b/drivers/bus/vdev/meson.build
@@ -6,5 +6,6 @@ sources = files(
         'vdev_params.c',
 )
 headers = files('rte_bus_vdev.h')
+driver_sdk_headers = files('bus_vdev_driver.h')
 
 deps += ['kvargs']
diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
index 5af6be009f..f48dd24e5e 100644
--- a/drivers/bus/vdev/rte_bus_vdev.h
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -15,140 +15,6 @@
 extern "C" {
 #endif
 
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
-	RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
-	struct rte_device device;               /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
-	container_of(ptr, struct rte_vdev_device, device)
-
-#define RTE_DEV_TO_VDEV_CONST(ptr) \
-	container_of(ptr, const struct rte_vdev_device, device)
-
-#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.name)
-		return dev->device.name;
-	return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
-	if (dev && dev->device.devargs)
-		return dev->device.devargs->args;
-	return "";
-}
-
-/** Double linked list of virtual device drivers. */
-RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * Driver-specific DMA mapping. After a successful call the device
- * will be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be mapped.
- * @param iova
- *   Starting IOVA address of memory to be mapped.
- * @param len
- *   Length of memory segment being mapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
-			    uint64_t iova, size_t len);
-
-/**
- * Driver-specific DMA un-mapping. After a successful call the device
- * will not be able to read/write from/to this segment.
- *
- * @param dev
- *   Pointer to the Virtual device.
- * @param addr
- *   Starting virtual address of memory to be unmapped.
- * @param iova
- *   Starting IOVA address of memory to be unmapped.
- * @param len
- *   Length of memory segment being unmapped.
- * @return
- *   - 0 On success.
- *   - Negative value and rte_errno is set otherwise.
- */
-typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
-			      uint64_t iova, size_t len);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
-	RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
-	struct rte_driver driver;        /**< Inherited general driver. */
-	rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
-	rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
-	rte_vdev_dma_map_t *dma_map;     /**< Virtual device DMA map function. */
-	rte_vdev_dma_unmap_t *dma_unmap; /**< Virtual device DMA unmap function. */
-	uint32_t drv_flags;              /**< Flags RTE_VDEV_DRV_*. */
-};
-
-/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
-#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- *   A pointer to a rte_vdev_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-static const char *vdrvinit_ ## nm ## _alias;\
-RTE_INIT(vdrvinitfn_ ##vdrv)\
-{\
-	(vdrv).driver.name = RTE_STR(nm);\
-	(vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
-	rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
 typedef void (*rte_vdev_scan_callback)(void *user_arg);
 
 /**
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index a8d8b2327e..7d78cf93bc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -21,7 +21,7 @@
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 
-#include "rte_bus_vdev.h"
+#include "bus_vdev_driver.h"
 #include "vdev_logs.h"
 #include "vdev_private.h"
 
@@ -30,16 +30,14 @@
 /* Forward declare to access virtual bus name */
 static struct rte_bus rte_vdev_bus;
 
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
 
-static struct vdev_device_list vdev_device_list =
+static TAILQ_HEAD(, rte_vdev_device) vdev_device_list =
 	TAILQ_HEAD_INITIALIZER(vdev_device_list);
 /* The lock needs to be recursive because a vdev can manage another vdev. */
 static rte_spinlock_recursive_t vdev_device_list_lock =
 	RTE_SPINLOCK_RECURSIVE_INITIALIZER;
 
-static struct vdev_driver_list vdev_driver_list =
+static TAILQ_HEAD(, rte_vdev_driver) vdev_driver_list =
 	TAILQ_HEAD_INITIALIZER(vdev_driver_list);
 
 struct vdev_custom_scan {
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 3969faf16d..2c72614776 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -5,7 +5,6 @@
 #include <string.h>
 
 #include <rte_dev.h>
-#include <rte_bus.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vdev/version.map b/drivers/bus/vdev/version.map
index 7cc3098a50..594c48c3db 100644
--- a/drivers/bus/vdev/version.map
+++ b/drivers/bus/vdev/version.map
@@ -3,10 +3,15 @@ DPDK_23 {
 
 	rte_vdev_add_custom_scan;
 	rte_vdev_init;
-	rte_vdev_register;
 	rte_vdev_remove_custom_scan;
 	rte_vdev_uninit;
-	rte_vdev_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vdev_register;
+	rte_vdev_unregister;
+};
diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index b7ba61c434..cb23e929ed 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -3,7 +3,7 @@
  */
 #include <isa-l.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_malloc.h>
diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zlib_pmd.c
index 0220c6d038..98abd41013 100644
--- a/drivers/compress/zlib/zlib_pmd.c
+++ b/drivers/compress/zlib/zlib_pmd.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Cavium Networks
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 
 #include "zlib_pmd_private.h"
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 32127a874c..5c060e71a3 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -8,7 +8,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_device.h b/drivers/crypto/bcmfs/bcmfs_device.h
index 4901a6cfd9..610454dd5e 100644
--- a/drivers/crypto/bcmfs/bcmfs_device.h
+++ b/drivers/crypto/bcmfs/bcmfs_device.h
@@ -9,7 +9,7 @@
 #include <sys/queue.h>
 
 #include <rte_spinlock.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "bcmfs_logs.h"
 #include "bcmfs_qp.h"
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8e9cfe73d8..8c0b4909cf 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -12,7 +12,7 @@
 #include <cryptodev_pmd.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_security_driver.h>
 #include <rte_hexdump.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 4957f11e97..6c3e45e333 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_string_fns.h>
 #include <bus_pci_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.c b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
index aab42c360c..2e7347fa79 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
 
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index e2c240dfc0..d0d4258ee1 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -7,7 +7,7 @@
 
 #include <intel-ipsec-mb.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #if defined(RTE_LIB_SECURITY)
 #define IPSEC_MB_DOCSIS_SEC_ENABLED 1
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index c9d4f9d0ae..fba10b8cf4 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2016-2021 Intel Corporation
  */
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 04efd9aaa8..c35876c8b4 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_security_driver.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 9ecb434fd0..eab74ad45f 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 
 #include "null_crypto_pmd_private.h"
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index e01dacc98d..ed6d215f1b 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -6,7 +6,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index dd198080bf..a15c02b4d8 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 82b4661323..09068a9521 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -4,7 +4,7 @@
 
 #include <inttypes.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 5de3e9e5f5..08df6e223a 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -23,7 +23,7 @@
 #include <rte_memcpy.h>
 #include <rte_memory.h>
 #include <rte_pci.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
index 941fb8fc43..427aff4b11 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index 9e14e35d10..fe157c59d5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -16,7 +16,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "ssovf_evdev.h"
 #include "timvf_evdev.h"
diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c
index b55523632a..3dbf31efa9 100644
--- a/drivers/event/octeontx/ssovf_evdev_selftest.c
+++ b/drivers/event/octeontx/ssovf_evdev_selftest.c
@@ -17,7 +17,7 @@
 #include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_random.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 #include "ssovf_evdev.h"
diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c
index 8b6890b220..368e5a9657 100644
--- a/drivers/event/opdl/opdl_evdev.c
+++ b/drivers/event/opdl/opdl_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memzone.h>
 #include <rte_kvargs.h>
diff --git a/drivers/event/opdl/opdl_evdev_init.c b/drivers/event/opdl/opdl_evdev_init.c
index 15aae47524..be3437fc2f 100644
--- a/drivers/event/opdl/opdl_evdev_init.c
+++ b/drivers/event/opdl/opdl_evdev_init.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_errno.h>
 #include <rte_cycles.h>
 #include <rte_memzone.h>
diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 24b92df476..50c12a18b0 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -19,7 +19,7 @@
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
 #include <rte_eventdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_pause.h>
 
 #include "opdl_evdev.h"
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index bf3b01ebc8..6bd8fec6d4 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "skeleton_eventdev.h"
 
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index f93313b31b..22cba1e74b 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_ring.h>
 #include <rte_errno.h>
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index cb97a4d615..59bcdf5734 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -21,7 +21,7 @@
 #include <rte_pause.h>
 #include <rte_service.h>
 #include <rte_service_component.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "sw_evdev.h"
 
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 1396f32c3d..e2771e6765 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -12,7 +12,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <errno.h>
 #include <linux/if_ether.h>
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fce649c2a1..fd7be47311 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -20,7 +20,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 4ac191c468..b44dd219cb 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <ethdev_driver.h>
 #include <rte_tcp.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 73e6972035..cd80a0af46 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -15,7 +15,7 @@
 #include <rte_ip_frag.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 05cf533896..5d4d52c341 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,8 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <rte_bus.h>
+#include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
 
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index dbf57f9ba8..4b93d2649e 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -19,7 +19,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index 0532de5315..c0e1f8db40 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -12,7 +12,7 @@
 #include <rte_kni.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 /* Only single queue supported */
 #define KNI_MAX_QUEUE_PER_PORT 1
diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 7886644412..4700ce2e77 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -17,7 +17,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
 #include <rte_string_fns.h>
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index dd951b8296..a574bce49e 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -21,7 +21,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index eef016aa0b..6a0dd6091d 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_string_fns.h>
 #include <ethdev_driver.h>
 #include <rte_kvargs.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <stdio.h>
 #include <fcntl.h>
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 735efb6cfc..310e3e5acf 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -9,7 +9,7 @@
 #include <rte_kvargs.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <fcntl.h>
 #include <linux/ethtool.h>
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index bb89c1abc4..a517376d40 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -8,7 +8,7 @@
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
 
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3aca53fb98..9ada22e2ff 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -12,7 +12,7 @@
 #include <eventdev_pmd.h>
 #include <rte_alarm.h>
 #include <rte_branch_prediction.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
 #include <rte_dev.h>
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index ec29fd6bc5..7fb4abb20b 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_os_shim.h>
 
 #include "pcap_osdep.h"
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index c2991ab1cc..0352a57950 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -6,7 +6,7 @@
 #include <sys/epoll.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_ether.h>
 #include <dpaa_of.h>
 
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cfb81da5fe..37e7ccfda0 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -8,7 +8,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 8c098cad5b..fa89940735 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -9,7 +9,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 #include <rte_ring.h>
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 9e1032fe72..d047489e94 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -10,7 +10,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_vdev.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_net.h>
 #include <rte_debug.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 2587195168..65043a04eb 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -25,7 +25,7 @@
 
 #include <rte_alarm.h>
 #include <rte_bus.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7e512d94bf..6c81967c6f 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_net.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_vhost.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index a7d7063c2a..3edfd7439e 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -14,7 +14,7 @@
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
 #include <ethdev_vdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 
diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c
index d759ed82d4..e2907c18b5 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.c
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/stat.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_lcore.h>
diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index c7bddbc6cc..aeee4ac289 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -6,7 +6,7 @@
 #include <errno.h>
 #include <stdint.h>
 
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_atomic.h>
 #include <rte_interrupts.h>
 #include <rte_branch_prediction.h>
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index ec86bfdb0c..1020adcf6e 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -26,7 +26,7 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_pmd_i40e.h>
 
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 72d3b69d75..6831cc8d20 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -21,7 +21,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_lcore.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index 693b24c415..fc257c5f44 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -8,7 +8,7 @@
 #include <rte_memcpy.h>
 #include <rte_dev.h>
 #include <rte_rawdev.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <rte_test.h>
 
 /* Using relative path as skeleton_rawdev is not part of exported headers */
diff --git a/lib/ethdev/ethdev_vdev.h b/lib/ethdev/ethdev_vdev.h
index f5f536ce64..364f140f91 100644
--- a/lib/ethdev/ethdev_vdev.h
+++ b/lib/ethdev/ethdev_vdev.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_config.h>
 #include <rte_malloc.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 #include <ethdev_driver.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd_vdev.h b/lib/eventdev/eventdev_pmd_vdev.h
index 77904910a2..cf2333cf41 100644
--- a/lib/eventdev/eventdev_pmd_vdev.h
+++ b/lib/eventdev/eventdev_pmd_vdev.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_config.h>
 #include <rte_debug.h>
 #include <rte_eal.h>
-#include <rte_bus_vdev.h>
+#include <bus_vdev_driver.h>
 
 #include "eventdev_pmd.h"
 
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 18/27] bus/vmbus: make driver-only headers private
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (16 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 17/27] bus/vdev: " David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 19/27] bus: move IOVA definition from header David Marchand
                     ` (9 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Stephen Hemminger, Long Li, Ray Kinsella

The vmbus 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 <david.marchand@redhat.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst |   2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h   | 106 +++++++++++++++++++++++++
 drivers/bus/vmbus/linux/vmbus_uio.c    |   1 -
 drivers/bus/vmbus/meson.build          |   1 +
 drivers/bus/vmbus/private.h            |  20 ++++-
 drivers/bus/vmbus/rte_bus_vmbus.h      | 104 ------------------------
 drivers/bus/vmbus/version.map          |   9 ++-
 drivers/bus/vmbus/vmbus_bufring.c      |   1 -
 drivers/bus/vmbus/vmbus_channel.c      |   1 -
 drivers/bus/vmbus/vmbus_common.c       |   3 -
 drivers/bus/vmbus/vmbus_common_uio.c   |   1 -
 drivers/net/netvsc/hn_ethdev.c         |   3 +-
 drivers/net/netvsc/hn_nvs.c            |   2 +-
 drivers/net/netvsc/hn_rndis.c          |   2 +-
 drivers/net/netvsc/hn_rxtx.c           |   2 +-
 drivers/net/netvsc/hn_vf.c             |   2 +-
 16 files changed, 140 insertions(+), 120 deletions(-)
 create mode 100644 drivers/bus/vmbus/bus_vmbus_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index bafd99c39e..e08a548285 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -89,7 +89,7 @@ API Changes
   to update their code.
 
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
-  ``vdev`` buses has been marked as an internal API.
+  ``vdev``, ``vmbus`` 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).
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
new file mode 100644
index 0000000000..3424e791c9
--- /dev/null
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018, Microsoft Corporation.
+ * All Rights Reserved.
+ */
+
+#ifndef BUS_VMBUS_DRIVER_H
+#define BUS_VMBUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus_vmbus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+
+struct vmbus_channel;
+struct vmbus_mon_page;
+
+/** Maximum number of VMBUS resources. */
+enum hv_uio_map {
+	HV_TXRX_RING_MAP = 0,
+	HV_INT_PAGE_MAP,
+	HV_MON_PAGE_MAP,
+	HV_RECV_BUF_MAP,
+	HV_SEND_BUF_MAP
+};
+#define VMBUS_MAX_RESOURCE 5
+
+/**
+ * A structure describing a VMBUS device.
+ */
+struct rte_vmbus_device {
+	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
+	const struct rte_vmbus_driver *driver; /**< Associated driver */
+	struct rte_device device;              /**< Inherit core device */
+	rte_uuid_t device_id;		       /**< VMBUS device id */
+	rte_uuid_t class_id;		       /**< VMBUS device type */
+	uint32_t relid;			       /**< id for primary */
+	uint8_t monitor_id;		       /**< monitor page */
+	int uio_num;			       /**< UIO device number */
+	uint32_t *int_page;		       /**< VMBUS interrupt page */
+	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
+	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
+
+	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
+	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
+};
+
+/**
+ * Initialization function for the driver called during VMBUS probing.
+ */
+typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
+			    struct rte_vmbus_device *);
+
+/**
+ * Initialization function for the driver called during hot plugging.
+ */
+typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
+
+/**
+ * A structure describing a VMBUS driver.
+ */
+struct rte_vmbus_driver {
+	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
+	struct rte_driver driver;
+	vmbus_probe_t *probe;               /**< Device Probe function. */
+	vmbus_remove_t *remove;             /**< Device Remove function. */
+
+	const rte_uuid_t *id_table;	    /**< ID table. */
+};
+
+/**
+ * Register a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be registered.
+ */
+__rte_internal
+void rte_vmbus_register(struct rte_vmbus_driver *driver);
+
+/**
+ * Unregister a VMBUS driver.
+ *
+ * @param driver
+ *   A pointer to a rte_vmbus_driver structure describing the driver
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
+
+/** Helper for VMBUS device registration from driver instance */
+#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
+	RTE_INIT(vmbusinitfn_ ##nm)			\
+	{						\
+		(vmbus_drv).driver.name = RTE_STR(nm);	\
+		rte_vmbus_register(&vmbus_drv);		\
+	}						\
+	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_VMBUS_DRIVER_H */
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5db70f8e0d..26edef342d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -13,7 +13,6 @@
 
 #include <rte_eal.h>
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_memory.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
diff --git a/drivers/bus/vmbus/meson.build b/drivers/bus/vmbus/meson.build
index 3892cbf67f..34988d1d84 100644
--- a/drivers/bus/vmbus/meson.build
+++ b/drivers/bus/vmbus/meson.build
@@ -8,6 +8,7 @@ endif
 
 
 headers = files('rte_bus_vmbus.h','rte_vmbus_reg.h')
+driver_sdk_headers = files('bus_vmbus_driver.h')
 
 sources = files(
         'vmbus_bufring.c',
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 658303bc27..3d233fa83c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -8,13 +8,31 @@
 
 #include <stdbool.h>
 #include <sys/uio.h>
+
+#include <rte_bus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
 #include <rte_vmbus_reg.h>
-#include <rte_bus_vmbus.h>
+
+/**
+ * Structure describing the VM bus
+ */
+struct rte_vmbus_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	RTE_TAILQ_HEAD(, rte_vmbus_device) device_list; /**< List of devices */
+	RTE_TAILQ_HEAD(, rte_vmbus_driver) driver_list; /**< List of drivers */
+};
 
 extern struct rte_vmbus_bus rte_vmbus_bus;
 
+/* VMBus iterators */
+#define FOREACH_DEVICE_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
+
+#define FOREACH_DRIVER_ON_VMBUS(p)	\
+	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
+
 extern int vmbus_logtype_bus;
 #define VMBUS_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index a24bad831d..03894a5d46 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -27,89 +27,12 @@ extern "C" {
 #include <rte_uuid.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
 #include <rte_vmbus_reg.h>
 
 /* Forward declarations */
 struct rte_vmbus_device;
 struct rte_vmbus_driver;
-struct rte_vmbus_bus;
 struct vmbus_channel;
-struct vmbus_mon_page;
-
-RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
-RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
-
-/* VMBus iterators */
-#define FOREACH_DEVICE_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
-
-#define FOREACH_DRIVER_ON_VMBUS(p)	\
-	RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
-
-/** Maximum number of VMBUS resources. */
-enum hv_uio_map {
-	HV_TXRX_RING_MAP = 0,
-	HV_INT_PAGE_MAP,
-	HV_MON_PAGE_MAP,
-	HV_RECV_BUF_MAP,
-	HV_SEND_BUF_MAP
-};
-#define VMBUS_MAX_RESOURCE 5
-
-/**
- * A structure describing a VMBUS device.
- */
-struct rte_vmbus_device {
-	RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
-	const struct rte_vmbus_driver *driver; /**< Associated driver */
-	struct rte_device device;              /**< Inherit core device */
-	rte_uuid_t device_id;		       /**< VMBUS device id */
-	rte_uuid_t class_id;		       /**< VMBUS device type */
-	uint32_t relid;			       /**< id for primary */
-	uint8_t monitor_id;		       /**< monitor page */
-	int uio_num;			       /**< UIO device number */
-	uint32_t *int_page;		       /**< VMBUS interrupt page */
-	struct vmbus_channel *primary;	       /**< VMBUS primary channel */
-	struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
-
-	struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
-	struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
-};
-
-/**
- * Initialization function for the driver called during VMBUS probing.
- */
-typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
-			    struct rte_vmbus_device *);
-
-/**
- * Initialization function for the driver called during hot plugging.
- */
-typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
-
-/**
- * A structure describing a VMBUS driver.
- */
-struct rte_vmbus_driver {
-	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
-	struct rte_driver driver;
-	struct rte_vmbus_bus *bus;          /**< VM bus reference. */
-	vmbus_probe_t *probe;               /**< Device Probe function. */
-	vmbus_remove_t *remove;             /**< Device Remove function. */
-
-	const rte_uuid_t *id_table;	    /**< ID table. */
-};
-
-
-/**
- * Structure describing the VM bus
- */
-struct rte_vmbus_bus {
-	struct rte_bus bus;               /**< Inherit the generic class */
-	struct rte_vmbus_device_list device_list;  /**< List of devices */
-	struct rte_vmbus_driver_list driver_list;  /**< List of drivers */
-};
 
 /**
  * Scan the content of the VMBUS bus, and the devices in the devices
@@ -378,15 +301,6 @@ void rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
 			   const struct vmbus_channel *chan,
 			   uint32_t latency);
 
-/**
- * Register a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be registered.
- */
-void rte_vmbus_register(struct rte_vmbus_driver *driver);
-
 /**
  * For debug dump contents of ring buffer.
  *
@@ -395,24 +309,6 @@ void rte_vmbus_register(struct rte_vmbus_driver *driver);
  */
 void rte_vmbus_chan_dump(FILE *f, const struct vmbus_channel *chan);
 
-/**
- * Unregister a VMBUS driver.
- *
- * @param driver
- *   A pointer to a rte_vmbus_driver structure describing the driver
- *   to be unregistered.
- */
-void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
-
-/** Helper for VMBUS device registration from driver instance */
-#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
-	RTE_INIT(vmbusinitfn_ ##nm)			\
-	{						\
-		(vmbus_drv).driver.name = RTE_STR(nm);	\
-		rte_vmbus_register(&vmbus_drv);		\
-	}						\
-	RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/drivers/bus/vmbus/version.map b/drivers/bus/vmbus/version.map
index 84db31b6e9..430781b29b 100644
--- a/drivers/bus/vmbus/version.map
+++ b/drivers/bus/vmbus/version.map
@@ -16,13 +16,18 @@ DPDK_23 {
 	rte_vmbus_map_device;
 	rte_vmbus_max_channels;
 	rte_vmbus_probe;
-	rte_vmbus_register;
 	rte_vmbus_scan;
 	rte_vmbus_set_latency;
 	rte_vmbus_sub_channel_index;
 	rte_vmbus_subchan_open;
 	rte_vmbus_unmap_device;
-	rte_vmbus_unregister;
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_vmbus_register;
+	rte_vmbus_unregister;
+};
diff --git a/drivers/bus/vmbus/vmbus_bufring.c b/drivers/bus/vmbus/vmbus_bufring.c
index c4aa07b307..c78619dc44 100644
--- a/drivers/bus/vmbus/vmbus_bufring.c
+++ b/drivers/bus/vmbus/vmbus_bufring.c
@@ -15,7 +15,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_pause.h>
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 9bd01679c3..5549fd0944 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -12,7 +12,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_atomic.h>
 #include <rte_memory.h>
 #include <rte_bus_vmbus.h>
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..03b39c82b7 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -11,7 +11,6 @@
 #include <sys/mman.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
@@ -235,7 +234,6 @@ rte_vmbus_register(struct rte_vmbus_driver *driver)
 		"Registered driver %s", driver->driver.name);
 
 	TAILQ_INSERT_TAIL(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = &rte_vmbus_bus;
 }
 
 /* unregister vmbus driver */
@@ -243,7 +241,6 @@ void
 rte_vmbus_unregister(struct rte_vmbus_driver *driver)
 {
 	TAILQ_REMOVE(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to VMBUS bus */
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 882a24f869..4d4613513c 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -13,7 +13,6 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
-#include <rte_bus.h>
 #include <rte_bus_vmbus.h>
 
 #include "private.h"
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 787139c0b2..188d92ffac 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,8 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <rte_bus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index b90280c9ff..817fb06dfb 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -29,7 +29,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 1b63b27e0c..20f75a17b0 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -27,7 +27,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
 #include "hn_var.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 909c07a4ab..61cf374224 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -27,7 +27,7 @@
 #include <rte_eal.h>
 #include <rte_dev.h>
 #include <rte_net.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index cce0a79edb..40981706d5 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
-#include <rte_bus_vmbus.h>
+#include <bus_vmbus_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_log.h>
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 19/27] bus: move IOVA definition from header
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (17 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 18/27] bus/vmbus: " David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 20/27] bus: introduce accessors David Marchand
                     ` (8 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Sunila Sahu,
	Fan Zhang, Ashish Gupta, Gaetan Rivet, Anatoly Burakov,
	Akhil Goyal, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
	Dmitry Malloy, Pallavi Kadam, Ferruh Yigit, Andrew Rybchenko,
	Reshma Pattan, Stephen Hemminger

iova enum definition does not need to be defined as part of the bus API.
Move it to rte_eal.h.
With this step, rte_eal.h does not depend on rte_bus.h and rte_dev.h.
Fix existing code that was relying on these implicit inclusions.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-compress-perf/comp_perf_options.h   |  2 ++
 app/test-pmd/config.c                        |  1 +
 app/test-pmd/testpmd.c                       |  1 +
 drivers/compress/zlib/zlib_pmd_ops.c         |  1 +
 drivers/net/failsafe/failsafe_eal.c          |  1 +
 examples/multi_process/hotplug_mp/commands.c |  2 ++
 lib/compressdev/rte_compressdev.c            |  1 +
 lib/compressdev/rte_compressdev_pmd.c        |  1 +
 lib/cryptodev/cryptodev_pmd.c                |  2 ++
 lib/eal/common/eal_thread.h                  |  1 +
 lib/eal/common/hotplug_mp.c                  |  1 +
 lib/eal/include/rte_bus.h                    | 18 ++----------------
 lib/eal/include/rte_eal.h                    | 15 ++++++++++++++-
 lib/eal/include/rte_lcore.h                  |  2 ++
 lib/eal/windows/eal.c                        |  1 +
 lib/ethdev/rte_ethdev.c                      |  1 +
 lib/pcapng/rte_pcapng.c                      |  1 +
 17 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0b777521c5..57dd146330 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -5,6 +5,8 @@
 #ifndef _COMP_PERF_OPS_
 #define _COMP_PERF_OPS_
 
+#include <rte_dev.h>
+
 #define MAX_LIST		32
 #define MIN_COMPRESSED_BUF_SIZE 8
 #define EXPANSE_RATIO 1.1
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index bc73819183..d988429f24 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -24,6 +24,7 @@
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
 #include <rte_launch.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index ee686393c5..510e0be624 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -32,6 +32,7 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_launch.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_alarm.h>
 #include <rte_per_lcore.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 0a73aed949..7d657d81bc 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_dev.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index cb4a2abc02..130344dce2 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,6 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
+#include <rte_bus.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index 41ea265e45..da8b5e5924 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -8,6 +8,8 @@
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
 #include <cmdline.h>
+
+#include <rte_bus.h>
 #include <rte_ethdev.h>
 
 /**********************************************************/
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 5ddbc3f9c0..e997bd01ed 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,6 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 7f500d76d4..9bfae077db 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,6 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
+#include <rte_dev.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 1903ade388..75d0075b86 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -3,6 +3,8 @@
  */
 
 #include <sys/queue.h>
+
+#include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/eal/common/eal_thread.h b/lib/eal/common/eal_thread.h
index ca3378d463..e0240ccc60 100644
--- a/lib/eal/common/eal_thread.h
+++ b/lib/eal/common/eal_thread.h
@@ -5,6 +5,7 @@
 #ifndef EAL_THREAD_H
 #define EAL_THREAD_H
 
+#include <rte_common.h>
 #include <rte_lcore.h>
 
 /**
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index bde0de196e..1614a57752 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,6 +3,7 @@
  */
 #include <string.h>
 
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index bbbb6efd28..17edaa37c9 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,27 +20,13 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_log.h>
 #include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_log.h>
 
 /** Double linked list of buses */
 RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
 
-
-/**
- * IOVA mapping mode.
- *
- * IOVA mapping mode is iommu programming mode of a device.
- * That device (for example: IOMMU backed DMA device) based
- * on rte_iova_mode will generate physical or virtual address.
- *
- */
-enum rte_iova_mode {
-	RTE_IOVA_DC = 0,	/* Don't care mode */
-	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
-	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
-};
-
 /**
  * Bus specific scan for devices attached on the bus.
  * For each bus object, the scan would be responsible for finding devices and
diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h
index 5dfc50e987..fd3d7c1da8 100644
--- a/lib/eal/include/rte_eal.h
+++ b/lib/eal/include/rte_eal.h
@@ -17,7 +17,6 @@
 #include <rte_config.h>
 #include <rte_compat.h>
 #include <rte_per_lcore.h>
-#include <rte_bus.h>
 #include <rte_uuid.h>
 
 #include <rte_pci_dev_feature_defs.h>
@@ -458,6 +457,20 @@ static inline int rte_gettid(void)
 __rte_internal
 uint64_t rte_eal_get_baseaddr(void);
 
+/**
+ * IOVA mapping mode.
+ *
+ * IOVA mapping mode is iommu programming mode of a device.
+ * That device (for example: IOMMU backed DMA device) based
+ * on rte_iova_mode will generate physical or virtual address.
+ *
+ */
+enum rte_iova_mode {
+	RTE_IOVA_DC = 0,	/* Don't care mode */
+	RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
+	RTE_IOVA_VA = (1 << 1)  /* DMA using virtual address */
+};
+
 /**
  * Get the iova mode
  *
diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h
index b598e1b9ec..4d3978512c 100644
--- a/lib/eal/include/rte_lcore.h
+++ b/lib/eal/include/rte_lcore.h
@@ -11,6 +11,8 @@
  * API for lcore and socket manipulation
  *
  */
+#include <stdio.h>
+
 #include <rte_config.h>
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index 122de2a319..79322d2ce9 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 
 #include <rte_debug.h>
+#include <rte_bus.h>
 #include <rte_eal.h>
 #include <eal_memcfg.h>
 #include <rte_errno.h>
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9d6f460726..9e358d187a 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
+#include <rte_bus.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 06ad712bd1..5b079cd14a 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,6 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <rte_bus.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 20/27] bus: introduce accessors
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (18 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 19/27] bus: move IOVA definition from header David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 21/27] bus: hide bus object David Marchand
                     ` (7 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang,
	Anatoly Burakov, Ray Kinsella

Add helpers to get a rte_bus object details.
This will be used externally.
Internal users may still dereference a rte_bus object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v1:
- changed approach: only external users are updated,

---
 app/test-pmd/config.c                        |  4 +--
 app/test-pmd/testpmd.c                       |  4 +--
 app/test/test_devargs.c                      |  4 +--
 examples/multi_process/hotplug_mp/commands.c |  4 +--
 lib/eal/common/eal_common_bus.c              | 26 ++++++++++++--------
 lib/eal/include/rte_bus.h                    | 14 +++++++++++
 lib/eal/version.map                          |  3 +++
 7 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d988429f24..7bd28ee3e8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -642,7 +642,7 @@ device_infos_display(const char *identifier)
 		if (identifier && da.bus != next)
 			continue;
 
-		snprintf(devstr, sizeof(devstr), "bus=%s", next->name);
+		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
 			if (!dev->driver)
@@ -653,7 +653,7 @@ device_infos_display(const char *identifier)
 				continue;
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
-			printf("Bus name: %s", dev->bus->name);
+			printf("Bus name: %s", rte_bus_name(dev->bus));
 			printf("\nDriver name: %s", dev->driver->name);
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 510e0be624..c7d1fa2719 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3507,9 +3507,9 @@ detach_devargs(char *identifier)
 		}
 	}
 
-	if (rte_eal_hotplug_remove(da.bus->name, da.name) != 0) {
+	if (rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name) != 0) {
 		TESTPMD_LOG(ERR, "Failed to detach device %s(%s)\n",
-			    da.name, da.bus->name);
+			    da.name, rte_bus_name(da.bus));
 		rte_devargs_reset(&da);
 		return;
 	}
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 16621285d2..ac5bc34c18 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -98,9 +98,9 @@ test_valid_devargs_cases(const struct devargs_case *list, size_t n)
 			      list[i].bus_kv) != 0)
 			goto fail;
 		if (list[i].bus != NULL &&
-		    strcmp(da.bus->name, list[i].bus) != 0) {
+		    strcmp(rte_bus_name(da.bus), list[i].bus) != 0) {
 			printf("rte_devargs_parse(%s) bus name (%s) not expected (%s)\n",
-			       list[i].devargs, da.bus->name, list[i].bus);
+			       list[i].devargs, rte_bus_name(da.bus), list[i].bus);
 			goto fail;
 		}
 		if ((list[i].class_kv > 0 || list[i].class != NULL) &&
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index da8b5e5924..88f44e00a0 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -126,7 +126,7 @@ static void cmd_dev_attach_parsed(void *parsed_result,
 		return;
 	}
 
-	if (!rte_eal_hotplug_add(da.bus->name, da.name, da.args))
+	if (!rte_eal_hotplug_add(rte_bus_name(da.bus), da.name, da.args))
 		cmdline_printf(cl, "attached device %s\n", da.name);
 	else
 		cmdline_printf(cl, "failed to attached device %s\n",
@@ -173,7 +173,7 @@ static void cmd_dev_detach_parsed(void *parsed_result,
 	}
 
 	printf("detaching...\n");
-	if (!rte_eal_hotplug_remove(da.bus->name, da.name))
+	if (!rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name))
 		cmdline_printf(cl, "detached device %s\n",
 			da.name);
 	else
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index baa5b532af..cbf382f967 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -16,11 +16,17 @@
 static struct rte_bus_list rte_bus_list =
 	TAILQ_HEAD_INITIALIZER(rte_bus_list);
 
+const char *
+rte_bus_name(const struct rte_bus *bus)
+{
+	return bus->name;
+}
+
 void
 rte_bus_register(struct rte_bus *bus)
 {
 	RTE_VERIFY(bus);
-	RTE_VERIFY(bus->name && strlen(bus->name));
+	RTE_VERIFY(rte_bus_name(bus) && strlen(rte_bus_name(bus)));
 	/* A bus should mandatorily have the scan implemented */
 	RTE_VERIFY(bus->scan);
 	RTE_VERIFY(bus->probe);
@@ -29,14 +35,14 @@ rte_bus_register(struct rte_bus *bus)
 	RTE_VERIFY(!bus->plug || bus->unplug);
 
 	TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", rte_bus_name(bus));
 }
 
 void
 rte_bus_unregister(struct rte_bus *bus)
 {
 	TAILQ_REMOVE(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
+	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", rte_bus_name(bus));
 }
 
 /* Scan all the buses for registered devices */
@@ -50,7 +56,7 @@ rte_bus_scan(void)
 		ret = bus->scan();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	return 0;
@@ -64,7 +70,7 @@ rte_bus_probe(void)
 	struct rte_bus *bus, *vbus = NULL;
 
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
-		if (!strcmp(bus->name, "vdev")) {
+		if (!strcmp(rte_bus_name(bus), "vdev")) {
 			vbus = bus;
 			continue;
 		}
@@ -72,14 +78,14 @@ rte_bus_probe(void)
 		ret = bus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				bus->name);
+				rte_bus_name(bus));
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
 		if (ret)
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
-				vbus->name);
+				rte_bus_name(vbus));
 	}
 
 	return 0;
@@ -92,7 +98,7 @@ bus_dump_one(FILE *f, struct rte_bus *bus)
 	int ret;
 
 	/* For now, dump only the bus name */
-	ret = fprintf(f, " %s\n", bus->name);
+	ret = fprintf(f, " %s\n", rte_bus_name(bus));
 
 	/* Error in case of inability in writing to stream */
 	if (ret < 0)
@@ -163,7 +169,7 @@ cmp_bus_name(const struct rte_bus *bus, const void *_name)
 {
 	const char *name = _name;
 
-	return strcmp(bus->name, name);
+	return strcmp(rte_bus_name(bus), name);
 }
 
 struct rte_bus *
@@ -213,7 +219,7 @@ rte_bus_get_iommu_class(void)
 
 		bus_iova_mode = bus->get_iommu_class();
 		RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n",
-			bus->name,
+			rte_bus_name(bus),
 			bus_iova_mode == RTE_IOVA_DC ? "DC" :
 			(bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA"));
 		if (bus_iova_mode == RTE_IOVA_PA)
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 17edaa37c9..3848b44db0 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -266,6 +266,20 @@ struct rte_bus {
 
 };
 
+/**
+ * Retrieve a bus name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure.
+ * @return
+ *   A pointer to the bus name string.
+ */
+__rte_experimental
+const char *rte_bus_name(const struct rte_bus *bus);
+
 /**
  * Register a Bus handler.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..aa53064db1 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_bus_name;
 };
 
 INTERNAL {
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 21/27] bus: hide bus object
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (19 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 20/27] bus: introduce accessors David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 22/27] dev: introduce driver accessors David Marchand
                     ` (6 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Anatoly Burakov,
	Stephen Hemminger, Long Li, Matan Azrad, Viacheslav Ovsiienko,
	Kevin Laatz, Chas Williams, Min Hu (Connor),
	Gaetan Rivet, Maxime Coquelin, Chenbo Xia, Ferruh Yigit,
	Andrew Rybchenko, Reshma Pattan

Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_bus objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

Changes since RFC v1:
- update all existing users of the public header to use the internal one,

---
 app/test/test_devargs.c                  |   2 +-
 app/test/test_vdev.c                     |   2 +-
 doc/guides/rel_notes/deprecation.rst     |   6 -
 doc/guides/rel_notes/release_22_11.rst   |   6 +
 drivers/bus/auxiliary/auxiliary_common.c |   2 +-
 drivers/bus/auxiliary/auxiliary_params.c |   2 +-
 drivers/bus/auxiliary/private.h          |   2 +-
 drivers/bus/dpaa/dpaa_bus.c              |   2 +-
 drivers/bus/fslmc/fslmc_bus.c            |   2 +-
 drivers/bus/fslmc/private.h              |   2 +-
 drivers/bus/ifpga/ifpga_bus.c            |   2 +-
 drivers/bus/pci/linux/pci_vfio.c         |   2 +-
 drivers/bus/pci/pci_common.c             |   2 +-
 drivers/bus/pci/pci_params.c             |   2 +-
 drivers/bus/pci/private.h                |   2 +-
 drivers/bus/vdev/vdev.c                  |   2 +-
 drivers/bus/vmbus/private.h              |   2 +-
 drivers/common/mlx5/mlx5_common_pci.c    |   2 +-
 drivers/dma/idxd/idxd_bus.c              |   2 +-
 drivers/net/bonding/rte_eth_bond_args.c  |   2 +-
 drivers/net/failsafe/failsafe.c          |   2 +-
 drivers/net/failsafe/failsafe_eal.c      |   2 +-
 drivers/net/mlx5/linux/mlx5_os.c         |   2 +-
 drivers/net/netvsc/hn_ethdev.c           |   2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c    |   2 +-
 drivers/net/virtio/virtio_pci.c          |   2 +-
 drivers/raw/ioat/idxd_bus.c              |   2 +-
 lib/eal/common/eal_common_bus.c          |   2 +-
 lib/eal/common/eal_common_dev.c          |   2 +-
 lib/eal/common/eal_common_devargs.c      |   2 +-
 lib/eal/common/hotplug_mp.c              |   2 +-
 lib/eal/include/bus_driver.h             | 296 +++++++++++++++++++++++
 lib/eal/include/meson.build              |   4 +
 lib/eal/include/rte_bus.h                | 278 +--------------------
 lib/eal/linux/eal_dev.c                  |   2 +-
 lib/eal/version.map                      |   8 +-
 lib/ethdev/rte_ethdev.c                  |   2 +-
 lib/pcapng/rte_pcapng.c                  |   2 +-
 38 files changed, 343 insertions(+), 319 deletions(-)
 create mode 100644 lib/eal/include/bus_driver.h

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index ac5bc34c18..0a4c34a1ad 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -9,7 +9,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 
 #include "test.h"
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 5eeff3106d..1904e76e44 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_common.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_vdev.h>
 
 #include "test.h"
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 5b4ffc992d..98a00da385 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,12 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* bus: The ``rte_bus`` object will be made opaque in DPDK 22.11.
-  The goal is to remove it from the public ABI and make this object extendable.
-  As a side effect, registering a bus will be marked as an internal API:
-  external users may still register their bus using a new driver header
-  (see ``enable_driver_sdk`` meson option).
-
 * drivers: As a follow-up of the work on the ``rte_bus`` object,
   the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
   their bus-specific counterparts) will be made opaque in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index e08a548285..36df0ccf93 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,6 +88,12 @@ API Changes
   in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
   to update their code.
 
+* bus: Registering a bus has been marked as an internal API.
+  External users may still register their bus using the ``bus_driver.h``
+  driver header (see ``enable_driver_sdk`` meson option).
+  The ``rte_bus`` object is now opaque and must be manipulated through added
+  accessors.
+
 * drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 6cf6c170ec..259ff152c4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -12,7 +12,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index 0289777922..a889e392c6 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 3f49f62493..3dee13e1d1 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "bus_auxiliary_driver.h"
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 1ac6aa314f..682427ba2c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -29,7 +29,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index b9b0981329..8503004e3d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 60d68155e1..6f14085d98 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -5,7 +5,7 @@
 #ifndef BUS_FSLMC_PRIVATE_H
 #define BUS_FSLMC_PRIVATE_H
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include <bus_fslmc_driver.h>
 
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 27e2de7072..bb943b58b5 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <rte_errno.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index cd0d0b1670..fab3483d9f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -18,7 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_vfio.h>
 #include <rte_eal.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 0d61d49287..c26aacd364 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,7 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_lcore.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 61a868707f..39d702a418 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 4e40a2ed85..fddf49251d 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -8,7 +8,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7d78cf93bc..809a8bb08f 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_memory.h>
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 3d233fa83c..e33424675c 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,7 +9,7 @@
 #include <stdbool.h>
 #include <sys/uio.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_log.h>
 #include <rte_eal_paging.h>
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index e82cb881bf..73178ce0f3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -9,7 +9,7 @@
 #include <rte_errno.h>
 #include <rte_class.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 
 #include "mlx5_common_log.h"
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 13cb967f6d..e30dcfc281 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -8,7 +8,7 @@
 #include <sys/mman.h>
 #include <libgen.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 1a86eb3c00..6553166f5c 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -4,7 +4,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 5d4d52c341..32811403b4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -11,7 +11,7 @@
 #include <ethdev_vdev.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 
 #include "failsafe_private.h"
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 130344dce2..d71b512f81 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,7 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index efb262e368..4f0a6f4d55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -19,7 +19,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_pci_driver.h>
 #include <bus_auxiliary_driver.h>
 #include <rte_common.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 188d92ffac..ccc06bdda6 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -31,7 +31,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 65043a04eb..dc90569df1 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
 #include <rte_dev.h>
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..9cf4d760b4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -9,7 +9,7 @@
 #endif
 
 #include <rte_io.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 
 #include "virtio_pci.h"
 #include "virtio_logs.h"
diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 539f51b1b1..f32d811055 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
 #include "ioat_private.h"
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index cbf382f967..be64d31b0f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b6f0392f30..62a598957c 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d5833af373..03e6e59baf 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -10,7 +10,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_class.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 1614a57752..5202bd5658 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_eal.h>
 #include <rte_errno.h>
 #include <rte_alarm.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
new file mode 100644
index 0000000000..d2e615a736
--- /dev/null
+++ b/lib/eal/include/bus_driver.h
@@ -0,0 +1,296 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef BUS_DRIVER_H
+#define BUS_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_bus.h>
+#include <rte_compat.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_tailq.h>
+
+struct rte_devargs;
+struct rte_device;
+
+/** Double linked list of buses */
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
+
+/**
+ * Bus specific scan for devices attached on the bus.
+ * For each bus object, the scan would be responsible for finding devices and
+ * adding them to its private device list.
+ *
+ * A bus should mandatorily implement this method.
+ *
+ * @return
+ *	0 for successful scan
+ *	<0 for unsuccessful scan with error value
+ */
+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);
+
+/**
+ * Device iterator to find a device on a bus.
+ *
+ * This function returns an rte_device if one of those held by the bus
+ * matches the data passed as parameter.
+ *
+ * If the comparison function returns zero this function should stop iterating
+ * over any more devices. To continue a search the device of a previous search
+ * can be passed via the start parameter.
+ *
+ * @param cmp
+ *	Comparison function.
+ *
+ * @param data
+ *	Data to compare each device against.
+ *
+ * @param start
+ *	starting point for the iteration
+ *
+ * @return
+ *	The first device matching the data, NULL if none exists.
+ */
+typedef struct rte_device *
+(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data);
+
+/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_plug_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ * @param dev
+ *	Device pointer that was returned by a previous call to find_device.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
+
+/**
+ * Bus specific parsing function.
+ * Validates the syntax used in the textual representation of a device,
+ * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
+ * device representation to ``addr``.
+ *
+ * @param[in] name
+ *	device textual description
+ *
+ * @param[out] addr
+ *	device information location address, into which parsed info
+ *	should be written. If NULL, nothing should be written, which
+ *	is not an error.
+ *
+ * @return
+ *	0 if parsing was successful.
+ *	!0 for any error.
+ */
+typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+
+/**
+ * Parse bus part of the device arguments.
+ *
+ * The field name of the struct rte_devargs will be set.
+ *
+ * @param da
+ *	Pointer to the devargs to parse.
+ *
+ * @return
+ *	0 on successful parsing, otherwise rte_errno is set.
+ *	-EINVAL: on parsing error.
+ *	-ENODEV: if no key matching a device argument is specified.
+ *	-E2BIG: device name is too long.
+ */
+typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
+
+/**
+ * Device level DMA map function.
+ * After a successful call, the memory segment will be mapped to the
+ * given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to map.
+ * @param iova
+ *	IOVA address to map.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
+				  uint64_t iova, size_t len);
+
+/**
+ * Device level DMA unmap function.
+ * After a successful call, the memory segment will no longer be
+ * accessible by the given device.
+ *
+ * @param dev
+ *	Device pointer.
+ * @param addr
+ *	Virtual address to unmap.
+ * @param iova
+ *	IOVA address to unmap.
+ * @param len
+ *	Length of the memory segment being mapped.
+ *
+ * @return
+ *	0 if un-mapping was successful.
+ *	Negative value and rte_errno is set otherwise.
+ */
+typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
+				   uint64_t iova, size_t len);
+
+/**
+ * Implement a specific hot-unplug handler, which is responsible for
+ * handle the failure when device be hot-unplugged. When the event of
+ * hot-unplug be detected, it could call this function to handle
+ * the hot-unplug failure and avoid app crash.
+ * @param dev
+ *	Pointer of the device structure.
+ *
+ * @return
+ *	0 on success.
+ *	!0 on error.
+ */
+typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
+
+/**
+ * Implement a specific sigbus handler, which is responsible for handling
+ * the sigbus error which is either original memory error, or specific memory
+ * error that caused of device be hot-unplugged. When sigbus error be captured,
+ * it could call this function to handle sigbus error.
+ * @param failure_addr
+ *	Pointer of the fault address of the sigbus error.
+ *
+ * @return
+ *	0 for success handle the sigbus for hot-unplug.
+ *	1 for not process it, because it is a generic sigbus error.
+ *	-1 for failed to handle the sigbus for hot-unplug.
+ */
+typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
+
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+	RTE_BUS_SCAN_UNDEFINED,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * A structure used to configure bus operations.
+ */
+struct rte_bus_conf {
+	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+};
+
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *      enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+/**
+ * A structure describing a generic bus.
+ */
+struct rte_bus {
+	RTE_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 */
+	rte_bus_find_device_t find_device; /**< Find a device on the bus */
+	rte_bus_plug_t plug;         /**< Probe single device for drivers */
+	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
+	rte_bus_parse_t parse;       /**< Parse a device name */
+	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
+	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
+	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
+	struct rte_bus_conf conf;    /**< Bus configuration */
+	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
+	rte_bus_hot_unplug_handler_t hot_unplug_handler;
+				/**< handle hot-unplug failure on the bus */
+	rte_bus_sigbus_handler_t sigbus_handler;
+					/**< handle sigbus error on the bus */
+};
+
+/**
+ * Register a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be registered.
+ */
+__rte_internal
+void rte_bus_register(struct rte_bus *bus);
+
+/**
+ * Helper for Bus registration.
+ * The constructor has higher priority than PMD constructors.
+ */
+#define RTE_REGISTER_BUS(nm, bus) \
+RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
+{\
+	(bus).name = RTE_STR(nm);\
+	rte_bus_register(&bus); \
+}
+
+/**
+ * Unregister a Bus handler.
+ *
+ * @param bus
+ *   A pointer to a rte_bus structure describing the bus
+ *   to be unregistered.
+ */
+__rte_internal
+void rte_bus_unregister(struct rte_bus *bus);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BUS_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index fd6e844224..77d8621a51 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -55,6 +55,10 @@ headers += files(
         'rte_vfio.h',
 )
 
+driver_sdk_headers = files(
+        'bus_driver.h',
+)
+
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
         'generic/rte_atomic.h',
diff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h
index 3848b44db0..dfe756fb11 100644
--- a/lib/eal/include/rte_bus.h
+++ b/lib/eal/include/rte_bus.h
@@ -20,284 +20,21 @@ extern "C" {
 
 #include <stdio.h>
 
-#include <rte_dev.h>
 #include <rte_eal.h>
-#include <rte_log.h>
 
-/** Double linked list of buses */
-RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
-
-/**
- * Bus specific scan for devices attached on the bus.
- * For each bus object, the scan would be responsible for finding devices and
- * adding them to its private device list.
- *
- * A bus should mandatorily implement this method.
- *
- * @return
- *	0 for successful scan
- *	<0 for unsuccessful scan with error value
- */
-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);
-
-/**
- * Device iterator to find a device on a bus.
- *
- * This function returns an rte_device if one of those held by the bus
- * matches the data passed as parameter.
- *
- * If the comparison function returns zero this function should stop iterating
- * over any more devices. To continue a search the device of a previous search
- * can be passed via the start parameter.
- *
- * @param cmp
- *	Comparison function.
- *
- * @param data
- *	Data to compare each device against.
- *
- * @param start
- *	starting point for the iteration
- *
- * @return
- *	The first device matching the data, NULL if none exists.
- */
-typedef struct rte_device *
-(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
-			 const void *data);
-
-/**
- * Implementation specific probe function which is responsible for linking
- * devices on that bus with applicable drivers.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_plug_t)(struct rte_device *dev);
-
-/**
- * Implementation specific remove function which is responsible for unlinking
- * devices on that bus from assigned driver.
- *
- * @param dev
- *	Device pointer that was returned by a previous call to find_device.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
-
-/**
- * Bus specific parsing function.
- * Validates the syntax used in the textual representation of a device,
- * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific
- * device representation to ``addr``.
- *
- * @param[in] name
- *	device textual description
- *
- * @param[out] addr
- *	device information location address, into which parsed info
- *	should be written. If NULL, nothing should be written, which
- *	is not an error.
- *
- * @return
- *	0 if parsing was successful.
- *	!0 for any error.
- */
-typedef int (*rte_bus_parse_t)(const char *name, void *addr);
-
-/**
- * Parse bus part of the device arguments.
- *
- * The field name of the struct rte_devargs will be set.
- *
- * @param da
- *	Pointer to the devargs to parse.
- *
- * @return
- *	0 on successful parsing, otherwise rte_errno is set.
- *	-EINVAL: on parsing error.
- *	-ENODEV: if no key matching a device argument is specified.
- *	-E2BIG: device name is too long.
- */
-typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
-
-/**
- * Device level DMA map function.
- * After a successful call, the memory segment will be mapped to the
- * given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to map.
- * @param iova
- *	IOVA address to map.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
-				  uint64_t iova, size_t len);
-
-/**
- * Device level DMA unmap function.
- * After a successful call, the memory segment will no longer be
- * accessible by the given device.
- *
- * @param dev
- *	Device pointer.
- * @param addr
- *	Virtual address to unmap.
- * @param iova
- *	IOVA address to unmap.
- * @param len
- *	Length of the memory segment being mapped.
- *
- * @return
- *	0 if un-mapping was successful.
- *	Negative value and rte_errno is set otherwise.
- */
-typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
-				   uint64_t iova, size_t len);
-
-/**
- * Implement a specific hot-unplug handler, which is responsible for
- * handle the failure when device be hot-unplugged. When the event of
- * hot-unplug be detected, it could call this function to handle
- * the hot-unplug failure and avoid app crash.
- * @param dev
- *	Pointer of the device structure.
- *
- * @return
- *	0 on success.
- *	!0 on error.
- */
-typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
-
-/**
- * Implement a specific sigbus handler, which is responsible for handling
- * the sigbus error which is either original memory error, or specific memory
- * error that caused of device be hot-unplugged. When sigbus error be captured,
- * it could call this function to handle sigbus error.
- * @param failure_addr
- *	Pointer of the fault address of the sigbus error.
- *
- * @return
- *	0 for success handle the sigbus for hot-unplug.
- *	1 for not process it, because it is a generic sigbus error.
- *	-1 for failed to handle the sigbus for hot-unplug.
- */
-typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
-
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_ALLOWLIST,
-	RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
-/**
- * Get common iommu class of the all the devices on the bus. The bus may
- * check that those devices are attached to iommu driver.
- * If no devices are attached to the bus. The bus may return with don't care
- * (_DC) value.
- * Otherwise, The bus will return appropriate _pa or _va iova mode.
- *
- * @return
- *      enum rte_iova_mode value.
- */
-typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
-
-
-/**
- * A structure describing a generic bus.
- */
-struct rte_bus {
-	RTE_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 */
-	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-	rte_bus_plug_t plug;         /**< Probe single device for drivers */
-	rte_bus_unplug_t unplug;     /**< Remove single device from driver */
-	rte_bus_parse_t parse;       /**< Parse a device name */
-	rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
-	rte_dev_dma_map_t dma_map;   /**< DMA map for device in the bus */
-	rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
-	struct rte_bus_conf conf;    /**< Bus configuration */
-	rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
-	rte_dev_iterate_t dev_iterate; /**< Device iterator. */
-	rte_bus_hot_unplug_handler_t hot_unplug_handler;
-				/**< handle hot-unplug failure on the bus */
-	rte_bus_sigbus_handler_t sigbus_handler;
-					/**< handle sigbus error on the bus */
-
-};
+struct rte_bus;
+struct rte_device;
 
 /**
  * Retrieve a bus name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param bus
  *   A pointer to a rte_bus structure.
  * @return
  *   A pointer to the bus name string.
  */
-__rte_experimental
 const char *rte_bus_name(const struct rte_bus *bus);
 
-/**
- * Register a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be registered.
- */
-void rte_bus_register(struct rte_bus *bus);
-
-/**
- * Unregister a Bus handler.
- *
- * @param bus
- *   A pointer to a rte_bus structure describing the bus
- *   to be unregistered.
- */
-void rte_bus_unregister(struct rte_bus *bus);
-
 /**
  * Scan all the buses.
  *
@@ -387,17 +124,6 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  */
 enum rte_iova_mode rte_bus_get_iommu_class(void);
 
-/**
- * Helper for Bus registration.
- * The constructor has higher priority than PMD constructors.
- */
-#define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
-{\
-	(bus).name = RTE_STR(nm);\
-	rte_bus_register(&bus); \
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 02ae1cde29..098a2c3076 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -13,7 +13,7 @@
 #include <rte_dev.h>
 #include <rte_interrupts.h>
 #include <rte_alarm.h>
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_errno.h>
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index aa53064db1..6ec15f1147 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -12,10 +12,9 @@ DPDK_23 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_bus_get_iommu_class;
+	rte_bus_name;
 	rte_bus_probe;
-	rte_bus_register;
 	rte_bus_scan;
-	rte_bus_unregister;
 	rte_calloc;
 	rte_calloc_socket;
 	rte_cpu_get_flag_enabled;
@@ -424,14 +423,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_bus_name;
 };
 
 INTERNAL {
 	global:
 
+	rte_bus_register;
+	rte_bus_unregister;
 	rte_eal_get_baseaddr;
 	rte_firmware_read;
 	rte_intr_allow_others;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9e358d187a..0c2c1088c0 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_memcpy.h>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 5b079cd14a..72aabd4dd0 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
+#include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_dev.h>
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 22/27] dev: introduce driver accessors
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (20 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 21/27] bus: hide bus object David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 23/27] dev: hide driver object David Marchand
                     ` (5 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Ray Kinsella,
	Ferruh Yigit, Andrew Rybchenko

Prepare for making the driver object opaque by adding accessors.
Update existing "external" users.
Internal users may still dereference a rte_driver object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/config.c           |  2 +-
 lib/eal/common/eal_common_dev.c |  6 ++++++
 lib/eal/include/rte_dev.h       | 15 +++++++++++++++
 lib/eal/version.map             |  3 +++
 lib/ethdev/rte_ethdev.h         |  2 +-
 5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7bd28ee3e8..6510f29c76 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,7 +654,7 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, dev->name, info_border);
 			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", dev->driver->name);
+			printf("\nDriver name: %s", rte_driver_name(dev->driver));
 			printf("\nDevargs: %s",
 			       dev->devargs ? dev->devargs->args : "");
 			printf("\nConnect to socket: %d", dev->numa_node);
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 62a598957c..16c5aef1d8 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -19,6 +19,12 @@
 #include "eal_private.h"
 #include "hotplug_mp.h"
 
+const char *
+rte_driver_name(const struct rte_driver *driver)
+{
+	return driver->name;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 2743c09320..ddea163cca 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -76,6 +76,21 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * Retrieve a driver name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param driver
+ *   A pointer to a driver structure.
+ * @return
+ *   A pointer to the driver name string.
+ */
+__rte_experimental
+const char *
+rte_driver_name(const struct rte_driver *driver);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 6ec15f1147..d10fd89458 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -423,6 +423,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 41d37e41b5..7556b94602 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = dev->device->driver->name
+ * driver_name = rte_driver_name(dev->device->driver)
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 23/27] dev: hide driver object
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (21 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 22/27] dev: introduce driver accessors David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 24/27] dev: introduce device accessors David Marchand
                     ` (4 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Jay Jayatheerthan, Ajit Khaparde,
	Nicolas Chautru, Parav Pandit, Xueming Li, Hemant Agrawal,
	Sachin Saxena, Stephen Hemminger, Long Li, Fan Zhang,
	Sunila Sahu, Ashish Gupta, Raveendra Padasalagi, Vikas Gupta,
	Chandubabu Namburu, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
	Gagandeep Singh, Kevin Laatz, Timothy McDaniel, Jerin Jacob,
	Elena Agostini, Ciara Loftus, Qi Zhang, Shepard Siegel, Ed Czeck,
	John Miller, Steven Webster, Matt Peters, Rasesh Mody,
	Shahed Shaikh, Somnath Kotur, Rahul Lakkireddy, Simei Su,
	Wenjun Wu, Marcin Wojtas, Michal Krawczyk, Shai Brandes,
	Evgeny Schemeilin, Igor Chauskin, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Yuying Zhang, Beilei Xing, Jingjing Wu,
	Qiming Yang, Matan Azrad, Viacheslav Ovsiienko, Chaoyong He,
	Niklas Soderlund, Harman Kalra, Devendra Singh Rawat,
	Andrew Rybchenko, Maciej Czekaj, Maxime Coquelin, Chenbo Xia,
	Jochen Behrens, Jakub Palider, Tomasz Duszynski, Ori Kam,
	Akhil Goyal, Chengwen Feng, Ray Kinsella, Ferruh Yigit,
	Abhinandan Gujjar, Olivier Matz, Reshma Pattan

Make rte_driver opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_driver definition.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_driver objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/release_22_11.rst        |  2 ++
 drivers/baseband/acc100/rte_acc100_pmd.c      |  2 +-
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         |  2 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |  2 +-
 drivers/bus/auxiliary/auxiliary_params.c      |  2 +-
 drivers/bus/auxiliary/bus_auxiliary_driver.h  |  2 +-
 drivers/bus/dpaa/bus_dpaa_driver.h            |  2 +-
 drivers/bus/fslmc/bus_fslmc_driver.h          |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  2 +-
 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/pci/bus_pci_driver.h              |  2 +-
 drivers/bus/pci/pci_params.c                  |  2 +-
 drivers/bus/vdev/bus_vdev_driver.h            |  2 +-
 drivers/bus/vdev/vdev.c                       |  2 +-
 drivers/bus/vdev/vdev_params.c                |  2 +-
 drivers/bus/vmbus/bus_vmbus_driver.h          |  2 +-
 drivers/common/qat/dev/qat_dev_gen4.c         |  2 +-
 drivers/common/qat/qat_qp.c                   |  2 +-
 drivers/compress/zlib/zlib_pmd_ops.c          |  2 +-
 drivers/crypto/bcmfs/bcmfs_qp.c               |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_pmd.c          |  2 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  2 +-
 drivers/crypto/cnxk/cn10k_cryptodev.c         |  2 +-
 drivers/crypto/cnxk/cn9k_cryptodev.c          |  2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/crypto/scheduler/scheduler_pmd_ops.c  |  2 +-
 drivers/dma/idxd/idxd_bus.c                   |  1 +
 drivers/event/dlb2/dlb2.c                     |  2 +-
 drivers/event/dlb2/pf/dlb2_pf.c               |  2 +-
 drivers/event/dpaa/dpaa_eventdev.c            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |  2 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  2 +-
 drivers/event/octeontx/ssovf_evdev.c          |  2 +-
 drivers/event/skeleton/skeleton_eventdev.c    |  2 +-
 drivers/gpu/cuda/cuda.c                       |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  2 +-
 drivers/net/ark/ark_global.h                  |  2 +-
 drivers/net/avp/avp_ethdev.c                  |  2 +-
 drivers/net/axgbe/axgbe_common.h              |  2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  2 +-
 drivers/net/cxgbe/base/t4_hw.c                |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c              |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                |  2 +-
 drivers/net/cxgbe/sge.c                       |  2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  2 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                |  2 +-
 drivers/net/dpaa2/dpaa2_sparser.c             |  2 +-
 drivers/net/e1000/em_ethdev.c                 |  2 +-
 drivers/net/e1000/igb_ethdev.c                |  2 +-
 drivers/net/e1000/igb_flow.c                  |  2 +-
 drivers/net/ena/ena_ethdev.h                  |  2 +-
 drivers/net/enic/enic_ethdev.c                |  2 +-
 drivers/net/enic/enic_vf_representor.c        |  2 +-
 drivers/net/failsafe/failsafe_private.h       |  2 +-
 drivers/net/fm10k/fm10k_ethdev.c              |  2 +-
 drivers/net/i40e/i40e_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_ethdev.c                |  2 +-
 drivers/net/iavf/iavf_vchnl.c                 |  2 +-
 drivers/net/ice/ice_dcf.c                     |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |  2 +-
 drivers/net/ixgbe/ixgbe_flow.c                |  2 +-
 drivers/net/mlx4/mlx4.c                       |  2 +-
 drivers/net/netvsc/hn_ethdev.c                |  2 +-
 drivers/net/netvsc/hn_nvs.c                   |  2 +-
 drivers/net/netvsc/hn_rndis.c                 |  2 +-
 drivers/net/netvsc/hn_rxtx.c                  |  2 +-
 drivers/net/nfp/nfp_common.c                  |  2 +-
 drivers/net/nfp/nfp_ethdev.c                  |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c        |  2 +-
 drivers/net/qede/qede_ethdev.h                |  2 +-
 drivers/net/sfc/sfc_ethdev.c                  |  2 +-
 drivers/net/sfc/sfc_sw_stats.c                |  2 +-
 drivers/net/sfc/sfc_sw_stats.h                |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c           |  2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c         |  2 +-
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_pci_ethdev.c        |  2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c          |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy.c             |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c        |  2 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c   |  2 +-
 drivers/regex/mlx5/mlx5_regex_control.c       |  2 +-
 lib/compressdev/rte_compressdev.c             |  2 +-
 lib/compressdev/rte_compressdev_pmd.c         |  2 +-
 lib/compressdev/rte_compressdev_pmd.h         |  1 +
 lib/cryptodev/cryptodev_pmd.c                 |  2 +-
 lib/cryptodev/cryptodev_pmd.h                 |  1 +
 lib/cryptodev/rte_cryptodev.c                 |  2 +-
 lib/dmadev/rte_dmadev_pmd.h                   |  2 +-
 lib/eal/common/eal_common_dev.c               |  2 +-
 lib/eal/include/dev_driver.h                  | 28 +++++++++++++++++++
 lib/eal/include/meson.build                   |  1 +
 lib/eal/include/rte_dev.h                     | 15 ++--------
 lib/eal/version.map                           |  4 +--
 lib/ethdev/ethdev_driver.h                    |  1 +
 lib/eventdev/eventdev_pmd.h                   |  2 +-
 lib/eventdev/rte_event_crypto_adapter.c       |  2 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |  2 +-
 lib/eventdev/rte_eventdev.c                   |  2 +-
 lib/gpudev/gpudev_driver.h                    |  2 +-
 lib/mempool/rte_mempool_ops.c                 |  2 +-
 lib/pcapng/rte_pcapng.c                       |  2 +-
 lib/rawdev/rte_rawdev.c                       |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                   |  2 +-
 lib/security/rte_security.c                   |  2 +-
 115 files changed, 144 insertions(+), 122 deletions(-)
 create mode 100644 lib/eal/include/dev_driver.h

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 36df0ccf93..4e20345b7a 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,6 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` 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).
+  The ``rte_driver`` object is now opaque and must be manipulated through added
+  accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 801e8920df..e2d9409185 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_byteorder.h>
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index c1d877c87f..51dd090c1b 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index f16814e241..036579e3ec 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -6,7 +6,7 @@
 
 #include <rte_common.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a889e392c6..e4c7ee0c3b 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -5,7 +5,7 @@
 #include <string.h>
 
 #include <bus_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1c2d2c04af..58fb7c7f69 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -25,7 +25,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #define RTE_BUS_AUXILIARY_NAME "auxiliary"
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index cf66fc0c53..26a83b2cdf 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -7,7 +7,7 @@
 #define BUS_DPAA_DRIVER_H
 
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_mempool.h>
 
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 798ddebf3a..7ac5fe6ff1 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -29,7 +29,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 8604e43947..5966776a85 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -28,7 +28,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index cfe4280f87..d7f6e45b7d 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -18,7 +18,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_pool_ops.h>
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index b7d81b518c..07256ed7ec 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <fslmc_logs.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 071b0d297d..4aec7b2cd8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -30,7 +30,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index 223e34bcba..65e2d799c3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "private.h"
 #include <fslmc_logs.h>
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b5c7dee617..0f2f9b5101 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_compat.h>
 
 /** Pathname of PCI devices directory. */
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 39d702a418..d24cc201b8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -6,7 +6,7 @@
 
 #include <bus_driver.h>
 #include <rte_bus_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 36748cdfae..bc7e30d7c6 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -11,7 +11,7 @@ extern "C" {
 
 #include <rte_bus_vdev.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 809a8bb08f..b176b658fc 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -11,7 +11,7 @@
 #include <sys/queue.h>
 
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 2c72614776..2d10a1e8ad 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index 3424e791c9..e2475a642d 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <rte_bus_vmbus.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 struct vmbus_channel;
 struct vmbus_mon_page;
diff --git a/drivers/common/qat/dev/qat_dev_gen4.c b/drivers/common/qat/dev/qat_dev_gen4.c
index 7ffde5f4c8..85d6ddfcf4 100644
--- a/drivers/common/qat/dev/qat_dev_gen4.c
+++ b/drivers/common/qat/dev/qat_dev_gen4.c
@@ -2,7 +2,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "qat_device.h"
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 5916e745e2..9cbd19a481 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -4,7 +4,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_pci.h>
diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib/zlib_pmd_ops.c
index 7d657d81bc..445a3baa67 100644
--- a/drivers/compress/zlib/zlib_pmd_ops.c
+++ b/drivers/compress/zlib/zlib_pmd_ops.c
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c
index 61d457f4e0..d1ede5e990 100644
--- a/drivers/crypto/bcmfs/bcmfs_qp.c
+++ b/drivers/crypto/bcmfs/bcmfs_qp.c
@@ -8,7 +8,7 @@
 #include <rte_atomic.h>
 #include <rte_bitmap.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_prefetch.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
index bc7fb67218..78272d616c 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_pmd.c
@@ -4,7 +4,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <cryptodev_pmd.h>
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 6c3e45e333..013f3be1e6 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -9,7 +9,7 @@
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 
 #include "ccp_crypto.h"
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
index 3fd9f3c426..db11ac7444 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn10k_cryptodev.h"
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
index bd425f95ff..4cfc1f2150 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -7,7 +7,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 
 #include "cn9k_cryptodev.h"
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 0cce861899..3b13578de0 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <cryptodev_pmd.h>
 #include <rte_common.h>
 #include <bus_fslmc_driver.h>
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7e554cb2b1..c6bd785262 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -19,7 +19,7 @@
 #include <rte_security_driver.h>
 #endif
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
 #include <rte_kvargs.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 83ae6b6be9..11b559e025 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -5,7 +5,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
 #include <rte_reorder.h>
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index e30dcfc281..9b7b16c6e3 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -9,6 +9,7 @@
 #include <libgen.h>
 
 #include <bus_driver.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_eal.h>
 #include <rte_log.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 5a443acff8..759578378f 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -17,7 +17,7 @@
 #include <rte_config.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_eventdev.h>
 #include <eventdev_pmd.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 9f8c6cd8b8..71ac141b66 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -15,7 +15,7 @@
 
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_mbuf.h>
 #include <rte_ring.h>
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index aa403f9e06..8e470584ea 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 08df6e223a..1001297cda 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -14,7 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <bus_fslmc_driver.h>
 #include <rte_lcore.h>
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 3882a9cf1d..a68d3ac154 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -17,7 +17,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index fe157c59d5..99fa326ad5 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -7,7 +7,7 @@
 #include <rte_common.h>
 #include <cryptodev_pmd.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <ethdev_driver.h>
 #include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 6bd8fec6d4..8513b9a013 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -12,7 +12,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 2be7b8d2df..a552aabeb8 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -8,7 +8,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <gpudev_driver.h>
 
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 56c629c681..84371d5d1a 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -20,7 +20,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include "rte_dpaa2_mempool.h"
 
 #include "fslmc_vfio.h"
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fd7be47311..9957de2314 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -24,7 +24,7 @@
 #include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_lcore.h>
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 748db590c1..71d0b53e03 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_version.h>
 
 #include "ark_pktdir.h"
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7c0cb666fb..b2a08f5635 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_cycles.h>
 #include <rte_spinlock.h>
 #include <rte_byteorder.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_io.h>
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index b9ebf64fb8..a5d11c5832 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -33,7 +33,7 @@
 #include <rte_memzone.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_pci.h>
 #include <rte_common.h>
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f36ad30e17..4448cf2de2 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -9,7 +9,7 @@
 #include "bnx2x_rxtx.h"
 
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_alarm.h>
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53f..1460dce2ab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 77ecbef04c..fd1506ddd4 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -7,7 +7,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 384080e6d3..bed755f5d9 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -18,7 +18,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_byteorder.h>
 
 #include "common.h"
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index fd71a50a58..45bbeaef0c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -31,7 +31,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "cxgbe.h"
 #include "cxgbe_pfvf.h"
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3c02c98b3d..f8dd833032 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -31,7 +31,7 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "base/common.h"
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5d91355c9a..5b13cb5c94 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -30,7 +30,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 9509f6e8a3..4d33b51fea 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <dpaa2_pmd_logs.h>
 #include <dpaa2_hw_pvt.h>
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index f876f4790c..37a8b43114 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -15,7 +15,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 #include "rte_dpaa2_mempool.h"
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 932570c6e0..fbfdf360d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -14,7 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_fslmc_driver.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7b9c528d13..9436a95ac8 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -13,7 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hexdump.h>
 
 #include <bus_fslmc_driver.h>
diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c
index ba0d500f74..63463c4fbf 100644
--- a/drivers/net/dpaa2/dpaa2_sparser.c
+++ b/drivers/net/dpaa2/dpaa2_sparser.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <fslmc_logs.h>
 #include <fslmc_vfio.h>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 409de50083..8ee9be12ad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 43979992d3..d6bcc5bf58 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -22,7 +22,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "e1000_logs.h"
 #include "base/e1000_api.h"
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index e46697b6a1..b775310651 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -21,7 +21,7 @@
 #include <rte_eal.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
 
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 4709675af8..4d27fba585 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -14,7 +14,7 @@
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <rte_timer.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 
 #include "ena_com.h"
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 998436e5e8..cdf0915591 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_pci.h>
 #include <bus_pci_driver.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 7312c411bd..46f85964e9 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -7,7 +7,7 @@
 
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index a80f5e2caf..53a451c1b1 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -11,7 +11,7 @@
 #include <pthread.h>
 
 #include <rte_atomic.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <rte_devargs.h>
 #include <rte_flow.h>
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8bbd8b445d..7adb20bff9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -7,7 +7,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_spinlock.h>
 #include <rte_kvargs.h>
 #include <rte_vect.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7bdc453ec1..67111ac251 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -23,7 +23,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_alarm.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_tailq.h>
 #include <rte_hash_crc.h>
 #include <rte_bitmap.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..ef2ab06475 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,7 +24,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 21bd1e2193..15f695682d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,7 +19,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..1c3d22ae0f 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -21,7 +21,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "ice_dcf.h"
 #include "ice_rxtx.h"
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 0da267db1f..dee712af98 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -18,7 +18,7 @@
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <iavf_devids.h>
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 552e41692c..04c9ce78a2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..67373a7b78 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -27,7 +27,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_hash_crc.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 910b76a92c..7e7e1824ef 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ccc06bdda6..d0bbc0a4c0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -30,7 +30,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_driver.h>
 #include <bus_vmbus_driver.h>
 #include <rte_alarm.h>
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 817fb06dfb..7db82af9f3 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -28,7 +28,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index 20f75a17b0..e6f1f28768 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -26,7 +26,7 @@
 #include <rte_cycles.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <bus_vmbus_driver.h>
 
 #include "hn_logs.h"
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 61cf374224..bc6f60c64a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -25,7 +25,7 @@
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_net.h>
 #include <bus_vmbus_driver.h>
 #include <rte_spinlock.h>
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c792..eaafe11fb9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -19,7 +19,7 @@
 #include <rte_debug.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e588..47359501bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_common.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ether.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 9ada22e2ff..0eee191566 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -15,7 +15,7 @@
 #include <bus_vdev_driver.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index a38b701183..b781bcdcfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -13,7 +13,7 @@
 #include <rte_ether.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_ip.h>
 
 /* ecore includes */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 506c62a726..2ec743ebce 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -7,7 +7,7 @@
  * for Solarflare) and Solarflare Communications, Inc.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_pci.h>
diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 81f5aa3cc4..3ae5023b6f 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2021 Xilinx, Inc.
  */
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_bitmap.h>
 
 #include "sfc.h"
diff --git a/drivers/net/sfc/sfc_sw_stats.h b/drivers/net/sfc/sfc_sw_stats.h
index 1abded8018..d9738e5214 100644
--- a/drivers/net/sfc/sfc_sw_stats.h
+++ b/drivers/net/sfc/sfc_sw_stats.h
@@ -5,7 +5,7 @@
 #ifndef _SFC_SW_STATS_H
 #define _SFC_SW_STATS_H
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "sfc.h"
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 28183ec740..9f57cb1a20 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -20,7 +20,7 @@
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <ethdev_driver.h>
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index dc90569df1..c3e045d892 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -27,7 +27,7 @@
 #include <bus_driver.h>
 #include <bus_vdev_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d180162abd..edf3becd32 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -24,7 +24,7 @@
 #include <rte_memory.h>
 #include <rte_eal_paging.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
 
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 2b9e35cef5..abc63b0935 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -16,7 +16,7 @@
 
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_kvargs.h>
 
 #include "virtio.h"
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 101b1cb500..fd946dec5c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -30,7 +30,7 @@
 #include <ethdev_pci.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "base/vmxnet3_defs.h"
 
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index db029cbf34..909fb8faab 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -3,7 +3,7 @@
  */
 #include <bus_pci_driver.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 6831cc8d20..5dd5bbb652 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -13,7 +13,7 @@
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index fc257c5f44..8ef7a6b127 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -6,7 +6,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_rawdev.h>
 #include <bus_vdev_driver.h>
 #include <rte_test.h>
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 6ab62a12fc..92cf5f495e 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -11,7 +11,7 @@
 #include <rte_regexdev.h>
 #include <rte_regexdev_core.h>
 #include <rte_regexdev_driver.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include <mlx5_common.h>
 #include <mlx5_glue.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index e997bd01ed..cf2c20a704 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -8,7 +8,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
 
diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c
index 9bfae077db..41f1415bea 100644
--- a/lib/compressdev/rte_compressdev_pmd.c
+++ b/lib/compressdev/rte_compressdev_pmd.c
@@ -5,7 +5,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_eal.h>
 
 #include "rte_compressdev_internal.h"
diff --git a/lib/compressdev/rte_compressdev_pmd.h b/lib/compressdev/rte_compressdev_pmd.h
index 9fabc399c5..72e52f876f 100644
--- a/lib/compressdev/rte_compressdev_pmd.h
+++ b/lib/compressdev/rte_compressdev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 
 #include "rte_compressdev.h"
 #include "rte_compressdev_internal.h"
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 75d0075b86..f07b92dfd7 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -4,7 +4,7 @@
 
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..96d7e225b0 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include <string.h>
 
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 6250302f3b..29c9c55131 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -13,7 +13,7 @@
 
 #include <rte_log.h>
 #include <rte_debug.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index 82ab7a8cc7..acd7f71cd1 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -14,7 +14,7 @@
  * by any application.
  */
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_dmadev.h"
 
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 16c5aef1d8..98f3c78795 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -9,7 +9,7 @@
 
 #include <bus_driver.h>
 #include <rte_class.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_devargs.h>
 #include <rte_errno.h>
 #include <rte_log.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
new file mode 100644
index 0000000000..015188abd5
--- /dev/null
+++ b/lib/eal/include/dev_driver.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2022 Red Hat, Inc.
+ */
+
+#ifndef DEV_DRIVER_H
+#define DEV_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include <rte_dev.h>
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+	const char *name;                   /**< Driver name. */
+	const char *alias;              /**< Driver alias. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEV_DRIVER_H */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index 77d8621a51..cfcd40aaed 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -57,6 +57,7 @@ headers += files(
 
 driver_sdk_headers = files(
         'bus_driver.h',
+        'dev_driver.h',
 )
 
 # special case install the generic headers, since they go in a subdir
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ddea163cca..7214f5d7fb 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,8 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_driver;
+
 /**
  * The device event type.
  */
@@ -67,27 +69,14 @@ struct rte_mem_resource {
 	void *addr;         /**< Virtual address, NULL when not mapped. */
 };
 
-/**
- * A structure describing a device driver.
- */
-struct rte_driver {
-	RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
-	const char *name;                   /**< Driver name. */
-	const char *alias;              /**< Driver alias. */
-};
-
 /**
  * Retrieve a driver name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param driver
  *   A pointer to a driver structure.
  * @return
  *   A pointer to the driver name string.
  */
-__rte_experimental
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
diff --git a/lib/eal/version.map b/lib/eal/version.map
index d10fd89458..8b53a1d258 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -37,6 +37,7 @@ DPDK_23 {
 	rte_devargs_parsef;
 	rte_devargs_remove;
 	rte_devargs_type_count;
+	rte_driver_name;
 	rte_dump_physmem_layout;
 	rte_dump_stack;
 	rte_dump_tailq;
@@ -423,9 +424,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_driver_name;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 5101868ea7..47a55a419e 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -19,6 +19,7 @@ extern "C" {
  *
  */
 
+#include <dev_driver.h>
 #include <rte_ethdev.h>
 
 /**
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 69402668d8..def6cd0876 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -22,7 +22,7 @@ extern "C" {
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 4938b4ee07..a8ef5bac06 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_cryptodev.h>
 #include <cryptodev_pmd.h>
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 8e81cf774d..29515401bd 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -9,7 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_common.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
 #include <rte_log.h>
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 79b905e9fc..bbb027aa0c 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 0e55b00bfe..23972b3dbd 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_gpudev.h"
 
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index ac32c4bb72..3b43edc548 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -9,7 +9,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 
 #include "rte_mempool_trace.h"
 
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 72aabd4dd0..af2b814251 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -14,7 +14,7 @@
 #include <bus_driver.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index e157d65332..569e836560 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -12,7 +12,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_telemetry.h>
diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 3b7be57d3e..a51944c8ff 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -19,7 +19,7 @@ extern "C" {
 
 #include <string.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 1a2a408f0e..94160f4177 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -5,7 +5,7 @@
  */
 
 #include <rte_cryptodev.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_telemetry.h>
 #include "rte_security.h"
 #include "rte_security_driver.h"
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 24/27] dev: introduce device accessors
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (22 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 23/27] dev: hide driver object David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 25/27] dev: provide bus specific information David Marchand
                     ` (3 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Maryam Tahhan, Reshma Pattan,
	Aman Singh, Yuying Zhang, Maxime Coquelin, Chenbo Xia,
	Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

Prepare for making the device object opaque by adding accessors.
Update existing "external" users.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v4:
- updated test_vdev.c,

Changes since RFC v2:
- added rte_dev_devargs,
- updated testpmd,

---
 app/proc-info/main.c               |  6 +--
 app/test-pmd/config.c              | 18 +++----
 app/test-pmd/testpmd.c             |  6 +--
 app/test/test_vdev.c               |  4 +-
 examples/ethtool/lib/rte_ethtool.c |  2 +-
 examples/l3fwd/l3fwd_em.c          |  4 +-
 examples/l3fwd/l3fwd_fib.c         |  8 +--
 examples/l3fwd/l3fwd_lpm.c         |  4 +-
 examples/vdpa/main.c               | 16 +++---
 lib/eal/common/eal_common_dev.c    | 30 ++++++++++++
 lib/eal/include/rte_dev.h          | 78 ++++++++++++++++++++++++++++++
 lib/eal/version.map                |  7 +++
 lib/ethdev/rte_ethdev.h            |  2 +-
 13 files changed, 150 insertions(+), 35 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 1bfba5f60d..d52ac8a038 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -755,7 +755,7 @@ show_port(void)
 		}
 
 		printf("\t  -- driver %s device %s socket %d\n",
-		       dev_info.driver_name, dev_info.device->name,
+		       dev_info.driver_name, rte_dev_name(dev_info.device),
 		       rte_eth_dev_socket_id(i));
 
 		ret = rte_eth_dev_owner_get(i, &owner);
@@ -1254,7 +1254,7 @@ show_crypto(void)
 		       rte_cryptodev_name_get(i),
 		       dev_info.driver_name,
 		       dev_info.driver_id,
-		       dev_info.device->numa_node,
+		       rte_dev_numa_node(dev_info.device),
 		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
@@ -1466,7 +1466,7 @@ dump_regs(char *file_prefix)
 			else
 				printf("Device (%s) regs dumped successfully, "
 					"driver:%s version:0X%08X\n",
-					dev_info.device->name,
+					rte_dev_name(dev_info.device),
 					dev_info.driver_name, reg_info.version);
 
 			fclose(fp_regs);
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 6510f29c76..de74690f06 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -645,19 +645,19 @@ device_infos_display(const char *identifier)
 		snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next));
 		RTE_DEV_FOREACH(dev, devstr, &dev_iter) {
 
-			if (!dev->driver)
+			if (rte_dev_driver(dev) == NULL)
 				continue;
 			/* Check for matching device if identifier is present */
 			if (identifier &&
-			    strncmp(da.name, dev->name, strlen(dev->name)))
+			    strncmp(da.name, rte_dev_name(dev), strlen(rte_dev_name(dev))))
 				continue;
 			printf("\n%s Infos for device %s %s\n",
-			       info_border, dev->name, info_border);
-			printf("Bus name: %s", rte_bus_name(dev->bus));
-			printf("\nDriver name: %s", rte_driver_name(dev->driver));
+			       info_border, rte_dev_name(dev), info_border);
+			printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev)));
+			printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev)));
 			printf("\nDevargs: %s",
-			       dev->devargs ? dev->devargs->args : "");
-			printf("\nConnect to socket: %d", dev->numa_node);
+			       rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : "");
+			printf("\nConnect to socket: %d", rte_dev_numa_node(dev));
 			printf("\n");
 
 			/* List ports with matching device name */
@@ -802,8 +802,8 @@ port_infos_display(portid_t port_id)
 	else
 		printf("\nFirmware-version: %s", "not available");
 
-	if (dev_info.device->devargs && dev_info.device->devargs->args)
-		printf("\nDevargs: %s", dev_info.device->devargs->args);
+	if (rte_dev_devargs(dev_info.device) && rte_dev_devargs(dev_info.device)->args)
+		printf("\nDevargs: %s", rte_dev_devargs(dev_info.device)->args);
 	printf("\nConnect to socket: %u", port->socket_id);
 
 	if (port_numa[port_id] != NUMA_NO_CONFIG) {
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c7d1fa2719..a399193e53 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1057,7 +1057,7 @@ dma_unmap_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
 			TESTPMD_LOG(DEBUG,
 				    "unable to DMA unmap addr 0x%p "
 				    "for device %s\n",
-				    memhdr->addr, dev_info.device->name);
+				    memhdr->addr, rte_dev_name(dev_info.device));
 		}
 	}
 	ret = rte_extmem_unregister(memhdr->addr, memhdr->len);
@@ -1098,7 +1098,7 @@ dma_map_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
 			TESTPMD_LOG(DEBUG,
 				    "unable to DMA map addr 0x%p "
 				    "for device %s\n",
-				    memhdr->addr, dev_info.device->name);
+				    memhdr->addr, rte_dev_name(dev_info.device));
 		}
 	}
 }
@@ -3441,7 +3441,7 @@ detach_device(struct rte_device *dev)
 	}
 
 	if (rte_dev_remove(dev) < 0) {
-		TESTPMD_LOG(ERR, "Failed to detach device %s\n", dev->name);
+		TESTPMD_LOG(ERR, "Failed to detach device %s\n", rte_dev_name(dev));
 		return;
 	}
 	remove_invalid_ports();
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index 1904e76e44..9f0e6c4b99 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -23,7 +23,7 @@ static const char * const valid_keys[] = {
 static int
 cmp_dev_name(const struct rte_device *dev, const void *name)
 {
-	return strcmp(dev->name, name);
+	return strcmp(rte_dev_name(dev), name);
 }
 
 static int
@@ -39,7 +39,7 @@ cmp_dev_match(const struct rte_device *dev, const void *_kvlist)
 
 	/* if key is present in kvlist and does not match, filter device */
 	name = rte_kvargs_get(kvlist, key);
-	if (name != NULL && strcmp(name, dev->name))
+	if (name != NULL && strcmp(name, rte_dev_name(dev)) != 0)
 		return -1;
 
 	return 0;
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 88dc917b73..33acc5e3cc 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -49,7 +49,7 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
 	strlcpy(drvinfo->driver, dev_info.driver_name,
 		sizeof(drvinfo->driver));
 	strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
-	strlcpy(drvinfo->bus_info, dev_info.device->name,
+	strlcpy(drvinfo->bus_info, rte_dev_name(dev_info.device),
 		sizeof(drvinfo->bus_info));
 
 	memset(&reg_info, 0, sizeof(reg_info));
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index 10be24c61d..0531282a1f 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -403,7 +403,7 @@ populate_ipv4_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v4[i].v4_key.port_dst,
 			   em_route_base_v4[i].v4_key.port_src,
 			   em_route_base_v4[i].v4_key.proto,
-		       em_route_base_v4[i].if_out, dev_info.device->name);
+		       em_route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 " keys\n",
 		(uint64_t)route_num_v4);
@@ -455,7 +455,7 @@ populate_ipv6_flow_into_table(const struct rte_hash *h)
 			   em_route_base_v6[i].v6_key.port_dst,
 			   em_route_base_v6[i].v6_key.port_src,
 			   em_route_base_v6[i].v6_key.proto,
-		       em_route_base_v6[i].if_out, dev_info.device->name);
+		       em_route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 	printf("Hash: Adding 0x%" PRIx64 "keys\n",
 		(uint64_t)route_num_v6);
diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index e02e4b3f5a..b82e0c0354 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -640,11 +640,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v4[i].depth,
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv4 route added to port %d [%s]\n",
 			       route_base_v4[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 	/* >8 End of setup fib. */
@@ -695,11 +695,11 @@ setup_fib(const int socketid)
 			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
 			       route_base_v6[i].depth,
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		} else {
 			printf("FIB: IPv6 route added to port %d [%s]\n",
 			       route_base_v6[i].if_out,
-			       dev_info.device->name);
+			       rte_dev_name(dev_info.device));
 		}
 	}
 }
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index d1b850dd5b..22d7f61a42 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -598,7 +598,7 @@ setup_lpm(const int socketid)
 		printf("LPM: Adding route %s / %d (%d) [%s]\n",
 		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 		       route_base_v4[i].depth,
-		       route_base_v4[i].if_out, dev_info.device->name);
+		       route_base_v4[i].if_out, rte_dev_name(dev_info.device));
 	}
 
 	/* create the LPM6 table */
@@ -642,7 +642,7 @@ setup_lpm(const int socketid)
 		       inet_ntop(AF_INET6, route_base_v6[i].ip_8, abuf,
 				 sizeof(abuf)),
 		       route_base_v6[i].depth,
-		       route_base_v6[i].if_out, dev_info.device->name);
+		       route_base_v6[i].if_out, rte_dev_name(dev_info.device));
 	}
 }
 
diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 7e11ef4e26..ee240dd15a 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -119,7 +119,7 @@ new_device(int vid)
 				"Failed to get generic device for port %d\n", i);
 			continue;
 		}
-		printf("\nnew port %s, device : %s\n", ifname, dev->name);
+		printf("\nnew port %s, device : %s\n", ifname, rte_dev_name(dev));
 		vports[i].vid = vid;
 		break;
 	}
@@ -149,7 +149,7 @@ destroy_device(int vid)
 			continue;
 		}
 
-		printf("\ndestroy port %s, device: %s\n", ifname, dev->name);
+		printf("\ndestroy port %s, device: %s\n", ifname, rte_dev_name(dev));
 		break;
 	}
 }
@@ -353,23 +353,23 @@ static void cmd_list_vdpa_devices_parsed(
 
 	cmdline_printf(cl, "device name\tqueue num\tsupported features\n");
 	RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-		vdev = rte_vdpa_find_device_by_name(dev->name);
+		vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 		if (!vdev)
 			continue;
 		if (rte_vdpa_get_queue_num(vdev, &queue_num) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa queue number "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		if (rte_vdpa_get_features(vdev, &features) < 0) {
 			RTE_LOG(ERR, VDPA,
 				"failed to get vdpa features "
-				"for device %s.\n", dev->name);
+				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
 		cmdline_printf(cl, "%s\t\t%" PRIu32 "\t\t0x%" PRIx64 "\n",
-			dev->name, queue_num, features);
+			rte_dev_name(dev), queue_num, features);
 	}
 }
 
@@ -606,10 +606,10 @@ main(int argc, char *argv[])
 		cmdline_stdin_exit(cl);
 	} else {
 		RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
-			vdev = rte_vdpa_find_device_by_name(dev->name);
+			vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 			if (vdev == NULL) {
 				rte_panic("Failed to find vDPA dev for %s\n",
-						dev->name);
+						rte_dev_name(dev));
 			}
 			vports[devcnt].dev = vdev;
 			snprintf(vports[devcnt].ifname, MAX_PATH_LEN, "%s%d",
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 98f3c78795..7b12d6e531 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -25,6 +25,36 @@ rte_driver_name(const struct rte_driver *driver)
 	return driver->name;
 }
 
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev)
+{
+	return dev->bus;
+}
+
+const struct rte_devargs *
+rte_dev_devargs(const struct rte_device *dev)
+{
+	return dev->devargs;
+}
+
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev)
+{
+	return dev->driver;
+}
+
+const char *
+rte_dev_name(const struct rte_device *dev)
+{
+	return dev->name;
+}
+
+int
+rte_dev_numa_node(const struct rte_device *dev)
+{
+	return dev->numa_node;
+}
+
 /**
  * The device event callback description.
  *
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 7214f5d7fb..ce97ee1086 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -24,6 +24,9 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_log.h>
 
+struct rte_bus;
+struct rte_devargs;
+struct rte_device;
 struct rte_driver;
 
 /**
@@ -80,6 +83,81 @@ struct rte_mem_resource {
 const char *
 rte_driver_name(const struct rte_driver *driver);
 
+/**
+ * Retrieve a device bus.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device bus.
+ */
+__rte_experimental
+const struct rte_bus *
+rte_dev_bus(const struct rte_device *dev);
+
+/**
+ * Retrieve a device arguments.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device devargs.
+ */
+__rte_experimental
+const struct rte_devargs *
+rte_dev_devargs(const struct rte_device *dev);
+
+/**
+ * Retrieve a device driver.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device driver.
+ */
+__rte_experimental
+const struct rte_driver *
+rte_dev_driver(const struct rte_device *dev);
+
+/**
+ * Retrieve a device name.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device name.
+ */
+__rte_experimental
+const char *
+rte_dev_name(const struct rte_device *dev);
+
+/**
+ * Retrieve a device numa node.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A pointer to this device numa node.
+ */
+__rte_experimental
+int
+rte_dev_numa_node(const struct rte_device *dev);
+
 /*
  * Internal identifier length
  * Sufficiently large to allow for UUID or PCI address
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 8b53a1d258..719789b8d1 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -424,6 +424,13 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	# added in 22.11
+	rte_dev_bus;
+	rte_dev_devargs;
+	rte_dev_driver;
+	rte_dev_name;
+	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 7556b94602..2e783536c1 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
  * exists for the device and the rte_eth_dev 'dev' has been populated
  * successfully with a call to it:
  *
- * driver_name = rte_driver_name(dev->device->driver)
+ * driver_name = rte_driver_name(rte_dev_driver(dev->device));
  * nb_rx_queues = dev->data->nb_rx_queues
  * nb_tx_queues = dev->data->nb_tx_queues
  * dev_flags = &dev->data->dev_flags
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 25/27] dev: provide bus specific information
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (23 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 24/27] dev: introduce device accessors David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 26/27] bus/pci: fill " David Marchand
                     ` (2 subsequent siblings)
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aman Singh, Yuying Zhang, Ray Kinsella

For diagnostic, it may be useful to provide a description of the device
with bus specific information.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v3:
- split patch in two, as per Thomas offlist request,

---
 app/test-pmd/config.c           |  2 ++
 lib/eal/common/eal_common_dev.c |  6 ++++++
 lib/eal/include/rte_dev.h       | 16 ++++++++++++++++
 lib/eal/version.map             |  1 +
 4 files changed, 25 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index de74690f06..c5e5a66fa4 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -654,6 +654,8 @@ device_infos_display(const char *identifier)
 			printf("\n%s Infos for device %s %s\n",
 			       info_border, rte_dev_name(dev), info_border);
 			printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev)));
+			printf("\nBus information: %s",
+				rte_dev_bus_info(dev) ? rte_dev_bus_info(dev) : "");
 			printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev)));
 			printf("\nDevargs: %s",
 			       rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : "");
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 7b12d6e531..a190bd37af 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -31,6 +31,12 @@ rte_dev_bus(const struct rte_device *dev)
 	return dev->bus;
 }
 
+const char *
+rte_dev_bus_info(const struct rte_device *dev)
+{
+	return dev->bus_info;
+}
+
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev)
 {
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index ce97ee1086..f010dd6441 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -98,6 +98,21 @@ __rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
+/**
+ * Retrieve bus specific information for a device.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @param dev
+ *   A pointer to a device structure.
+ * @return
+ *   A string describing this device or NULL if none is available.
+ */
+__rte_experimental
+const char *
+rte_dev_bus_info(const struct rte_device *dev);
+
 /**
  * Retrieve a device arguments.
  *
@@ -170,6 +185,7 @@ rte_dev_numa_node(const struct rte_device *dev);
 struct rte_device {
 	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
 	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
 	const struct rte_driver *driver; /**< Driver assigned after probing */
 	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
 	int numa_node;                /**< NUMA node connection */
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 719789b8d1..0cf321605e 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -427,6 +427,7 @@ EXPERIMENTAL {
 
 	# added in 22.11
 	rte_dev_bus;
+	rte_dev_bus_info;
 	rte_dev_devargs;
 	rte_dev_driver;
 	rte_dev_name;
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 26/27] bus/pci: fill bus specific information
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (24 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 25/27] dev: provide bus specific information David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-14  7:58   ` [PATCH v6 27/27] dev: hide device object David Marchand
  2022-09-24  7:14   ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

For diagnostic, it may be useful to provide the PCI vendor and device
id.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v5:
- fixed Windows build issue (bis...),

Changes since v4:
- fixed Windows build issue (missing asprintf implementation),

---
 drivers/bus/pci/bsd/pci.c        |  8 +++---
 drivers/bus/pci/bus_pci_driver.h |  1 +
 drivers/bus/pci/linux/pci.c      | 24 ++++++++--------
 drivers/bus/pci/pci_common.c     | 49 ++++++++++++++++++++++++++++++--
 drivers/bus/pci/private.h        | 10 +++++--
 drivers/bus/pci/windows/pci.c    |  6 ++--
 6 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index bc560a2a56..844d145fed 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -248,7 +248,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	/* FreeBSD has no NUMA support (yet) */
 	dev->device.numa_node = 0;
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	/* FreeBSD has only one pass through driver */
 	dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
@@ -299,11 +299,11 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 			} else { /* already registered */
 				dev2->kdrv = dev->kdrv;
 				dev2->max_vfs = dev->max_vfs;
-				pci_name_set(dev2);
+				pci_common_set(dev2);
 				memmove(dev2->mem_resource,
 					dev->mem_resource,
 					sizeof(dev->mem_resource));
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
@@ -313,7 +313,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	return 0;
 
 skipdev:
-	free(dev);
+	pci_free(dev);
 	return 0;
 }
 
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index 0f2f9b5101..be32263a82 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -43,6 +43,7 @@ struct rte_pci_device {
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
 	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	char *bus_info;                     /**< PCI bus specific info */
 	struct rte_intr_handle *vfio_req_intr_handle;
 				/**< Handler of VFIO request interrupt */
 };
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index fa5d5e131d..c8703d52f3 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -226,7 +226,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* get vendor id */
 	snprintf(filename, sizeof(filename), "%s/vendor", dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.vendor_id = (uint16_t)tmp;
@@ -234,7 +234,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* get device id */
 	snprintf(filename, sizeof(filename), "%s/device", dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.device_id = (uint16_t)tmp;
@@ -243,7 +243,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/subsystem_vendor",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.subsystem_vendor_id = (uint16_t)tmp;
@@ -252,7 +252,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/subsystem_device",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	dev->id.subsystem_device_id = (uint16_t)tmp;
@@ -261,7 +261,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/class",
 		 dirname);
 	if (eal_parse_sysfs_value(filename, &tmp) < 0) {
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 	/* the least 24 bits are valid: class, subclass, program interface */
@@ -295,13 +295,13 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		dev->device.numa_node = 0;
 	}
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	/* parse resources */
 	snprintf(filename, sizeof(filename), "%s/resource", dirname);
 	if (pci_parse_sysfs_resource(filename, dev) < 0) {
 		RTE_LOG(ERR, EAL, "%s(): cannot parse resource\n", __func__);
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 
@@ -310,7 +310,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	ret = pci_get_kernel_driver_by_path(filename, driver, sizeof(driver));
 	if (ret < 0) {
 		RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");
-		free(dev);
+		pci_free(dev);
 		return -1;
 	}
 
@@ -324,7 +324,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		else
 			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
-		free(dev);
+		pci_free(dev);
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
@@ -346,7 +346,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 					dev2->kdrv = dev->kdrv;
 					dev2->max_vfs = dev->max_vfs;
 					dev2->id = dev->id;
-					pci_name_set(dev2);
+					pci_common_set(dev2);
 					memmove(dev2->mem_resource,
 						dev->mem_resource,
 						sizeof(dev->mem_resource));
@@ -376,10 +376,10 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 					else if (dev2->device.devargs !=
 						 dev->device.devargs) {
 						rte_devargs_remove(dev2->device.devargs);
-						pci_name_set(dev2);
+						pci_common_set(dev2);
 					}
 				}
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index c26aacd364..5ea72bcf23 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -44,6 +44,38 @@ const char *rte_pci_get_sysfs_path(void)
 	return path;
 }
 
+#ifdef RTE_EXEC_ENV_WINDOWS
+#define asprintf pci_asprintf
+
+static int
+__rte_format_printf(2, 3)
+pci_asprintf(char **buffer, const char *format, ...)
+{
+	int size, ret;
+	va_list arg;
+
+	va_start(arg, format);
+	size = vsnprintf(NULL, 0, format, arg);
+	va_end(arg);
+	if (size < 0)
+		return -1;
+	size++;
+
+	*buffer = malloc(size);
+	if (*buffer == NULL)
+		return -1;
+
+	va_start(arg, format);
+	ret = vsnprintf(*buffer, size, format, arg);
+	va_end(arg);
+	if (ret != size - 1) {
+		free(*buffer);
+		return -1;
+	}
+	return ret;
+}
+#endif /* RTE_EXEC_ENV_WINDOWS */
+
 static struct rte_devargs *
 pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
 {
@@ -59,7 +91,7 @@ pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
 }
 
 void
-pci_name_set(struct rte_pci_device *dev)
+pci_common_set(struct rte_pci_device *dev)
 {
 	struct rte_devargs *devargs;
 
@@ -80,6 +112,19 @@ pci_name_set(struct rte_pci_device *dev)
 	else
 		/* Otherwise, it uses the internal, canonical form. */
 		dev->device.name = dev->name;
+
+	if (asprintf(&dev->bus_info, "vendor_id=%"PRIx16", device_id=%"PRIx16,
+			dev->id.vendor_id, dev->id.device_id) != -1)
+		dev->device.bus_info = dev->bus_info;
+}
+
+void
+pci_free(struct rte_pci_device *dev)
+{
+	if (dev == NULL)
+		return;
+	free(dev->bus_info);
+	free(dev);
 }
 
 /* map a particular resource from a file */
@@ -604,7 +649,7 @@ pci_unplug(struct rte_device *dev)
 	if (ret == 0) {
 		rte_pci_remove_device(pdev);
 		rte_devargs_remove(dev->devargs);
-		free(pdev);
+		pci_free(pdev);
 	}
 	return ret;
 }
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index fddf49251d..c8161a1074 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -44,10 +44,16 @@ struct rte_pci_device;
 int rte_pci_scan(void);
 
 /**
- * Find the name of a PCI device.
+ * Set common internal information for a PCI device.
  */
 void
-pci_name_set(struct rte_pci_device *dev);
+pci_common_set(struct rte_pci_device *dev);
+
+/**
+ * Free a PCI device.
+ */
+void
+pci_free(struct rte_pci_device *dev);
 
 /**
  * Validate whether a device with given PCI address should be ignored or not.
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index f013b743b3..3f7a8b9432 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -382,7 +382,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 	dev->id = pci_id;
 	dev->max_vfs = 0; /* TODO: get max_vfs */
 
-	pci_name_set(dev);
+	pci_common_set(dev);
 
 	set_kernel_driver_type(device_info_data, dev);
 
@@ -410,7 +410,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 				dev2->max_vfs = dev->max_vfs;
 				memmove(dev2->mem_resource, dev->mem_resource,
 					sizeof(dev->mem_resource));
-				free(dev);
+				pci_free(dev);
 			}
 			return 0;
 		}
@@ -419,7 +419,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 
 	return 0;
 end:
-	free(dev);
+	pci_free(dev);
 	return ret;
 }
 
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* [PATCH v6 27/27] dev: hide device object
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (25 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 26/27] bus/pci: fill " David Marchand
@ 2022-09-14  7:58   ` David Marchand
  2022-09-24  7:14   ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-14  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Ray Kinsella, Maxime Coquelin, Chenbo Xia

Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Some applications may have been dereferencing rte_device objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/deprecation.rst   |  7 -----
 doc/guides/rel_notes/release_22_11.rst |  4 +--
 lib/eal/common/eal_private.h           |  2 +-
 lib/eal/include/dev_driver.h           | 13 +++++++++
 lib/eal/include/rte_dev.h              | 37 --------------------------
 lib/eal/version.map                    | 14 +++++-----
 lib/vhost/vdpa.c                       |  1 +
 7 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 98a00da385..64668500c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,13 +47,6 @@ Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* drivers: As a follow-up of the work on the ``rte_bus`` object,
-  the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
-  their bus-specific counterparts) will be made opaque in DPDK 22.11.
-  Registering a driver on a bus will be marked as an internal API:
-  external users may still register their drivers using the bus-specific
-  driver header (see ``enable_driver_sdk`` meson option).
-
 * bus: The ``dev->device.numa_node`` field is set by each bus driver for
   every device it manages to indicate on which NUMA node this device lies.
   When this information is unknown, the assigned value is not consistent
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 4e20345b7a..43502349bd 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,8 +98,8 @@ API Changes
   ``vdev``, ``vmbus`` 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).
-  The ``rte_driver`` object is now opaque and must be manipulated through added
-  accessors.
+  The ``rte_driver`` and ``rte_device`` objects are now opaque and must be
+  manipulated through added accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..5efa8c437e 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -21,6 +21,19 @@ struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index f010dd6441..dc1acc8953 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -86,90 +86,66 @@ rte_driver_name(const struct rte_driver *driver);
 /**
  * Retrieve a device bus.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device bus.
  */
-__rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
 /**
  * Retrieve bus specific information for a device.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A string describing this device or NULL if none is available.
  */
-__rte_experimental
 const char *
 rte_dev_bus_info(const struct rte_device *dev);
 
 /**
  * Retrieve a device arguments.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device devargs.
  */
-__rte_experimental
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev);
 
 /**
  * Retrieve a device driver.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device driver.
  */
-__rte_experimental
 const struct rte_driver *
 rte_dev_driver(const struct rte_device *dev);
 
 /**
  * Retrieve a device name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device name.
  */
-__rte_experimental
 const char *
 rte_dev_name(const struct rte_device *dev);
 
 /**
  * Retrieve a device numa node.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device numa node.
  */
-__rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
@@ -179,19 +155,6 @@ rte_dev_numa_node(const struct rte_device *dev);
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const char *bus_info;         /**< Device bus specific information */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 0cf321605e..3c14cf2724 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -26,7 +26,13 @@ DPDK_23 {
 	rte_delay_us_block;
 	rte_delay_us_callback_register;
 	rte_delay_us_sleep;
+	rte_dev_bus;
+	rte_dev_bus_info;
+	rte_dev_devargs;
+	rte_dev_driver;
 	rte_dev_is_probed;
+	rte_dev_name;
+	rte_dev_numa_node;
 	rte_dev_probe;
 	rte_dev_remove;
 	rte_devargs_add;
@@ -424,14 +430,6 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_dev_bus;
-	rte_dev_bus_info;
-	rte_dev_devargs;
-	rte_dev_driver;
-	rte_dev_name;
-	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index a6ca785b29..bb828577cb 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>
-- 
2.37.3


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-08-30 15:09         ` David Marchand
@ 2022-09-21 22:29           ` Harris, James R
  2022-09-23  7:13             ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Harris, James R @ 2022-09-21 22:29 UTC (permalink / raw)
  To: David Marchand
  Cc: Walker, Benjamin, dev, Liu, Changpeng, Alexey Marchuk,
	Shuhei Matsumoto, Thomas Monjalon, Richardson, Bruce,
	Stephen Hemminger



> On Aug 30, 2022, at 8:09 AM, David Marchand <david.marchand@redhat.com> wrote:
> 
> On Mon, Aug 29, 2022 at 7:12 PM Walker, Benjamin
> <benjamin.walker@intel.com> wrote:
>>>> Can we keep rte_pci_register(), or a new variation of it that keeps
>>>> the rte_pci_driver structure hidden?  Hiding rte_pci_register() would
>>>> mean SPDK can no longer work with a packaged DPDK.  Or the DPDK
>>>> packages would need to set enable_driver_sdk which I suspect is not the
>>> intent.
>>> 
>>> What do you think if SPDK maintains a copy of the internal headers?
>>> 
>>> The internal API are not supposed to change that often, but we (DPDK) won't
>>> guarantee it.
>>> This would still put some maintenance burden on SPDK but I think it is a good
>>> compromise.
>>> 
>> 
>> Would these internal symbols be considered part of the public/official ABI? When
> 
> What do you mean by "public/official"?
> If you mean the "stable" ABI (as described in the ABI policy document
> and for which compatibility is preserved across minor versions of the
> ABI), the answer is no: internal symbols are not part of it.
> 
> 
>> SPDK goes to dynamically load a shared DPDK library, how can we detect
>> whether it's a version that we support linking against?
> 
> The runtime version of a DPDK library is available via rte_version().
> 
> 
> As for the PCI drivers that SPDK wants to register in DPDK, what do
> you think if SPDK people added and maintained a "generic" PCI driver
> in DPDK.
> This driver would expose a new API (which can not re-expose internal
> structures, like rte_pci_driver and consorts) and ensure its ABI is
> maintained in the long term.
> This makes me think of pci-stub, but in DPDK.
> 
> I did not think too much about it and I don't understand what SPDK
> requires, but is there something wrong with this approach?

The stub driver idea is interesting. In the past we’ve needed access to more
than what a stub driver would provide - for example, to work around kernel
vfio + pci bugs when we probe 24 NVMe SSDs behind a PCIe switch that is
hot-inserted, or conversely handling hot removal of that same switch.  So
I’m worried that even if we do the stub driver, we end up running into a
case where we need these header file copies anyways.  Not ruling the stub
driver out, but I think it's a longer-term goal, not something we would have
ready for 22.11 obviously. 

So sticking with the internal header copies for now, this works fine
for LTS and non-LTS releases.  What about stable releases (i.e. 22.11.1)?
IIUC, these header files could change in a stable release since they are
no longer part of the ABI?

-Jim



^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-09-21 22:29           ` Harris, James R
@ 2022-09-23  7:13             ` David Marchand
  2022-09-23 21:56               ` Harris, James R
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-09-23  7:13 UTC (permalink / raw)
  To: Harris, James R
  Cc: Walker, Benjamin, dev, Liu, Changpeng, Alexey Marchuk,
	Shuhei Matsumoto, Thomas Monjalon, Richardson, Bruce,
	Stephen Hemminger

On Thu, Sep 22, 2022 at 12:29 AM Harris, James R
<james.r.harris@intel.com> wrote:
> > On Aug 30, 2022, at 8:09 AM, David Marchand <david.marchand@redhat.com> wrote:
> >
> > On Mon, Aug 29, 2022 at 7:12 PM Walker, Benjamin
> > <benjamin.walker@intel.com> wrote:
> >>>> Can we keep rte_pci_register(), or a new variation of it that keeps
> >>>> the rte_pci_driver structure hidden?  Hiding rte_pci_register() would
> >>>> mean SPDK can no longer work with a packaged DPDK.  Or the DPDK
> >>>> packages would need to set enable_driver_sdk which I suspect is not the
> >>> intent.
> >>>
> >>> What do you think if SPDK maintains a copy of the internal headers?
> >>>
> >>> The internal API are not supposed to change that often, but we (DPDK) won't
> >>> guarantee it.
> >>> This would still put some maintenance burden on SPDK but I think it is a good
> >>> compromise.
> >>>
> >>
> >> Would these internal symbols be considered part of the public/official ABI? When
> >
> > What do you mean by "public/official"?
> > If you mean the "stable" ABI (as described in the ABI policy document
> > and for which compatibility is preserved across minor versions of the
> > ABI), the answer is no: internal symbols are not part of it.
> >
> >
> >> SPDK goes to dynamically load a shared DPDK library, how can we detect
> >> whether it's a version that we support linking against?
> >
> > The runtime version of a DPDK library is available via rte_version().
> >
> >
> > As for the PCI drivers that SPDK wants to register in DPDK, what do
> > you think if SPDK people added and maintained a "generic" PCI driver
> > in DPDK.
> > This driver would expose a new API (which can not re-expose internal
> > structures, like rte_pci_driver and consorts) and ensure its ABI is
> > maintained in the long term.
> > This makes me think of pci-stub, but in DPDK.
> >
> > I did not think too much about it and I don't understand what SPDK
> > requires, but is there something wrong with this approach?
>
> The stub driver idea is interesting. In the past we’ve needed access to more
> than what a stub driver would provide - for example, to work around kernel
> vfio + pci bugs when we probe 24 NVMe SSDs behind a PCIe switch that is
> hot-inserted, or conversely handling hot removal of that same switch.  So
> I’m worried that even if we do the stub driver, we end up running into a
> case where we need these header file copies anyways.  Not ruling the stub
> driver out, but I think it's a longer-term goal, not something we would have
> ready for 22.11 obviously.
>
> So sticking with the internal header copies for now, this works fine
> for LTS and non-LTS releases.  What about stable releases (i.e. 22.11.1)?
> IIUC, these header files could change in a stable release since they are
> no longer part of the ABI?

In theory, yes they can change.
But this is a price to pay, as no one seems willing to invest and
maintain a stable API for PCI drivers.


I just noticed that some parts of the cleanups I had proposed have
been merged in SPDK.
Next time, I prefer getting some feedback from SPDK community before
my SoB is applied (or stripped) on modified patches.


Thanks.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-07-09 16:28               ` Stephen Hemminger
@ 2022-09-23  8:49                 ` David Marchand
  2022-09-23  8:57                   ` Thomas Monjalon
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-09-23  8:49 UTC (permalink / raw)
  To: Stephen Hemminger, Tyler Retzlaff, Thomas Monjalon
  Cc: dev, Bruce Richardson, Kevin Laatz, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Stephen Hemminger,
	Long Li, Chas Williams, Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

On Sat, Jul 9, 2022 at 6:28 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
> > > > > > > to avoid people tripping over mishandling pointers in/out of the api
> > > > > > > surface taking the opaque object you could declare opaque handle for the
> > > > > > > api to operate on instead. it would force the use of a cast in the
> > > > > > > implementation but would avoid accidental void * of the wrong thing that
> > > > > > > got cached being passed in. if the cast was really undesirable just
> > > > > > > whack it under an inline / internal function.
> > > > > >
> > > > > > I don't like that because it least to dangerous casts in the internal code.
> > > > > > Better to keep the the type of the object. As long as the API only passes
> > > > > > around an pointer to a struct, without exposing the contents of the struct;
> > > > > > it is safer and easier to debug.
> > > > >
> > > > > as i mentioned you can use an inline/internal function or even a macro
> > > > > to hide the cast, you could provide some additional integrity checks
> > > > > here if desired as a value add.
> > > > >
> > > > > the fact that you expose that it is a struct is an internal
> > > > > implementation detail, if truly opaque tomorrow you could convert it
> > > > > to a simple integer that indexes or enumerates something and prevents
> > > > > any meaningful interpretation in the application.
> > > > >
> > > > > when you say it is safer to debug i think you mean for dpdk devs not the
> > > > > application developer because unless the app developer does something
> > > > > really gross/dangerous casting they really can't "mishandle" the opaque
> > > > > object except to use one that isn't initialized at all which we
> > > > > can detect and handle internally in a general way.
> > > > >
> > > > > i will however concede there would be slightly more finger work when
> > > > > debugging dpdk itself since gdb / debugger doesn't automatically infer
> > > > > type so you end up having to tell gdb what is in the uintptr_t.
> > > > >
> > > > > anyway just drawing from experience in the driver frameworks we maintain
> > > > > in windows, i think one of our regrets is that we didn't do this from
> > > > > day 1 and subsequentl that we initially only used one opaque type
> > > > > instead of defining separate (not implicitly convertable) types to each
> > > > > opaque type.
> > > >
> > > > It seems to be a difference in style/taste.
> > >
> > > it's not i've sited at least one example of a mistake that becomes a
> > > compile time failure where application code is incorrectly authored
> > > where use of a pointer offers no such protection.
> > >
> > > > The Linux/Unix side prefers opaque structure pointers.
> > > > Windows (and LLVM) uses numeric handles.
> > > >
> > > > At this point DPDK should follow the Linux bus.
> > >
> > > dpdk is multi-platform and unix does not necessarily standardize on
> > > pointer to struct for opaque objects. freebsd has many apis notably
> > > bus_space that does uses handles and as previously mentioned posix
> > > threads uses handles.
> > >
> > > i understand that linux is an important platform but it isn't the only
> > > platform dpdk targets and just because it is important doesn't mean it
> > > should always enjoy being the defacto standard.
> > >
> > > anyway, i'll leave it for the patch author to decide. i still like the
> > > patch series either way. i just think this would make applications more
> > > robust.
> >
> > Thanks for this feedback Tyler.
> > I would lean towards Stephen opinion atm, but I am not decided yet.
> >
> > For now, I'll post a v2, extending the series to other internal objects.
> > We can conclude on this topic during 22.11.
>
> If you get chance to deconstruct API, switching to a numeric index
> is safest similar to what Tyler suggested.  Think of ethdev port number
> and Posix file descriptor model. The advantage of an index is that
> it can be validated more easily by the code that is called.

This is still a heavy change in the APIs.
The deprecation notice did not mention such change, and I don't think
many people are aware of this suggestion.
This would need more discussion but I don't want to block the series
on concluding on this question.

So I am for going ahead with the series in its current form.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC PATCH 11/11] bus: hide bus object
  2022-09-23  8:49                 ` David Marchand
@ 2022-09-23  8:57                   ` Thomas Monjalon
  0 siblings, 0 replies; 231+ messages in thread
From: Thomas Monjalon @ 2022-09-23  8:57 UTC (permalink / raw)
  To: Stephen Hemminger, Tyler Retzlaff, David Marchand
  Cc: dev, Bruce Richardson, Kevin Laatz, Parav Pandit, Xueming Li,
	Hemant Agrawal, Sachin Saxena, Rosen Xu, Stephen Hemminger,
	Long Li, Chas Williams, Min Hu (Connor),
	Matan Azrad, Ray Kinsella, Ferruh Yigit, Andrew Rybchenko

23/09/2022 10:49, David Marchand:
> On Sat, Jul 9, 2022 at 6:28 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > > For now, I'll post a v2, extending the series to other internal objects.
> > > We can conclude on this topic during 22.11.
> >
> > If you get chance to deconstruct API, switching to a numeric index
> > is safest similar to what Tyler suggested.  Think of ethdev port number
> > and Posix file descriptor model. The advantage of an index is that
> > it can be validated more easily by the code that is called.
> 
> This is still a heavy change in the APIs.
> The deprecation notice did not mention such change, and I don't think
> many people are aware of this suggestion.
> This would need more discussion but I don't want to block the series
> on concluding on this question.
> 
> So I am for going ahead with the series in its current form.

I agree that changing the object type would too much heavy.
The goal of this series is to hide the object,
not changing the way we refer to it.

I understand the compilation check is stronger on a plain object
than on a pointer, but I don't think this benefit is worth
changing some basic API of DPDK.
It seems our users prefer having less API change.



^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [RFC v3 00/26] Bus and device cleanup for 22.11
  2022-09-23  7:13             ` David Marchand
@ 2022-09-23 21:56               ` Harris, James R
  0 siblings, 0 replies; 231+ messages in thread
From: Harris, James R @ 2022-09-23 21:56 UTC (permalink / raw)
  To: David Marchand
  Cc: Walker, Benjamin, dev, Liu, Changpeng, Alexey Marchuk,
	Shuhei Matsumoto, Thomas Monjalon, Richardson, Bruce,
	Stephen Hemminger



> On Sep 23, 2022, at 12:13 AM, David Marchand <david.marchand@redhat.com> wrote:
> 
> On Thu, Sep 22, 2022 at 12:29 AM Harris, James R
> <james.r.harris@intel.com> wrote:
>> 
>> 
>> So sticking with the internal header copies for now, this works fine
>> for LTS and non-LTS releases.  What about stable releases (i.e. 22.11.1)?
>> IIUC, these header files could change in a stable release since they are
>> no longer part of the ABI?
> 
> In theory, yes they can change.
> But this is a price to pay, as no one seems willing to invest and
> maintain a stable API for PCI drivers.

Understood.  SPDK is preparing for this possibility, just wanted to confirm
it was necessary.

> I just noticed that some parts of the cleanups I had proposed have
> been merged in SPDK.
> Next time, I prefer getting some feedback from SPDK community before
> my SoB is applied (or stripped) on modified patches.

My apologies David.  The RTE_DEV_FOREACH cleanup was a nice one and an obvious
improvement.  I believe it was applied without any modifications (except for
fuzz offsets) but still should have given you a heads-up.

-Jim




^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [PATCH v6 00/27] Bus and device cleanup for 22.11
  2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
                     ` (26 preceding siblings ...)
  2022-09-14  7:58   ` [PATCH v6 27/27] dev: hide device object David Marchand
@ 2022-09-24  7:14   ` David Marchand
  27 siblings, 0 replies; 231+ messages in thread
From: David Marchand @ 2022-09-24  7:14 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, Ferruh Yigit, Andrew Rybchenko,
	Ajit Khaparde, Qi Zhang, Jerin Jacob Kollanukkaran,
	Raslan Darawsheh, Maxime Coquelin, Xia, Chenbo

On Wed, Sep 14, 2022 at 9:59 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> The rte_bus, rte_driver and rte_device objects are part of the public
> ABI and this has proved to be a problem when needing to extend them.
> This series hides them, and mark associated driver only API as internal.
>
> A good amount of the patches are preparation work on rte_bus.h,
> rte_dev.h, rte_devargs.h and rte_eal.h headers, removing dependencies
> between them.
>
> PCI bus specific handling are removed from testpmd, unit tests and
> examples.
>
> After this series, driver-only API headers for registering to buses are
> not exported anymore, unless the enable_driver_sdk meson option is
> selected.
>
> New accessors for rte_bus, rte_driver and rte_device have been added,
> marked with an experimental tag first when introducing them, and later
> in the series marked as stable since external users will want to use
> those drop-in replacements right away.
>
> A check is added to ensure we won't pollute app/ and examples/ again,
> though some unit tests are left intentionnally untouched as they test
> some internals of DPDK.
>
> Changes since v5:
> - fixed Windows build (bis...),

I rebased the series and pushed it to main.
I had tested the series against some next-* repositories before.
It should be rather painless, but please subtree maintainers, don't
wait too much and rebase your trees.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [PATCH v6 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-09-14  7:58   ` [PATCH v6 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
@ 2022-10-26  9:04     ` Morten Brørup
  2022-10-26  9:21       ` David Marchand
  0 siblings, 1 reply; 231+ messages in thread
From: Morten Brørup @ 2022-10-26  9:04 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: thomas, bruce.richardson, Ray Kinsella, Fan Zhang, Ashish Gupta,
	Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Rosen Xu, Tianfei zhang,
	Sachin Saxena, Hemant Agrawal, Akhil Goyal, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Abhinandan Gujjar,
	Jerin Jacob, Jay Jayatheerthan, Olivier Matz, Ori Kam,
	Maxime Coquelin, Chenbo Xia

> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Wednesday, 14 September 2022 09.58
> 
> Those macros have no real value and are easily replaced with a simple
> if() block.
> 
> Existing users have been converted using a new cocci script.
> Deprecate them.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

[...]

>  /* Macros to check for invalid function pointers */
> -#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> +#define RTE_FUNC_PTR_OR_ERR_RET(func, retval)
> RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \
> +do { \
>  	if ((func) == NULL) \
>  		return retval; \
>  } while (0)
> 
> -#define RTE_FUNC_PTR_OR_RET(func) do { \
> +#define RTE_FUNC_PTR_OR_RET(func) RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET)
> \
> +do { \
>  	if ((func) == NULL) \
>  		return; \
>  } while (0)

rte_ethdev.h has somewhat similar macros [1]:

/* Macros to check for valid port */
#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
	if (!rte_eth_dev_is_valid_port(port_id)) { \
		RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id); \
		return retval; \
	} \
} while (0)

#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
	if (!rte_eth_dev_is_valid_port(port_id)) { \
		RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id); \
		return; \
	} \
} while (0)

However, these log an error message. It makes me wonder about consistency...

Are the RTE_FUNC_PTR_OR_* macros a special case, or should similar macros, such as RTE_ETH_VALID_PORTID_OR_*, also be deprecated?

Or should the RTE_FUNC_PTR_OR_* macros be modified to log an error message instead of being deprecated?


[1]: https://elixir.bootlin.com/dpdk/v22.11-rc1/source/lib/ethdev/rte_ethdev.h#L1909


^ permalink raw reply	[flat|nested] 231+ messages in thread

* Re: [PATCH v6 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-10-26  9:04     ` Morten Brørup
@ 2022-10-26  9:21       ` David Marchand
  2022-10-26 10:30         ` Morten Brørup
  0 siblings, 1 reply; 231+ messages in thread
From: David Marchand @ 2022-10-26  9:21 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, thomas, bruce.richardson, Ray Kinsella, Fan Zhang,
	Ashish Gupta, Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Rosen Xu, Tianfei zhang,
	Sachin Saxena, Hemant Agrawal, Akhil Goyal, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Abhinandan Gujjar,
	Jerin Jacob, Jay Jayatheerthan, Olivier Matz, Ori Kam,
	Maxime Coquelin, Chenbo Xia

On Wed, Oct 26, 2022 at 11:05 AM Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > From: David Marchand [mailto:david.marchand@redhat.com]
> > Sent: Wednesday, 14 September 2022 09.58
> >
> > Those macros have no real value and are easily replaced with a simple
> > if() block.
> >
> > Existing users have been converted using a new cocci script.
> > Deprecate them.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
>
> [...]
>
> >  /* Macros to check for invalid function pointers */
> > -#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> > +#define RTE_FUNC_PTR_OR_ERR_RET(func, retval)
> > RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \
> > +do { \
> >       if ((func) == NULL) \
> >               return retval; \
> >  } while (0)
> >
> > -#define RTE_FUNC_PTR_OR_RET(func) do { \
> > +#define RTE_FUNC_PTR_OR_RET(func) RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET)
> > \
> > +do { \
> >       if ((func) == NULL) \
> >               return; \
> >  } while (0)
>
> rte_ethdev.h has somewhat similar macros [1]:
>
> /* Macros to check for valid port */
> #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
>         if (!rte_eth_dev_is_valid_port(port_id)) { \
>                 RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id); \
>                 return retval; \
>         } \
> } while (0)
>
> #define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
>         if (!rte_eth_dev_is_valid_port(port_id)) { \
>                 RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id); \
>                 return; \
>         } \
> } while (0)
>
> However, these log an error message. It makes me wonder about consistency...
>
> Are the RTE_FUNC_PTR_OR_* macros a special case, or should similar macros, such as RTE_ETH_VALID_PORTID_OR_*, also be deprecated?
>
> Or should the RTE_FUNC_PTR_OR_* macros be modified to log an error message instead of being deprecated?

The difference is that those ethdev macros validate something
expressed in their name "is this portid valid".

The RTE_FUNC_PTR_OR_* macros were really just a if() + return block.
I don't see what message to log for them.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 231+ messages in thread

* RE: [PATCH v6 08/27] eal: deprecate RTE_FUNC_PTR_* macros
  2022-10-26  9:21       ` David Marchand
@ 2022-10-26 10:30         ` Morten Brørup
  0 siblings, 0 replies; 231+ messages in thread
From: Morten Brørup @ 2022-10-26 10:30 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, thomas, bruce.richardson, Ray Kinsella, Fan Zhang,
	Ashish Gupta, Qiming Yang, Wenjun Wu, Shijith Thotton,
	Srisivasubramanian Srinivasan, Rosen Xu, Tianfei zhang,
	Sachin Saxena, Hemant Agrawal, Akhil Goyal, Chengwen Feng,
	Kevin Laatz, Ferruh Yigit, Andrew Rybchenko, Abhinandan Gujjar,
	Jerin Jacob, Jay Jayatheerthan, Olivier Matz, Ori Kam,
	Maxime Coquelin, Chenbo Xia

> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Wednesday, 26 October 2022 11.21
> 
> On Wed, Oct 26, 2022 at 11:05 AM Morten Brørup
> <mb@smartsharesystems.com> wrote:
> >
> > > From: David Marchand [mailto:david.marchand@redhat.com]
> > > Sent: Wednesday, 14 September 2022 09.58
> > >
> > > Those macros have no real value and are easily replaced with a
> simple
> > > if() block.
> > >
> > > Existing users have been converted using a new cocci script.
> > > Deprecate them.
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---
> >
> > [...]
> >
> > >  /* Macros to check for invalid function pointers */
> > > -#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> > > +#define RTE_FUNC_PTR_OR_ERR_RET(func, retval)
> > > RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \
> > > +do { \
> > >       if ((func) == NULL) \
> > >               return retval; \
> > >  } while (0)
> > >
> > > -#define RTE_FUNC_PTR_OR_RET(func) do { \
> > > +#define RTE_FUNC_PTR_OR_RET(func)
> RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET)
> > > \
> > > +do { \
> > >       if ((func) == NULL) \
> > >               return; \
> > >  } while (0)
> >
> > rte_ethdev.h has somewhat similar macros [1]:
> >
> > /* Macros to check for valid port */
> > #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
> >         if (!rte_eth_dev_is_valid_port(port_id)) { \
> >                 RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id);
> \
> >                 return retval; \
> >         } \
> > } while (0)
> >
> > #define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
> >         if (!rte_eth_dev_is_valid_port(port_id)) { \
> >                 RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id);
> \
> >                 return; \
> >         } \
> > } while (0)
> >
> > However, these log an error message. It makes me wonder about
> consistency...
> >
> > Are the RTE_FUNC_PTR_OR_* macros a special case, or should similar
> macros, such as RTE_ETH_VALID_PORTID_OR_*, also be deprecated?
> >
> > Or should the RTE_FUNC_PTR_OR_* macros be modified to log an error
> message instead of being deprecated?
> 
> The difference is that those ethdev macros validate something
> expressed in their name "is this portid valid".
> 
> The RTE_FUNC_PTR_OR_* macros were really just a if() + return block.
> I don't see what message to log for them.

The RTE_ETH_VALID_PORTID_OR_* macros seem to serve the same purpose as the RTE_FUNC_PTR_OR_* macros.

Is it just a coincidence that the RTE_FUNC_PTR_OR_* macros don't log an error message, while similar macros do?

Cleaning up is certainly good, so I don't object to this patch!

I'm only asking if a broader scope applies:

Are the RTE_FUNC_PTR_OR_* macros a unique case (so they can be removed as suggested), or should we add an error message to the macros instead of removing them?


^ permalink raw reply	[flat|nested] 231+ messages in thread

end of thread, other threads:[~2022-10-26 10:36 UTC | newest]

Thread overview: 231+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 14:46 [RFC PATCH 00/11] Bus cleanup for 22.11 David Marchand
2022-06-28 14:46 ` [RFC PATCH 01/11] common/mlx5: rework check on driver registration David Marchand
2022-06-28 14:46 ` [RFC PATCH 02/11] raw/ifpga: remove PCI bus accessor David Marchand
2022-06-28 14:46 ` [RFC PATCH 03/11] dev: hide debug messages in device iterator David Marchand
2022-06-28 14:46 ` [RFC PATCH 04/11] dev: move unrelated macros from header David Marchand
2022-06-28 14:46 ` [RFC PATCH 05/11] devargs: remove dependency on bus header David Marchand
2022-06-28 14:46 ` [RFC PATCH 06/11] bus: remove unneeded inclusion of " David Marchand
2022-06-28 14:46 ` [RFC PATCH 07/11] bus: move IOVA definition from header David Marchand
2022-06-28 14:46 ` [RFC PATCH 08/11] drivers/bus: remove back reference to bus objects David Marchand
2022-06-28 14:46 ` [RFC PATCH 09/11] drivers/bus: hide specific structures David Marchand
2022-06-28 14:46 ` [RFC PATCH 10/11] bus: introduce accessors David Marchand
2022-06-28 14:46 ` [RFC PATCH 11/11] bus: hide bus object David Marchand
2022-06-28 16:22   ` Tyler Retzlaff
2022-06-28 16:24     ` Tyler Retzlaff
2022-06-28 16:29     ` Stephen Hemminger
2022-06-28 17:07       ` Tyler Retzlaff
2022-06-28 17:38         ` Stephen Hemminger
2022-06-28 18:23           ` Tyler Retzlaff
2022-07-09  8:16             ` David Marchand
2022-07-09 16:28               ` Stephen Hemminger
2022-09-23  8:49                 ` David Marchand
2022-09-23  8:57                   ` Thomas Monjalon
2022-07-09  8:26 ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 David Marchand
2022-07-09  8:26   ` [RFC v2 v2 01/29] common/mlx5: rework check on driver registration David Marchand
2022-07-09  8:26   ` [RFC v2 v2 02/29] raw/ifpga: remove PCI bus accessor David Marchand
2022-07-09  8:26   ` [RFC v2 v2 03/29] kni: stop populating PCI info in examples David Marchand
2022-07-09  8:26   ` [RFC v2 v2 04/29] examples/ethtool: prefer device name David Marchand
2022-07-09  8:26   ` [RFC v2 v2 05/29] dev: hide debug messages in device iterator David Marchand
2022-07-09  8:26   ` [RFC v2 v2 06/29] dev: move unrelated macros from header David Marchand
2022-07-09  8:26   ` [RFC v2 v2 07/29] devargs: remove dependency on bus header David Marchand
2022-07-09  8:26   ` [RFC v2 v2 08/29] bus: remove unneeded inclusion of " David Marchand
2022-07-09  8:26   ` [RFC v2 v2 09/29] bus: move IOVA definition from header David Marchand
2022-07-09  8:26   ` [RFC v2 v2 10/29] drivers/bus: remove back reference to bus objects David Marchand
2022-07-09  8:26   ` [RFC v2 v2 11/29] drivers/bus: hide specific structures David Marchand
2022-07-09  8:26   ` [RFC v2 v2 12/29] bus: introduce accessors David Marchand
2022-07-09  8:26   ` [RFC v2 v2 13/29] bus: hide bus object David Marchand
2022-07-09  8:26   ` [RFC v2 v2 14/29] bbdev: mark driver header David Marchand
2022-07-09  8:26   ` [RFC v2 v2 15/29] ethdev: mark some headers as driver only David Marchand
2022-07-09  8:26   ` [RFC v2 v2 16/29] rawdev: mark driver header David Marchand
2022-07-09  8:26   ` [RFC v2 v2 17/29] drivers: export drivers headers David Marchand
2022-07-09  8:26   ` [RFC v2 v2 18/29] bus/auxiliary: make driver-only headers private David Marchand
2022-07-09  8:26   ` [RFC v2 v2 19/29] bus/dpaa: " David Marchand
2022-07-09  8:26   ` [RFC v2 v2 20/29] bus/fslmc: " David Marchand
2022-07-09  8:26   ` [RFC v2 v2 21/29] bus/ifpga: cleanup exported symbols David Marchand
2022-07-09  8:26   ` [RFC v2 v2 22/29] bus/ifpga: make driver-only headers private David Marchand
2022-07-09  8:26   ` [RFC v2 v2 23/29] bus/pci: " David Marchand
2022-07-09  8:26   ` [RFC v2 v2 24/29] bus/vdev: " David Marchand
2022-07-09  8:26   ` [RFC v2 v2 25/29] bus/vmbus: " David Marchand
2022-07-09  8:26   ` [RFC v2 v2 26/29] dev: introduce driver name David Marchand
2022-07-09  8:26   ` [RFC v2 v2 27/29] dev: hide driver object David Marchand
2022-07-09  8:26   ` [RFC v2 v2 28/29] dev: introduce device accessors David Marchand
2022-07-09  8:26   ` [RFC v2 v2 29/29] dev: hide device object David Marchand
2022-07-09 16:30   ` [RFC v2 v2 00/29] Bus and device cleanup for 22.11 Stephen Hemminger
2022-07-11  8:38   ` Bruce Richardson
2022-07-28 15:26 ` [RFC v3 00/26] " David Marchand
2022-07-28 15:26   ` [RFC v3 01/26] devtools: forbid inclusions of driver only headers David Marchand
2022-07-28 16:23     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 02/26] common/mlx5: rework check on driver registration David Marchand
2022-07-28 15:26   ` [RFC v3 03/26] raw/ifpga: remove PCI bus accessor David Marchand
2022-07-29  2:36     ` Xu, Rosen
2022-07-28 15:26   ` [RFC v3 04/26] app/testpmd: drop PCI register commands David Marchand
2022-07-28 16:26     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 05/26] kni: stop populating PCI info in examples David Marchand
2022-07-28 16:30     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 06/26] examples/ethtool: prefer device name David Marchand
2022-07-28 16:32     ` Bruce Richardson
2022-07-28 19:27       ` David Marchand
2022-07-28 15:26   ` [RFC v3 07/26] dev: hide debug messages in device iterator David Marchand
2022-07-28 16:33     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 08/26] dev: move unrelated macros from header David Marchand
2022-07-28 16:38     ` Bruce Richardson
2022-07-28 19:32       ` David Marchand
2022-07-29  9:58         ` Bruce Richardson
2022-07-29 13:22           ` David Marchand
2022-08-24  6:50             ` David Marchand
2022-08-24  7:39               ` Thomas Monjalon
2022-08-24 11:52                 ` Morten Brørup
2022-08-24 12:53                   ` Thomas Monjalon
2022-07-28 15:26   ` [RFC v3 09/26] devargs: remove dependency on bus header David Marchand
2022-07-28 16:40     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 10/26] build: export drivers headers David Marchand
2022-07-28 16:41     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 11/26] bus/auxiliary: make driver-only headers private David Marchand
2022-07-28 15:26   ` [RFC v3 12/26] bus/dpaa: " David Marchand
2022-07-28 15:26   ` [RFC v3 13/26] bus/fslmc: " David Marchand
2022-07-28 15:26   ` [RFC v3 14/26] bus/ifpga: cleanup exported symbols David Marchand
2022-07-29  2:36     ` Xu, Rosen
2022-07-28 15:26   ` [RFC v3 15/26] bus/ifpga: make driver-only headers private David Marchand
2022-07-29  2:37     ` Xu, Rosen
2022-07-28 15:26   ` [RFC v3 16/26] bus/pci: " David Marchand
2022-07-28 16:46     ` Bruce Richardson
2022-07-28 16:52       ` Ajit Khaparde
2022-07-29  2:41     ` Xu, Rosen
2022-07-28 15:26   ` [RFC v3 17/26] bus/vdev: " David Marchand
2022-07-29  2:38     ` Xu, Rosen
2022-07-28 15:26   ` [RFC v3 18/26] bus/vmbus: " David Marchand
2022-07-28 15:26   ` [RFC v3 19/26] bus: move IOVA definition from header David Marchand
2022-07-28 16:48     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 20/26] bus: introduce accessors David Marchand
2022-07-28 16:51     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 21/26] bus: hide bus object David Marchand
2022-07-28 16:56     ` Bruce Richardson
2022-07-28 19:26       ` David Marchand
2022-07-29 10:01         ` Bruce Richardson
2022-07-29 11:14           ` David Marchand
2022-07-28 15:26   ` [RFC v3 22/26] dev: introduce driver accessors David Marchand
2022-07-28 16:59     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 23/26] dev: hide driver object David Marchand
2022-07-28 17:00     ` Bruce Richardson
2022-08-01 17:18       ` Ajit Khaparde
2022-08-01  7:06     ` Jayatheerthan, Jay
2022-07-28 15:26   ` [RFC v3 24/26] dev: introduce device accessors David Marchand
2022-07-28 17:01     ` Bruce Richardson
2022-07-28 15:26   ` [RFC v3 25/26] dev: provide Bus specific information David Marchand
2022-07-28 17:03     ` Bruce Richardson
2022-07-28 19:45       ` David Marchand
2022-07-28 15:26   ` [RFC v3 26/26] dev: hide device object David Marchand
2022-07-28 17:04     ` Bruce Richardson
2022-08-04 23:19   ` [RFC v3 00/26] Bus and device cleanup for 22.11 Harris, James R
2022-08-25  9:31     ` David Marchand
2022-08-29 17:12       ` Walker, Benjamin
2022-08-30 15:09         ` David Marchand
2022-09-21 22:29           ` Harris, James R
2022-09-23  7:13             ` David Marchand
2022-09-23 21:56               ` Harris, James R
2022-08-26 12:41 ` [PATCH v4 00/27] " David Marchand
2022-08-26 12:41   ` [PATCH v4 01/27] devtools: forbid inclusions of driver only headers David Marchand
2022-08-26 12:41   ` [PATCH v4 02/27] common/mlx5: rework check on driver registration David Marchand
2022-08-26 12:41   ` [PATCH v4 03/27] raw/ifpga: remove PCI bus accessor David Marchand
2022-08-26 12:41   ` [PATCH v4 04/27] app/testpmd: drop PCI register commands David Marchand
2022-08-26 12:41   ` [PATCH v4 05/27] kni: stop populating PCI info in examples David Marchand
2022-08-26 12:41   ` [PATCH v4 06/27] examples/ethtool: prefer device name David Marchand
2022-08-26 12:41   ` [PATCH v4 07/27] dev: hide debug messages in device iterator David Marchand
2022-08-26 12:41   ` [PATCH v4 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
2022-08-26 12:41   ` [PATCH v4 09/27] devargs: remove dependency on bus header David Marchand
2022-08-26 12:41   ` [PATCH v4 10/27] build: export drivers headers David Marchand
2022-08-26 12:41   ` [PATCH v4 11/27] bus/auxiliary: make driver-only headers private David Marchand
2022-08-26 12:41   ` [PATCH v4 12/27] bus/dpaa: " David Marchand
2022-08-30  4:50     ` Hemant Agrawal
2022-08-26 12:41   ` [PATCH v4 13/27] bus/fslmc: " David Marchand
2022-08-30  4:49     ` Hemant Agrawal
2022-08-26 12:41   ` [PATCH v4 14/27] bus/ifpga: cleanup exported symbols David Marchand
2022-08-26 12:41   ` [PATCH v4 15/27] bus/ifpga: make driver-only headers private David Marchand
2022-08-26 12:41   ` [PATCH v4 16/27] bus/pci: " David Marchand
2022-08-26 12:41   ` [PATCH v4 17/27] bus/vdev: " David Marchand
2022-08-29  7:17     ` Ruifeng Wang
2022-08-29  8:12       ` David Marchand
2022-08-26 12:41   ` [PATCH v4 18/27] bus/vmbus: " David Marchand
2022-08-26 12:42   ` [PATCH v4 19/27] bus: move IOVA definition from header David Marchand
2022-08-26 12:42   ` [PATCH v4 20/27] bus: introduce accessors David Marchand
2022-08-26 12:42   ` [PATCH v4 21/27] bus: hide bus object David Marchand
2022-08-26 12:42   ` [PATCH v4 22/27] dev: introduce driver accessors David Marchand
2022-08-26 12:42   ` [PATCH v4 23/27] dev: hide driver object David Marchand
2022-08-26 12:42   ` [PATCH v4 24/27] dev: introduce device accessors David Marchand
2022-08-26 12:42   ` [PATCH v4 25/27] dev: provide bus specific information David Marchand
2022-08-26 12:42   ` [PATCH v4 26/27] bus/pci: fill " David Marchand
2022-08-26 12:42   ` [PATCH v4 27/27] dev: hide device object David Marchand
2022-09-05  8:35 ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
2022-09-05  8:35   ` [PATCH v5 01/27] devtools: forbid inclusions of driver only headers David Marchand
2022-09-05  8:35   ` [PATCH v5 02/27] common/mlx5: rework check on driver registration David Marchand
2022-09-05  8:35   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
2022-09-05  8:35   ` [PATCH v5 04/27] app/testpmd: drop PCI register commands David Marchand
2022-09-05  8:35   ` [PATCH v5 05/27] kni: stop populating PCI info in examples David Marchand
2022-09-05  8:35   ` [PATCH v5 06/27] examples/ethtool: prefer device name David Marchand
2022-09-05  8:35   ` [PATCH v5 07/27] dev: hide debug messages in device iterator David Marchand
2022-09-05  8:35   ` [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
2022-09-06  8:24     ` Jayatheerthan, Jay
2022-09-05  8:39   ` [PATCH v5 00/27] Bus and device cleanup for 22.11 David Marchand
2022-09-05  8:39 ` David Marchand
2022-09-05  8:39   ` [PATCH v5 01/27] devtools: forbid inclusions of driver only headers David Marchand
2022-09-05  8:39   ` [PATCH v5 02/27] common/mlx5: rework check on driver registration David Marchand
2022-09-05  8:39   ` [PATCH v5 03/27] raw/ifpga: remove PCI bus accessor David Marchand
2022-09-05  8:39   ` [PATCH v5 04/27] app/testpmd: drop PCI register commands David Marchand
2022-09-05  8:39   ` [PATCH v5 05/27] kni: stop populating PCI info in examples David Marchand
2022-09-05  8:39   ` [PATCH v5 06/27] examples/ethtool: prefer device name David Marchand
2022-09-05  8:39   ` [PATCH v5 07/27] dev: hide debug messages in device iterator David Marchand
2022-09-05  8:39   ` [PATCH v5 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
2022-09-06  6:11     ` [EXT] " Akhil Goyal
2022-09-05  8:39   ` [PATCH v5 09/27] devargs: remove dependency on bus header David Marchand
2022-09-05  8:39   ` [PATCH v5 10/27] build: export drivers headers David Marchand
2022-09-05  8:39   ` [PATCH v5 11/27] bus/auxiliary: make driver-only headers private David Marchand
2022-09-05  8:39   ` [PATCH v5 12/27] bus/dpaa: " David Marchand
2022-09-05  8:39   ` [PATCH v5 13/27] bus/fslmc: " David Marchand
2022-09-05  8:39   ` [PATCH v5 14/27] bus/ifpga: cleanup exported symbols David Marchand
2022-09-05  8:39   ` [PATCH v5 15/27] bus/ifpga: make driver-only headers private David Marchand
2022-09-05  8:39   ` [PATCH v5 16/27] bus/pci: " David Marchand
2022-09-05  8:39   ` [PATCH v5 17/27] bus/vdev: " David Marchand
2022-09-05  8:39   ` [PATCH v5 18/27] bus/vmbus: " David Marchand
2022-09-05  8:39   ` [PATCH v5 19/27] bus: move IOVA definition from header David Marchand
2022-09-05  8:39   ` [PATCH v5 20/27] bus: introduce accessors David Marchand
2022-09-05  8:39   ` [PATCH v5 21/27] bus: hide bus object David Marchand
2022-09-05  8:39   ` [PATCH v5 22/27] dev: introduce driver accessors David Marchand
2022-09-05  8:39   ` [PATCH v5 23/27] dev: hide driver object David Marchand
2022-09-06  6:05     ` [EXT] " Akhil Goyal
2022-09-06  6:46     ` Gujjar, Abhinandan S
2022-09-05  8:39   ` [PATCH v5 24/27] dev: introduce device accessors David Marchand
2022-09-05  8:39   ` [PATCH v5 25/27] dev: provide bus specific information David Marchand
2022-09-05  8:39   ` [PATCH v5 26/27] bus/pci: fill " David Marchand
2022-09-05  8:39   ` [PATCH v5 27/27] dev: hide device object David Marchand
2022-09-14  7:58 ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand
2022-09-14  7:58   ` [PATCH v6 01/27] devtools: forbid inclusions of driver only headers David Marchand
2022-09-14  7:58   ` [PATCH v6 02/27] common/mlx5: rework check on driver registration David Marchand
2022-09-14  7:58   ` [PATCH v6 03/27] raw/ifpga: remove PCI bus accessor David Marchand
2022-09-14  7:58   ` [PATCH v6 04/27] app/testpmd: drop PCI register commands David Marchand
2022-09-14  7:58   ` [PATCH v6 05/27] kni: stop populating PCI info in examples David Marchand
2022-09-14  7:58   ` [PATCH v6 06/27] examples/ethtool: prefer device name David Marchand
2022-09-14  7:58   ` [PATCH v6 07/27] dev: hide debug messages in device iterator David Marchand
2022-09-14  7:58   ` [PATCH v6 08/27] eal: deprecate RTE_FUNC_PTR_* macros David Marchand
2022-10-26  9:04     ` Morten Brørup
2022-10-26  9:21       ` David Marchand
2022-10-26 10:30         ` Morten Brørup
2022-09-14  7:58   ` [PATCH v6 09/27] devargs: remove dependency on bus header David Marchand
2022-09-14  7:58   ` [PATCH v6 10/27] build: export drivers headers David Marchand
2022-09-14  7:58   ` [PATCH v6 11/27] bus/auxiliary: make driver-only headers private David Marchand
2022-09-14  7:58   ` [PATCH v6 12/27] bus/dpaa: " David Marchand
2022-09-14  7:58   ` [PATCH v6 13/27] bus/fslmc: " David Marchand
2022-09-14  7:58   ` [PATCH v6 14/27] bus/ifpga: cleanup exported symbols David Marchand
2022-09-14  7:58   ` [PATCH v6 15/27] bus/ifpga: make driver-only headers private David Marchand
2022-09-14  7:58   ` [PATCH v6 16/27] bus/pci: " David Marchand
2022-09-14  7:58   ` [PATCH v6 17/27] bus/vdev: " David Marchand
2022-09-14  7:58   ` [PATCH v6 18/27] bus/vmbus: " David Marchand
2022-09-14  7:58   ` [PATCH v6 19/27] bus: move IOVA definition from header David Marchand
2022-09-14  7:58   ` [PATCH v6 20/27] bus: introduce accessors David Marchand
2022-09-14  7:58   ` [PATCH v6 21/27] bus: hide bus object David Marchand
2022-09-14  7:58   ` [PATCH v6 22/27] dev: introduce driver accessors David Marchand
2022-09-14  7:58   ` [PATCH v6 23/27] dev: hide driver object David Marchand
2022-09-14  7:58   ` [PATCH v6 24/27] dev: introduce device accessors David Marchand
2022-09-14  7:58   ` [PATCH v6 25/27] dev: provide bus specific information David Marchand
2022-09-14  7:58   ` [PATCH v6 26/27] bus/pci: fill " David Marchand
2022-09-14  7:58   ` [PATCH v6 27/27] dev: hide device object David Marchand
2022-09-24  7:14   ` [PATCH v6 00/27] Bus and device cleanup for 22.11 David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).