[RFC,09/11] drivers/bus: hide specific structures

Message ID 20220628144643.1213026-10-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Bus cleanup for 22.11 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand June 28, 2022, 2:46 p.m. UTC
  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
  

Patch

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>