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 0CC95A0C43;
	Mon, 18 Oct 2021 14:28:32 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id E6178410EF;
	Mon, 18 Oct 2021 14:28:27 +0200 (CEST)
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by mails.dpdk.org (Postfix) with ESMTP id 4ED83410E4
 for <dev@dpdk.org>; Mon, 18 Oct 2021 14:28:26 +0200 (CEST)
X-IronPort-AV: E=McAfee;i="6200,9189,10140"; a="215401527"
X-IronPort-AV: E=Sophos;i="5.85,382,1624345200"; d="scan'208";a="215401527"
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 18 Oct 2021 05:28:25 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.85,382,1624345200"; d="scan'208";a="493562406"
Received: from silpixa00401122.ir.intel.com ([10.55.128.10])
 by orsmga008.jf.intel.com with ESMTP; 18 Oct 2021 05:28:22 -0700
From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com, fengchengwen@huawei.com,
 jerinj@marvell.com, conor.walsh@intel.com,
 Kevin Laatz <kevin.laatz@intel.com>
Date: Mon, 18 Oct 2021 12:28:03 +0000
Message-Id: <20211018122818.1579942-2-kevin.laatz@intel.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211018122818.1579942-1-kevin.laatz@intel.com>
References: <20210827172048.558704-1-kevin.laatz@intel.com>
 <20211018122818.1579942-1-kevin.laatz@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v8 01/16] raw/ioat: only build if dmadev not
 present
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
Sender: "dev" <dev-bounces@dpdk.org>

From: Bruce Richardson <bruce.richardson@intel.com>

Only build the rawdev IDXD/IOAT drivers if the dmadev drivers are not
present.

This change requires the dependencies to be reordered in
drivers/meson.build so that rawdev can use the "RTE_DMA_* build macros to
check for the presence of the equivalent dmadev driver.

A note is also added to the documentation to inform users of this change.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
---
 doc/guides/rawdevs/ioat.rst  |  8 ++++++++
 drivers/meson.build          |  4 ++--
 drivers/raw/ioat/meson.build | 24 +++++++++++++++++++++---
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/doc/guides/rawdevs/ioat.rst b/doc/guides/rawdevs/ioat.rst
index a28e909935..a65530bd30 100644
--- a/doc/guides/rawdevs/ioat.rst
+++ b/doc/guides/rawdevs/ioat.rst
@@ -34,6 +34,14 @@ Compilation
 For builds using ``meson`` and ``ninja``, the driver will be built when the target platform is x86-based.
 No additional compilation steps are necessary.
 
+.. note::
+        Since the addition of the dmadev library, the ``ioat`` and ``idxd`` parts of this driver
+        will only be built if their ``dmadev`` counterparts are not built.
+        The following can be used to disable the ``dmadev`` drivers,
+        if the raw drivers are to be used instead::
+
+                $ meson -Ddisable_drivers=dma/* <build_dir>
+
 Device Setup
 -------------
 
diff --git a/drivers/meson.build b/drivers/meson.build
index b7d680868a..34c0276487 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -10,15 +10,15 @@ subdirs = [
         'common/qat',     # depends on bus.
         'common/sfc_efx', # depends on bus.
         'mempool',        # depends on common and bus.
+        'dma',            # depends on common and bus.
         'net',            # depends on common, bus, mempool
-        'raw',            # depends on common, bus and net.
+        'raw',            # depends on common, bus, dma and net.
         'crypto',         # depends on common, bus and mempool (net in future).
         'compress',       # depends on common, bus, mempool.
         'regex',          # depends on common, bus, regexdev.
         'vdpa',           # depends on common, bus and mempool.
         'event',          # depends on common, bus, mempool and net.
         'baseband',       # depends on common and bus.
-        'dma',            # depends on common and bus.
 ]
 
 if meson.is_cross_build()
diff --git a/drivers/raw/ioat/meson.build b/drivers/raw/ioat/meson.build
index 0e81cb5951..1b866aab74 100644
--- a/drivers/raw/ioat/meson.build
+++ b/drivers/raw/ioat/meson.build
@@ -2,14 +2,32 @@
 # Copyright 2019 Intel Corporation
 
 build = dpdk_conf.has('RTE_ARCH_X86')
+# only use ioat rawdev driver if we don't have the equivalent dmadev ones
+if dpdk_conf.has('RTE_DMA_IDXD') and dpdk_conf.has('RTE_DMA_IOAT')
+    build = false
+    reason = 'replaced by dmadev drivers'
+    subdir_done()
+endif
+
 reason = 'only supported on x86'
 sources = files(
-        'idxd_bus.c',
-        'idxd_pci.c',
         'ioat_common.c',
-        'ioat_rawdev.c',
         'ioat_rawdev_test.c',
 )
+
+if not dpdk_conf.has('RTE_DMA_IDXD')
+    sources += files(
+            'idxd_bus.c',
+            'idxd_pci.c',
+    )
+endif
+
+if not dpdk_conf.has('RTE_DMA_IOAT')
+    sources += files (
+            'ioat_rawdev.c',
+    )
+endif
+
 deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
-- 
2.30.2