DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: remove useless bus API includes
@ 2021-04-14 17:43 Thomas Monjalon
  2021-04-16  7:22 ` David Marchand
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Monjalon @ 2021-04-14 17:43 UTC (permalink / raw)
  To: dev
  Cc: Hemant Agrawal, Sachin Saxena, Rosen Xu, Stephen Hemminger,
	Long Li, Jay Zhou, Gaetan Rivet, Matan Azrad, Shahaf Shuler,
	Tianfei zhang, Radha Mohan Chintakuntla, Veerasenareddy Burru,
	Anatoly Burakov, Nicolas Chautru, Ferruh Yigit, Andrew Rybchenko,
	Maxime Coquelin, Chenbo Xia

The file rte_bus.h was included in too many files.

The enum rte_iova_mode is moved from rte_bus.h to rte_eal.h
because it is not specific to the bus layer.
It allows to clean-up more includes of rte_bus.h.

Some indirect includes had to be added in few files to compensate.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 app/test-compress-perf/comp_perf_options.h   |  2 ++
 drivers/bus/dpaa/dpaa_bus.c                  |  1 -
 drivers/bus/fslmc/fslmc_bus.c                |  1 -
 drivers/bus/fslmc/fslmc_vfio.c               |  1 -
 drivers/bus/ifpga/ifpga_common.c             |  1 -
 drivers/bus/ifpga/rte_bus_ifpga.h            |  1 -
 drivers/bus/pci/linux/pci.c                  |  1 -
 drivers/bus/pci/pci_common.c                 |  1 -
 drivers/bus/vdev/vdev_params.c               |  1 -
 drivers/bus/vmbus/linux/vmbus_uio.c          |  1 -
 drivers/bus/vmbus/rte_bus_vmbus.h            |  1 +
 drivers/bus/vmbus/vmbus_bufring.c            |  1 -
 drivers/bus/vmbus/vmbus_channel.c            |  1 -
 drivers/bus/vmbus/vmbus_common.c             |  1 -
 drivers/bus/vmbus/vmbus_common_uio.c         |  1 -
 drivers/crypto/virtio/virtio_pci.c           |  1 -
 drivers/net/failsafe/failsafe.c              |  1 +
 drivers/net/failsafe/failsafe_eal.c          |  1 +
 drivers/net/mlx4/mlx4_ethdev.c               |  1 +
 drivers/raw/ifpga/ifpga_rawdev.c             |  1 -
 drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c  |  1 -
 drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c    |  1 -
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c    |  1 -
 examples/multi_process/hotplug_mp/commands.c |  1 +
 lib/librte_bbdev/rte_bbdev.h                 |  1 -
 lib/librte_eal/common/hotplug_mp.c           |  1 +
 lib/librte_eal/common/hotplug_mp.h           |  1 -
 lib/librte_eal/include/rte_bus.h             | 14 --------------
 lib/librte_eal/include/rte_devargs.h         |  3 ++-
 lib/librte_eal/include/rte_eal.h             | 15 ++++++++++++++-
 lib/librte_eal/include/rte_lcore.h           |  4 ++++
 lib/librte_ethdev/rte_ethdev.c               |  1 +
 lib/librte_pci/rte_pci.c                     |  1 -
 lib/librte_vhost/vhost_user.c                |  1 +
 34 files changed, 30 insertions(+), 37 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/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 173041c026..98ff68c97c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -30,7 +30,6 @@
 #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 26910ac01f..05967512c8 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -9,7 +9,6 @@
 #include <stdbool.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/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index c8373e627a..9fc0e01115 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -29,7 +29,6 @@
 #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"
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 b43084155a..bb9432a54e 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/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 0dc99e9cb2..ff4ca1aa41 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>
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 30630809bb..74f58c8037 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -13,7 +13,6 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_per_lcore.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 6f74704d1c..02a6b534bb 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 b52ca5bf1d..8ce4207374 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -12,7 +12,6 @@
 #include <sys/mman.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/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 4cf73ce815..00fa357ff6 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -28,6 +28,7 @@ extern "C" {
 #include <rte_uuid.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
+#include <rte_bus.h>
 #include <rte_dev.h>
 #include <rte_vmbus_reg.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 f67f1c438a..508cd955a9 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 39b3308577..1b3be86700 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/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 8582e32c1d..d283f286dc 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/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index e3bda0df2b..57ed41c1b7 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..05662f037e 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -5,6 +5,7 @@
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
+#include <rte_bus.h>
 
 #include "failsafe_private.h"
 
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index 783ff94dce..7fd7a91a00 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -32,6 +32,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
+#include <rte_eal.h>
 #include <rte_bus_pci.h>
 #include <rte_errno.h>
 #include <ethdev_driver.h>
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index d9a46ef915..1b5f57a356 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -11,7 +11,6 @@
 #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>
diff --git a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c
index efdba2779b..21d98e0d62 100644
--- a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c
+++ b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.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>
diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c
index d04e957d82..415c6ab7a8 100644
--- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c
+++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c
@@ -7,7 +7,6 @@
 #include <dirent.h>
 #include <fcntl.h>
 
-#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c
index b2ccdda83e..4d0e84907f 100644
--- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c
+++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c
@@ -4,7 +4,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c
index 48fd329583..0e60ac39da 100644
--- a/examples/multi_process/hotplug_mp/commands.c
+++ b/examples/multi_process/hotplug_mp/commands.c
@@ -8,6 +8,7 @@
 #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/librte_bbdev/rte_bbdev.h b/lib/librte_bbdev/rte_bbdev.h
index 7017124414..7e5d8d2249 100644
--- a/lib/librte_bbdev/rte_bbdev.h
+++ b/lib/librte_bbdev/rte_bbdev.h
@@ -33,7 +33,6 @@ extern "C" {
 #include <string.h>
 
 #include <rte_compat.h>
-#include <rte_bus.h>
 #include <rte_cpuflags.h>
 #include <rte_memory.h>
 
diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index ae6010e8f8..f8fbf358ff 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -8,6 +8,7 @@
 #include <rte_alarm.h>
 #include <rte_string_fns.h>
 #include <rte_devargs.h>
+#include <rte_bus.h>
 
 #include "hotplug_mp.h"
 #include "eal_private.h"
diff --git a/lib/librte_eal/common/hotplug_mp.h b/lib/librte_eal/common/hotplug_mp.h
index 8fcf9b52e2..066494ff27 100644
--- a/lib/librte_eal/common/hotplug_mp.h
+++ b/lib/librte_eal/common/hotplug_mp.h
@@ -6,7 +6,6 @@
 #define _HOTPLUG_MP_H_
 
 #include "rte_dev.h"
-#include "rte_bus.h"
 
 #define EAL_DEV_MP_ACTION_REQUEST      "eal_dev_mp_request"
 #define EAL_DEV_MP_ACTION_RESPONSE     "eal_dev_mp_response"
diff --git a/lib/librte_eal/include/rte_bus.h b/lib/librte_eal/include/rte_bus.h
index ebacc7adc3..f59a025955 100644
--- a/lib/librte_eal/include/rte_bus.h
+++ b/lib/librte_eal/include/rte_bus.h
@@ -28,20 +28,6 @@ extern "C" {
 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/librte_eal/include/rte_devargs.h b/lib/librte_eal/include/rte_devargs.h
index 134b44a887..be850607bc 100644
--- a/lib/librte_eal/include/rte_devargs.h
+++ b/lib/librte_eal/include/rte_devargs.h
@@ -22,8 +22,9 @@ extern "C" {
 
 #include <stdio.h>
 #include <sys/queue.h>
+
 #include <rte_compat.h>
-#include <rte_bus.h>
+#include <rte_dev.h>
 
 /**
  * Type of generic device
diff --git a/lib/librte_eal/include/rte_eal.h b/lib/librte_eal/include/rte_eal.h
index eaf6469e50..530eb74391 100644
--- a/lib/librte_eal/include/rte_eal.h
+++ b/lib/librte_eal/include/rte_eal.h
@@ -18,7 +18,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>
@@ -32,6 +31,20 @@ extern "C" {
 /* Maximum thread_name length. */
 #define RTE_MAX_THREAD_NAME_LEN 16
 
+/**
+ * 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 */
+};
+
 /**
  * The type of process in a linux, multi-process setup
  */
diff --git a/lib/librte_eal/include/rte_lcore.h b/lib/librte_eal/include/rte_lcore.h
index 1550b75da0..edf3ebd338 100644
--- a/lib/librte_eal/include/rte_lcore.h
+++ b/lib/librte_eal/include/rte_lcore.h
@@ -11,7 +11,11 @@
  * API for lcore and socket manipulation
  *
  */
+
+#include <stdio.h>
+
 #include <rte_config.h>
+#include <rte_common.h>
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 0419500fc3..b3448527f0 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -35,6 +35,7 @@
 #include <rte_spinlock.h>
 #include <rte_string_fns.h>
 #include <rte_kvargs.h>
+#include <rte_bus.h>
 #include <rte_class.h>
 #include <rte_ether.h>
 #include <rte_telemetry.h>
diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c
index c91be8b167..a304c12fae 100644
--- a/lib/librte_pci/rte_pci.c
+++ b/lib/librte_pci/rte_pci.c
@@ -13,7 +13,6 @@
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
-#include <rte_bus.h>
 #include <rte_eal_paging.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index cdd46a0116..f14c070e60 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -44,6 +44,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
+#include <rte_dev.h>
 #include <rte_log.h>
 
 #include "iotlb.h"
-- 
2.31.1


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

end of thread, other threads:[~2021-04-16  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 17:43 [dpdk-dev] [PATCH] eal: remove useless bus API includes Thomas Monjalon
2021-04-16  7:22 ` 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).