Skip to contentSkip to conversation

DPDK main build is broken for me in net/mlx5 if I disable common/mlx5

PATCH Superseded Andrew Rybchenko 6 participants 25 messages Oct 29, 2022 – Nov 14, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

Hi,

DPDK main build is broken for me in net/mlx5 if I disable common/mlx5

../src/drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

It worked for me before and net/mlx5 is not built since common driver is missing.

Andrew.

#1 lore raw

cover fix build disabling common/mlx5

Andrew reported a build failure when disabling mlx5 common driver. It is a blocker for -rc2 release.

While fixing the use of a variable across mlx5 drivers in first patch, the consistency of its use is improved in a second patch.

Thomas Monjalon (2):
net/mlx5: fix disabling common/mlx5 dependency common/mlx5: move Meson config initialization and check

 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            | 8 +++++---
 5 files changed, 11 insertions(+), 9 deletions(-)
Signature · 1 line
2.36.1
#2 lore raw

PATCH 1/2 net/mlx5: fix disabling common/mlx5 dependency

If the dependency common/mlx5 is explicitly disabled,
but net/mlx5 is not explictly disabled,
Meson will read the full recipe of net/mlx5
and will fail when accessing a variable from common/mlx5:
drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

The solution is to stop parsing net/mlx5 if common/mlx5 is disabled. The deps array must be defined before stopping, in order to automatically disable the build of net/mlx5 and print the reason.

Fixes 22681deead3e ("net/mlx5/hws: enable hardware steering")
---
 drivers/net/mlx5/meson.build | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/mlx5/meson.build +4 -0
index ff84448186..9a8eb0bc19 100644
@@ -9,6 +9,10 @@ if not (is_linux or is_windows)
 endif
 
 deps += ['hash', 'common_mlx5']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
 headers = files('rte_pmd_mlx5.h')
 sources = files(
         'mlx5.c',
Signature · 1 line
2.36.1
#3 lore raw

PATCH 2/2 common/mlx5: move Meson config initialization and check

In reply to Thomas Monjalon

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.

---
 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(-)
drivers/common/mlx5/linux/meson.build +0 -2
index 84e2a1ad8c..2b57b299bd 100644
@@ -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
drivers/common/mlx5/meson.build +2 -0
index 6ddbde7e8f..d7ca21d2cf 100644
@@ -37,4 +37,6 @@ else
     cflags += [ '-UPEDANTIC' ]
 endif
 
+mlx5_config = configuration_data()
 subdir(exec_env)
+configure_file(output : 'mlx5_autoconf.h', configuration : mlx5_config)
drivers/common/mlx5/windows/meson.build +0 -4
index edbbaa9ae1..cc486014a8 100644
@@ -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)
drivers/net/mlx5/hws/meson.build +4 -0
index d2bb864fd2..38776d5163 100644
@@ -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',
drivers/net/mlx5/meson.build +1 -3
index 9a8eb0bc19..66b23f5584 100644
@@ -77,6 +77,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')
Signature · 1 line
2.36.1
#4 lore raw

Re: [PATCH 0/2] fix build disabling common/mlx5

In reply to Thomas Monjalon
Quoted 10 lines · Thomas Monjalon

Andrew reported a build failure when disabling mlx5 common driver. It is a blocker for -rc2 release.

While fixing the use of a variable across mlx5 drivers in first patch, the consistency of its use is improved in a second patch.

Thomas Monjalon (2):
net/mlx5: fix disabling common/mlx5 dependency common/mlx5: move Meson config initialization and check

Quoted 7 lines
  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            | 8 +++++---
  5 files changed, 11 insertions(+), 9 deletions(-)

Many thanks, it solves my build problem:

#5 lore raw

v2 cover fix build disabling common/mlx5

In reply to Andrew Rybchenko

Andrew reported a build failure when disabling mlx5 common driver. It is a blocker for -rc2 release.

While fixing the use of a variable across mlx5 drivers in first patch, the consistency of its use is improved in a second patch.

v2: apply the same protection to other mlx5 drivers

