[v5,01/16] raw/ioat: only build if dmadev not present

Message ID 20210917152437.3270330-2-kevin.laatz@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series add dmadev driver for idxd devices |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing warning apply patch failure

Commit Message

Kevin Laatz Sept. 17, 2021, 3:24 p.m. UTC
  From: Bruce Richardson <bruce.richardson@intel.com>

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

A not 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>

---
v4:
  - Fix build issue
  - Add note in raw documentation to outline this change
---
 doc/guides/rawdevs/ioat.rst  |  7 +++++++
 drivers/meson.build          |  2 +-
 drivers/raw/ioat/meson.build | 23 ++++++++++++++++++++---
 3 files changed, 28 insertions(+), 4 deletions(-)
  

Comments

Bruce Richardson Sept. 20, 2021, 10:15 a.m. UTC | #1
On Fri, Sep 17, 2021 at 03:24:22PM +0000, Kevin Laatz wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Only build the rawdev IDXD/IOAT drivers if the dmadev drivers are not
> present.
> 
> A not is also added to the documentation to inform users of this change.

typo: "note"

It would also be worthwhile mentioning in the commit log that the order of
dependencies is changed so that dmadev comes before rawdev.

> 
> 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>
> 
> ---
> v4:
>   - Fix build issue
>   - Add note in raw documentation to outline this change
> ---
>  doc/guides/rawdevs/ioat.rst  |  7 +++++++
>  drivers/meson.build          |  2 +-
>  drivers/raw/ioat/meson.build | 23 ++++++++++++++++++++---
>  3 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/guides/rawdevs/ioat.rst b/doc/guides/rawdevs/ioat.rst
> index a28e909935..4fc327f1a4 100644
> --- a/doc/guides/rawdevs/ioat.rst
> +++ b/doc/guides/rawdevs/ioat.rst
> @@ -34,6 +34,13 @@ 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::
> +

Suggest where possible to split lines on punctuation. Put a line break
after the "." at the end of the first sentence. Similarly if breaking
lines, try and do so after commas.

> +                $ meson -Ddisable_drivers=dma/* <build_dir>
> +
>  Device Setup
>  -------------
>  
> diff --git a/drivers/meson.build b/drivers/meson.build
> index b7d680868a..27ff10a9fc 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -10,6 +10,7 @@ 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.
>          'crypto',         # depends on common, bus and mempool (net in future).
> @@ -18,7 +19,6 @@ subdirs = [
>          '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.
>  ]
>  

As stated above, I think the reason for this change should be noted in the
commit log.

>  if meson.is_cross_build()
> diff --git a/drivers/raw/ioat/meson.build b/drivers/raw/ioat/meson.build
> index 0e81cb5951..9be9d8cc65 100644
> --- a/drivers/raw/ioat/meson.build
> +++ b/drivers/raw/ioat/meson.build
> @@ -2,14 +2,31 @@
>  # 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
> +    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
>
  

Patch

diff --git a/doc/guides/rawdevs/ioat.rst b/doc/guides/rawdevs/ioat.rst
index a28e909935..4fc327f1a4 100644
--- a/doc/guides/rawdevs/ioat.rst
+++ b/doc/guides/rawdevs/ioat.rst
@@ -34,6 +34,13 @@  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..27ff10a9fc 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -10,6 +10,7 @@  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.
         'crypto',         # depends on common, bus and mempool (net in future).
@@ -18,7 +19,6 @@  subdirs = [
         '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..9be9d8cc65 100644
--- a/drivers/raw/ioat/meson.build
+++ b/drivers/raw/ioat/meson.build
@@ -2,14 +2,31 @@ 
 # 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
+    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',