From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 8FFDCA00C5;
	Sat,  9 Jul 2022 10:28:05 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 8AC59410DD;
	Sat,  9 Jul 2022 10:27:56 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124])
 by mails.dpdk.org (Postfix) with ESMTP id 07350410DD
 for <dev@dpdk.org>; Sat,  9 Jul 2022 10:27:54 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1657355274;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=+t3zyoAVyulm+oxGToIbp8mQkmVKr9Yx8cVuvMe/ENg=;
 b=UqRt2wZHMKMjbqXeGAVBXE4UF0rMMcMVdI6wwdqCFvKwqL5cFDIxjpK+QXdBlnLc84TxKa
 sOLUf/5kFT8R/RYy9KUVQKdbO4zwR3iOZyg1NAMQ3C9ZGY31GyBpSVkaf7PJwEKPEXuorq
 vE2i1Ozwy4TJurDFPj2PsQzVtO6yQC4=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-121-hNujy_cyNQyBom5OhrnHfg-1; Sat, 09 Jul 2022 04:27:52 -0400
X-MC-Unique: hNujy_cyNQyBom5OhrnHfg-1
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
 [10.11.54.4])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2042885A581;
 Sat,  9 Jul 2022 08:27:51 +0000 (UTC)
Received: from localhost.localdomain (unknown [10.40.192.194])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 315A32026D64;
 Sat,  9 Jul 2022 08:27:48 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Stephen Hemminger <sthemmin@microsoft.com>, Long Li <longli@microsoft.com>,
 Sunila Sahu <ssahu@marvell.com>, Fan Zhang <roy.fan.zhang@intel.com>,
 Ashish Gupta <ashish.gupta@marvell.com>, Gaetan Rivet <grive@u256.net>,
 Anatoly Burakov <anatoly.burakov@intel.com>,
 Akhil Goyal <gakhil@marvell.com>,
 Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
 Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,
 Dmitry Malloy <dmitrym@microsoft.com>,
 Pallavi Kadam <pallavi.kadam@intel.com>,
 Thomas Monjalon <thomas@monjalon.net>,
 Ferruh Yigit <ferruh.yigit@xilinx.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
 Reshma Pattan <reshma.pattan@intel.com>
Subject: [RFC v2 v2 09/29] bus: move IOVA definition from header
Date: Sat,  9 Jul 2022 10:26:24 +0200
Message-Id: <20220709082644.664675-10-david.marchand@redhat.com>
In-Reply-To: <20220709082644.664675-1-david.marchand@redhat.com>
References: <20220628144643.1213026-1-david.marchand@redhat.com>
 <20220709082644.664675-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"; x-default=true
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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