Thomas Monjalon (2):
common/mlx5: fix build disabling
common/mlx5: move Meson config initialization and check

 drivers/common/mlx5/linux/meson.build   | 2 --
 drivers/common/mlx5/meson.build         | 2 ++
 drivers/common/mlx5/windows/meson.build | 4 ----
 drivers/compress/mlx5/meson.build       | 5 +++++
 drivers/crypto/mlx5/meson.build         | 5 +++++
 drivers/net/mlx5/hws/meson.build        | 4 ++++
 drivers/net/mlx5/meson.build            | 9 ++++++---
 drivers/regex/mlx5/meson.build          | 5 +++++
 drivers/vdpa/mlx5/meson.build           | 5 +++++
 9 files changed, 32 insertions(+), 9 deletions(-)
Signature · 1 line
2.36.1
#6 lore raw

PATCH v2 1/2 common/mlx5: fix build disabling

If the dependency common/mlx5 is explicitly disabled,
but net/mlx5 is not explicitly disabled,
Meson will read the full recipe of net/mlx5
and will fail when accessing a variable from common/mlx5:
drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

The solution is to stop parsing net/mlx5 if common/mlx5 is disabled. The deps array must be defined before stopping, in order to automatically disable the build of net/mlx5 and print the reason.

The same protection is applied to other mlx5 drivers, so it will allow using the variable mlx5_config in future.

Fixes 22681deead3e ("net/mlx5/hws: enable hardware steering")
---
 drivers/compress/mlx5/meson.build | 5 +++++
 drivers/crypto/mlx5/meson.build   | 5 +++++
 drivers/net/mlx5/meson.build      | 5 +++++
 drivers/regex/mlx5/meson.build    | 5 +++++
 drivers/vdpa/mlx5/meson.build     | 5 +++++
 5 files changed, 25 insertions(+)
drivers/compress/mlx5/meson.build +5 -0
index 7aac329986..49ce3aff46 100644
@@ -9,6 +9,11 @@ endif
 
 fmt_name = 'mlx5_compress'
 deps += ['common_mlx5', 'eal', 'compressdev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_compress.c',
 )
