[v2,2/2] common/mlx5: move Meson config initialization and check

Message ID 20221030082722.1333530-3-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series fix build disabling common/mlx5 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build fail github build: failed
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Thomas Monjalon Oct. 30, 2022, 8:27 a.m. UTC
  The variable mlx5_config may be used by other mlx5 drivers
and should be always initialized.
By moving its initialization (with configuration file generation),
it is made consistent for Linux and Windows builds.

And the check of mlx5_config in net/mlx5 is moved at the top of
net/mlx5/hws/meson.build so HWS requirements are in the right context.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/common/mlx5/linux/meson.build   | 2 --
 drivers/common/mlx5/meson.build         | 2 ++
 drivers/common/mlx5/windows/meson.build | 4 ----
 drivers/net/mlx5/hws/meson.build        | 4 ++++
 drivers/net/mlx5/meson.build            | 4 +---
 5 files changed, 7 insertions(+), 9 deletions(-)
  

Comments

Matan Azrad Oct. 30, 2022, 9:16 a.m. UTC | #1
> The variable mlx5_config may be used by other mlx5 drivers and should be
> always initialized.
> By moving its initialization (with configuration file generation), it is made
> consistent for Linux and Windows builds.
> 
> And the check of mlx5_config in net/mlx5 is moved at the top of
> net/mlx5/hws/meson.build so HWS requirements are in the right context.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Tested-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Matan Azrad <matan@nvidia.com>
  

Patch

diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build
index 84e2a1ad8c..2b57b299bd 100644
--- a/drivers/common/mlx5/linux/meson.build
+++ b/drivers/common/mlx5/linux/meson.build
@@ -8,7 +8,6 @@  dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen')
 LIB_GLUE_BASE = 'librte_common_mlx5_glue.so'
 LIB_GLUE_VERSION = abi_version
 LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
-mlx5_config = configuration_data()
 if dlopen_ibverbs
     dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1)
     cflags += [
@@ -232,7 +231,6 @@  foreach arg:has_member_args
     file_prefix = '#include <' + arg[1] + '>'
     mlx5_config.set(arg[0], cc.has_member(arg[2], arg[3], prefix : file_prefix, dependencies: libs))
 endforeach
-configure_file(output : 'mlx5_autoconf.h', configuration : mlx5_config)
 
 # Build Glue Library
 if dlopen_ibverbs
diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build
index 6ddbde7e8f..d7ca21d2cf 100644
--- a/drivers/common/mlx5/meson.build
+++ b/drivers/common/mlx5/meson.build
@@ -37,4 +37,6 @@  else
     cflags += [ '-UPEDANTIC' ]
 endif
 
+mlx5_config = configuration_data()
 subdir(exec_env)
+configure_file(output : 'mlx5_autoconf.h', configuration : mlx5_config)
diff --git a/drivers/common/mlx5/windows/meson.build b/drivers/common/mlx5/windows/meson.build
index edbbaa9ae1..cc486014a8 100644
--- a/drivers/common/mlx5/windows/meson.build
+++ b/drivers/common/mlx5/windows/meson.build
@@ -39,7 +39,3 @@  if get_option('buildtype').contains('debug')
 else
     cflags += [ '-UPEDANTIC' ]
 endif
-
-# Generate an empty mlx5_autoconf.h file for compatibility with Linux
-config = configuration_data()
-configure_file(output : 'mlx5_autoconf.h', configuration : config)
diff --git a/drivers/net/mlx5/hws/meson.build b/drivers/net/mlx5/hws/meson.build
index d2bb864fd2..38776d5163 100644
--- a/drivers/net/mlx5/hws/meson.build
+++ b/drivers/net/mlx5/hws/meson.build
@@ -1,6 +1,10 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright (c) 2022 NVIDIA Corporation & Affiliates
 
+if not (is_linux and mlx5_config.get('HAVE_IBV_FLOW_DV_SUPPORT', false))
+    subdir_done()
+endif
+
 includes += include_directories('.')
 sources += files(
         'mlx5dr_context.c',
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index fa15158039..f1aab18f82 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -78,6 +78,4 @@  testpmd_sources += files('mlx5_testpmd.c')
 
 subdir(exec_env)
 
-if (is_linux and mlx5_config.get('HAVE_IBV_FLOW_DV_SUPPORT', false))
-    subdir('hws')
-endif
+subdir('hws')