drivers/crypto/mlx5/meson.build +5 -0
index 9d9c9c00bc..7521c4c671 100644
@@ -9,6 +9,11 @@ endif
 
 fmt_name = 'mlx5_crypto'
 deps += ['common_mlx5', 'eal', 'cryptodev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_crypto.c',
         'mlx5_crypto_dek.c',
drivers/net/mlx5/meson.build +5 -0
index ff84448186..fa15158039 100644
@@ -9,6 +9,11 @@ if not (is_linux or is_windows)
 endif
 
 deps += ['hash', 'common_mlx5']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 headers = files('rte_pmd_mlx5.h')
 sources = files(
         'mlx5.c',
drivers/regex/mlx5/meson.build +5 -0
index e553dcb83d..70edc5b6da 100644
@@ -8,6 +8,11 @@ if not is_linux
 endif
 
 deps += ['common_mlx5', 'eal', 'regexdev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_regex.c',
         'mlx5_rxp.c',
drivers/vdpa/mlx5/meson.build +5 -0
index 9d8dbb1a82..54a4eac6f4 100644
@@ -8,6 +8,11 @@ if not is_linux
 endif
 
 deps += ['hash', 'common_mlx5', 'vhost', 'pci', 'eal', 'sched']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_vdpa.c',
         'mlx5_vdpa_mem.c',
Signature · 1 line
2.36.1
Acked-by on v2 1/2
#7 lore raw

RE: [PATCH v2 1/2] common/mlx5: fix build disabling

Quoted 12 lines

If the dependency common/mlx5 is explicitly disabled, but net/mlx5 is not explicitly disabled, Meson will read the full recipe of net/mlx5 and will fail when accessing a variable from common/mlx5:
drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

The solution is to stop parsing net/mlx5 if common/mlx5 is disabled. The deps array must be defined before stopping, in order to automatically disable the build of net/mlx5 and print the reason.

Quoted 8 lines

The same protection is applied to other mlx5 drivers, so it will allow using the variable mlx5_config in future.

Fixes 22681deead3e ("net/mlx5/hws: enable hardware steering")
#8 lore raw

Re: [PATCH v2 1/2] common/mlx5: fix build disabling

In reply to Thomas Monjalon
Quoted 31 lines · Thomas Monjalon

If the dependency common/mlx5 is explicitly disabled,
but net/mlx5 is not explicitly disabled,
Meson will read the full recipe of net/mlx5
and will fail when accessing a variable from common/mlx5:
drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

The solution is to stop parsing net/mlx5 if common/mlx5 is disabled. The deps array must be defined before stopping, in order to automatically disable the build of net/mlx5 and print the reason.

The same protection is applied to other mlx5 drivers, so it will allow using the variable mlx5_config in future.

Fixes 22681deead3e ("net/mlx5/hws: enable hardware steering")
---
 drivers/compress/mlx5/meson.build | 5 +++++
 drivers/crypto/mlx5/meson.build   | 5 +++++
 drivers/net/mlx5/meson.build      | 5 +++++
 drivers/regex/mlx5/meson.build    | 5 +++++
 drivers/vdpa/mlx5/meson.build     | 5 +++++
 5 files changed, 25 insertions(+)
drivers/compress/mlx5/meson.build +0 -0
index 7aac329986..49ce3aff46 100644

drivers/compress/mlx5/meson.build endif · line 12

Quoted 4 lines
drivers/compress/mlx5/meson.build +1 -0
@@ -9,6 +9,11 @@ endif
 
 fmt_name = 'mlx5_compress'
 deps += ['common_mlx5', 'eal', 'compressdev']
+if not ('mlx5' in common_drivers)

While this is fine as-is, I think the more usual way for checking the presence of a component in DPDK is to check dpdk_conf. In this case the check would be "if not dpdk_conf.has('RTE_COMMON_MLX5')". You may want to consider using that for consistency.

/Bruce

#9 lore raw

Re: [PATCH v2 1/2] common/mlx5: fix build disabling

02/11/2022 13:10, Bruce Richardson:

Quoted 33 lines · Thomas Monjalon
Quoted 32 lines

If the dependency common/mlx5 is explicitly disabled,
but net/mlx5 is not explicitly disabled,
Meson will read the full recipe of net/mlx5
and will fail when accessing a variable from common/mlx5:
drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

The solution is to stop parsing net/mlx5 if common/mlx5 is disabled. The deps array must be defined before stopping, in order to automatically disable the build of net/mlx5 and print the reason.

The same protection is applied to other mlx5 drivers, so it will allow using the variable mlx5_config in future.

Fixes 22681deead3e ("net/mlx5/hws: enable hardware steering")
---
 drivers/compress/mlx5/meson.build | 5 +++++
 drivers/crypto/mlx5/meson.build   | 5 +++++
 drivers/net/mlx5/meson.build      | 5 +++++
 drivers/regex/mlx5/meson.build    | 5 +++++
 drivers/vdpa/mlx5/meson.build     | 5 +++++
 5 files changed, 25 insertions(+)
drivers/compress/mlx5/meson.build +0 -0
index 7aac329986..49ce3aff46 100644
@@ -9,6 +9,11 @@ endif
 
Quoted 8 lines

drivers/compress/mlx5/meson.build endif · line 12

Quoted 3 lines
drivers/compress/mlx5/meson.build +1 -0
 fmt_name = 'mlx5_compress'
 deps += ['common_mlx5', 'eal', 'compressdev']
+if not ('mlx5' in common_drivers)

While this is fine as-is, I think the more usual way for checking the presence of a component in DPDK is to check dpdk_conf. In this case the check would be "if not dpdk_conf.has('RTE_COMMON_MLX5')". You may want to consider using that for consistency.

Yes, I've forgotten this:

	lib_name = '_'.join(['rte', class, name])
	dpdk_conf.set(lib_name.to_upper(), 1)

Then what is the usage of this?

set_variable(class + '_drivers', enabled_drivers)

#10 lore raw

Re: [PATCH v2 1/2] common/mlx5: fix build disabling

Quoted 43 lines · Thomas Monjalon

02/11/2022 13:10, Bruce Richardson:

Quoted 33 lines · Thomas Monjalon
Quoted 32 lines

If the dependency common/mlx5 is explicitly disabled,
but net/mlx5 is not explicitly disabled,
Meson will read the full recipe of net/mlx5
and will fail when accessing a variable from common/mlx5:
drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

The solution is to stop parsing net/mlx5 if common/mlx5 is disabled. The deps array must be defined before stopping, in order to automatically disable the build of net/mlx5 and print the reason.

The same protection is applied to other mlx5 drivers, so it will allow using the variable mlx5_config in future.

Fixes 22681deead3e ("net/mlx5/hws: enable hardware steering")
---
 drivers/compress/mlx5/meson.build | 5 +++++
 drivers/crypto/mlx5/meson.build   | 5 +++++
 drivers/net/mlx5/meson.build      | 5 +++++
 drivers/regex/mlx5/meson.build    | 5 +++++
 drivers/vdpa/mlx5/meson.build     | 5 +++++
 5 files changed, 25 insertions(+)
drivers/compress/mlx5/meson.build +0 -0
index 7aac329986..49ce3aff46 100644
@@ -9,6 +9,11 @@ endif
 
Quoted 8 lines

drivers/compress/mlx5/meson.build endif · line 12

Quoted 3 lines
drivers/compress/mlx5/meson.build +1 -0
 fmt_name = 'mlx5_compress'
 deps += ['common_mlx5', 'eal', 'compressdev']
+if not ('mlx5' in common_drivers)

While this is fine as-is, I think the more usual way for checking the presence of a component in DPDK is to check dpdk_conf. In this case the check would be "if not dpdk_conf.has('RTE_COMMON_MLX5')". You may want to consider using that for consistency.

Quoted 9 lines

Yes, I've forgotten this:

	lib_name = '_'.join(['rte', class, name])
	dpdk_conf.set(lib_name.to_upper(), 1)

Then what is the usage of this?

set_variable(class + '_drivers', enabled_drivers)

That is used for the summary printout at the end, so we can list the drivers enabled.

The approach using the common_drivers works fine for this patch, so let's keep it, since it's merged. I was just pointing out the other approach for consistency sake.

/Bruce

#11 lore raw

Re: [PATCH v2 1/2] common/mlx5: fix build disabling

02/11/2022 14:14, Bruce Richardson:

Quoted 17 lines · Thomas Monjalon
Quoted 16 lines

02/11/2022 13:10, Bruce Richardson:

Quoted 7 lines · Thomas Monjalon
Quoted 1 line

+if not ('mlx5' in common_drivers)

While this is fine as-is, I think the more usual way for checking the presence of a component in DPDK is to check dpdk_conf. In this case the check would be "if not dpdk_conf.has('RTE_COMMON_MLX5')". You may want to consider using that for consistency.

Yes, I've forgotten this:

	lib_name = '_'.join(['rte', class, name])
	dpdk_conf.set(lib_name.to_upper(), 1)

Then what is the usage of this?

Quoted 8 lines
Quoted 2 lines

set_variable(class + '_drivers', enabled_drivers)

That is used for the summary printout at the end, so we can list the drivers enabled.

The approach using the common_drivers works fine for this patch, so let's keep it, since it's merged. I was just pointing out the other approach for consistency sake.

I can send a patch for consistency.

#12 lore raw

PATCH 1/1 common/mlx5: use build configuration dictionary

In reply to Bruce Richardson

A recent commit added an explicit dependency check on common/mlx5. For consistency, query dpdk_conf instead of the list of common drivers. The lists *_drivers should be used only for printing.

Fixes 3df380f61797 ("common/mlx5: fix disabling build")
---
 drivers/compress/mlx5/meson.build | 2 +-
 drivers/crypto/mlx5/meson.build   | 2 +-
 drivers/net/mlx5/meson.build      | 2 +-
 drivers/regex/mlx5/meson.build    | 2 +-
 drivers/vdpa/mlx5/meson.build     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/compress/mlx5/meson.build +1 -1
index 49ce3aff46..df4f79fa7e 100644
@@ -9,7 +9,7 @@ endif
 
 fmt_name = 'mlx5_compress'
 deps += ['common_mlx5', 'eal', 'compressdev']
-if not ('mlx5' in common_drivers)
+if not dpdk_conf.has('RTE_COMMON_MLX5')
     # avoid referencing undefined variables from common/mlx5
     subdir_done()
 endif
drivers/crypto/mlx5/meson.build +1 -1
index 7521c4c671..7e32095695 100644
@@ -9,7 +9,7 @@ endif
 
 fmt_name = 'mlx5_crypto'
 deps += ['common_mlx5', 'eal', 'cryptodev']
-if not ('mlx5' in common_drivers)
+if not dpdk_conf.has('RTE_COMMON_MLX5')
     # avoid referencing undefined variables from common/mlx5
     subdir_done()
 endif
drivers/net/mlx5/meson.build +1 -1
index f1aab18f82..abd507bd88 100644
@@ -9,7 +9,7 @@ if not (is_linux or is_windows)
 endif
 
 deps += ['hash', 'common_mlx5']
-if not ('mlx5' in common_drivers)
+if not dpdk_conf.has('RTE_COMMON_MLX5')
     # avoid referencing undefined variables from common/mlx5
     subdir_done()
 endif
drivers/regex/mlx5/meson.build +1 -1
index 70edc5b6da..87404101b9 100644
@@ -8,7 +8,7 @@ if not is_linux
 endif
 
 deps += ['common_mlx5', 'eal', 'regexdev']
-if not ('mlx5' in common_drivers)
+if not dpdk_conf.has('RTE_COMMON_MLX5')
     # avoid referencing undefined variables from common/mlx5
     subdir_done()
 endif
drivers/vdpa/mlx5/meson.build +1 -1
index 54a4eac6f4..e224d1bcc9 100644
@@ -8,7 +8,7 @@ if not is_linux
 endif
 
 deps += ['hash', 'common_mlx5', 'vhost', 'pci', 'eal', 'sched']
-if not ('mlx5' in common_drivers)
+if not dpdk_conf.has('RTE_COMMON_MLX5')
     # avoid referencing undefined variables from common/mlx5
     subdir_done()
 endif
Signature · 1 line
2.36.1
Acked-by on v1 1/1
#13 lore raw

Re: [PATCH] common/mlx5: use build configuration dictionary

Quoted 9 lines · Thomas Monjalon

A recent commit added an explicit dependency check on common/mlx5. For consistency, query dpdk_conf instead of the list of common drivers. The lists *_drivers should be used only for printing.

Fixes 3df380f61797 ("common/mlx5: fix disabling build")

---

Reviewed-by on v1 1/1
#14 lore raw

Re: [PATCH] common/mlx5: use build configuration dictionary

In reply to Thomas Monjalon
Quoted 9 lines · Thomas Monjalon

A recent commit added an explicit dependency check on common/mlx5. For consistency, query dpdk_conf instead of the list of common drivers. The lists *_drivers should be used only for printing.

Fixes 3df380f61797 ("common/mlx5: fix disabling build")
Signature · 1 line
David Marchand
Acked-by Bruce Richardson Applied
#15 lore raw

Re: [PATCH] common/mlx5: use build configuration dictionary

Quoted 12 lines · David Marchand
Quoted 9 lines · Thomas Monjalon

A recent commit added an explicit dependency check on common/mlx5. For consistency, query dpdk_conf instead of the list of common drivers. The lists *_drivers should be used only for printing.

Fixes 3df380f61797 ("common/mlx5: fix disabling build")
Quoted 1 line

Applied, thanks.

Signature · 1 line
David Marchand
#16 lore raw

PATCH v2 2/2 common/mlx5: move Meson config initialization and check

In reply to Thomas Monjalon

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.

---
 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(-)
drivers/common/mlx5/linux/meson.build +0 -2
index 84e2a1ad8c..2b57b299bd 100644
@@ -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
drivers/common/mlx5/meson.build +2 -0
index 6ddbde7e8f..d7ca21d2cf 100644
@@ -37,4 +37,6 @@ else
     cflags += [ '-UPEDANTIC' ]
 endif
 
+mlx5_config = configuration_data()
 subdir(exec_env)
+configure_file(output : 'mlx5_autoconf.h', configuration : mlx5_config)
drivers/common/mlx5/windows/meson.build +0 -4
index edbbaa9ae1..cc486014a8 100644
@@ -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)
drivers/net/mlx5/hws/meson.build +4 -0
index d2bb864fd2..38776d5163 100644
@@ -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',
drivers/net/mlx5/meson.build +1 -3
index fa15158039..f1aab18f82 100644
@@ -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')
Signature · 1 line
2.36.1
Acked-by on v2 2/2
#17 lore raw

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

Quoted 11 lines

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.

Reviewed-by on the v2 series
#18 lore raw

Re: [PATCH v2 0/2] fix build disabling common/mlx5

In reply to Thomas Monjalon
Quoted 13 lines · Thomas Monjalon

Andrew reported a build failure when disabling mlx5 common driver. It is a blocker for -rc2 release.

While fixing the use of a variable across mlx5 drivers in first patch, the consistency of its use is improved in a second patch.

v2: apply the same protection to other mlx5 drivers

Thomas Monjalon (2):
common/mlx5: fix build disabling
common/mlx5: move Meson config initialization and check

Quoted 10 lines
 drivers/common/mlx5/linux/meson.build   | 2 --
 drivers/common/mlx5/meson.build         | 2 ++
 drivers/common/mlx5/windows/meson.build | 4 ----
 drivers/compress/mlx5/meson.build       | 5 +++++
 drivers/crypto/mlx5/meson.build         | 5 +++++
 drivers/net/mlx5/hws/meson.build        | 4 ++++
 drivers/net/mlx5/meson.build            | 9 ++++++---
 drivers/regex/mlx5/meson.build          | 5 +++++
 drivers/vdpa/mlx5/meson.build           | 5 +++++
 9 files changed, 32 insertions(+), 9 deletions(-)

For the series,

Signature · 1 line
David Marchand
#19 lore raw

v3 cover fix build disabling common/mlx5

In reply to Andrew Rybchenko

Andrew reported a build failure when disabling mlx5 common driver. It is a blocker for -rc2 release.

While fixing the use of a variable across mlx5 drivers in first patch, the consistency of its use is improved in a second patch.

v2: apply the same protection to other mlx5 drivers
v3: fix ibverbs_link=dlopen (include directory was missing)

Thomas Monjalon (2):
common/mlx5: fix build disabling
common/mlx5: move build config initialization and check

 drivers/common/mlx5/linux/meson.build   | 3 +--
 drivers/common/mlx5/meson.build         | 2 ++
 drivers/common/mlx5/windows/meson.build | 4 ----
 drivers/compress/mlx5/meson.build       | 5 +++++
 drivers/crypto/mlx5/meson.build         | 5 +++++
 drivers/net/mlx5/hws/meson.build        | 4 ++++
 drivers/net/mlx5/meson.build            | 9 ++++++---
 drivers/regex/mlx5/meson.build          | 5 +++++
 drivers/vdpa/mlx5/meson.build           | 5 +++++
 9 files changed, 33 insertions(+), 9 deletions(-)
Signature · 1 line
2.36.1
#20 lore raw

PATCH v3 1/2 common/mlx5: fix build disabling

If the dependency common/mlx5 is explicitly disabled,
but net/mlx5 is not explicitly disabled,
Meson will read the full recipe of net/mlx5
and will fail when accessing a variable from common/mlx5:
drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

The solution is to stop parsing net/mlx5 if common/mlx5 is disabled. The deps array must be defined before stopping, in order to automatically disable the build of net/mlx5 and print the reason.

The same protection is applied to other mlx5 drivers, so it will allow using the variable mlx5_config in future.

Fixes 22681deead3e ("net/mlx5/hws: enable hardware steering")
---
 drivers/compress/mlx5/meson.build | 5 +++++
 drivers/crypto/mlx5/meson.build   | 5 +++++
 drivers/net/mlx5/meson.build      | 5 +++++
 drivers/regex/mlx5/meson.build    | 5 +++++
 drivers/vdpa/mlx5/meson.build     | 5 +++++
 5 files changed, 25 insertions(+)
drivers/compress/mlx5/meson.build +5 -0
index 7aac329986..49ce3aff46 100644
@@ -9,6 +9,11 @@ endif
 
 fmt_name = 'mlx5_compress'
 deps += ['common_mlx5', 'eal', 'compressdev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_compress.c',
 )
drivers/crypto/mlx5/meson.build +5 -0
index 9d9c9c00bc..7521c4c671 100644
@@ -9,6 +9,11 @@ endif
 
 fmt_name = 'mlx5_crypto'
 deps += ['common_mlx5', 'eal', 'cryptodev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_crypto.c',
         'mlx5_crypto_dek.c',
drivers/net/mlx5/meson.build +5 -0
index ff84448186..fa15158039 100644
@@ -9,6 +9,11 @@ if not (is_linux or is_windows)
 endif
 
 deps += ['hash', 'common_mlx5']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 headers = files('rte_pmd_mlx5.h')
 sources = files(
         'mlx5.c',
drivers/regex/mlx5/meson.build +5 -0
index e553dcb83d..70edc5b6da 100644
@@ -8,6 +8,11 @@ if not is_linux
 endif
 
 deps += ['common_mlx5', 'eal', 'regexdev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_regex.c',
         'mlx5_rxp.c',
drivers/vdpa/mlx5/meson.build +5 -0
index 9d8dbb1a82..54a4eac6f4 100644
@@ -8,6 +8,11 @@ if not is_linux
 endif
 
 deps += ['hash', 'common_mlx5', 'vhost', 'pci', 'eal', 'sched']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_vdpa.c',
         'mlx5_vdpa_mem.c',
Signature · 1 line
2.36.1
Acked-by on v3 1/2
#21 lore raw

RE: [PATCH v3 1/2] common/mlx5: fix build disabling

Quoted 123 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Sunday, October 30, 2022 1:08 PM
To: [email protected]
Cc: Alex Vesker <[email protected]>; [email protected]; [email protected]; Raslan Darawsheh <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Fan Zhang <[email protected]>; Ashish Gupta <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>
Subject: [PATCH v3 1/2] common/mlx5: fix build disabling

If the dependency common/mlx5 is explicitly disabled, but net/mlx5 is not explicitly disabled, Meson will read the full recipe of net/mlx5 and will fail when accessing a variable from common/mlx5:
drivers/net/mlx5/meson.build:76:4: ERROR: Unknown variable "mlx5_config".

The solution is to stop parsing net/mlx5 if common/mlx5 is disabled. The deps array must be defined before stopping, in order to automatically disable the build of net/mlx5 and print the reason.

The same protection is applied to other mlx5 drivers, so it will allow using the variable mlx5_config in future.

Fixes 22681deead3e ("net/mlx5/hws: enable hardware steering")
---
 drivers/compress/mlx5/meson.build | 5 +++++
 drivers/crypto/mlx5/meson.build   | 5 +++++
 drivers/net/mlx5/meson.build      | 5 +++++
 drivers/regex/mlx5/meson.build    | 5 +++++
 drivers/vdpa/mlx5/meson.build     | 5 +++++
 5 files changed, 25 insertions(+)
drivers/compress/mlx5/meson.build +5 -0
index 7aac329986..49ce3aff46 100644
@@ -9,6 +9,11 @@ endif
 
 fmt_name = 'mlx5_compress'
 deps += ['common_mlx5', 'eal', 'compressdev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_compress.c',
 )
(quoted diff) +0 -0

b/drivers/crypto/mlx5/meson.build index 9d9c9c00bc..7521c4c671 100644

drivers/crypto/mlx5/meson.build +5 -0
@@ -9,6 +9,11 @@ endif
 
 fmt_name = 'mlx5_crypto'
 deps += ['common_mlx5', 'eal', 'cryptodev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_crypto.c',
         'mlx5_crypto_dek.c',
drivers/net/mlx5/meson.build +5 -0
index ff84448186..fa15158039 100644
@@ -9,6 +9,11 @@ if not (is_linux or is_windows)  endif
 
 deps += ['hash', 'common_mlx5']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 headers = files('rte_pmd_mlx5.h')
 sources = files(
         'mlx5.c',
(quoted diff) +0 -0

b/drivers/regex/mlx5/meson.build index e553dcb83d..70edc5b6da 100644

drivers/regex/mlx5/meson.build +5 -0
@@ -8,6 +8,11 @@ if not is_linux
 endif
 
 deps += ['common_mlx5', 'eal', 'regexdev']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_regex.c',
         'mlx5_rxp.c',
(quoted diff) +0 -0

b/drivers/vdpa/mlx5/meson.build index 9d8dbb1a82..54a4eac6f4 100644

drivers/vdpa/mlx5/meson.build +5 -1
@@ -8,6 +8,11 @@ if not is_linux
 endif
 
 deps += ['hash', 'common_mlx5', 'vhost', 'pci', 'eal', 'sched']
+if not ('mlx5' in common_drivers)
+    # avoid referencing undefined variables from common/mlx5
+    subdir_done()
+endif
+
 sources = files(
         'mlx5_vdpa.c',
         'mlx5_vdpa_mem.c',
--
Quoted 1 line

2.36.1

#22 lore raw

PATCH v3 2/2 common/mlx5: move build config initialization and check

In reply to Thomas Monjalon

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.

---
 drivers/common/mlx5/linux/meson.build   | 3 +--
 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, 8 insertions(+), 9 deletions(-)
drivers/common/mlx5/linux/meson.build +1 -2
index 84e2a1ad8c..7e1575efc8 100644
@@ -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
@@ -243,6 +241,7 @@ if dlopen_ibverbs
     dlopen_install_dir = [ eal_pmd_path + '-glue' ]
     dlopen_includes = [global_inc]
     dlopen_includes += include_directories('../../../../lib/eal/include/generic')
+    dlopen_includes += include_directories('..')
     shared_lib = shared_library(
             dlopen_lib_name,
             dlopen_sources,
drivers/common/mlx5/meson.build +2 -0
index 6ddbde7e8f..60ccd95cbc 100644
@@ -37,4 +37,6 @@ else
     cflags += [ '-UPEDANTIC' ]
 endif
 
+mlx5_config = configuration_data()
 subdir(exec_env)
+configure_file(output: 'mlx5_autoconf.h', configuration: mlx5_config)
drivers/common/mlx5/windows/meson.build +0 -4
index edbbaa9ae1..cc486014a8 100644
@@ -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)
drivers/net/mlx5/hws/meson.build +4 -0
index d2bb864fd2..38776d5163 100644
@@ -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',
drivers/net/mlx5/meson.build +1 -3
index fa15158039..f1aab18f82 100644
@@ -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')
Signature · 1 line
2.36.1
Acked-by on v3 2/2
#23 lore raw

RE: [PATCH v3 2/2] common/mlx5: move build config initialization and check

Quoted 114 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Sunday, October 30, 2022 1:08 PM
To: [email protected]
Cc: Alex Vesker <[email protected]>; [email protected]; [email protected]; Raslan Darawsheh <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH v3 2/2] common/mlx5: move build config initialization and check

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.

---
 drivers/common/mlx5/linux/meson.build   | 3 +--
 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, 8 insertions(+), 9 deletions(-)
drivers/common/mlx5/linux/meson.build +0 -0
index 84e2a1ad8c..7e1575efc8 100644
@@ -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 += [
drivers/common/mlx5/linux/meson.build +1 -0
@@ -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
@@ -243,6 +241,7 @@ if dlopen_ibverbs
     dlopen_install_dir = [ eal_pmd_path + '-glue' ]
     dlopen_includes = [global_inc]
     dlopen_includes += include_directories('../../../../lib/eal/include/generic')
+    dlopen_includes += include_directories('..')
     shared_lib = shared_library(
             dlopen_lib_name,
             dlopen_sources,
(quoted diff) +0 -0

b/drivers/common/mlx5/meson.build index 6ddbde7e8f..60ccd95cbc 100644

drivers/common/mlx5/meson.build +2 -0
@@ -37,4 +37,6 @@ else
     cflags += [ '-UPEDANTIC' ]
 endif
 
+mlx5_config = configuration_data()
 subdir(exec_env)
+configure_file(output: 'mlx5_autoconf.h', configuration: mlx5_config)
drivers/common/mlx5/windows/meson.build +0 -2
index edbbaa9ae1..cc486014a8 100644
@@ -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

drivers/net/mlx5/hws/meson.build +0 -0
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright (c) 2022 NVIDIA

Corporation & Affiliates

drivers/net/mlx5/hws/meson.build +4 -0
+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',
drivers/net/mlx5/meson.build +1 -4
index fa15158039..f1aab18f82 100644
@@ -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')
--
Quoted 1 line

2.36.1

#24 lore raw

Re: [PATCH v3 0/2] fix build disabling common/mlx5

In reply to Thomas Monjalon

30/10/2022 12:08, Thomas Monjalon:

Quoted 6 lines

Andrew reported a build failure when disabling mlx5 common driver. It is a blocker for -rc2 release.

While fixing the use of a variable across mlx5 drivers in first patch, the consistency of its use is improved in a second patch.

Quoted 6 lines

v2: apply the same protection to other mlx5 drivers
v3: fix ibverbs_link=dlopen (include directory was missing)

Thomas Monjalon (2):
common/mlx5: fix build disabling
common/mlx5: move build config initialization and check

Applied

There is a CI error with Fedora 35 but it seems unrelated.