DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option
@ 2018-08-27 11:10 Nelio Laranjeiro
  2018-08-27 11:10 ` [dpdk-dev] [PATCH 2/2] net/mlx: add meson build support Nelio Laranjeiro
  2018-08-27 11:24 ` [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Bruce Richardson
  0 siblings, 2 replies; 26+ messages in thread
From: Nelio Laranjeiro @ 2018-08-27 11:10 UTC (permalink / raw)
  To: dev, Yongseok Koh, Shahaf Shuler, Bruce Richardson

Almost equivalent to the make system build which uses those options
through environment variables (EXTRA_{CFLAGS,LDFLAGS}).

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/meson.build | 2 +-
 meson_options.txt   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index f94e2fe67..008aac62c 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -11,7 +11,7 @@ driver_classes = ['common',
 	       'event',   # depends on common, bus, mempool and net.
 	       'raw']     # depends on common, bus, mempool, net and event.
 
-default_cflags = machine_args
+default_cflags = machine_args + [get_option('extra_cflags'), get_option('extra_ldflags')]
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
diff --git a/meson_options.txt b/meson_options.txt
index c84327858..da6373a2c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,3 +22,5 @@ option('use_hpet', type: 'boolean', value: false,
 	description: 'use HPET timer in EAL')
 option('tests', type: 'boolean', value: true,
 	description: 'build unit tests')
+option('extra_cflags', type: 'string', description: 'Extra compiler flags')
+option('extra_ldflags', type: 'string', description: 'Extra linker flags')
-- 
2.18.0

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH 2/2] net/mlx: add meson build support
  2018-08-27 11:10 [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Nelio Laranjeiro
@ 2018-08-27 11:10 ` Nelio Laranjeiro
  2018-08-27 11:24 ` [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Bruce Richardson
  1 sibling, 0 replies; 26+ messages in thread
From: Nelio Laranjeiro @ 2018-08-27 11:10 UTC (permalink / raw)
  To: dev, Yongseok Koh, Shahaf Shuler, Bruce Richardson

Adds a configuration item to enable those drivers and also to configure
it in 'glue mode'.  Option driver_mlx{4,5}_glue_enable will enable its
compilation with the creation for the
librte_pmd_mlx{4,5}_glue.so.xx.yy.z library whereas driver_mlx5_enable
will configure the compilation without this glue library.
driver_mlx{4,5}_glue_enable overrides driver_mlx{4,5}_enable meson's
option.

To avoid modifying the whole sources and keep the compatibility with
current build systems, the mlx{4,5}_autoconf.h is still generated by
invoking DPDK scripts though meson's run_command() instead of using
has_types, has_members, ... commands.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/meson.build      |   2 +
 drivers/net/mlx4/meson.build | 109 +++++++
 drivers/net/mlx5/meson.build | 561 +++++++++++++++++++++++++++++++++++
 meson_options.txt            |   8 +
 4 files changed, 680 insertions(+)
 create mode 100644 drivers/net/mlx4/meson.build
 create mode 100644 drivers/net/mlx5/meson.build

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 9c28ed4da..c7a2d0e7d 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -18,6 +18,8 @@ drivers = ['af_packet',
 	'ixgbe',
 	'kni',
 	'liquidio',
+	'mlx4',
+	'mlx5',
 	'mvpp2',
 	'netvsc',
 	'nfp',
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
new file mode 100644
index 000000000..ccaf03433
--- /dev/null
+++ b/drivers/net/mlx4/meson.build
@@ -0,0 +1,109 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+# As there is no more configuration file to activate/configure the PMD it will
+# use some variables here to configure it.
+pmd_dlopen = get_option('enable_driver_mlx4_glue')
+build = get_option('enable_driver_mlx4') or pmd_dlopen
+# dpdk_conf.set('RTE_LIBRTE_MLX4_DEBUG', 1)
+# Glue configuratin
+LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
+LIB_GLUE_VERSION = '18.02.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+                '-ldl',
+        ]
+endif
+# Compile PMD
+if build
+        allow_experimental_apis = true
+        ext_deps += [ cc.find_library('mnl') ]
+        # Search for ibverbs and mlx4 library.
+        # note: meson find_library accept directories arrays but they must be
+        # stripped i.e. no extra space.
+        flags = get_option('extra_ldflags')
+        libs_dir = []
+        foreach flag:flags.split('-L')
+                flag = flag.strip()
+                if flag != ''
+                        libs_dir += [ flag.strip() ]
+                endif
+        endforeach
+        foreach libname:['ibverbs', 'mlx4']
+                lib = cc.find_library(libname, dirs:libs_dir, required:false)
+                if not lib.found()
+                        lib = cc.find_library(libname, required:true)
+                endif
+                ext_deps += [ lib ]
+        endforeach
+        sources = files(
+               'mlx4.c',
+               'mlx4_ethdev.c',
+               'mlx4_flow.c',
+               'mlx4_intr.c',
+               'mlx4_mr.c',
+               'mlx4_rxq.c',
+               'mlx4_rxtx.c',
+               'mlx4_txq.c',
+               'mlx4_utils.c',
+        )
+        if not pmd_dlopen
+                sources += files('mlx4_glue.c')
+        endif
+        cflags += [
+               '-O3',
+               '-Wall',
+               '-Wextra',
+               '-g',
+               '-std=c11',
+               '-I.',
+               '-D_BSD_SOURCE',
+               '-D_DEFAULT_SOURCE',
+               '-D_XOPEN_SOURCE=600',
+               '-Wno-strict-prototypes',
+        ]
+        if dpdk_conf.has('RTE_LIBRTE_MLX4_DEBUG')
+                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+        else
+                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+        endif
+        # To maintain the compatibility with the make build system
+        # mlx4_autoconf.h file is still generated.
+        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                        'mlx4_autoconf.h',
+                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
+                        'infiniband/mlx4dv.h',
+                        'type', 'struct mlx4_wqe_lso_seg')
+        if r.returncode() != 0
+                error('autoconfiguration fail')
+        endif
+endif
+# Build Glue Library
+if pmd_dlopen
+        dlopen_name = 'mlx4_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx4_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+               dlopen_lib_name,
+               dlopen_sources,
+               include_directories: global_inc,
+               c_args: cflags + [ get_option('extra_cflags') ],
+               link_args: [
+                       '-Wl,-export-dynamic',
+                       '-Wl,-h,@0@'.format(LIB_GLUE),
+                       flags,
+                       '-lmlx4',
+                       '-libverbs',
+                       ],
+               soversion: dlopen_so_version,
+               install: true,
+               install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
new file mode 100644
index 000000000..1124aab48
--- /dev/null
+++ b/drivers/net/mlx5/meson.build
@@ -0,0 +1,561 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+# As there is no more configuration file to activate/configure the PMD it will
+# use some variables here to configure it.
+pmd_dlopen = get_option('enable_driver_mlx5_glue')
+build = get_option('enable_driver_mlx5') or pmd_dlopen
+# dpdk_conf.set('RTE_LIBRTE_MLX5_DEBUG', 1)
+# Glue configuratin
+LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
+LIB_GLUE_VERSION = '18.05.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+                '-ldl',
+        ]
+endif
+# Compile PMD
+if build
+        allow_experimental_apis = true
+        ext_deps += [ cc.find_library('mnl') ]
+        # Search for ibverbs and mlx5 library.
+        # note: meson find_library accept directories arrays but they must be
+        # stripped i.e. no extra space.
+        flags = get_option('extra_ldflags')
+        libs_dir = []
+        foreach flag:flags.split('-L')
+                flag = flag.strip()
+                if flag != ''
+                        libs_dir += [ flag.strip() ]
+                endif
+        endforeach
+        foreach libname:['ibverbs', 'mlx5']
+                lib = cc.find_library(libname, dirs:libs_dir, required:false)
+                if not lib.found()
+                        lib = cc.find_library(libname, required:true)
+                endif
+                ext_deps += [ lib ]
+        endforeach
+        ext_deps += [ lib ]
+        sources = files(
+                'mlx5.c',
+                'mlx5_ethdev.c',
+                'mlx5_flow.c',
+                'mlx5_mac.c',
+                'mlx5_mr.c',
+                'mlx5_nl.c',
+                'mlx5_nl_flow.c',
+                'mlx5_rss.c',
+                'mlx5_rxmode.c',
+                'mlx5_rxq.c',
+                'mlx5_rxtx.c',
+                'mlx5_socket.c',
+                'mlx5_stats.c',
+                'mlx5_trigger.c',
+                'mlx5_txq.c',
+                'mlx5_vlan.c',
+        )
+        if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
+                sources += files('mlx5_rxtx_vec.c')
+        endif
+        if not pmd_dlopen
+                sources += files('mlx5_glue.c')
+        endif
+        cflags += [
+               '-O3',
+               '-Wall',
+               '-Wextra',
+               '-g',
+               '-std=c11',
+               '-I.',
+               '-D_BSD_SOURCE',
+               '-D_DEFAULT_SOURCE',
+               '-D_XOPEN_SOURCE=600',
+               '-Wno-strict-prototypes',
+       ]
+       if dpdk_conf.has('RTE_LIBRTE_MLX5_DEBUG')
+               cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+       else
+               cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+       endif
+       # To maintain the compatibility with the make build system
+       # mlx5_autoconf.h file is still generated.
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT',
+                       'infiniband/mlx5dv.h',
+                       'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_DEVICE_TUNNEL_SUPPORT',
+                       'infiniband/mlx5dv.h',
+                       'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_DEVICE_MPLS_SUPPORT',
+                       'infiniband/verbs.h',
+                       'enum', 'IBV_FLOW_SPEC_MPLS')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_WQ_FLAG_RX_END_PADDING',
+                       'infiniband/verbs.h',
+                       'enum', 'IBV_WQ_FLAG_RX_END_PADDING')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_MLX5_MOD_SWP',
+                       'infiniband/mlx5dv.h',
+                       'type', 'struct mlx5dv_sw_parsing_caps')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_MLX5_MOD_MPW',
+                       'infiniband/mlx5dv.h',
+                       'enum', 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_MLX5_MOD_CQE_128B_COMP',
+                       'infiniband/mlx5dv.h',
+                       'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_ETHTOOL_LINK_MODE_25G',
+                       '/usr/include/linux/ethtool.h',
+                       'enum', 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_ETHTOOL_LINK_MODE_50G',
+                       '/usr/include/linux/ethtool.h',
+                       'enum', 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_ETHTOOL_LINK_MODE_100G',
+                       '/usr/include/linux/ethtool.h',
+                       'enum', 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT',
+                       'infiniband/verbs.h',
+                       'type', 'struct ibv_counter_set_init_attr')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NL_NLDEV',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NL_NLDEV')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_CMD_GET',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_CMD_GET')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_CMD_PORT_GET',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_CMD_PORT_GET')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_ATTR_DEV_NAME',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_ATTR_DEV_NAME')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IFLA_PHYS_SWITCH_ID',
+                       'linux/if_link.h',
+                       'enum', 'IFLA_PHYS_SWITCH_ID')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IFLA_PHYS_PORT_NAME',
+                       'linux/if_link.h',
+                       'enum', 'IFLA_PHYS_PORT_NAME')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_ACT',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_ACT')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_FLAGS',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_FLAGS')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_TYPE',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_TYPE')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IP_PROTO',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IP_PROTO')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV4_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV4_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV4_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV4_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV6_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV6_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV6_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV6_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_TCP_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_TCP_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_TCP_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_TCP_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_UDP_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_UDP_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_UDP_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_UDP_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_VLAN_ID',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_VLAN_ID')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_VLAN_PRIO',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_VLAN_PRIO')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TC_ACT_VLAN',
+                       'linux/tc_act/tc_vlan.h',
+                       'enum', 'TCA_VLAN_PUSH_VLAN_PRIORITY')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_40000baseKR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_40000baseKR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_40000baseCR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_40000baseCR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_40000baseSR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_40000baseSR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_40000baseLR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_40000baseLR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_56000baseKR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_56000baseKR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_56000baseCR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_56000baseCR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_56000baseSR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_56000baseSR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_56000baseLR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_56000baseLR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+endif
+# Build Glue Library
+if pmd_dlopen
+        dlopen_name = 'mlx5_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx5_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+                dlopen_lib_name,
+                dlopen_sources,
+                include_directories: global_inc,
+                c_args: cflags + [ get_option('extra_cflags') ],
+                link_args: [
+                        '-Wl,-export-dynamic',
+                        '-Wl,-h,@0@'.format(LIB_GLUE),
+                        flags,
+                        '-lmlx5',
+                        '-libverbs',
+                        ],
+                soversion: dlopen_so_version,
+                install: true,
+                install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/meson_options.txt b/meson_options.txt
index da6373a2c..c75108e05 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -24,3 +24,11 @@ option('tests', type: 'boolean', value: true,
 	description: 'build unit tests')
 option('extra_cflags', type: 'string', description: 'Extra compiler flags')
 option('extra_ldflags', type: 'string', description: 'Extra linker flags')
+option('enable_driver_mlx5', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-4/5 NIC')
+option('enable_driver_mlx5_glue', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-4/5 NIC glue library')
+option('enable_driver_mlx4', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-3 NIC')
+option('enable_driver_mlx4_glue', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-3 NIC glue library')
-- 
2.18.0

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option
  2018-08-27 11:10 [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Nelio Laranjeiro
  2018-08-27 11:10 ` [dpdk-dev] [PATCH 2/2] net/mlx: add meson build support Nelio Laranjeiro
@ 2018-08-27 11:24 ` Bruce Richardson
  2018-08-27 12:20   ` Nélio Laranjeiro
  1 sibling, 1 reply; 26+ messages in thread
From: Bruce Richardson @ 2018-08-27 11:24 UTC (permalink / raw)
  To: Nelio Laranjeiro; +Cc: dev, Yongseok Koh, Shahaf Shuler

On Mon, Aug 27, 2018 at 01:10:52PM +0200, Nelio Laranjeiro wrote:
> Almost equivalent to the make system build which uses those options
> through environment variables (EXTRA_{CFLAGS,LDFLAGS}).
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
>  drivers/meson.build | 2 +-
>  meson_options.txt   | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/meson.build b/drivers/meson.build
> index f94e2fe67..008aac62c 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -11,7 +11,7 @@ driver_classes = ['common',
>  	       'event',   # depends on common, bus, mempool and net.
>  	       'raw']     # depends on common, bus, mempool, net and event.
>  
> -default_cflags = machine_args
> +default_cflags = machine_args + [get_option('extra_cflags'), get_option('extra_ldflags')]
>  if cc.has_argument('-Wno-format-truncation')
>  	default_cflags += '-Wno-format-truncation'
>  endif
> diff --git a/meson_options.txt b/meson_options.txt
> index c84327858..da6373a2c 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -22,3 +22,5 @@ option('use_hpet', type: 'boolean', value: false,
>  	description: 'use HPET timer in EAL')
>  option('tests', type: 'boolean', value: true,
>  	description: 'build unit tests')
> +option('extra_cflags', type: 'string', description: 'Extra compiler flags')
> +option('extra_ldflags', type: 'string', description: 'Extra linker flags')

This should not be needed. Meson should pick up CFLAGS and LDFLAGS from the
environment without having to add options for them.

https://mesonbuild.com/howtox.html#set-extra-compiler-and-linker-flags-from-the-outside-when-eg-building-distro-packages

/Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option
  2018-08-27 11:24 ` [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Bruce Richardson
@ 2018-08-27 12:20   ` Nélio Laranjeiro
  0 siblings, 0 replies; 26+ messages in thread
From: Nélio Laranjeiro @ 2018-08-27 12:20 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Yongseok Koh, Shahaf Shuler

On Mon, Aug 27, 2018 at 12:24:11PM +0100, Bruce Richardson wrote:
> On Mon, Aug 27, 2018 at 01:10:52PM +0200, Nelio Laranjeiro wrote:
> > Almost equivalent to the make system build which uses those options
> > through environment variables (EXTRA_{CFLAGS,LDFLAGS}).
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > ---
> >  drivers/meson.build | 2 +-
> >  meson_options.txt   | 2 ++
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/meson.build b/drivers/meson.build
> > index f94e2fe67..008aac62c 100644
> > --- a/drivers/meson.build
> > +++ b/drivers/meson.build
> > @@ -11,7 +11,7 @@ driver_classes = ['common',
> >  	       'event',   # depends on common, bus, mempool and net.
> >  	       'raw']     # depends on common, bus, mempool, net and event.
> >  
> > -default_cflags = machine_args
> > +default_cflags = machine_args + [get_option('extra_cflags'), get_option('extra_ldflags')]
> >  if cc.has_argument('-Wno-format-truncation')
> >  	default_cflags += '-Wno-format-truncation'
> >  endif
> > diff --git a/meson_options.txt b/meson_options.txt
> > index c84327858..da6373a2c 100644
> > --- a/meson_options.txt
> > +++ b/meson_options.txt
> > @@ -22,3 +22,5 @@ option('use_hpet', type: 'boolean', value: false,
> >  	description: 'use HPET timer in EAL')
> >  option('tests', type: 'boolean', value: true,
> >  	description: 'build unit tests')
> > +option('extra_cflags', type: 'string', description: 'Extra compiler flags')
> > +option('extra_ldflags', type: 'string', description: 'Extra linker flags')
> 
> This should not be needed. Meson should pick up CFLAGS and LDFLAGS from the
> environment without having to add options for them.
> 
> https://mesonbuild.com/howtox.html#set-extra-compiler-and-linker-flags-from-the-outside-when-eg-building-distro-packages
> 
> /Bruce

Indeed this works with the CLFAGS/LDFLAGS way, but to find correctly the
library dependencies, it also needs to have the LD_LIBRARY_PATH set with
the correct path.

This patch will be discarded in the next version.

Thanks,

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v2] net/mlx: add meson build support
       [not found] <Message-Id: <7812af2267017898332783e934bef9478814ae96.1535361299.git.nelio.laranjeiro@6wind.com>
@ 2018-08-27 12:42 ` Nelio Laranjeiro
  2018-08-28 15:45   ` Bruce Richardson
  2018-08-29 13:48   ` [dpdk-dev] [PATCH v3] " Nelio Laranjeiro
  0 siblings, 2 replies; 26+ messages in thread
From: Nelio Laranjeiro @ 2018-08-27 12:42 UTC (permalink / raw)
  To: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad, Bruce Richardson

Mellanox drivers remains un-compiled by default due to third party
libraries dependencies.  They can be enabled through:
- enable_driver_mlx{4,5}=true or
- enable_driver_mlx{4,5}_glue=true
depending on the needs.

To avoid modifying the whole sources and keep the compatibility with
current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
generated by invoking DPDK scripts though meson's run_command() instead
of using has_types, has_members, ... commands.

Meson will try to find the required external libraries.  When they are
not installed system wide, they can be provided though CFLAGS, LDFLAGS
and LD_LIBRARY_PATH environment variables, example (considering
RDMA-Core is installed in /tmp/rdma-core):

 # CLFAGS=-I/tmp/rdma-core/build/include \
   LDFLAGS=-L/tmp/rdma-core/build/lib \
   LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   meson -Denable_driver_mlx4=true output

 # CLFAGS=-I/tmp/rdma-core/build/include \
   LDFLAGS=-L/tmp/rdma-core/build/lib \
   LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   ninja -C output install

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

---

Changes in v2:

- dropped patch https://patches.dpdk.org/patch/43897/
- remove extra_{cflags,ldflags} as already honored by meson through
environment variables.
---
 drivers/net/meson.build      |   2 +
 drivers/net/mlx4/meson.build |  94 ++++++
 drivers/net/mlx5/meson.build | 545 +++++++++++++++++++++++++++++++++++
 meson_options.txt            |   8 +
 4 files changed, 649 insertions(+)
 create mode 100644 drivers/net/mlx4/meson.build
 create mode 100644 drivers/net/mlx5/meson.build

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 9c28ed4da..c7a2d0e7d 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -18,6 +18,8 @@ drivers = ['af_packet',
 	'ixgbe',
 	'kni',
 	'liquidio',
+	'mlx4',
+	'mlx5',
 	'mvpp2',
 	'netvsc',
 	'nfp',
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
new file mode 100644
index 000000000..debaca5b6
--- /dev/null
+++ b/drivers/net/mlx4/meson.build
@@ -0,0 +1,94 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+# As there is no more configuration file to activate/configure the PMD it will
+# use some variables here to configure it.
+pmd_dlopen = get_option('enable_driver_mlx4_glue')
+build = get_option('enable_driver_mlx4') or pmd_dlopen
+# dpdk_conf.set('RTE_LIBRTE_MLX4_DEBUG', 1)
+# Glue configuratin
+LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
+LIB_GLUE_VERSION = '18.02.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+                '-ldl',
+        ]
+endif
+# Compile PMD
+if build
+        allow_experimental_apis = true
+        ext_deps += [
+                cc.find_library('mnl'),
+                cc.find_library('mlx4'),
+                cc.find_library('ibverbs'),
+        ]
+        sources = files(
+               'mlx4.c',
+               'mlx4_ethdev.c',
+               'mlx4_flow.c',
+               'mlx4_intr.c',
+               'mlx4_mr.c',
+               'mlx4_rxq.c',
+               'mlx4_rxtx.c',
+               'mlx4_txq.c',
+               'mlx4_utils.c',
+        )
+        if not pmd_dlopen
+                sources += files('mlx4_glue.c')
+        endif
+        cflags += [
+               '-O3',
+               '-Wall',
+               '-Wextra',
+               '-g',
+               '-std=c11',
+               '-I.',
+               '-D_BSD_SOURCE',
+               '-D_DEFAULT_SOURCE',
+               '-D_XOPEN_SOURCE=600',
+               '-Wno-strict-prototypes',
+        ]
+        if dpdk_conf.has('RTE_LIBRTE_MLX4_DEBUG')
+                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+        else
+                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+        endif
+        # To maintain the compatibility with the make build system
+        # mlx4_autoconf.h file is still generated.
+        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                        'mlx4_autoconf.h',
+                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
+                        'infiniband/mlx4dv.h',
+                        'type', 'struct mlx4_wqe_lso_seg')
+        if r.returncode() != 0
+                error('autoconfiguration fail')
+        endif
+endif
+# Build Glue Library
+if pmd_dlopen
+        dlopen_name = 'mlx4_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx4_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+               dlopen_lib_name,
+               dlopen_sources,
+               include_directories: global_inc,
+               c_args: cflags,
+               link_args: [
+                       '-Wl,-export-dynamic',
+                       '-Wl,-h,@0@'.format(LIB_GLUE),
+                       '-lmlx4',
+                       '-libverbs',
+                       ],
+               soversion: dlopen_so_version,
+               install: true,
+               install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
new file mode 100644
index 000000000..b918ca437
--- /dev/null
+++ b/drivers/net/mlx5/meson.build
@@ -0,0 +1,545 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+# As there is no more configuration file to activate/configure the PMD it will
+# use some variables here to configure it.
+pmd_dlopen = get_option('enable_driver_mlx5_glue')
+build = get_option('enable_driver_mlx5') or pmd_dlopen
+# dpdk_conf.set('RTE_LIBRTE_MLX5_DEBUG', 1)
+# Glue configuratin
+LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
+LIB_GLUE_VERSION = '18.05.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+                '-ldl',
+        ]
+endif
+# Compile PMD
+if build
+        allow_experimental_apis = true
+        ext_deps += [
+                cc.find_library('mnl'),
+                cc.find_library('mlx5'),
+                cc.find_library('ibverbs'),
+        ]
+        sources = files(
+                'mlx5.c',
+                'mlx5_ethdev.c',
+                'mlx5_flow.c',
+                'mlx5_mac.c',
+                'mlx5_mr.c',
+                'mlx5_nl.c',
+                'mlx5_nl_flow.c',
+                'mlx5_rss.c',
+                'mlx5_rxmode.c',
+                'mlx5_rxq.c',
+                'mlx5_rxtx.c',
+                'mlx5_socket.c',
+                'mlx5_stats.c',
+                'mlx5_trigger.c',
+                'mlx5_txq.c',
+                'mlx5_vlan.c',
+        )
+        if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
+                sources += files('mlx5_rxtx_vec.c')
+        endif
+        if not pmd_dlopen
+                sources += files('mlx5_glue.c')
+        endif
+        cflags += [
+               '-O3',
+               '-Wall',
+               '-Wextra',
+               '-g',
+               '-std=c11',
+               '-I.',
+               '-D_BSD_SOURCE',
+               '-D_DEFAULT_SOURCE',
+               '-D_XOPEN_SOURCE=600',
+               '-Wno-strict-prototypes',
+       ]
+       if dpdk_conf.has('RTE_LIBRTE_MLX5_DEBUG')
+               cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+       else
+               cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+       endif
+       # To maintain the compatibility with the make build system
+       # mlx5_autoconf.h file is still generated.
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT',
+                       'infiniband/mlx5dv.h',
+                       'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_DEVICE_TUNNEL_SUPPORT',
+                       'infiniband/mlx5dv.h',
+                       'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_DEVICE_MPLS_SUPPORT',
+                       'infiniband/verbs.h',
+                       'enum', 'IBV_FLOW_SPEC_MPLS')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_WQ_FLAG_RX_END_PADDING',
+                       'infiniband/verbs.h',
+                       'enum', 'IBV_WQ_FLAG_RX_END_PADDING')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_MLX5_MOD_SWP',
+                       'infiniband/mlx5dv.h',
+                       'type', 'struct mlx5dv_sw_parsing_caps')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_MLX5_MOD_MPW',
+                       'infiniband/mlx5dv.h',
+                       'enum', 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_MLX5_MOD_CQE_128B_COMP',
+                       'infiniband/mlx5dv.h',
+                       'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_ETHTOOL_LINK_MODE_25G',
+                       '/usr/include/linux/ethtool.h',
+                       'enum', 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_ETHTOOL_LINK_MODE_50G',
+                       '/usr/include/linux/ethtool.h',
+                       'enum', 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_ETHTOOL_LINK_MODE_100G',
+                       '/usr/include/linux/ethtool.h',
+                       'enum', 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT',
+                       'infiniband/verbs.h',
+                       'type', 'struct ibv_counter_set_init_attr')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NL_NLDEV',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NL_NLDEV')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_CMD_GET',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_CMD_GET')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_CMD_PORT_GET',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_CMD_PORT_GET')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_ATTR_DEV_NAME',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_ATTR_DEV_NAME')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX',
+                       'rdma/rdma_netlink.h',
+                       'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IFLA_PHYS_SWITCH_ID',
+                       'linux/if_link.h',
+                       'enum', 'IFLA_PHYS_SWITCH_ID')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_IFLA_PHYS_PORT_NAME',
+                       'linux/if_link.h',
+                       'enum', 'IFLA_PHYS_PORT_NAME')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_ACT',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_ACT')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_FLAGS',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_FLAGS')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_TYPE',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_TYPE')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IP_PROTO',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IP_PROTO')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV4_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV4_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV4_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV4_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV6_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV6_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV6_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV6_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_TCP_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_TCP_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_TCP_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_TCP_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_UDP_SRC',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_UDP_SRC')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_UDP_DST',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_UDP_DST')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_VLAN_ID',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_VLAN_ID')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_VLAN_PRIO',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_VLAN_PRIO')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE',
+                       'linux/pkt_cls.h',
+                       'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_TC_ACT_VLAN',
+                       'linux/tc_act/tc_vlan.h',
+                       'enum', 'TCA_VLAN_PUSH_VLAN_PRIORITY')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_40000baseKR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_40000baseKR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_40000baseCR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_40000baseCR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_40000baseSR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_40000baseSR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_40000baseLR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_40000baseLR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_56000baseKR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_56000baseKR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_56000baseCR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_56000baseCR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_56000baseSR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_56000baseSR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                       'mlx5_autoconf.h',
+                       'HAVE_SUPPORTED_56000baseLR4_Full',
+                       '/usr/include/linux/ethtool.h',
+                       'define', 'SUPPORTED_56000baseLR4_Full')
+       if r.returncode() != 0
+               error('autoconfiguration fail')
+       endif
+endif
+# Build Glue Library
+if pmd_dlopen
+        dlopen_name = 'mlx5_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx5_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+                dlopen_lib_name,
+                dlopen_sources,
+                include_directories: global_inc,
+                c_args: cflags,
+                link_args: [
+                        '-Wl,-export-dynamic',
+                        '-Wl,-h,@0@'.format(LIB_GLUE),
+                        '-lmlx5',
+                        '-libverbs',
+                        ],
+                soversion: dlopen_so_version,
+                install: true,
+                install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/meson_options.txt b/meson_options.txt
index c84327858..a1ae0cabc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,3 +22,11 @@ option('use_hpet', type: 'boolean', value: false,
 	description: 'use HPET timer in EAL')
 option('tests', type: 'boolean', value: true,
 	description: 'build unit tests')
+option('enable_driver_mlx5', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-4/5 NIC')
+option('enable_driver_mlx5_glue', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-4/5 NIC glue library')
+option('enable_driver_mlx4', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-3 NIC')
+option('enable_driver_mlx4_glue', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-3 NIC glue library')
-- 
2.18.0

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
  2018-08-27 12:42 ` [dpdk-dev] [PATCH v2] net/mlx: add meson build support Nelio Laranjeiro
@ 2018-08-28 15:45   ` Bruce Richardson
  2018-08-29  9:34     ` Nélio Laranjeiro
  2018-08-29 10:00     ` Luca Boccassi
  2018-08-29 13:48   ` [dpdk-dev] [PATCH v3] " Nelio Laranjeiro
  1 sibling, 2 replies; 26+ messages in thread
From: Bruce Richardson @ 2018-08-28 15:45 UTC (permalink / raw)
  To: Nelio Laranjeiro; +Cc: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

Thanks for this, comments inline below.

/Bruce

On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> Mellanox drivers remains un-compiled by default due to third party
> libraries dependencies.  They can be enabled through:
> - enable_driver_mlx{4,5}=true or
> - enable_driver_mlx{4,5}_glue=true
> depending on the needs.

The big reason why we wanted a new build system was to move away from this
sort of static configuration. Instead, detect if the requirements as
present and build the driver if you can.

> 
> To avoid modifying the whole sources and keep the compatibility with
> current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> generated by invoking DPDK scripts though meson's run_command() instead
> of using has_types, has_members, ... commands.
> 
> Meson will try to find the required external libraries.  When they are
> not installed system wide, they can be provided though CFLAGS, LDFLAGS
> and LD_LIBRARY_PATH environment variables, example (considering
> RDMA-Core is installed in /tmp/rdma-core):
> 
>  # CLFAGS=-I/tmp/rdma-core/build/include \
>    LDFLAGS=-L/tmp/rdma-core/build/lib \
>    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
>    meson -Denable_driver_mlx4=true output
> 
>  # CLFAGS=-I/tmp/rdma-core/build/include \
>    LDFLAGS=-L/tmp/rdma-core/build/lib \
>    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
>    ninja -C output install

Once the CFLAGS/LDFLAGS are passed to meson, they should not be needed for
ninja. The LD_LIBRARY_PATH might be - I'm not sure about that one! :-)

> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> 
> ---
> 
> Changes in v2:
> 
> - dropped patch https://patches.dpdk.org/patch/43897/
> - remove extra_{cflags,ldflags} as already honored by meson through
> environment variables.
> ---
>  drivers/net/meson.build      |   2 +
>  drivers/net/mlx4/meson.build |  94 ++++++
>  drivers/net/mlx5/meson.build | 545 +++++++++++++++++++++++++++++++++++
>  meson_options.txt            |   8 +
>  4 files changed, 649 insertions(+)
>  create mode 100644 drivers/net/mlx4/meson.build
>  create mode 100644 drivers/net/mlx5/meson.build
> 
> diff --git a/drivers/net/meson.build b/drivers/net/meson.build
> index 9c28ed4da..c7a2d0e7d 100644
> --- a/drivers/net/meson.build
> +++ b/drivers/net/meson.build
> @@ -18,6 +18,8 @@ drivers = ['af_packet',
>  	'ixgbe',
>  	'kni',
>  	'liquidio',
> +	'mlx4',
> +	'mlx5',
>  	'mvpp2',
>  	'netvsc',
>  	'nfp',
> diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
> new file mode 100644
> index 000000000..debaca5b6
> --- /dev/null
> +++ b/drivers/net/mlx4/meson.build
> @@ -0,0 +1,94 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright 2018 6WIND S.A.
> +# Copyright 2018 Mellanox Technologies, Ltd
> +
> +# As there is no more configuration file to activate/configure the PMD it will
> +# use some variables here to configure it.
> +pmd_dlopen = get_option('enable_driver_mlx4_glue')
> +build = get_option('enable_driver_mlx4') or pmd_dlopen

As stated above, I believe this should be based upon whether you find the
"mnl", "mlx4" and "ibverbs" libraries. If we start adding back in static
options for every driver, then we'll be back to having a mass of config
options like we had before.

> +# dpdk_conf.set('RTE_LIBRTE_MLX4_DEBUG', 1)
> +# Glue configuratin
> +LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
> +LIB_GLUE_VERSION = '18.02.0'
> +LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
> +if pmd_dlopen
> +        dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1)
> +        cflags += [
> +                '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
> +                '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
> +                '-ldl',
> +        ]

Is the '-ldl' flag necessary, given that for Linux it is added as a
standard linker flag in config/meson.build? If it is needed, does it get
passed through to the pkgconfig file etc. appropriately.

> +endif
> +# Compile PMD
> +if build

If you make the build value depend on the results of the find_library
calls, you can remove this conditional and de-dent the rest of the code,
since the assigned values will be ignored at the higher level.

> +        allow_experimental_apis = true
> +        ext_deps += [
> +                cc.find_library('mnl'),
> +                cc.find_library('mlx4'),
> +                cc.find_library('ibverbs'),
> +        ]
> +        sources = files(
> +               'mlx4.c',
> +               'mlx4_ethdev.c',
> +               'mlx4_flow.c',
> +               'mlx4_intr.c',
> +               'mlx4_mr.c',
> +               'mlx4_rxq.c',
> +               'mlx4_rxtx.c',
> +               'mlx4_txq.c',
> +               'mlx4_utils.c',
> +        )
> +        if not pmd_dlopen
> +                sources += files('mlx4_glue.c')
> +        endif
> +        cflags += [
> +               '-O3',
> +               '-Wall',
> +               '-Wextra',
> +               '-g',

Please don't add these flags into your driver build. The optimization and
debug flags are controlled instead at the project level via the meson
build-in "buildtype" option.

> +               '-std=c11',
> +               '-I.',

Unnecessary, the current build directory is always present in the include
path.

> +               '-D_BSD_SOURCE',
> +               '-D_DEFAULT_SOURCE',
> +               '-D_XOPEN_SOURCE=600',
> +               '-Wno-strict-prototypes',
> +        ]

For safety, it's advisable to have compiler flags checked via
cc.has_option() before adding them to cflags. [The -D options shouldn't
need checking though]

> +        if dpdk_conf.has('RTE_LIBRTE_MLX4_DEBUG')
> +                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
> +        else
> +                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
> +        endif

Rather than having your own separate debug option flag, why not set these
based on the "buildtype" option e.g. if buildtype is set to "debug".

> +        # To maintain the compatibility with the make build system
> +        # mlx4_autoconf.h file is still generated.
> +        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                        'mlx4_autoconf.h',
> +                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
> +                        'infiniband/mlx4dv.h',
> +                        'type', 'struct mlx4_wqe_lso_seg')
> +        if r.returncode() != 0
> +                error('autoconfiguration fail')
> +        endif

Just to check that you are ok with this only being run at configure time?
If any changes are made to the inputs, ninja won't pick them up. To have it
tracked for input changes, "custom_target" should be used instead of
run_command.

> +endif
> +# Build Glue Library
> +if pmd_dlopen
> +        dlopen_name = 'mlx4_glue'
> +        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
> +        dlopen_so_version = LIB_GLUE_VERSION
> +        dlopen_sources = files('mlx4_glue.c')
> +        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
> +        shared_lib = shared_library(
> +               dlopen_lib_name,
> +               dlopen_sources,
> +               include_directories: global_inc,
> +               c_args: cflags,
> +               link_args: [
> +                       '-Wl,-export-dynamic',
> +                       '-Wl,-h,@0@'.format(LIB_GLUE),
> +                       '-lmlx4',
> +                       '-libverbs',

While this works, the recommended approach is to save the return value from
cc.find_library() above, and pass that as a dependency directly, rather
than as a linker flag.

> +                       ],
> +               soversion: dlopen_so_version,
> +               install: true,
> +               install_dir: dlopen_install_dir,
> +        )
> +endif

> diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
> new file mode 100644
> index 000000000..b918ca437
> --- /dev/null
> +++ b/drivers/net/mlx5/meson.build

I believe most of the comments above for the mlx4 driver would apply below
also. I'll just note any additional things I spot.

> @@ -0,0 +1,545 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright 2018 6WIND S.A.
> +# Copyright 2018 Mellanox Technologies, Ltd
> +
> +# As there is no more configuration file to activate/configure the PMD it will
> +# use some variables here to configure it.
> +pmd_dlopen = get_option('enable_driver_mlx5_glue')
> +build = get_option('enable_driver_mlx5') or pmd_dlopen
> +# dpdk_conf.set('RTE_LIBRTE_MLX5_DEBUG', 1)
> +# Glue configuratin
> +LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
> +LIB_GLUE_VERSION = '18.05.0'
> +LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
> +if pmd_dlopen
> +        dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
> +        cflags += [
> +                '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
> +                '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
> +                '-ldl',
> +        ]
> +endif
> +# Compile PMD
> +if build
> +        allow_experimental_apis = true
> +        ext_deps += [
> +                cc.find_library('mnl'),
> +                cc.find_library('mlx5'),
> +                cc.find_library('ibverbs'),
> +        ]
> +        sources = files(
> +                'mlx5.c',
> +                'mlx5_ethdev.c',
> +                'mlx5_flow.c',
> +                'mlx5_mac.c',
> +                'mlx5_mr.c',
> +                'mlx5_nl.c',
> +                'mlx5_nl_flow.c',
> +                'mlx5_rss.c',
> +                'mlx5_rxmode.c',
> +                'mlx5_rxq.c',
> +                'mlx5_rxtx.c',
> +                'mlx5_socket.c',
> +                'mlx5_stats.c',
> +                'mlx5_trigger.c',
> +                'mlx5_txq.c',
> +                'mlx5_vlan.c',
> +        )
> +        if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
> +                sources += files('mlx5_rxtx_vec.c')
> +        endif
> +        if not pmd_dlopen
> +                sources += files('mlx5_glue.c')
> +        endif
> +        cflags += [
> +               '-O3',
> +               '-Wall',
> +               '-Wextra',
> +               '-g',
> +               '-std=c11',
> +               '-I.',
> +               '-D_BSD_SOURCE',
> +               '-D_DEFAULT_SOURCE',
> +               '-D_XOPEN_SOURCE=600',
> +               '-Wno-strict-prototypes',
> +       ]
> +       if dpdk_conf.has('RTE_LIBRTE_MLX5_DEBUG')
> +               cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
> +       else
> +               cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
> +       endif
> +       # To maintain the compatibility with the make build system
> +       # mlx5_autoconf.h file is still generated.
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT',
> +                       'infiniband/mlx5dv.h',
> +                       'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IBV_DEVICE_TUNNEL_SUPPORT',
> +                       'infiniband/mlx5dv.h',
> +                       'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IBV_DEVICE_MPLS_SUPPORT',
> +                       'infiniband/verbs.h',
> +                       'enum', 'IBV_FLOW_SPEC_MPLS')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IBV_WQ_FLAG_RX_END_PADDING',
> +                       'infiniband/verbs.h',
> +                       'enum', 'IBV_WQ_FLAG_RX_END_PADDING')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IBV_MLX5_MOD_SWP',
> +                       'infiniband/mlx5dv.h',
> +                       'type', 'struct mlx5dv_sw_parsing_caps')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IBV_MLX5_MOD_MPW',
> +                       'infiniband/mlx5dv.h',
> +                       'enum', 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IBV_MLX5_MOD_CQE_128B_COMP',
> +                       'infiniband/mlx5dv.h',
> +                       'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_ETHTOOL_LINK_MODE_25G',
> +                       '/usr/include/linux/ethtool.h',
> +                       'enum', 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_ETHTOOL_LINK_MODE_50G',
> +                       '/usr/include/linux/ethtool.h',
> +                       'enum', 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_ETHTOOL_LINK_MODE_100G',
> +                       '/usr/include/linux/ethtool.h',
> +                       'enum', 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT',
> +                       'infiniband/verbs.h',
> +                       'type', 'struct ibv_counter_set_init_attr')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_RDMA_NL_NLDEV',
> +                       'rdma/rdma_netlink.h',
> +                       'enum', 'RDMA_NL_NLDEV')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_RDMA_NLDEV_CMD_GET',
> +                       'rdma/rdma_netlink.h',
> +                       'enum', 'RDMA_NLDEV_CMD_GET')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_RDMA_NLDEV_CMD_PORT_GET',
> +                       'rdma/rdma_netlink.h',
> +                       'enum', 'RDMA_NLDEV_CMD_PORT_GET')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX',
> +                       'rdma/rdma_netlink.h',
> +                       'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_RDMA_NLDEV_ATTR_DEV_NAME',
> +                       'rdma/rdma_netlink.h',
> +                       'enum', 'RDMA_NLDEV_ATTR_DEV_NAME')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX',
> +                       'rdma/rdma_netlink.h',
> +                       'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX',
> +                       'rdma/rdma_netlink.h',
> +                       'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IFLA_PHYS_SWITCH_ID',
> +                       'linux/if_link.h',
> +                       'enum', 'IFLA_PHYS_SWITCH_ID')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_IFLA_PHYS_PORT_NAME',
> +                       'linux/if_link.h',
> +                       'enum', 'IFLA_PHYS_PORT_NAME')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_ACT',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_ACT')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_FLAGS',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_FLAGS')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_ETH_TYPE',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_ETH_TYPE')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_ETH_DST',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_ETH_DST')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_ETH_SRC',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_ETH_SRC')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IP_PROTO',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IP_PROTO')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IPV4_SRC',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IPV4_SRC')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IPV4_DST',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IPV4_DST')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IPV6_SRC',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IPV6_SRC')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IPV6_DST',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IPV6_DST')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_TCP_SRC',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_TCP_SRC')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_TCP_DST',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_TCP_DST')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_UDP_SRC',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_UDP_SRC')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_UDP_DST',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_UDP_DST')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_VLAN_ID',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_VLAN_ID')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_VLAN_PRIO',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_VLAN_PRIO')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE',
> +                       'linux/pkt_cls.h',
> +                       'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_TC_ACT_VLAN',
> +                       'linux/tc_act/tc_vlan.h',
> +                       'enum', 'TCA_VLAN_PUSH_VLAN_PRIORITY')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_SUPPORTED_40000baseKR4_Full',
> +                       '/usr/include/linux/ethtool.h',
> +                       'define', 'SUPPORTED_40000baseKR4_Full')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_SUPPORTED_40000baseCR4_Full',
> +                       '/usr/include/linux/ethtool.h',
> +                       'define', 'SUPPORTED_40000baseCR4_Full')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_SUPPORTED_40000baseSR4_Full',
> +                       '/usr/include/linux/ethtool.h',
> +                       'define', 'SUPPORTED_40000baseSR4_Full')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_SUPPORTED_40000baseLR4_Full',
> +                       '/usr/include/linux/ethtool.h',
> +                       'define', 'SUPPORTED_40000baseLR4_Full')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_SUPPORTED_56000baseKR4_Full',
> +                       '/usr/include/linux/ethtool.h',
> +                       'define', 'SUPPORTED_56000baseKR4_Full')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_SUPPORTED_56000baseCR4_Full',
> +                       '/usr/include/linux/ethtool.h',
> +                       'define', 'SUPPORTED_56000baseCR4_Full')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_SUPPORTED_56000baseSR4_Full',
> +                       '/usr/include/linux/ethtool.h',
> +                       'define', 'SUPPORTED_56000baseSR4_Full')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif
> +       r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                       'mlx5_autoconf.h',
> +                       'HAVE_SUPPORTED_56000baseLR4_Full',
> +                       '/usr/include/linux/ethtool.h',
> +                       'define', 'SUPPORTED_56000baseLR4_Full')
> +       if r.returncode() != 0
> +               error('autoconfiguration fail')
> +       endif

That's a huge number of run_commands, have you investigated putting it into
a foreach loop (or loops) and having it based off arrays as input?
Alternatively, it could all be put into a single script, if you didn't want
to clutter up the build file.

> +endif
> +# Build Glue Library
> +if pmd_dlopen
> +        dlopen_name = 'mlx5_glue'
> +        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
> +        dlopen_so_version = LIB_GLUE_VERSION
> +        dlopen_sources = files('mlx5_glue.c')
> +        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
> +        shared_lib = shared_library(
> +                dlopen_lib_name,
> +                dlopen_sources,
> +                include_directories: global_inc,
> +                c_args: cflags,
> +                link_args: [
> +                        '-Wl,-export-dynamic',
> +                        '-Wl,-h,@0@'.format(LIB_GLUE),
> +                        '-lmlx5',
> +                        '-libverbs',
> +                        ],
> +                soversion: dlopen_so_version,
> +                install: true,
> +                install_dir: dlopen_install_dir,
> +        )
> +endif
> diff --git a/meson_options.txt b/meson_options.txt
> index c84327858..a1ae0cabc 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -22,3 +22,11 @@ option('use_hpet', type: 'boolean', value: false,
>  	description: 'use HPET timer in EAL')
>  option('tests', type: 'boolean', value: true,
>  	description: 'build unit tests')
> +option('enable_driver_mlx5', type: 'boolean', value: false,
> +	description: 'Enable Mellanox PMD for ConnectX-4/5 NIC')
> +option('enable_driver_mlx5_glue', type: 'boolean', value: false,
> +	description: 'Enable Mellanox PMD for ConnectX-4/5 NIC glue library')
> +option('enable_driver_mlx4', type: 'boolean', value: false,
> +	description: 'Enable Mellanox PMD for ConnectX-3 NIC')
> +option('enable_driver_mlx4_glue', type: 'boolean', value: false,
> +	description: 'Enable Mellanox PMD for ConnectX-3 NIC glue library')

As well as dropping the two build options, I'd also suggest merging the
glue library options into 1, on the assumption that users either want glue
libs or don't. 
Also, the options should be kept in alphabetical order.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
  2018-08-28 15:45   ` Bruce Richardson
@ 2018-08-29  9:34     ` Nélio Laranjeiro
  2018-08-29 10:01       ` Bruce Richardson
  2018-08-29 10:00     ` Luca Boccassi
  1 sibling, 1 reply; 26+ messages in thread
From: Nélio Laranjeiro @ 2018-08-29  9:34 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

Hi Bruce,

Thanks for your comments I have address almost all of them in the v3 by
doing what you suggest, I still have some comments, please see below,

On Tue, Aug 28, 2018 at 04:45:00PM +0100, Bruce Richardson wrote:
> Thanks for this, comments inline below.
> 
> /Bruce
> 
> On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> > Mellanox drivers remains un-compiled by default due to third party
> > libraries dependencies.  They can be enabled through:
> > - enable_driver_mlx{4,5}=true or
> > - enable_driver_mlx{4,5}_glue=true
> > depending on the needs.
> 
> The big reason why we wanted a new build system was to move away from this
> sort of static configuration. Instead, detect if the requirements as
> present and build the driver if you can.

Ok, I am letting only the glue option for both drivers as suggested at
the end of your answer.

> > To avoid modifying the whole sources and keep the compatibility with
> > current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> > generated by invoking DPDK scripts though meson's run_command() instead
> > of using has_types, has_members, ... commands.
> > 
> > Meson will try to find the required external libraries.  When they are
> > not installed system wide, they can be provided though CFLAGS, LDFLAGS
> > and LD_LIBRARY_PATH environment variables, example (considering
> > RDMA-Core is installed in /tmp/rdma-core):
> > 
> >  # CLFAGS=-I/tmp/rdma-core/build/include \
> >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    meson -Denable_driver_mlx4=true output
> > 
> >  # CLFAGS=-I/tmp/rdma-core/build/include \
> >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    ninja -C output install
> 
> Once the CFLAGS/LDFLAGS are passed to meson, they should not be needed for
> ninja. The LD_LIBRARY_PATH might be - I'm not sure about that one! :-)

CFLAGS/LDFLAGS are correctly evaluated and inserted in the build.ninja
file, for the LD_LIBRARY_PATH, it is necessary for the run_command stuff
generating the mlx*_autoconf.h

>[...] 
> Rather than having your own separate debug option flag, why not set these
> based on the "buildtype" option e.g. if buildtype is set to "debug".
> 
> > +        # To maintain the compatibility with the make build system
> > +        # mlx4_autoconf.h file is still generated.
> > +        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> > +                        'mlx4_autoconf.h',
> > +                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
> > +                        'infiniband/mlx4dv.h',
> > +                        'type', 'struct mlx4_wqe_lso_seg')
> > +        if r.returncode() != 0
> > +                error('autoconfiguration fail')
> > +        endif
> 
> Just to check that you are ok with this only being run at configure time?
> If any changes are made to the inputs, ninja won't pick them up. To have it
> tracked for input changes, "custom_target" should be used instead of
> run_command.

It seems to not be possible to have several custom_target on the same
output file has this last is used as the target identifier in ninja.

This limitation is acceptable for now, when meson will be the default
build system, then such autoconf can be removed to use meson built-in
functions.

> > +endif
> > +# Build Glue Library
> > +if pmd_dlopen
> > +        dlopen_name = 'mlx4_glue'
> > +        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
> > +        dlopen_so_version = LIB_GLUE_VERSION
> > +        dlopen_sources = files('mlx4_glue.c')
> > +        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
> > +        shared_lib = shared_library(
> > +               dlopen_lib_name,
> > +               dlopen_sources,
> > +               include_directories: global_inc,
> > +               c_args: cflags,
> > +               link_args: [
> > +                       '-Wl,-export-dynamic',
> > +                       '-Wl,-h,@0@'.format(LIB_GLUE),
> > +                       '-lmlx4',
> > +                       '-libverbs',
> 
> While this works, the recommended approach is to save the return value from
> cc.find_library() above, and pass that as a dependency directly, rather
> than as a linker flag.

I tried it, but:

 drivers/net/mlx5/meson.build:216:8: ERROR:  Link_args arguments must be
 strings.

find_library returns a compiler object, I did not found anyway to use
directly the output of the find_library which works in places.

Thanks,

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
  2018-08-28 15:45   ` Bruce Richardson
  2018-08-29  9:34     ` Nélio Laranjeiro
@ 2018-08-29 10:00     ` Luca Boccassi
  2018-08-29 11:59       ` Nélio Laranjeiro
  1 sibling, 1 reply; 26+ messages in thread
From: Luca Boccassi @ 2018-08-29 10:00 UTC (permalink / raw)
  To: Bruce Richardson, Nelio Laranjeiro
  Cc: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

On Tue, 2018-08-28 at 16:45 +0100, Bruce Richardson wrote:
> Thanks for this, comments inline below.
> 
> /Bruce
> 
> On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> > Mellanox drivers remains un-compiled by default due to third party
> > libraries dependencies.  They can be enabled through:
> > - enable_driver_mlx{4,5}=true or
> > - enable_driver_mlx{4,5}_glue=true
> > depending on the needs.
> 
> The big reason why we wanted a new build system was to move away from
> this
> sort of static configuration. Instead, detect if the requirements as
> present and build the driver if you can.
> 
> > 
> > To avoid modifying the whole sources and keep the compatibility
> > with
> > current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> > generated by invoking DPDK scripts though meson's run_command()
> > instead
> > of using has_types, has_members, ... commands.
> > 
> > Meson will try to find the required external libraries.  When they
> > are
> > not installed system wide, they can be provided though CFLAGS,
> > LDFLAGS
> > and LD_LIBRARY_PATH environment variables, example (considering
> > RDMA-Core is installed in /tmp/rdma-core):
> > 
> >  # CLFAGS=-I/tmp/rdma-core/build/include \
> >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    meson -Denable_driver_mlx4=true output
> > 
> >  # CLFAGS=-I/tmp/rdma-core/build/include \
> >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    ninja -C output install
> 
> Once the CFLAGS/LDFLAGS are passed to meson, they should not be
> needed for
> ninja. The LD_LIBRARY_PATH might be - I'm not sure about that one! :-
> )
> 
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > 
> > ---
> > 
> > Changes in v2:
> > 
> > - dropped patch https://patches.dpdk.org/patch/43897/
> > - remove extra_{cflags,ldflags} as already honored by meson through
> > environment variables.
> > ---
> >  drivers/net/meson.build      |   2 +
> >  drivers/net/mlx4/meson.build |  94 ++++++
> >  drivers/net/mlx5/meson.build | 545
> > +++++++++++++++++++++++++++++++++++
> >  meson_options.txt            |   8 +
> >  4 files changed, 649 insertions(+)
> >  create mode 100644 drivers/net/mlx4/meson.build
> >  create mode 100644 drivers/net/mlx5/meson.build
> > 
> > diff --git a/drivers/net/meson.build b/drivers/net/meson.build
> > index 9c28ed4da..c7a2d0e7d 100644
> > --- a/drivers/net/meson.build
> > +++ b/drivers/net/meson.build
> > @@ -18,6 +18,8 @@ drivers = ['af_packet',
> >  	'ixgbe',
> >  	'kni',
> >  	'liquidio',
> > +	'mlx4',
> > +	'mlx5',
> >  	'mvpp2',
> >  	'netvsc',
> >  	'nfp',
> > diff --git a/drivers/net/mlx4/meson.build
> > b/drivers/net/mlx4/meson.build
> > new file mode 100644
> > index 000000000..debaca5b6
> > --- /dev/null
> > +++ b/drivers/net/mlx4/meson.build
> > @@ -0,0 +1,94 @@
> > +# SPDX-License-Identifier: BSD-3-Clause
> > +# Copyright 2018 6WIND S.A.
> > +# Copyright 2018 Mellanox Technologies, Ltd
> > +
> > +# As there is no more configuration file to activate/configure the
> > PMD it will
> > +# use some variables here to configure it.
> > +pmd_dlopen = get_option('enable_driver_mlx4_glue')
> > +build = get_option('enable_driver_mlx4') or pmd_dlopen
> 
> As stated above, I believe this should be based upon whether you find
> the
> "mnl", "mlx4" and "ibverbs" libraries. If we start adding back in
> static
> options for every driver, then we'll be back to having a mass of
> config
> options like we had before.

BTW, slightly related to that: ibverbs doesn't ship pkg-config files at
the moment which makes the detection slightly more awkward that it
could be, so I've sent a PR upstream to add that:

https://github.com/linux-rdma/rdma-core/pull/373

Hope this can be useful!

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
  2018-08-29  9:34     ` Nélio Laranjeiro
@ 2018-08-29 10:01       ` Bruce Richardson
  2018-08-29 12:44         ` Nélio Laranjeiro
  0 siblings, 1 reply; 26+ messages in thread
From: Bruce Richardson @ 2018-08-29 10:01 UTC (permalink / raw)
  To: Nélio Laranjeiro; +Cc: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

On Wed, Aug 29, 2018 at 11:34:10AM +0200, Nélio Laranjeiro wrote:
> Hi Bruce,
> 
> Thanks for your comments I have address almost all of them in the v3 by
> doing what you suggest, I still have some comments, please see below,
> 

Thanks.

> On Tue, Aug 28, 2018 at 04:45:00PM +0100, Bruce Richardson wrote:
> > Thanks for this, comments inline below.
> > 
> > /Bruce
> > 
> > On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> > > Mellanox drivers remains un-compiled by default due to third party
> > > libraries dependencies.  They can be enabled through:
> > > - enable_driver_mlx{4,5}=true or
> > > - enable_driver_mlx{4,5}_glue=true
> > > depending on the needs.
> > 
> > The big reason why we wanted a new build system was to move away from this
> > sort of static configuration. Instead, detect if the requirements as
> > present and build the driver if you can.
> 
> Ok, I am letting only the glue option for both drivers as suggested at
> the end of your answer.
> 
> > > To avoid modifying the whole sources and keep the compatibility with
> > > current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> > > generated by invoking DPDK scripts though meson's run_command() instead
> > > of using has_types, has_members, ... commands.
> > > 
> > > Meson will try to find the required external libraries.  When they are
> > > not installed system wide, they can be provided though CFLAGS, LDFLAGS
> > > and LD_LIBRARY_PATH environment variables, example (considering
> > > RDMA-Core is installed in /tmp/rdma-core):
> > > 
> > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > >    meson -Denable_driver_mlx4=true output
> > > 
> > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > >    ninja -C output install
> > 
> > Once the CFLAGS/LDFLAGS are passed to meson, they should not be needed for
> > ninja. The LD_LIBRARY_PATH might be - I'm not sure about that one! :-)
> 
> CFLAGS/LDFLAGS are correctly evaluated and inserted in the build.ninja
> file, for the LD_LIBRARY_PATH, it is necessary for the run_command stuff
> generating the mlx*_autoconf.h
> 

Just realised there is another issue which you should address. The
mlx*_autoconf.h files are being written into a source folder rather than
into the destination folder. This could cause problems if we are enabling
mlx for cross-compile builds. Perhaps inside the auto-config-h.sh script
you can check for $MESON_BUILD_ROOT value, and use that (and possibly
$MESON_SUBDIR) to put the header file in the build directory.

> >[...] 
> > Rather than having your own separate debug option flag, why not set these
> > based on the "buildtype" option e.g. if buildtype is set to "debug".
> > 
> > > +        # To maintain the compatibility with the make build system
> > > +        # mlx4_autoconf.h file is still generated.
> > > +        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> > > +                        'mlx4_autoconf.h',
> > > +                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
> > > +                        'infiniband/mlx4dv.h',
> > > +                        'type', 'struct mlx4_wqe_lso_seg')
> > > +        if r.returncode() != 0
> > > +                error('autoconfiguration fail')
> > > +        endif
> > 
> > Just to check that you are ok with this only being run at configure time?
> > If any changes are made to the inputs, ninja won't pick them up. To have it
> > tracked for input changes, "custom_target" should be used instead of
> > run_command.
> 
> It seems to not be possible to have several custom_target on the same
> output file has this last is used as the target identifier in ninja.
> 
> This limitation is acceptable for now, when meson will be the default
> build system, then such autoconf can be removed to use meson built-in
> functions.
> 
> > > +endif
> > > +# Build Glue Library
> > > +if pmd_dlopen
> > > +        dlopen_name = 'mlx4_glue'
> > > +        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
> > > +        dlopen_so_version = LIB_GLUE_VERSION
> > > +        dlopen_sources = files('mlx4_glue.c')
> > > +        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
> > > +        shared_lib = shared_library(
> > > +               dlopen_lib_name,
> > > +               dlopen_sources,
> > > +               include_directories: global_inc,
> > > +               c_args: cflags,
> > > +               link_args: [
> > > +                       '-Wl,-export-dynamic',
> > > +                       '-Wl,-h,@0@'.format(LIB_GLUE),
> > > +                       '-lmlx4',
> > > +                       '-libverbs',
> > 
> > While this works, the recommended approach is to save the return value from
> > cc.find_library() above, and pass that as a dependency directly, rather
> > than as a linker flag.
> 
> I tried it, but:
> 
>  drivers/net/mlx5/meson.build:216:8: ERROR:  Link_args arguments must be
>  strings.
> 

It needs to be passed using "dependencies" rather than as a link_arg. [See
list of possible arguments to library and executable objects here:
http://mesonbuild.com/Reference-manual.html#executable]

/Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
  2018-08-29 10:00     ` Luca Boccassi
@ 2018-08-29 11:59       ` Nélio Laranjeiro
  2018-08-29 12:28         ` Luca Boccassi
  2018-08-31 16:24         ` Luca Boccassi
  0 siblings, 2 replies; 26+ messages in thread
From: Nélio Laranjeiro @ 2018-08-29 11:59 UTC (permalink / raw)
  To: Luca Boccassi
  Cc: Bruce Richardson, dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

On Wed, Aug 29, 2018 at 11:00:54AM +0100, Luca Boccassi wrote:
> On Tue, 2018-08-28 at 16:45 +0100, Bruce Richardson wrote:
> > Thanks for this, comments inline below.
> > 
> > /Bruce
> > 
> > On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> > > Mellanox drivers remains un-compiled by default due to third party
> > > libraries dependencies.  They can be enabled through:
> > > - enable_driver_mlx{4,5}=true or
> > > - enable_driver_mlx{4,5}_glue=true
> > > depending on the needs.
> > 
> > The big reason why we wanted a new build system was to move away from
> > this
> > sort of static configuration. Instead, detect if the requirements as
> > present and build the driver if you can.
> > 
> > > 
> > > To avoid modifying the whole sources and keep the compatibility
> > > with
> > > current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> > > generated by invoking DPDK scripts though meson's run_command()
> > > instead
> > > of using has_types, has_members, ... commands.
> > > 
> > > Meson will try to find the required external libraries.  When they
> > > are
> > > not installed system wide, they can be provided though CFLAGS,
> > > LDFLAGS
> > > and LD_LIBRARY_PATH environment variables, example (considering
> > > RDMA-Core is installed in /tmp/rdma-core):
> > > 
> > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > >    meson -Denable_driver_mlx4=true output
> > > 
> > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > >    ninja -C output install
> > 
> > Once the CFLAGS/LDFLAGS are passed to meson, they should not be
> > needed for
> > ninja. The LD_LIBRARY_PATH might be - I'm not sure about that one! :-
> > )
> > 
> > > 
> > > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > > 
> > > ---
> > > 
> > > Changes in v2:
> > > 
> > > - dropped patch https://patches.dpdk.org/patch/43897/
> > > - remove extra_{cflags,ldflags} as already honored by meson through
> > > environment variables.
> > > ---
> > >  drivers/net/meson.build      |   2 +
> > >  drivers/net/mlx4/meson.build |  94 ++++++
> > >  drivers/net/mlx5/meson.build | 545
> > > +++++++++++++++++++++++++++++++++++
> > >  meson_options.txt            |   8 +
> > >  4 files changed, 649 insertions(+)
> > >  create mode 100644 drivers/net/mlx4/meson.build
> > >  create mode 100644 drivers/net/mlx5/meson.build
> > > 
> > > diff --git a/drivers/net/meson.build b/drivers/net/meson.build
> > > index 9c28ed4da..c7a2d0e7d 100644
> > > --- a/drivers/net/meson.build
> > > +++ b/drivers/net/meson.build
> > > @@ -18,6 +18,8 @@ drivers = ['af_packet',
> > >  	'ixgbe',
> > >  	'kni',
> > >  	'liquidio',
> > > +	'mlx4',
> > > +	'mlx5',
> > >  	'mvpp2',
> > >  	'netvsc',
> > >  	'nfp',
> > > diff --git a/drivers/net/mlx4/meson.build
> > > b/drivers/net/mlx4/meson.build
> > > new file mode 100644
> > > index 000000000..debaca5b6
> > > --- /dev/null
> > > +++ b/drivers/net/mlx4/meson.build
> > > @@ -0,0 +1,94 @@
> > > +# SPDX-License-Identifier: BSD-3-Clause
> > > +# Copyright 2018 6WIND S.A.
> > > +# Copyright 2018 Mellanox Technologies, Ltd
> > > +
> > > +# As there is no more configuration file to activate/configure the
> > > PMD it will
> > > +# use some variables here to configure it.
> > > +pmd_dlopen = get_option('enable_driver_mlx4_glue')
> > > +build = get_option('enable_driver_mlx4') or pmd_dlopen
> > 
> > As stated above, I believe this should be based upon whether you find
> > the
> > "mnl", "mlx4" and "ibverbs" libraries. If we start adding back in
> > static
> > options for every driver, then we'll be back to having a mass of
> > config
> > options like we had before.
> 
> BTW, slightly related to that: ibverbs doesn't ship pkg-config files at
> the moment which makes the detection slightly more awkward that it
> could be, so I've sent a PR upstream to add that:
> 
> https://github.com/linux-rdma/rdma-core/pull/373
> 
> Hope this can be useful!

Thanks Luca, I was also searching for it, you save me some time, I hope
this can be backported down to RDMA-Core's stable version v15 of
RDMA-Core it would fully help.

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
  2018-08-29 11:59       ` Nélio Laranjeiro
@ 2018-08-29 12:28         ` Luca Boccassi
  2018-08-31 16:24         ` Luca Boccassi
  1 sibling, 0 replies; 26+ messages in thread
From: Luca Boccassi @ 2018-08-29 12:28 UTC (permalink / raw)
  To: Nélio Laranjeiro
  Cc: Bruce Richardson, dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

On Wed, 2018-08-29 at 13:59 +0200, Nélio Laranjeiro wrote:
> On Wed, Aug 29, 2018 at 11:00:54AM +0100, Luca Boccassi wrote:
> > On Tue, 2018-08-28 at 16:45 +0100, Bruce Richardson wrote:
> > > Thanks for this, comments inline below.
> > > 
> > > /Bruce
> > > 
> > > On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> > > > Mellanox drivers remains un-compiled by default due to third
> > > > party
> > > > libraries dependencies.  They can be enabled through:
> > > > - enable_driver_mlx{4,5}=true or
> > > > - enable_driver_mlx{4,5}_glue=true
> > > > depending on the needs.
> > > 
> > > The big reason why we wanted a new build system was to move away
> > > from
> > > this
> > > sort of static configuration. Instead, detect if the requirements
> > > as
> > > present and build the driver if you can.
> > > 
> > > > 
> > > > To avoid modifying the whole sources and keep the compatibility
> > > > with
> > > > current build systems (e.g. make), the mlx{4,5}_autoconf.h is
> > > > still
> > > > generated by invoking DPDK scripts though meson's run_command()
> > > > instead
> > > > of using has_types, has_members, ... commands.
> > > > 
> > > > Meson will try to find the required external libraries.  When
> > > > they
> > > > are
> > > > not installed system wide, they can be provided though CFLAGS,
> > > > LDFLAGS
> > > > and LD_LIBRARY_PATH environment variables, example (considering
> > > > RDMA-Core is installed in /tmp/rdma-core):
> > > > 
> > > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > > >    meson -Denable_driver_mlx4=true output
> > > > 
> > > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > > >    ninja -C output install
> > > 
> > > Once the CFLAGS/LDFLAGS are passed to meson, they should not be
> > > needed for
> > > ninja. The LD_LIBRARY_PATH might be - I'm not sure about that
> > > one! :-
> > > )
> > > 
> > > > 
> > > > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > > > 
> > > > ---
> > > > 
> > > > Changes in v2:
> > > > 
> > > > - dropped patch https://patches.dpdk.org/patch/43897/
> > > > - remove extra_{cflags,ldflags} as already honored by meson
> > > > through
> > > > environment variables.
> > > > ---
> > > >  drivers/net/meson.build      |   2 +
> > > >  drivers/net/mlx4/meson.build |  94 ++++++
> > > >  drivers/net/mlx5/meson.build | 545
> > > > +++++++++++++++++++++++++++++++++++
> > > >  meson_options.txt            |   8 +
> > > >  4 files changed, 649 insertions(+)
> > > >  create mode 100644 drivers/net/mlx4/meson.build
> > > >  create mode 100644 drivers/net/mlx5/meson.build
> > > > 
> > > > diff --git a/drivers/net/meson.build b/drivers/net/meson.build
> > > > index 9c28ed4da..c7a2d0e7d 100644
> > > > --- a/drivers/net/meson.build
> > > > +++ b/drivers/net/meson.build
> > > > @@ -18,6 +18,8 @@ drivers = ['af_packet',
> > > >  	'ixgbe',
> > > >  	'kni',
> > > >  	'liquidio',
> > > > +	'mlx4',
> > > > +	'mlx5',
> > > >  	'mvpp2',
> > > >  	'netvsc',
> > > >  	'nfp',
> > > > diff --git a/drivers/net/mlx4/meson.build
> > > > b/drivers/net/mlx4/meson.build
> > > > new file mode 100644
> > > > index 000000000..debaca5b6
> > > > --- /dev/null
> > > > +++ b/drivers/net/mlx4/meson.build
> > > > @@ -0,0 +1,94 @@
> > > > +# SPDX-License-Identifier: BSD-3-Clause
> > > > +# Copyright 2018 6WIND S.A.
> > > > +# Copyright 2018 Mellanox Technologies, Ltd
> > > > +
> > > > +# As there is no more configuration file to activate/configure
> > > > the
> > > > PMD it will
> > > > +# use some variables here to configure it.
> > > > +pmd_dlopen = get_option('enable_driver_mlx4_glue')
> > > > +build = get_option('enable_driver_mlx4') or pmd_dlopen
> > > 
> > > As stated above, I believe this should be based upon whether you
> > > find
> > > the
> > > "mnl", "mlx4" and "ibverbs" libraries. If we start adding back in
> > > static
> > > options for every driver, then we'll be back to having a mass of
> > > config
> > > options like we had before.
> > 
> > BTW, slightly related to that: ibverbs doesn't ship pkg-config
> > files at
> > the moment which makes the detection slightly more awkward that it
> > could be, so I've sent a PR upstream to add that:
> > 
> > https://github.com/linux-rdma/rdma-core/pull/373
> > 
> > Hope this can be useful!
> 
> Thanks Luca, I was also searching for it, you save me some time, I
> hope
> this can be backported down to RDMA-Core's stable version v15 of
> RDMA-Core it would fully help.

With a quick glance at the v15 branch, the CMake files look similar
enough that it should be pretty straightforward to backport.

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
  2018-08-29 10:01       ` Bruce Richardson
@ 2018-08-29 12:44         ` Nélio Laranjeiro
  0 siblings, 0 replies; 26+ messages in thread
From: Nélio Laranjeiro @ 2018-08-29 12:44 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

On Wed, Aug 29, 2018 at 11:01:15AM +0100, Bruce Richardson wrote:
> On Wed, Aug 29, 2018 at 11:34:10AM +0200, Nélio Laranjeiro wrote:
> > Hi Bruce,
> > 
> > Thanks for your comments I have address almost all of them in the v3 by
> > doing what you suggest, I still have some comments, please see below,
> > 
> 
> Thanks.
> 
> > On Tue, Aug 28, 2018 at 04:45:00PM +0100, Bruce Richardson wrote:
> > > Thanks for this, comments inline below.
> > > 
> > > /Bruce
> > > 
> > > On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> > > > Mellanox drivers remains un-compiled by default due to third party
> > > > libraries dependencies.  They can be enabled through:
> > > > - enable_driver_mlx{4,5}=true or
> > > > - enable_driver_mlx{4,5}_glue=true
> > > > depending on the needs.
> > > 
> > > The big reason why we wanted a new build system was to move away from this
> > > sort of static configuration. Instead, detect if the requirements as
> > > present and build the driver if you can.
> > 
> > Ok, I am letting only the glue option for both drivers as suggested at
> > the end of your answer.
> > 
> > > > To avoid modifying the whole sources and keep the compatibility with
> > > > current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> > > > generated by invoking DPDK scripts though meson's run_command() instead
> > > > of using has_types, has_members, ... commands.
> > > > 
> > > > Meson will try to find the required external libraries.  When they are
> > > > not installed system wide, they can be provided though CFLAGS, LDFLAGS
> > > > and LD_LIBRARY_PATH environment variables, example (considering
> > > > RDMA-Core is installed in /tmp/rdma-core):
> > > > 
> > > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > > >    meson -Denable_driver_mlx4=true output
> > > > 
> > > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > > >    ninja -C output install
> > > 
> > > Once the CFLAGS/LDFLAGS are passed to meson, they should not be needed for
> > > ninja. The LD_LIBRARY_PATH might be - I'm not sure about that one! :-)
> > 
> > CFLAGS/LDFLAGS are correctly evaluated and inserted in the build.ninja
> > file, for the LD_LIBRARY_PATH, it is necessary for the run_command stuff
> > generating the mlx*_autoconf.h
> > 
> 
> Just realised there is another issue which you should address. The
> mlx*_autoconf.h files are being written into a source folder rather than
> into the destination folder. This could cause problems if we are enabling
> mlx for cross-compile builds. Perhaps inside the auto-config-h.sh script
> you can check for $MESON_BUILD_ROOT value, and use that (and possibly
> $MESON_SUBDIR) to put the header file in the build directory.

Indeed, I was searching also for a solution, I finally found it without
modifying the shell script by using meson.current_build_dir() which
contains the same path has $MESON_BUILD_ROOT/$MESON_SUBDIR.

> > >[...] 
> > > Rather than having your own separate debug option flag, why not set these
> > > based on the "buildtype" option e.g. if buildtype is set to "debug".
> > > 
> > > > +        # To maintain the compatibility with the make build system
> > > > +        # mlx4_autoconf.h file is still generated.
> > > > +        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> > > > +                        'mlx4_autoconf.h',
> > > > +                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
> > > > +                        'infiniband/mlx4dv.h',
> > > > +                        'type', 'struct mlx4_wqe_lso_seg')
> > > > +        if r.returncode() != 0
> > > > +                error('autoconfiguration fail')
> > > > +        endif
> > > 
> > > Just to check that you are ok with this only being run at configure time?
> > > If any changes are made to the inputs, ninja won't pick them up. To have it
> > > tracked for input changes, "custom_target" should be used instead of
> > > run_command.
> > 
> > It seems to not be possible to have several custom_target on the same
> > output file has this last is used as the target identifier in ninja.
> > 
> > This limitation is acceptable for now, when meson will be the default
> > build system, then such autoconf can be removed to use meson built-in
> > functions.
> > 
> > > > +endif
> > > > +# Build Glue Library
> > > > +if pmd_dlopen
> > > > +        dlopen_name = 'mlx4_glue'
> > > > +        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
> > > > +        dlopen_so_version = LIB_GLUE_VERSION
> > > > +        dlopen_sources = files('mlx4_glue.c')
> > > > +        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
> > > > +        shared_lib = shared_library(
> > > > +               dlopen_lib_name,
> > > > +               dlopen_sources,
> > > > +               include_directories: global_inc,
> > > > +               c_args: cflags,
> > > > +               link_args: [
> > > > +                       '-Wl,-export-dynamic',
> > > > +                       '-Wl,-h,@0@'.format(LIB_GLUE),
> > > > +                       '-lmlx4',
> > > > +                       '-libverbs',
> > > 
> > > While this works, the recommended approach is to save the return value from
> > > cc.find_library() above, and pass that as a dependency directly, rather
> > > than as a linker flag.
> > 
> > I tried it, but:
> > 
> >  drivers/net/mlx5/meson.build:216:8: ERROR:  Link_args arguments must be
> >  strings.
> > 
> 
> It needs to be passed using "dependencies" rather than as a link_arg. [See
> list of possible arguments to library and executable objects here:
> http://mesonbuild.com/Reference-manual.html#executable]

Thanks this works with the dependencies.

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v3] net/mlx: add meson build support
  2018-08-27 12:42 ` [dpdk-dev] [PATCH v2] net/mlx: add meson build support Nelio Laranjeiro
  2018-08-28 15:45   ` Bruce Richardson
@ 2018-08-29 13:48   ` Nelio Laranjeiro
  2018-08-30 14:46     ` Bruce Richardson
  2018-08-31  7:16     ` [dpdk-dev] [PATCH v4] " Nelio Laranjeiro
  1 sibling, 2 replies; 26+ messages in thread
From: Nelio Laranjeiro @ 2018-08-29 13:48 UTC (permalink / raw)
  To: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad, Bruce Richardson

Compile Mellanox drivers when their external dependencies are met.  A
glue version of the driver can still be requested by using the
-Denable_driver_mlx_glue=true

To avoid modifying the whole sources and keep the compatibility with
current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
generated by invoking DPDK scripts though meson's run_command() instead
of using has_types, has_members, ... commands.

Meson will try to find the required external libraries.  When they are
not installed system wide, they can be provided though CFLAGS, LDFLAGS
and LD_LIBRARY_PATH environment variables, example (considering
RDMA-Core is installed in /tmp/rdma-core):

 # CLFAGS=-I/tmp/rdma-core/build/include \
   LDFLAGS=-L/tmp/rdma-core/build/lib \
   LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   meson output
 # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   ninja -C output install

Note: LD_LIBRARY_PATH before ninja is necessary when the meson
configuration has changed (e.g. meson configure has been called), in
such situation the LD_LIBRARY_PATH is necessary to invoke the
autoconfiguration script.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

---

Changes in v3:

Sanitize the build files:
- remove enable_driver_mlx{4,5} options,
- test cflags capabilities before using them,
- remove old autoconfiguration file,
- use an array for autoconfiguration and put them in the build directory,
- use dependencies in shared_library for link arguments.

Changes in v2:

- dropped patch https://patches.dpdk.org/patch/43897/
- remove extra_{cflags,ldflags} as already honored by meson through
environment variables.
---
 drivers/net/meson.build      |   2 +
 drivers/net/mlx4/meson.build |  97 +++++++++++++++
 drivers/net/mlx5/meson.build | 232 +++++++++++++++++++++++++++++++++++
 meson_options.txt            |   2 +
 4 files changed, 333 insertions(+)
 create mode 100644 drivers/net/mlx4/meson.build
 create mode 100644 drivers/net/mlx5/meson.build

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 9c28ed4da..c7a2d0e7d 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -18,6 +18,8 @@ drivers = ['af_packet',
 	'ixgbe',
 	'kni',
 	'liquidio',
+	'mlx4',
+	'mlx5',
 	'mvpp2',
 	'netvsc',
 	'nfp',
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
new file mode 100644
index 000000000..6b5460b91
--- /dev/null
+++ b/drivers/net/mlx4/meson.build
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+pmd_dlopen = get_option('enable_driver_mlx_glue')
+LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
+LIB_GLUE_VERSION = '18.02.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+        ]
+endif
+libs = [
+        cc.find_library('mnl', required:false),
+        cc.find_library('mlx4', required:false),
+        cc.find_library('ibverbs', required:false),
+]
+build = true
+foreach lib:libs
+        if not lib.found()
+                build = false
+        endif
+endforeach
+# Compile PMD
+if build
+        allow_experimental_apis = true
+        ext_deps += libs
+        sources = files(
+               'mlx4.c',
+               'mlx4_ethdev.c',
+               'mlx4_flow.c',
+               'mlx4_intr.c',
+               'mlx4_mr.c',
+               'mlx4_rxq.c',
+               'mlx4_rxtx.c',
+               'mlx4_txq.c',
+               'mlx4_utils.c',
+        )
+        if not pmd_dlopen
+                sources += files('mlx4_glue.c')
+        endif
+        cflags_options = [
+                '-Wall',
+                '-Wextra',
+                '-std=c11',
+                '-Wno-strict-prototypes',
+                '-D_BSD_SOURCE',
+                '-D_DEFAULT_SOURCE',
+                '-D_XOPEN_SOURCE=600'
+        ]
+        foreach option:cflags_options
+                if cc.has_argument(option)
+                        cflags += option
+                endif
+        endforeach
+        if get_option('buildtype').contains('debug')
+                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+        else
+                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+        endif
+        # To maintain the compatibility with the make build system
+        # mlx4_autoconf.h file is still generated.
+        run_command('rm', '-f', meson.current_build_dir() + '/mlx4_autoconf.h')
+        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                        meson.current_build_dir() + '/mlx4_autoconf.h',
+                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
+                        'infiniband/mlx4dv.h',
+                        'type', 'struct mlx4_wqe_lso_seg')
+        if r.returncode() != 0
+                error('autoconfiguration fail')
+        endif
+endif
+# Build Glue Library
+if pmd_dlopen and build
+        dlopen_name = 'mlx4_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx4_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+               dlopen_lib_name,
+               dlopen_sources,
+               include_directories: global_inc,
+               c_args: cflags,
+               dependencies: libs,
+               link_args: [
+                       '-Wl,-export-dynamic',
+                       '-Wl,-h,@0@'.format(LIB_GLUE),
+                       ],
+               soversion: dlopen_so_version,
+               install: true,
+               install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
new file mode 100644
index 000000000..fbca00849
--- /dev/null
+++ b/drivers/net/mlx5/meson.build
@@ -0,0 +1,232 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+pmd_dlopen = get_option('enable_driver_mlx_glue')
+LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
+LIB_GLUE_VERSION = '18.05.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+        ]
+endif
+libs = [
+        cc.find_library('mnl', required:false),
+        cc.find_library('mlx5', required:false),
+        cc.find_library('ibverbs', required:false),
+]
+build = true
+foreach lib:libs
+        if not lib.found()
+                build = false
+        endif
+endforeach
+if build
+        allow_experimental_apis = true
+        ext_deps += libs
+        sources = files(
+                'mlx5.c',
+                'mlx5_ethdev.c',
+                'mlx5_flow.c',
+                'mlx5_mac.c',
+                'mlx5_mr.c',
+                'mlx5_nl.c',
+                'mlx5_nl_flow.c',
+                'mlx5_rss.c',
+                'mlx5_rxmode.c',
+                'mlx5_rxq.c',
+                'mlx5_rxtx.c',
+                'mlx5_socket.c',
+                'mlx5_stats.c',
+                'mlx5_trigger.c',
+                'mlx5_txq.c',
+                'mlx5_vlan.c',
+        )
+        if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
+                sources += files('mlx5_rxtx_vec.c')
+        endif
+        if not pmd_dlopen
+                sources += files('mlx5_glue.c')
+        endif
+        cflags_options = [
+                '-Wall',
+                '-Wextra',
+                '-std=c11',
+                '-Wno-strict-prototypes',
+                '-D_BSD_SOURCE',
+                '-D_DEFAULT_SOURCE',
+                '-D_XOPEN_SOURCE=600'
+        ]
+        foreach option:cflags_options
+                if cc.has_argument(option)
+                        cflags += option
+                endif
+        endforeach
+        if get_option('buildtype').contains('debug')
+                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+        else
+                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+        endif
+        # To maintain the compatibility with the make build system
+        # mlx5_autoconf.h file is still generated.
+        args = [
+                [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
+                [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
+                [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
+                  'enum', 'IBV_FLOW_SPEC_MPLS' ],
+                [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
+                  'enum', 'IBV_WQ_FLAG_RX_END_PADDING' ],
+                [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', 'type',
+                  'struct mlx5dv_sw_parsing_caps' ],
+                [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', 'enum',
+                  'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
+                [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_25G',
+                  '/usr/include/linux/ethtool.h', 'enum',
+                  'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_50G',
+                  '/usr/include/linux/ethtool.h', 'enum',
+                  'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_100G',
+                  '/usr/include/linux/ethtool.h', 'enum',
+                  'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
+                [ 'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT',
+                  'infiniband/verbs.h', 'type',
+                  'struct ibv_counter_set_init_attr' ],
+                [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', 'enum',
+                  'RDMA_NL_NLDEV' ],
+                [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', 'enum',
+                  'RDMA_NLDEV_CMD_GET' ],
+                [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_CMD_PORT_GET' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_DEV_NAME' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
+                [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', 'enum',
+                  'IFLA_PHYS_SWITCH_ID' ],
+                [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', 'enum',
+                  'IFLA_PHYS_PORT_NAME' ],
+                [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_ACT' ],
+                [ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_FLAGS' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_ETH_TYPE' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_ETH_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_ETH_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IP_PROTO' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IPV4_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IPV4_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IPV6_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IPV6_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_TCP_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_TCP_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_UDP_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_UDP_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_VLAN_ID' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_VLAN_PRIO' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
+                [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', 'enum',
+                  'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
+                [ 'HAVE_SUPPORTED_40000baseKR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_40000baseKR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseCR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_40000baseCR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseSR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_40000baseSR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseLR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_40000baseLR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseKR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_56000baseKR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseCR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_56000baseCR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseSR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_56000baseSR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseLR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_56000baseLR4_Full' ],
+        ]
+        run_command('rm', '-f', meson.current_build_dir() + '/mlx5_autoconf.h')
+        foreach arg:args
+                r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                                meson.current_build_dir() +
+                                '/mlx5_autoconf.h', arg)
+                if r.returncode() != 0
+                        error('autoconfiguration fail')
+                endif
+        endforeach
+endif
+# Build Glue Library
+if pmd_dlopen and build
+        dlopen_name = 'mlx5_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx5_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+                dlopen_lib_name,
+                dlopen_sources,
+                include_directories: global_inc,
+                c_args: cflags,
+                dependencies: libs,
+                link_args: [
+                        '-Wl,-export-dynamic',
+                        '-Wl,-h,@0@'.format(LIB_GLUE),
+                        ],
+                soversion: dlopen_so_version,
+                install: true,
+                install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/meson_options.txt b/meson_options.txt
index c84327858..583ce3249 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,7 @@
 option('allow_invalid_socket_id', type: 'boolean', value: false,
 	description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly')
+option('enable_driver_mlx_glue', type: 'boolean', value: false,
+	description: 'Enable Mellanox PMD for ConnectX-3/4/5 NIC glue library')
 option('enable_kmods', type: 'boolean', value: true,
 	description: 'build kernel modules')
 option('examples', type: 'string', value: '',
-- 
2.18.0

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/mlx: add meson build support
  2018-08-29 13:48   ` [dpdk-dev] [PATCH v3] " Nelio Laranjeiro
@ 2018-08-30 14:46     ` Bruce Richardson
  2018-08-31  7:05       ` Nélio Laranjeiro
  2018-08-31  7:16     ` [dpdk-dev] [PATCH v4] " Nelio Laranjeiro
  1 sibling, 1 reply; 26+ messages in thread
From: Bruce Richardson @ 2018-08-30 14:46 UTC (permalink / raw)
  To: Nelio Laranjeiro; +Cc: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

On Wed, Aug 29, 2018 at 03:48:17PM +0200, Nelio Laranjeiro wrote:
> Compile Mellanox drivers when their external dependencies are met.  A
> glue version of the driver can still be requested by using the
> -Denable_driver_mlx_glue=true
> 
> To avoid modifying the whole sources and keep the compatibility with
> current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> generated by invoking DPDK scripts though meson's run_command() instead
> of using has_types, has_members, ... commands.
> 
> Meson will try to find the required external libraries.  When they are
> not installed system wide, they can be provided though CFLAGS, LDFLAGS
> and LD_LIBRARY_PATH environment variables, example (considering
> RDMA-Core is installed in /tmp/rdma-core):
> 
>  # CLFAGS=-I/tmp/rdma-core/build/include \
>    LDFLAGS=-L/tmp/rdma-core/build/lib \
>    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
>    meson output
>  # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
>    ninja -C output install
> 
> Note: LD_LIBRARY_PATH before ninja is necessary when the meson
> configuration has changed (e.g. meson configure has been called), in
> such situation the LD_LIBRARY_PATH is necessary to invoke the
> autoconfiguration script.
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> 

Couple of minor comments inline below. Otherwise:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
> 
> Changes in v3:
> 
> Sanitize the build files:
> - remove enable_driver_mlx{4,5} options,
> - test cflags capabilities before using them,
> - remove old autoconfiguration file,
> - use an array for autoconfiguration and put them in the build directory,
> - use dependencies in shared_library for link arguments.
> 
> Changes in v2:
> 
> - dropped patch https://patches.dpdk.org/patch/43897/
> - remove extra_{cflags,ldflags} as already honored by meson through
> environment variables.
> ---
>  drivers/net/meson.build      |   2 +
>  drivers/net/mlx4/meson.build |  97 +++++++++++++++
>  drivers/net/mlx5/meson.build | 232 +++++++++++++++++++++++++++++++++++
>  meson_options.txt            |   2 +
>  4 files changed, 333 insertions(+)
>  create mode 100644 drivers/net/mlx4/meson.build
>  create mode 100644 drivers/net/mlx5/meson.build
> 
> diff --git a/drivers/net/meson.build b/drivers/net/meson.build
> index 9c28ed4da..c7a2d0e7d 100644
> --- a/drivers/net/meson.build
> +++ b/drivers/net/meson.build
> @@ -18,6 +18,8 @@ drivers = ['af_packet',
>  	'ixgbe',
>  	'kni',
>  	'liquidio',
> +	'mlx4',
> +	'mlx5',
>  	'mvpp2',
>  	'netvsc',
>  	'nfp',
> diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
> new file mode 100644
> index 000000000..6b5460b91
> --- /dev/null
> +++ b/drivers/net/mlx4/meson.build
> @@ -0,0 +1,97 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright 2018 6WIND S.A.
> +# Copyright 2018 Mellanox Technologies, Ltd
> +
> +pmd_dlopen = get_option('enable_driver_mlx_glue')
> +LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
> +LIB_GLUE_VERSION = '18.02.0'
> +LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
> +if pmd_dlopen
> +        dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1)
> +        cflags += [
> +                '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
> +                '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
> +        ]
> +endif
> +libs = [
> +        cc.find_library('mnl', required:false),
> +        cc.find_library('mlx4', required:false),
> +        cc.find_library('ibverbs', required:false),
> +]
> +build = true
> +foreach lib:libs
> +        if not lib.found()
> +                build = false
> +        endif
> +endforeach
> +# Compile PMD
> +if build
> +        allow_experimental_apis = true
> +        ext_deps += libs
> +        sources = files(
> +               'mlx4.c',
> +               'mlx4_ethdev.c',
> +               'mlx4_flow.c',
> +               'mlx4_intr.c',
> +               'mlx4_mr.c',
> +               'mlx4_rxq.c',
> +               'mlx4_rxtx.c',
> +               'mlx4_txq.c',
> +               'mlx4_utils.c',
> +        )
> +        if not pmd_dlopen
> +                sources += files('mlx4_glue.c')
> +        endif
> +        cflags_options = [
> +                '-Wall',
> +                '-Wextra',

I believe -Wall is already passed to all meson build commands by default,
but it's presence here doesn't hurt.

> +                '-std=c11',
> +                '-Wno-strict-prototypes',
> +                '-D_BSD_SOURCE',
> +                '-D_DEFAULT_SOURCE',
> +                '-D_XOPEN_SOURCE=600'
> +        ]
> +        foreach option:cflags_options
> +                if cc.has_argument(option)
> +                        cflags += option
> +                endif
> +        endforeach
> +        if get_option('buildtype').contains('debug')
> +                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
> +        else
> +                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
> +        endif
> +        # To maintain the compatibility with the make build system
> +        # mlx4_autoconf.h file is still generated.
> +        run_command('rm', '-f', meson.current_build_dir() + '/mlx4_autoconf.h')
> +        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                        meson.current_build_dir() + '/mlx4_autoconf.h',
> +                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
> +                        'infiniband/mlx4dv.h',
> +                        'type', 'struct mlx4_wqe_lso_seg')
> +        if r.returncode() != 0
> +                error('autoconfiguration fail')
> +        endif
> +endif
> +# Build Glue Library
> +if pmd_dlopen and build
> +        dlopen_name = 'mlx4_glue'
> +        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
> +        dlopen_so_version = LIB_GLUE_VERSION
> +        dlopen_sources = files('mlx4_glue.c')
> +        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
> +        shared_lib = shared_library(
> +               dlopen_lib_name,
> +               dlopen_sources,
> +               include_directories: global_inc,
> +               c_args: cflags,
> +               dependencies: libs,
> +               link_args: [
> +                       '-Wl,-export-dynamic',
> +                       '-Wl,-h,@0@'.format(LIB_GLUE),
> +                       ],
> +               soversion: dlopen_so_version,
> +               install: true,
> +               install_dir: dlopen_install_dir,
> +        )
> +endif
> diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
> new file mode 100644
> index 000000000..fbca00849
> --- /dev/null
> +++ b/drivers/net/mlx5/meson.build
> @@ -0,0 +1,232 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright 2018 6WIND S.A.
> +# Copyright 2018 Mellanox Technologies, Ltd
> +
> +pmd_dlopen = get_option('enable_driver_mlx_glue')
> +LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
> +LIB_GLUE_VERSION = '18.05.0'
> +LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
> +if pmd_dlopen
> +        dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
> +        cflags += [
> +                '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
> +                '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
> +        ]
> +endif
> +libs = [
> +        cc.find_library('mnl', required:false),
> +        cc.find_library('mlx5', required:false),
> +        cc.find_library('ibverbs', required:false),
> +]
> +build = true
> +foreach lib:libs
> +        if not lib.found()
> +                build = false
> +        endif
> +endforeach
> +if build
> +        allow_experimental_apis = true
> +        ext_deps += libs
> +        sources = files(
> +                'mlx5.c',
> +                'mlx5_ethdev.c',
> +                'mlx5_flow.c',
> +                'mlx5_mac.c',
> +                'mlx5_mr.c',
> +                'mlx5_nl.c',
> +                'mlx5_nl_flow.c',
> +                'mlx5_rss.c',
> +                'mlx5_rxmode.c',
> +                'mlx5_rxq.c',
> +                'mlx5_rxtx.c',
> +                'mlx5_socket.c',
> +                'mlx5_stats.c',
> +                'mlx5_trigger.c',
> +                'mlx5_txq.c',
> +                'mlx5_vlan.c',
> +        )
> +        if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
> +                sources += files('mlx5_rxtx_vec.c')
> +        endif
> +        if not pmd_dlopen
> +                sources += files('mlx5_glue.c')
> +        endif
> +        cflags_options = [
> +                '-Wall',
> +                '-Wextra',
> +                '-std=c11',
> +                '-Wno-strict-prototypes',
> +                '-D_BSD_SOURCE',
> +                '-D_DEFAULT_SOURCE',
> +                '-D_XOPEN_SOURCE=600'
> +        ]
> +        foreach option:cflags_options
> +                if cc.has_argument(option)
> +                        cflags += option
> +                endif
> +        endforeach
> +        if get_option('buildtype').contains('debug')
> +                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
> +        else
> +                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
> +        endif
> +        # To maintain the compatibility with the make build system
> +        # mlx5_autoconf.h file is still generated.
> +        args = [
> +                [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
> +                  'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
> +                [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
> +                  'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
> +                [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
> +                  'enum', 'IBV_FLOW_SPEC_MPLS' ],
> +                [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
> +                  'enum', 'IBV_WQ_FLAG_RX_END_PADDING' ],
> +                [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', 'type',
> +                  'struct mlx5dv_sw_parsing_caps' ],
> +                [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', 'enum',
> +                  'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
> +                [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
> +                  'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
> +                [ 'HAVE_ETHTOOL_LINK_MODE_25G',
> +                  '/usr/include/linux/ethtool.h', 'enum',
> +                  'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
> +                [ 'HAVE_ETHTOOL_LINK_MODE_50G',
> +                  '/usr/include/linux/ethtool.h', 'enum',
> +                  'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
> +                [ 'HAVE_ETHTOOL_LINK_MODE_100G',
> +                  '/usr/include/linux/ethtool.h', 'enum',
> +                  'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
> +                [ 'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT',
> +                  'infiniband/verbs.h', 'type',
> +                  'struct ibv_counter_set_init_attr' ],
> +                [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', 'enum',
> +                  'RDMA_NL_NLDEV' ],
> +                [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', 'enum',
> +                  'RDMA_NLDEV_CMD_GET' ],
> +                [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_CMD_PORT_GET' ],
> +                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
> +                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_ATTR_DEV_NAME' ],
> +                [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
> +                [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
> +                [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', 'enum',
> +                  'IFLA_PHYS_SWITCH_ID' ],
> +                [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', 'enum',
> +                  'IFLA_PHYS_PORT_NAME' ],
> +                [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_ACT' ],
> +                [ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_FLAGS' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_ETH_TYPE' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_ETH_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_ETH_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_IP_PROTO' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_IPV4_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_IPV4_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_IPV6_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_IPV6_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_TCP_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_TCP_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_UDP_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_UDP_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_VLAN_ID' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h', 'enum',
> +                  'TCA_FLOWER_KEY_VLAN_PRIO' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
> +                [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', 'enum',
> +                  'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
> +                [ 'HAVE_SUPPORTED_40000baseKR4_Full',
> +                  '/usr/include/linux/ethtool.h', 'define',
> +                  'SUPPORTED_40000baseKR4_Full' ],
> +                [ 'HAVE_SUPPORTED_40000baseCR4_Full',
> +                  '/usr/include/linux/ethtool.h', 'define',
> +                  'SUPPORTED_40000baseCR4_Full' ],
> +                [ 'HAVE_SUPPORTED_40000baseSR4_Full',
> +                  '/usr/include/linux/ethtool.h', 'define',
> +                  'SUPPORTED_40000baseSR4_Full' ],
> +                [ 'HAVE_SUPPORTED_40000baseLR4_Full',
> +                  '/usr/include/linux/ethtool.h', 'define',
> +                  'SUPPORTED_40000baseLR4_Full' ],
> +                [ 'HAVE_SUPPORTED_56000baseKR4_Full',
> +                  '/usr/include/linux/ethtool.h', 'define',
> +                  'SUPPORTED_56000baseKR4_Full' ],
> +                [ 'HAVE_SUPPORTED_56000baseCR4_Full',
> +                  '/usr/include/linux/ethtool.h', 'define',
> +                  'SUPPORTED_56000baseCR4_Full' ],
> +                [ 'HAVE_SUPPORTED_56000baseSR4_Full',
> +                  '/usr/include/linux/ethtool.h', 'define',
> +                  'SUPPORTED_56000baseSR4_Full' ],
> +                [ 'HAVE_SUPPORTED_56000baseLR4_Full',
> +                  '/usr/include/linux/ethtool.h', 'define',
> +                  'SUPPORTED_56000baseLR4_Full' ],
> +        ]
> +        run_command('rm', '-f', meson.current_build_dir() + '/mlx5_autoconf.h')
> +        foreach arg:args
> +                r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> +                                meson.current_build_dir() +
> +                                '/mlx5_autoconf.h', arg)
> +                if r.returncode() != 0
> +                        error('autoconfiguration fail')
> +                endif
> +        endforeach

Having it as a loop doesn't really help much, does it! :-) The array is
still pretty ugly. You could probably improve the error message to include
the failing arguments to make debug easier, but otherwise it's ok.

> +endif
> +# Build Glue Library
> +if pmd_dlopen and build
> +        dlopen_name = 'mlx5_glue'
> +        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
> +        dlopen_so_version = LIB_GLUE_VERSION
> +        dlopen_sources = files('mlx5_glue.c')
> +        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
> +        shared_lib = shared_library(
> +                dlopen_lib_name,
> +                dlopen_sources,
> +                include_directories: global_inc,
> +                c_args: cflags,
> +                dependencies: libs,
> +                link_args: [
> +                        '-Wl,-export-dynamic',
> +                        '-Wl,-h,@0@'.format(LIB_GLUE),
> +                        ],
> +                soversion: dlopen_so_version,
> +                install: true,
> +                install_dir: dlopen_install_dir,
> +        )
> +endif
> diff --git a/meson_options.txt b/meson_options.txt
> index c84327858..583ce3249 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -1,5 +1,7 @@
>  option('allow_invalid_socket_id', type: 'boolean', value: false,
>  	description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly')
> +option('enable_driver_mlx_glue', type: 'boolean', value: false,
> +	description: 'Enable Mellanox PMD for ConnectX-3/4/5 NIC glue library')

I think the description might be better as:
"Enable glue library for Mellanox ConnectX-3/4/5 NIC PMD".
Having the glue library at the end doesn't read well, IMHO

>  option('enable_kmods', type: 'boolean', value: true,
>  	description: 'build kernel modules')
>  option('examples', type: 'string', value: '',
> -- 
> 2.18.0
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/mlx: add meson build support
  2018-08-30 14:46     ` Bruce Richardson
@ 2018-08-31  7:05       ` Nélio Laranjeiro
  0 siblings, 0 replies; 26+ messages in thread
From: Nélio Laranjeiro @ 2018-08-31  7:05 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

On Thu, Aug 30, 2018 at 03:46:17PM +0100, Bruce Richardson wrote:
> On Wed, Aug 29, 2018 at 03:48:17PM +0200, Nelio Laranjeiro wrote:
> > Compile Mellanox drivers when their external dependencies are met.  A
> > glue version of the driver can still be requested by using the
> > -Denable_driver_mlx_glue=true
> > 
> > To avoid modifying the whole sources and keep the compatibility with
> > current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> > generated by invoking DPDK scripts though meson's run_command() instead
> > of using has_types, has_members, ... commands.
> > 
> > Meson will try to find the required external libraries.  When they are
> > not installed system wide, they can be provided though CFLAGS, LDFLAGS
> > and LD_LIBRARY_PATH environment variables, example (considering
> > RDMA-Core is installed in /tmp/rdma-core):
> > 
> >  # CLFAGS=-I/tmp/rdma-core/build/include \
> >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    meson output
> >  # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    ninja -C output install
> > 
> > Note: LD_LIBRARY_PATH before ninja is necessary when the meson
> > configuration has changed (e.g. meson configure has been called), in
> > such situation the LD_LIBRARY_PATH is necessary to invoke the
> > autoconfiguration script.
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > 
> 
> Couple of minor comments inline below. Otherwise:
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>[...]

Hi Bruce,

I'll address those comments in a v4, thanks a lot for your help and
review.

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v4] net/mlx: add meson build support
  2018-08-29 13:48   ` [dpdk-dev] [PATCH v3] " Nelio Laranjeiro
  2018-08-30 14:46     ` Bruce Richardson
@ 2018-08-31  7:16     ` Nelio Laranjeiro
  2018-09-05 11:47       ` [dpdk-dev] [PATCH v5] " Shahaf Shuler
  1 sibling, 1 reply; 26+ messages in thread
From: Nelio Laranjeiro @ 2018-08-31  7:16 UTC (permalink / raw)
  To: dev, Yongseok Koh, Shahaf Shuler, Matan Azrad; +Cc: Bruce Richardson

Compile Mellanox drivers when their external dependencies are met.  A
glue version of the driver can still be requested by using the
-Denable_driver_mlx_glue=true

To avoid modifying the whole sources and keep the compatibility with
current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
generated by invoking DPDK scripts though meson's run_command() instead
of using has_types, has_members, ... commands.

Meson will try to find the required external libraries.  When they are
not installed system wide, they can be provided though CFLAGS, LDFLAGS
and LD_LIBRARY_PATH environment variables, example (considering
RDMA-Core is installed in /tmp/rdma-core):

 # CLFAGS=-I/tmp/rdma-core/build/include \
   LDFLAGS=-L/tmp/rdma-core/build/lib \
   LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   meson output
 # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   ninja -C output install

Note: LD_LIBRARY_PATH before ninja is necessary when the meson
configuration has changed (e.g. meson configure has been called), in
such situation the LD_LIBRARY_PATH is necessary to invoke the
autoconfiguration script.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

---

Changes in v4:

- remove implicit -Wall flag (set by default by meson),
- add item information in the autoconfiguration failure error message,
- reword the help for the glue library option,

Changes in v3:

Sanitize the build files:
- remove enable_driver_mlx{4,5} options,
- test cflags capabilities before using them,
- remove old autoconfiguration file,
- use an array for autoconfiguration and put them in the build directory,
- use dependencies in shared_library for link arguments.

Changes in v2:

- dropped patch https://patches.dpdk.org/patch/43897/
- remove extra_{cflags,ldflags} as already honored by meson through
environment variables.
---
 drivers/net/meson.build      |   2 +
 drivers/net/mlx4/meson.build |  96 +++++++++++++++
 drivers/net/mlx5/meson.build | 231 +++++++++++++++++++++++++++++++++++
 meson_options.txt            |   2 +
 4 files changed, 331 insertions(+)
 create mode 100644 drivers/net/mlx4/meson.build
 create mode 100644 drivers/net/mlx5/meson.build

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 9c28ed4da..c7a2d0e7d 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -18,6 +18,8 @@ drivers = ['af_packet',
 	'ixgbe',
 	'kni',
 	'liquidio',
+	'mlx4',
+	'mlx5',
 	'mvpp2',
 	'netvsc',
 	'nfp',
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
new file mode 100644
index 000000000..aa948b5f2
--- /dev/null
+++ b/drivers/net/mlx4/meson.build
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+pmd_dlopen = get_option('enable_driver_mlx_glue')
+LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
+LIB_GLUE_VERSION = '18.02.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+        ]
+endif
+libs = [
+        cc.find_library('mnl', required:false),
+        cc.find_library('mlx4', required:false),
+        cc.find_library('ibverbs', required:false),
+]
+build = true
+foreach lib:libs
+        if not lib.found()
+                build = false
+        endif
+endforeach
+# Compile PMD
+if build
+        allow_experimental_apis = true
+        ext_deps += libs
+        sources = files(
+               'mlx4.c',
+               'mlx4_ethdev.c',
+               'mlx4_flow.c',
+               'mlx4_intr.c',
+               'mlx4_mr.c',
+               'mlx4_rxq.c',
+               'mlx4_rxtx.c',
+               'mlx4_txq.c',
+               'mlx4_utils.c',
+        )
+        if not pmd_dlopen
+                sources += files('mlx4_glue.c')
+        endif
+        cflags_options = [
+                '-Wextra',
+                '-std=c11',
+                '-Wno-strict-prototypes',
+                '-D_BSD_SOURCE',
+                '-D_DEFAULT_SOURCE',
+                '-D_XOPEN_SOURCE=600'
+        ]
+        foreach option:cflags_options
+                if cc.has_argument(option)
+                        cflags += option
+                endif
+        endforeach
+        if get_option('buildtype').contains('debug')
+                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+        else
+                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+        endif
+        # To maintain the compatibility with the make build system
+        # mlx4_autoconf.h file is still generated.
+        run_command('rm', '-f', meson.current_build_dir() + '/mlx4_autoconf.h')
+        r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                        meson.current_build_dir() + '/mlx4_autoconf.h',
+                        'HAVE_IBV_MLX4_WQE_LSO_SEG',
+                        'infiniband/mlx4dv.h',
+                        'type', 'struct mlx4_wqe_lso_seg')
+        if r.returncode() != 0
+                error('autoconfiguration fail')
+        endif
+endif
+# Build Glue Library
+if pmd_dlopen and build
+        dlopen_name = 'mlx4_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx4_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+               dlopen_lib_name,
+               dlopen_sources,
+               include_directories: global_inc,
+               c_args: cflags,
+               dependencies: libs,
+               link_args: [
+                       '-Wl,-export-dynamic',
+                       '-Wl,-h,@0@'.format(LIB_GLUE),
+                       ],
+               soversion: dlopen_so_version,
+               install: true,
+               install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
new file mode 100644
index 000000000..f26f111d6
--- /dev/null
+++ b/drivers/net/mlx5/meson.build
@@ -0,0 +1,231 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+pmd_dlopen = get_option('enable_driver_mlx_glue')
+LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
+LIB_GLUE_VERSION = '18.05.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+        ]
+endif
+libs = [
+        cc.find_library('mnl', required:false),
+        cc.find_library('mlx5', required:false),
+        cc.find_library('ibverbs', required:false),
+]
+build = true
+foreach lib:libs
+        if not lib.found()
+                build = false
+        endif
+endforeach
+if build
+        allow_experimental_apis = true
+        ext_deps += libs
+        sources = files(
+                'mlx5.c',
+                'mlx5_ethdev.c',
+                'mlx5_flow.c',
+                'mlx5_mac.c',
+                'mlx5_mr.c',
+                'mlx5_nl.c',
+                'mlx5_nl_flow.c',
+                'mlx5_rss.c',
+                'mlx5_rxmode.c',
+                'mlx5_rxq.c',
+                'mlx5_rxtx.c',
+                'mlx5_socket.c',
+                'mlx5_stats.c',
+                'mlx5_trigger.c',
+                'mlx5_txq.c',
+                'mlx5_vlan.c',
+        )
+        if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
+                sources += files('mlx5_rxtx_vec.c')
+        endif
+        if not pmd_dlopen
+                sources += files('mlx5_glue.c')
+        endif
+        cflags_options = [
+                '-Wextra',
+                '-std=c11',
+                '-Wno-strict-prototypes',
+                '-D_BSD_SOURCE',
+                '-D_DEFAULT_SOURCE',
+                '-D_XOPEN_SOURCE=600'
+        ]
+        foreach option:cflags_options
+                if cc.has_argument(option)
+                        cflags += option
+                endif
+        endforeach
+        if get_option('buildtype').contains('debug')
+                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+        else
+                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+        endif
+        # To maintain the compatibility with the make build system
+        # mlx5_autoconf.h file is still generated.
+        args = [
+                [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
+                [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
+                [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
+                  'enum', 'IBV_FLOW_SPEC_MPLS' ],
+                [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
+                  'enum', 'IBV_WQ_FLAG_RX_END_PADDING' ],
+                [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', 'type',
+                  'struct mlx5dv_sw_parsing_caps' ],
+                [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', 'enum',
+                  'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
+                [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_25G',
+                  '/usr/include/linux/ethtool.h', 'enum',
+                  'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_50G',
+                  '/usr/include/linux/ethtool.h', 'enum',
+                  'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_100G',
+                  '/usr/include/linux/ethtool.h', 'enum',
+                  'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
+                [ 'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT',
+                  'infiniband/verbs.h', 'type',
+                  'struct ibv_counter_set_init_attr' ],
+                [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', 'enum',
+                  'RDMA_NL_NLDEV' ],
+                [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', 'enum',
+                  'RDMA_NLDEV_CMD_GET' ],
+                [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_CMD_PORT_GET' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_DEV_NAME' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
+                [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', 'enum',
+                  'IFLA_PHYS_SWITCH_ID' ],
+                [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', 'enum',
+                  'IFLA_PHYS_PORT_NAME' ],
+                [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_ACT' ],
+                [ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_FLAGS' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_ETH_TYPE' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_ETH_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_ETH_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IP_PROTO' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IPV4_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IPV4_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IPV6_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_IPV6_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_TCP_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_TCP_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_UDP_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_UDP_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_VLAN_ID' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h', 'enum',
+                  'TCA_FLOWER_KEY_VLAN_PRIO' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
+                [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', 'enum',
+                  'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
+                [ 'HAVE_SUPPORTED_40000baseKR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_40000baseKR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseCR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_40000baseCR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseSR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_40000baseSR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseLR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_40000baseLR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseKR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_56000baseKR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseCR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_56000baseCR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseSR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_56000baseSR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseLR4_Full',
+                  '/usr/include/linux/ethtool.h', 'define',
+                  'SUPPORTED_56000baseLR4_Full' ],
+        ]
+        run_command('rm', '-f', meson.current_build_dir() + '/mlx5_autoconf.h')
+        foreach arg:args
+                r = run_command('sh', '../../../buildtools/auto-config-h.sh',
+                                meson.current_build_dir() +
+                                '/mlx5_autoconf.h', arg)
+                if r.returncode() != 0
+                        error('@0@ autoconfiguration failed'.format(arg[0]))
+                endif
+        endforeach
+endif
+# Build Glue Library
+if pmd_dlopen and build
+        dlopen_name = 'mlx5_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx5_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+                dlopen_lib_name,
+                dlopen_sources,
+                include_directories: global_inc,
+                c_args: cflags,
+                dependencies: libs,
+                link_args: [
+                        '-Wl,-export-dynamic',
+                        '-Wl,-h,@0@'.format(LIB_GLUE),
+                        ],
+                soversion: dlopen_so_version,
+                install: true,
+                install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/meson_options.txt b/meson_options.txt
index c84327858..484f3e260 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,7 @@
 option('allow_invalid_socket_id', type: 'boolean', value: false,
 	description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly')
+option('enable_driver_mlx_glue', type: 'boolean', value: false,
+	description: 'Enable glue library for Mellanox ConnectX-3/4/5 NIC PMD')
 option('enable_kmods', type: 'boolean', value: true,
 	description: 'build kernel modules')
 option('examples', type: 'string', value: '',
-- 
2.19.0.rc1

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
  2018-08-29 11:59       ` Nélio Laranjeiro
  2018-08-29 12:28         ` Luca Boccassi
@ 2018-08-31 16:24         ` Luca Boccassi
  1 sibling, 0 replies; 26+ messages in thread
From: Luca Boccassi @ 2018-08-31 16:24 UTC (permalink / raw)
  To: Nélio Laranjeiro
  Cc: Bruce Richardson, dev, Yongseok Koh, Shahaf Shuler, Matan Azrad

On Wed, 2018-08-29 at 13:59 +0200, Nélio Laranjeiro wrote:
> On Wed, Aug 29, 2018 at 11:00:54AM +0100, Luca Boccassi wrote:
> > On Tue, 2018-08-28 at 16:45 +0100, Bruce Richardson wrote:
> > > Thanks for this, comments inline below.
> > > 
> > > /Bruce
> > > 
> > > On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> > > > Mellanox drivers remains un-compiled by default due to third
> > > > party
> > > > libraries dependencies.  They can be enabled through:
> > > > - enable_driver_mlx{4,5}=true or
> > > > - enable_driver_mlx{4,5}_glue=true
> > > > depending on the needs.
> > > 
> > > The big reason why we wanted a new build system was to move away
> > > from
> > > this
> > > sort of static configuration. Instead, detect if the requirements
> > > as
> > > present and build the driver if you can.
> > > 
> > > > 
> > > > To avoid modifying the whole sources and keep the compatibility
> > > > with
> > > > current build systems (e.g. make), the mlx{4,5}_autoconf.h is
> > > > still
> > > > generated by invoking DPDK scripts though meson's run_command()
> > > > instead
> > > > of using has_types, has_members, ... commands.
> > > > 
> > > > Meson will try to find the required external libraries.  When
> > > > they
> > > > are
> > > > not installed system wide, they can be provided though CFLAGS,
> > > > LDFLAGS
> > > > and LD_LIBRARY_PATH environment variables, example (considering
> > > > RDMA-Core is installed in /tmp/rdma-core):
> > > > 
> > > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > > >    meson -Denable_driver_mlx4=true output
> > > > 
> > > >  # CLFAGS=-I/tmp/rdma-core/build/include \
> > > >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> > > >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > > >    ninja -C output install
> > > 
> > > Once the CFLAGS/LDFLAGS are passed to meson, they should not be
> > > needed for
> > > ninja. The LD_LIBRARY_PATH might be - I'm not sure about that
> > > one! :-
> > > )
> > > 
> > > > 
> > > > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > > > 
> > > > ---
> > > > 
> > > > Changes in v2:
> > > > 
> > > > - dropped patch https://patches.dpdk.org/patch/43897/
> > > > - remove extra_{cflags,ldflags} as already honored by meson
> > > > through
> > > > environment variables.
> > > > ---
> > > >  drivers/net/meson.build      |   2 +
> > > >  drivers/net/mlx4/meson.build |  94 ++++++
> > > >  drivers/net/mlx5/meson.build | 545
> > > > +++++++++++++++++++++++++++++++++++
> > > >  meson_options.txt            |   8 +
> > > >  4 files changed, 649 insertions(+)
> > > >  create mode 100644 drivers/net/mlx4/meson.build
> > > >  create mode 100644 drivers/net/mlx5/meson.build
> > > > 
> > > > diff --git a/drivers/net/meson.build b/drivers/net/meson.build
> > > > index 9c28ed4da..c7a2d0e7d 100644
> > > > --- a/drivers/net/meson.build
> > > > +++ b/drivers/net/meson.build
> > > > @@ -18,6 +18,8 @@ drivers = ['af_packet',
> > > >  	'ixgbe',
> > > >  	'kni',
> > > >  	'liquidio',
> > > > +	'mlx4',
> > > > +	'mlx5',
> > > >  	'mvpp2',
> > > >  	'netvsc',
> > > >  	'nfp',
> > > > diff --git a/drivers/net/mlx4/meson.build
> > > > b/drivers/net/mlx4/meson.build
> > > > new file mode 100644
> > > > index 000000000..debaca5b6
> > > > --- /dev/null
> > > > +++ b/drivers/net/mlx4/meson.build
> > > > @@ -0,0 +1,94 @@
> > > > +# SPDX-License-Identifier: BSD-3-Clause
> > > > +# Copyright 2018 6WIND S.A.
> > > > +# Copyright 2018 Mellanox Technologies, Ltd
> > > > +
> > > > +# As there is no more configuration file to activate/configure
> > > > the
> > > > PMD it will
> > > > +# use some variables here to configure it.
> > > > +pmd_dlopen = get_option('enable_driver_mlx4_glue')
> > > > +build = get_option('enable_driver_mlx4') or pmd_dlopen
> > > 
> > > As stated above, I believe this should be based upon whether you
> > > find
> > > the
> > > "mnl", "mlx4" and "ibverbs" libraries. If we start adding back in
> > > static
> > > options for every driver, then we'll be back to having a mass of
> > > config
> > > options like we had before.
> > 
> > BTW, slightly related to that: ibverbs doesn't ship pkg-config
> > files at
> > the moment which makes the detection slightly more awkward that it
> > could be, so I've sent a PR upstream to add that:
> > 
> > https://github.com/linux-rdma/rdma-core/pull/373
> > 
> > Hope this can be useful!
> 
> Thanks Luca, I was also searching for it, you save me some time, I
> hope
> this can be backported down to RDMA-Core's stable version v15 of
> RDMA-Core it would fully help.

This was merged now, so if you want it backported you can ask the
maintainers if it would be fine to do so.

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v5] net/mlx: add meson build support
  2018-08-31  7:16     ` [dpdk-dev] [PATCH v4] " Nelio Laranjeiro
@ 2018-09-05 11:47       ` Shahaf Shuler
  2018-09-07 10:34         ` Bruce Richardson
                           ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Shahaf Shuler @ 2018-09-05 11:47 UTC (permalink / raw)
  To: nelio.laranjeiro, yskoh, matan, bruce.richardson, bluca; +Cc: dev

From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Compile Mellanox drivers when their external dependencies are met.  A
glue version of the driver can still be requested by using the
-Denable_driver_mlx_glue=true

To avoid modifying the whole sources and keep the compatibility with
current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
generated.

Meson will try to find the required external libraries.  When they are
not installed system wide, they can be provided though CFLAGS, LDFLAGS
and LD_LIBRARY_PATH environment variables, example (considering
RDMA-Core is installed in /tmp/rdma-core):

 # CLFAGS=-I/tmp/rdma-core/build/include \
   LDFLAGS=-L/tmp/rdma-core/build/lib \
   LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   meson output
 # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   ninja -C output install

Note: LD_LIBRARY_PATH before ninja is necessary when the meson
configuration has changed (e.g. meson configure has been called), in
such situation the LD_LIBRARY_PATH is necessary to invoke the
autoconfiguration script.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes in v5:

- use meson tool to generate Mellanox config file instead of DPDK custom scripts.

Changes in v4:

- remove implicit -Wall flag (set by default by meson),
- add item information in the autoconfiguration failure error message,
- reword the help for the glue library option,

Changes in v3:

Sanitize the build files:
- remove enable_driver_mlx{4,5} options,
- test cflags capabilities before using them,
- remove old autoconfiguration file,
- use an array for autoconfiguration and put them in the build directory,
- use dependencies in shared_library for link arguments.

Changes in v2:

- dropped patch https://patches.dpdk.org/patch/43897/
- remove extra_{cflags,ldflags} as already honored by meson through
environment variables.
---
 drivers/net/meson.build      |   2 +
 drivers/net/mlx4/meson.build | 110 +++++++++++++++++++++
 drivers/net/mlx5/meson.build | 231 +++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt            |   2 +
 4 files changed, 345 insertions(+)
 create mode 100644 drivers/net/mlx4/meson.build
 create mode 100644 drivers/net/mlx5/meson.build

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 9c28ed4da4..c7a2d0e7db 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -18,6 +18,8 @@ drivers = ['af_packet',
 	'ixgbe',
 	'kni',
 	'liquidio',
+	'mlx4',
+	'mlx5',
 	'mvpp2',
 	'netvsc',
 	'nfp',
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
new file mode 100644
index 0000000000..e552d7b0c2
--- /dev/null
+++ b/drivers/net/mlx4/meson.build
@@ -0,0 +1,110 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+pmd_dlopen = get_option('enable_driver_mlx_glue')
+LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
+LIB_GLUE_VERSION = '18.02.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+        ]
+endif
+libs = [
+        cc.find_library('mnl', required:false),
+        cc.find_library('mlx4', required:false),
+        cc.find_library('ibverbs', required:false),
+]
+build = true
+foreach lib:libs
+        if not lib.found()
+                build = false
+        endif
+endforeach
+# Compile PMD
+if build
+        allow_experimental_apis = true
+        ext_deps += libs
+        sources = files(
+               'mlx4.c',
+               'mlx4_ethdev.c',
+               'mlx4_flow.c',
+               'mlx4_intr.c',
+               'mlx4_mr.c',
+               'mlx4_rxq.c',
+               'mlx4_rxtx.c',
+               'mlx4_txq.c',
+               'mlx4_utils.c',
+        )
+        if not pmd_dlopen
+                sources += files('mlx4_glue.c')
+        endif
+        cflags_options = [
+                '-Wextra',
+                '-std=c11',
+                '-Wno-strict-prototypes',
+                '-D_BSD_SOURCE',
+                '-D_DEFAULT_SOURCE',
+                '-D_XOPEN_SOURCE=600'
+        ]
+        foreach option:cflags_options
+                if cc.has_argument(option)
+                        cflags += option
+                endif
+        endforeach
+        if get_option('buildtype').contains('debug')
+                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+        else
+                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+        endif
+        # To maintain the compatibility with the make build system
+        # mlx4_autoconf.h file is still generated.
+        # input array for meson symbol search:
+        # [ "MACRO to define if found", "header for the search",
+        #   "type/enum/define", "symbol to search",
+        #   "struct member to search (type only)]
+        #
+        args = [
+		[ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h',
+                  'type', 'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ],
+	]
+        run_command('rm', '-f', meson.current_build_dir() + '/mlx4_autoconf.h')
+        config = configuration_data()
+        foreach arg:args
+		if arg[2] == 'type'
+			file_prefix = '#include<' + arg[1] + '>'
+			has = cc.has_member(arg[3], arg[4], prefix : file_prefix)
+		else
+			has = cc.has_header_symbol(arg[1], arg[3])
+		endif
+		if has
+			config.set(arg[0], 1)
+		endif
+        endforeach
+        configure_file(output : 'mlx4_autoconf.h', configuration : config)
+endif
+# Build Glue Library
+if pmd_dlopen and build
+        dlopen_name = 'mlx4_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx4_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+               dlopen_lib_name,
+               dlopen_sources,
+               include_directories: global_inc,
+               c_args: cflags,
+               dependencies: libs,
+               link_args: [
+                       '-Wl,-export-dynamic',
+                       '-Wl,-h,@0@'.format(LIB_GLUE),
+                       ],
+               soversion: dlopen_so_version,
+               install: true,
+               install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
new file mode 100644
index 0000000000..9f0219cfb0
--- /dev/null
+++ b/drivers/net/mlx5/meson.build
@@ -0,0 +1,231 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+pmd_dlopen = get_option('enable_driver_mlx_glue')
+LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
+LIB_GLUE_VERSION = '18.05.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+        dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
+        cflags += [
+                '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
+                '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+        ]
+endif
+libs = [
+        cc.find_library('mnl', required:false),
+        cc.find_library('mlx5', required:false),
+        cc.find_library('ibverbs', required:false),
+]
+build = true
+foreach lib:libs
+        if not lib.found()
+                build = false
+        endif
+endforeach
+if build
+        allow_experimental_apis = true
+        ext_deps += libs
+        sources = files(
+                'mlx5.c',
+                'mlx5_ethdev.c',
+                'mlx5_flow.c',
+                'mlx5_mac.c',
+                'mlx5_mr.c',
+                'mlx5_nl.c',
+                'mlx5_nl_flow.c',
+                'mlx5_rss.c',
+                'mlx5_rxmode.c',
+                'mlx5_rxq.c',
+                'mlx5_rxtx.c',
+                'mlx5_socket.c',
+                'mlx5_stats.c',
+                'mlx5_trigger.c',
+                'mlx5_txq.c',
+                'mlx5_vlan.c',
+        )
+        if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
+                sources += files('mlx5_rxtx_vec.c')
+        endif
+        if not pmd_dlopen
+                sources += files('mlx5_glue.c')
+        endif
+        cflags_options = [
+                '-Wextra',
+                '-std=c11',
+                '-Wno-strict-prototypes',
+                '-D_BSD_SOURCE',
+                '-D_DEFAULT_SOURCE',
+                '-D_XOPEN_SOURCE=600'
+        ]
+        foreach option:cflags_options
+                if cc.has_argument(option)
+                        cflags += option
+                endif
+        endforeach
+        if get_option('buildtype').contains('debug')
+                cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+        else
+                cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+        endif
+        # To maintain the compatibility with the make build system
+        # mlx5_autoconf.h file is still generated.
+        # input array for meson symbol search:
+        # [ "MACRO to define if found", "header for the search",
+        #   "type/enum/define", "symbol to search",
+        #   "struct member to search (type only)]
+        #
+        args = [
+                [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
+                [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
+                [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
+                [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
+                  'type', 'struct mlx5dv_sw_parsing_caps',
+                  'sw_parsing_offloads' ],
+                [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
+                  'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
+                [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
+                  'enum', 'IBV_FLOW_SPEC_MPLS' ],
+                [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
+                  'enum', 'IBV_WQ_FLAG_RX_END_PADDING' ],
+                [ 'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT', 'infiniband/verbs.h',
+                  'type', 'struct ibv_counter_set_init_attr',
+                  'counter_set_id' ],
+                [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
+                  'define', 'SUPPORTED_40000baseKR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
+                  'define', 'SUPPORTED_40000baseCR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h',
+                  'define', 'SUPPORTED_40000baseSR4_Full' ],
+                [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h',
+                  'define', 'SUPPORTED_40000baseLR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h',
+                  'define', 'SUPPORTED_56000baseKR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h',
+                  'define', 'SUPPORTED_56000baseCR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h',
+                  'define', 'SUPPORTED_56000baseSR4_Full' ],
+                [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h',
+                  'define', 'SUPPORTED_56000baseLR4_Full' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h',
+                  'enum', 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h',
+                  'enum', 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
+                [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h',
+                  'enum', 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
+                [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
+                  'enum', 'IFLA_PHYS_SWITCH_ID' ],
+                [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
+                  'enum', 'IFLA_PHYS_PORT_NAME' ],
+                [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_ACT' ],
+                [ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_FLAGS' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_TYPE' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IP_PROTO' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV4_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV6_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_TCP_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_TCP_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_UDP_SRC' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_UDP_DST' ],
+                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_VLAN_ID' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_VLAN_PRIO' ],
+                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
+                  'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
+                [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', 'enum',
+                  'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
+                [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', 'enum',
+                  'RDMA_NL_NLDEV' ],
+                [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', 'enum',
+                  'RDMA_NLDEV_CMD_GET' ],
+                [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_CMD_PORT_GET' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_DEV_NAME' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
+                [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
+                  'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
+        ]
+        run_command('rm', '-f', meson.current_build_dir() + '/mlx5_autoconf.h')
+        config = configuration_data()
+        foreach arg:args
+		if arg[2] == 'type'
+			file_prefix = '#include<' + arg[1] + '>'
+			has = cc.has_member(arg[3], arg[4], prefix : file_prefix)
+		else
+			has = cc.has_header_symbol(arg[1], arg[3])
+		endif
+		if has
+			config.set(arg[0], 1)
+		endif
+        endforeach
+        configure_file(output : 'mlx5_autoconf.h', configuration : config)
+endif
+# Build Glue Library
+if pmd_dlopen and build
+        dlopen_name = 'mlx5_glue'
+        dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+        dlopen_so_version = LIB_GLUE_VERSION
+        dlopen_sources = files('mlx5_glue.c')
+        dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+        shared_lib = shared_library(
+                dlopen_lib_name,
+                dlopen_sources,
+                include_directories: global_inc,
+                c_args: cflags,
+                dependencies: libs,
+                link_args: [
+                        '-Wl,-export-dynamic',
+                        '-Wl,-h,@0@'.format(LIB_GLUE),
+                        ],
+                soversion: dlopen_so_version,
+                install: true,
+                install_dir: dlopen_install_dir,
+        )
+endif
diff --git a/meson_options.txt b/meson_options.txt
index c843278587..484f3e2601 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,7 @@
 option('allow_invalid_socket_id', type: 'boolean', value: false,
 	description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly')
+option('enable_driver_mlx_glue', type: 'boolean', value: false,
+	description: 'Enable glue library for Mellanox ConnectX-3/4/5 NIC PMD')
 option('enable_kmods', type: 'boolean', value: true,
 	description: 'build kernel modules')
 option('examples', type: 'string', value: '',
-- 
2.12.0

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v5] net/mlx: add meson build support
  2018-09-05 11:47       ` [dpdk-dev] [PATCH v5] " Shahaf Shuler
@ 2018-09-07 10:34         ` Bruce Richardson
  2018-09-13  9:22           ` Bruce Richardson
  2018-09-13 12:11         ` [dpdk-dev] [PATCH v6 1/2] net/mlx5: support meson build Shahaf Shuler
  2018-09-13 12:11         ` [dpdk-dev] [PATCH v6 2/2] net/mlx4: " Shahaf Shuler
  2 siblings, 1 reply; 26+ messages in thread
From: Bruce Richardson @ 2018-09-07 10:34 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: nelio.laranjeiro, yskoh, matan, bluca, dev

On Wed, Sep 05, 2018 at 02:47:46PM +0300, Shahaf Shuler wrote:
> From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> 
> Compile Mellanox drivers when their external dependencies are met.  A
> glue version of the driver can still be requested by using the
> -Denable_driver_mlx_glue=true
> 
> To avoid modifying the whole sources and keep the compatibility with
> current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> generated.
> 
> Meson will try to find the required external libraries.  When they are
> not installed system wide, they can be provided though CFLAGS, LDFLAGS
> and LD_LIBRARY_PATH environment variables, example (considering
> RDMA-Core is installed in /tmp/rdma-core):
> 
>  # CLFAGS=-I/tmp/rdma-core/build/include \
>    LDFLAGS=-L/tmp/rdma-core/build/lib \
>    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
>    meson output
>  # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
>    ninja -C output install
> 
> Note: LD_LIBRARY_PATH before ninja is necessary when the meson
> configuration has changed (e.g. meson configure has been called), in
> such situation the LD_LIBRARY_PATH is necessary to invoke the
> autoconfiguration script.
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> Changes in v5:
> 
> - use meson tool to generate Mellanox config file instead of DPDK custom scripts.
> 

<snip>

> +        # To maintain the compatibility with the make build system
> +        # mlx5_autoconf.h file is still generated.
> +        # input array for meson symbol search:
> +        # [ "MACRO to define if found", "header for the search",
> +        #   "type/enum/define", "symbol to search",
> +        #   "struct member to search (type only)]
> +        #
> +        args = [
> +                [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
> +                  'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
> +                [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
> +                  'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
> +                [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h',
> +                  'enum', 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
> +                [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
> +                  'type', 'struct mlx5dv_sw_parsing_caps',
> +                  'sw_parsing_offloads' ],
> +                [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
> +                  'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
> +                [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
> +                  'enum', 'IBV_FLOW_SPEC_MPLS' ],
> +                [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
> +                  'enum', 'IBV_WQ_FLAG_RX_END_PADDING' ],
> +                [ 'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT', 'infiniband/verbs.h',
> +                  'type', 'struct ibv_counter_set_init_attr',
> +                  'counter_set_id' ],
> +                [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
> +                  'define', 'SUPPORTED_40000baseKR4_Full' ],
> +                [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
> +                  'define', 'SUPPORTED_40000baseCR4_Full' ],
> +                [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h',
> +                  'define', 'SUPPORTED_40000baseSR4_Full' ],
> +                [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h',
> +                  'define', 'SUPPORTED_40000baseLR4_Full' ],
> +                [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h',
> +                  'define', 'SUPPORTED_56000baseKR4_Full' ],
> +                [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h',
> +                  'define', 'SUPPORTED_56000baseCR4_Full' ],
> +                [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h',
> +                  'define', 'SUPPORTED_56000baseSR4_Full' ],
> +                [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h',
> +                  'define', 'SUPPORTED_56000baseLR4_Full' ],
> +                [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h',
> +                  'enum', 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
> +                [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h',
> +                  'enum', 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
> +                [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h',
> +                  'enum', 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
> +                [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
> +                  'enum', 'IFLA_PHYS_SWITCH_ID' ],
> +                [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
> +                  'enum', 'IFLA_PHYS_PORT_NAME' ],
> +                [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_ACT' ],
> +                [ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_FLAGS' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_ETH_TYPE' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_ETH_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_ETH_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IP_PROTO' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV4_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV6_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_TCP_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_TCP_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_UDP_SRC' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_UDP_DST' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_VLAN_ID' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_VLAN_PRIO' ],
> +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
> +                  'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
> +                [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', 'enum',
> +                  'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
> +                [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', 'enum',
> +                  'RDMA_NL_NLDEV' ],
> +                [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', 'enum',
> +                  'RDMA_NLDEV_CMD_GET' ],
> +                [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_CMD_PORT_GET' ],
> +                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
> +                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_ATTR_DEV_NAME' ],
> +                [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
> +                [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
> +                  'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
> +        ]
> +        run_command('rm', '-f', meson.current_build_dir() + '/mlx5_autoconf.h')
> +        config = configuration_data()
> +        foreach arg:args
> +		if arg[2] == 'type'
> +			file_prefix = '#include<' + arg[1] + '>'
> +			has = cc.has_member(arg[3], arg[4], prefix : file_prefix)
> +		else
> +			has = cc.has_header_symbol(arg[1], arg[3])
> +		endif
> +		if has
> +			config.set(arg[0], 1)
> +		endif
> +        endforeach
> +        configure_file(output : 'mlx5_autoconf.h', configuration : config)
> +endif

couple of minor points:
* These new additions use tab rather than space for indent. The standard
  with meson I think is normally spaces, but I (inadvertently) added all
  other DPDK meson.build files with tabs, so for consistency I think it
  would be good if the whole file used tabs i.e. change all the other lines
  apart from your new ones in v5.

* is the "rm" command really necessary? I would expect the configure_file()
  function to just do the right thing here when replacing the file.

* Would you consider splitting the args array into two arrays, one for the
  "type" values and another for the enum/define ones? This would mean
  having two loops, but the loops themselves would be clearer and shorter -
  as would the arrays.  Especially since according to
  http://mesonbuild.com/Configuration.html
  a boolean false converts to an "undef", rather than a 0/1 value.
  For example:

	foreach arg:has_sym_args
		config.set(arg[0], cc.has_header_symbol(arg[1], arg[3]))
	endforeach
 
* Very minor suggestion: is it neater to use "args: '-include ' + arg[1]",
  instead of using prefix with the #include syntax? [Assuming the former
  works]

Thanks,
/Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v5] net/mlx: add meson build support
  2018-09-07 10:34         ` Bruce Richardson
@ 2018-09-13  9:22           ` Bruce Richardson
  2018-09-13 10:12             ` Shahaf Shuler
  0 siblings, 1 reply; 26+ messages in thread
From: Bruce Richardson @ 2018-09-13  9:22 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: nelio.laranjeiro, yskoh, matan, bluca, dev

On Fri, Sep 07, 2018 at 11:34:29AM +0100, Bruce Richardson wrote:
> On Wed, Sep 05, 2018 at 02:47:46PM +0300, Shahaf Shuler wrote:
> > From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > 
> > Compile Mellanox drivers when their external dependencies are met.  A
> > glue version of the driver can still be requested by using the
> > -Denable_driver_mlx_glue=true
> > 
> > To avoid modifying the whole sources and keep the compatibility with
> > current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> > generated.
> > 
> > Meson will try to find the required external libraries.  When they are
> > not installed system wide, they can be provided though CFLAGS, LDFLAGS
> > and LD_LIBRARY_PATH environment variables, example (considering
> > RDMA-Core is installed in /tmp/rdma-core):
> > 
> >  # CLFAGS=-I/tmp/rdma-core/build/include \
> >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    meson output
> >  # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    ninja -C output install
> > 
> > Note: LD_LIBRARY_PATH before ninja is necessary when the meson
> > configuration has changed (e.g. meson configure has been called), in
> > such situation the LD_LIBRARY_PATH is necessary to invoke the
> > autoconfiguration script.
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> > Changes in v5:
> > 
> > - use meson tool to generate Mellanox config file instead of DPDK custom scripts.
> > 
> 
> <snip>
> 
> > +        # To maintain the compatibility with the make build system
> > +        # mlx5_autoconf.h file is still generated.
> > +        # input array for meson symbol search:
> > +        # [ "MACRO to define if found", "header for the search",
> > +        #   "type/enum/define", "symbol to search",
> > +        #   "struct member to search (type only)]
> > +        #
> > +        args = [
> > +                [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
> > +                  'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
> > +                [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
> > +                  'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
> > +                [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h',
> > +                  'enum', 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
> > +                [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
> > +                  'type', 'struct mlx5dv_sw_parsing_caps',
> > +                  'sw_parsing_offloads' ],
> > +                [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
> > +                  'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
> > +                [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
> > +                  'enum', 'IBV_FLOW_SPEC_MPLS' ],
> > +                [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
> > +                  'enum', 'IBV_WQ_FLAG_RX_END_PADDING' ],
> > +                [ 'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT', 'infiniband/verbs.h',
> > +                  'type', 'struct ibv_counter_set_init_attr',
> > +                  'counter_set_id' ],
> > +                [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
> > +                  'define', 'SUPPORTED_40000baseKR4_Full' ],
> > +                [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
> > +                  'define', 'SUPPORTED_40000baseCR4_Full' ],
> > +                [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h',
> > +                  'define', 'SUPPORTED_40000baseSR4_Full' ],
> > +                [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h',
> > +                  'define', 'SUPPORTED_40000baseLR4_Full' ],
> > +                [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h',
> > +                  'define', 'SUPPORTED_56000baseKR4_Full' ],
> > +                [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h',
> > +                  'define', 'SUPPORTED_56000baseCR4_Full' ],
> > +                [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h',
> > +                  'define', 'SUPPORTED_56000baseSR4_Full' ],
> > +                [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h',
> > +                  'define', 'SUPPORTED_56000baseLR4_Full' ],
> > +                [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h',
> > +                  'enum', 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
> > +                [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h',
> > +                  'enum', 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
> > +                [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h',
> > +                  'enum', 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
> > +                [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
> > +                  'enum', 'IFLA_PHYS_SWITCH_ID' ],
> > +                [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
> > +                  'enum', 'IFLA_PHYS_PORT_NAME' ],
> > +                [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_ACT' ],
> > +                [ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_FLAGS' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_ETH_TYPE' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_ETH_DST' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_ETH_DST_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_ETH_SRC' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IP_PROTO' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IPV4_DST' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IPV6_DST' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_TCP_SRC' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_TCP_DST' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_TCP_DST_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_UDP_SRC' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_UDP_DST' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_UDP_DST_MASK' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_VLAN_ID' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_VLAN_PRIO' ],
> > +                [ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
> > +                  'enum', 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
> > +                [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', 'enum',
> > +                  'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
> > +                [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', 'enum',
> > +                  'RDMA_NL_NLDEV' ],
> > +                [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', 'enum',
> > +                  'RDMA_NLDEV_CMD_GET' ],
> > +                [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
> > +                  'enum', 'RDMA_NLDEV_CMD_PORT_GET' ],
> > +                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
> > +                  'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
> > +                [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
> > +                  'enum', 'RDMA_NLDEV_ATTR_DEV_NAME' ],
> > +                [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
> > +                  'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
> > +                [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
> > +                  'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
> > +        ]
> > +        run_command('rm', '-f', meson.current_build_dir() + '/mlx5_autoconf.h')
> > +        config = configuration_data()
> > +        foreach arg:args
> > +		if arg[2] == 'type'
> > +			file_prefix = '#include<' + arg[1] + '>'
> > +			has = cc.has_member(arg[3], arg[4], prefix : file_prefix)
> > +		else
> > +			has = cc.has_header_symbol(arg[1], arg[3])
> > +		endif
> > +		if has
> > +			config.set(arg[0], 1)
> > +		endif
> > +        endforeach
> > +        configure_file(output : 'mlx5_autoconf.h', configuration : config)
> > +endif
> 
> couple of minor points:
> * These new additions use tab rather than space for indent. The standard
>   with meson I think is normally spaces, but I (inadvertently) added all
>   other DPDK meson.build files with tabs, so for consistency I think it
>   would be good if the whole file used tabs i.e. change all the other lines
>   apart from your new ones in v5.
> 
> * is the "rm" command really necessary? I would expect the configure_file()
>   function to just do the right thing here when replacing the file.
> 
> * Would you consider splitting the args array into two arrays, one for the
>   "type" values and another for the enum/define ones? This would mean
>   having two loops, but the loops themselves would be clearer and shorter -
>   as would the arrays.  Especially since according to
>   http://mesonbuild.com/Configuration.html
>   a boolean false converts to an "undef", rather than a 0/1 value.
>   For example:
> 
> 	foreach arg:has_sym_args
> 		config.set(arg[0], cc.has_header_symbol(arg[1], arg[3]))
> 	endforeach
>  
> * Very minor suggestion: is it neater to use "args: '-include ' + arg[1]",
>   instead of using prefix with the #include syntax? [Assuming the former
>   works]
> 

Any plans for a new version of this? If so, can I also suggest
splitting the patch into two, one for mlx4 and the other for mlx5.

Regards,
/Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v5] net/mlx: add meson build support
  2018-09-13  9:22           ` Bruce Richardson
@ 2018-09-13 10:12             ` Shahaf Shuler
  2018-09-13 10:51               ` Bruce Richardson
  0 siblings, 1 reply; 26+ messages in thread
From: Shahaf Shuler @ 2018-09-13 10:12 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Nélio Laranjeiro, Yongseok Koh, Matan Azrad, bluca, dev

Hi Bruce,

Sorry for the late reply. Holiday time in Israel. 

Thursday, September 13, 2018 12:22 PM, Bruce Richardson:
> Subject: Re: [dpdk-dev] [PATCH v5] net/mlx: add meson build support
> 
> On Fri, Sep 07, 2018 at 11:34:29AM +0100, Bruce Richardson wrote:
> > On Wed, Sep 05, 2018 at 02:47:46PM +0300, Shahaf Shuler wrote:
> > > From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

[...]

> > couple of minor points:
> > * These new additions use tab rather than space for indent. The standard
> >   with meson I think is normally spaces, but I (inadvertently) added all
> >   other DPDK meson.build files with tabs, so for consistency I think it
> >   would be good if the whole file used tabs i.e. change all the other lines
> >   apart from your new ones in v5.

OK, all indentation will be with tab.  

> >
> > * is the "rm" command really necessary? I would expect the
> configure_file()
> >   function to just do the right thing here when replacing the file.

Yep it is not needed. Also from meson sources:
        output = kwargs['output']                                                                                
        ofile_rpath = os.path.join(self.subdir, output)                                                          
        if not isinstance(output, str):                                                                          
            raise InterpreterException('Output file name must be a string')                                      
        if ofile_rpath in self.configure_file_outputs:                                                           
            mesonbuildfile = os.path.join(self.subdir, 'meson.build')                                            
            current_call = "{}:{}".format(mesonbuildfile, self.current_lineno)                                   
            first_call = "{}:{}".format(mesonbuildfile, self.configure_file_outputs[ofile_rpath])                
            mlog.warning('Output file', mlog.bold(ofile_rpath, True), 'for configure_file() at', current_call, 'o
verwrites configure_file() output at', first_call)                                                               

> >
> > * Would you consider splitting the args array into two arrays, one for the
> >   "type" values and another for the enum/define ones? This would mean
> >   having two loops, but the loops themselves would be clearer and shorter -
> >   as would the arrays.  Especially since according to
> >
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmes
> onbuild.com%2FConfiguration.html&amp;data=02%7C01%7Cshahafs%40mell
> anox.com%7C38f62333815c48eaea6e08d6195a908a%7Ca652971c7d2e4d9ba6
> a4d149256f461b%7C0%7C0%7C636724274091500993&amp;sdata=fZvTg16D8K
> TsE7Q0DWsS9hiNnB%2BhHPuHi%2FFC7wrk8x8%3D&amp;reserved=0
> >   a boolean false converts to an "undef", rather than a 0/1 value.
> >   For example:
> >
> > 	foreach arg:has_sym_args
> > 		config.set(arg[0], cc.has_header_symbol(arg[1], arg[3]))
> > 	endforeach
> >

Done.

> > * Very minor suggestion: is it neater to use "args: '-include ' + arg[1]",
> >   instead of using prefix with the #include syntax? [Assuming the former
> >   works]

I don't understand the benefit with this change. Is there? 

> >
> 
> Any plans for a new version of this? If so, can I also suggest splitting the patch
> into two, one for mlx4 and the other for mlx5.

No problem to split.

Another change in plans: 
diff --git a/meson_options.txt b/meson_options.txt
index 484f3e2601..444a380d97 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,7 +1,7 @@
 option('allow_invalid_socket_id', type: 'boolean', value: false,
        description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly')
 option('enable_driver_mlx_glue', type: 'boolean', value: false,
-       description: 'Enable glue library for Mellanox ConnectX-3/4/5 NIC PMD')
+       description: 'Enable glue library for Mellanox PMDs')
 option('enable_kmods', type: 'boolean', value: true,
        description: 'build kernel modules')
 option('examples', type: 'string', value: '',

I don't see the need to constantly update with each device being added.  

> 
> Regards,
> /Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v5] net/mlx: add meson build support
  2018-09-13 10:12             ` Shahaf Shuler
@ 2018-09-13 10:51               ` Bruce Richardson
  0 siblings, 0 replies; 26+ messages in thread
From: Bruce Richardson @ 2018-09-13 10:51 UTC (permalink / raw)
  To: Shahaf Shuler
  Cc: Nélio Laranjeiro, Yongseok Koh, Matan Azrad, bluca, dev

On Thu, Sep 13, 2018 at 10:12:18AM +0000, Shahaf Shuler wrote:
> Hi Bruce,
> 
> Sorry for the late reply. Holiday time in Israel. 
> 
No problem! Hope you had a good break. :-)

> Thursday, September 13, 2018 12:22 PM, Bruce Richardson:
> > Subject: Re: [dpdk-dev] [PATCH v5] net/mlx: add meson build support
> > 
> > On Fri, Sep 07, 2018 at 11:34:29AM +0100, Bruce Richardson wrote:
> > > On Wed, Sep 05, 2018 at 02:47:46PM +0300, Shahaf Shuler wrote:
> > > > From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> 
<snip>
> 
> > > * Very minor suggestion: is it neater to use "args: '-include ' + arg[1]",
> > >   instead of using prefix with the #include syntax? [Assuming the former
> > >   works]
> 
> I don't understand the benefit with this change. Is there? 
> 

No, it was just a suggestion as to what looked neater in the code. Use
whatever you prefer.

> > >
> > 
> > Any plans for a new version of this? If so, can I also suggest splitting the patch
> > into two, one for mlx4 and the other for mlx5.
> 
> No problem to split.
> 
> Another change in plans: 
> diff --git a/meson_options.txt b/meson_options.txt
> index 484f3e2601..444a380d97 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -1,7 +1,7 @@
>  option('allow_invalid_socket_id', type: 'boolean', value: false,
>         description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly')
>  option('enable_driver_mlx_glue', type: 'boolean', value: false,
> -       description: 'Enable glue library for Mellanox ConnectX-3/4/5 NIC PMD')
> +       description: 'Enable glue library for Mellanox PMDs')
>  option('enable_kmods', type: 'boolean', value: true,
>         description: 'build kernel modules')
>  option('examples', type: 'string', value: '',
> 
> I don't see the need to constantly update with each device being added.  
> 
Good idea!

/Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v6 1/2] net/mlx5: support meson build
  2018-09-05 11:47       ` [dpdk-dev] [PATCH v5] " Shahaf Shuler
  2018-09-07 10:34         ` Bruce Richardson
@ 2018-09-13 12:11         ` Shahaf Shuler
  2018-09-13 12:41           ` Bruce Richardson
  2018-09-13 12:11         ` [dpdk-dev] [PATCH v6 2/2] net/mlx4: " Shahaf Shuler
  2 siblings, 1 reply; 26+ messages in thread
From: Shahaf Shuler @ 2018-09-13 12:11 UTC (permalink / raw)
  To: yskoh, matan, nelio.laranjeiro, bluca, bruce.richardson; +Cc: dev

From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Compile Mellanox driver when its external dependencies are met.  A
glue version of the driver can still be requested by using the
-Denable_driver_mlx_glue=true

To avoid modifying the whole sources and keep the compatibility with
current build systems (e.g. make), the mlx5_autoconf.h is still
generated by invoking DPDK scripts though meson's run_command() instead
of using has_types, has_members, ... commands.

Meson will try to find the required external libraries.  When they are
not installed system wide, they can be provided though CFLAGS, LDFLAGS
and LD_LIBRARY_PATH environment variables, example (considering
RDMA-Core is installed in /tmp/rdma-core):

 # CLFAGS=-I/tmp/rdma-core/build/include \
   LDFLAGS=-L/tmp/rdma-core/build/lib \
   LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   meson output
 # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   ninja -C output install

Note: LD_LIBRARY_PATH before ninja is necessary when the meson
configuration has changed (e.g. meson configure has been called), in
such situation the LD_LIBRARY_PATH is necessary to invoke the
autoconfiguration script.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
Changes in v6:
- split into two patches for mlx5 and mlx4
- ident with tabs instead of spaces
- no need to remove the confiugration file, meson will override it
- split configuration file creation into two loops: symbols and structs
- rewrite enable_driver_mlx_glue description

Changes in v5:

- use meson tool to generate Mellanox config file instead of DPDK custom scripts.

Changes in v4:

- remove implicit -Wall flag (set by default by meson),
- add item information in the autoconfiguration failure error message,
- reword the help for the glue library option,

Changes in v3:

Sanitize the build files:
- remove enable_driver_mlx{4,5} options,
- test cflags capabilities before using them,
- remove old autoconfiguration file,
- use an array for autoconfiguration and put them in the build directory,
- use dependencies in shared_library for link arguments.

Changes in v2:

- dropped patch https://patches.dpdk.org/patch/43897/
- remove extra_{cflags,ldflags} as already honored by meson through
environment variables.

---
 drivers/net/meson.build      |   1 +
 drivers/net/mlx5/meson.build | 228 +++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt            |   2 +
 3 files changed, 231 insertions(+)
 create mode 100644 drivers/net/mlx5/meson.build

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 9c28ed4da4..d444c3287f 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -18,6 +18,7 @@ drivers = ['af_packet',
 	'ixgbe',
 	'kni',
 	'liquidio',
+	'mlx5',
 	'mvpp2',
 	'netvsc',
 	'nfp',
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
new file mode 100644
index 0000000000..289c7a4c07
--- /dev/null
+++ b/drivers/net/mlx5/meson.build
@@ -0,0 +1,228 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+pmd_dlopen = get_option('enable_driver_mlx_glue')
+LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
+LIB_GLUE_VERSION = '18.05.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+	dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
+	cflags += [
+		'-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
+		'-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+	]
+endif
+libs = [
+	cc.find_library('mnl', required:false),
+	cc.find_library('mlx5', required:false),
+	cc.find_library('ibverbs', required:false),
+]
+build = true
+foreach lib:libs
+	if not lib.found()
+		build = false
+	endif
+endforeach
+if build
+	allow_experimental_apis = true
+	ext_deps += libs
+	sources = files(
+		'mlx5.c',
+		'mlx5_ethdev.c',
+		'mlx5_flow.c',
+		'mlx5_mac.c',
+		'mlx5_mr.c',
+		'mlx5_nl.c',
+		'mlx5_nl_flow.c',
+		'mlx5_rss.c',
+		'mlx5_rxmode.c',
+		'mlx5_rxq.c',
+		'mlx5_rxtx.c',
+		'mlx5_socket.c',
+		'mlx5_stats.c',
+		'mlx5_trigger.c',
+		'mlx5_txq.c',
+		'mlx5_vlan.c',
+	)
+	if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
+		sources += files('mlx5_rxtx_vec.c')
+	endif
+	if not pmd_dlopen
+		sources += files('mlx5_glue.c')
+	endif
+	cflags_options = [
+		'-Wextra',
+		'-std=c11',
+		'-Wno-strict-prototypes',
+		'-D_BSD_SOURCE',
+		'-D_DEFAULT_SOURCE',
+		'-D_XOPEN_SOURCE=600'
+	]
+	foreach option:cflags_options
+		if cc.has_argument(option)
+			cflags += option
+		endif
+	endforeach
+	if get_option('buildtype').contains('debug')
+		cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+	else
+		cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+	endif
+	# To maintain the compatibility with the make build system
+	# mlx5_autoconf.h file is still generated.
+	# input array for meson member search:
+	# [ "MACRO to define if found", "header for the search",
+	#   "symbol to search", "struct member to search" ]
+	has_member_args = [
+		[ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
+		'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ],
+		[ 'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT', 'infiniband/verbs.h',
+		'struct ibv_counter_set_init_attr', 'counter_set_id' ],
+	]
+	# input array for meson symbol search:
+	# [ "MACRO to define if found", "header for the search",
+	#   "symbol to search" ]
+	has_sym_args = [
+		[ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
+		'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
+		[ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
+		'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
+		[ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h',
+		'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
+		[ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
+		'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
+		[ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
+		'IBV_FLOW_SPEC_MPLS' ],
+		[ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
+		'IBV_WQ_FLAG_RX_END_PADDING' ],
+		[ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
+		'SUPPORTED_40000baseKR4_Full' ],
+		[ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
+		'SUPPORTED_40000baseCR4_Full' ],
+		[ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h',
+		'SUPPORTED_40000baseSR4_Full' ],
+		[ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h',
+		'SUPPORTED_40000baseLR4_Full' ],
+		[ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h',
+		'SUPPORTED_56000baseKR4_Full' ],
+		[ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h',
+		'SUPPORTED_56000baseCR4_Full' ],
+		[ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h',
+		'SUPPORTED_56000baseSR4_Full' ],
+		[ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h',
+		'SUPPORTED_56000baseLR4_Full' ],
+		[ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h',
+		'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
+		[ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h',
+		'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
+		[ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h',
+		'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
+		[ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
+		'IFLA_PHYS_SWITCH_ID' ],
+		[ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
+		'IFLA_PHYS_PORT_NAME' ],
+		[ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h',
+		'TCA_FLOWER_ACT' ],
+		[ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h',
+		'TCA_FLOWER_FLAGS' ],
+		[ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_ETH_TYPE' ],
+		[ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_ETH_DST' ],
+		[ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_ETH_DST_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_ETH_SRC' ],
+		[ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IP_PROTO' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IPV4_SRC' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IPV4_DST' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IPV6_SRC' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IPV6_DST' ],
+		[ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_TCP_SRC' ],
+		[ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_TCP_DST' ],
+		[ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_TCP_DST_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_UDP_SRC' ],
+		[ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_UDP_DST' ],
+		[ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_UDP_DST_MASK' ],
+		[ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_VLAN_ID' ],
+		[ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_VLAN_PRIO' ],
+		[ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
+		'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
+		[ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h',
+		'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
+		[ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h',
+		'RDMA_NL_NLDEV' ],
+		[ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h',
+		'RDMA_NLDEV_CMD_GET' ],
+		[ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
+		'RDMA_NLDEV_CMD_PORT_GET' ],
+		[ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
+		'RDMA_NLDEV_ATTR_DEV_INDEX' ],
+		[ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
+		'RDMA_NLDEV_ATTR_DEV_NAME' ],
+		[ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
+		'RDMA_NLDEV_ATTR_PORT_INDEX' ],
+		[ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
+		'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
+	]
+	config = configuration_data()
+	foreach arg:has_sym_args
+		config.set(arg[0], cc.has_header_symbol(arg[1], arg[2]))
+	endforeach
+	foreach arg:has_member_args
+		file_prefix = '#include<' + arg[1] + '>'
+		config.set(arg[0], cc.has_member(arg[2], arg[3],
+			prefix : file_prefix))
+	endforeach
+	configure_file(output : 'mlx5_autoconf.h', configuration : config)
+endif
+# Build Glue Library
+if pmd_dlopen and build
+	dlopen_name = 'mlx5_glue'
+	dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+	dlopen_so_version = LIB_GLUE_VERSION
+	dlopen_sources = files('mlx5_glue.c')
+	dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+	shared_lib = shared_library(
+		dlopen_lib_name,
+		dlopen_sources,
+		include_directories: global_inc,
+		c_args: cflags,
+		dependencies: libs,
+		link_args: [
+		'-Wl,-export-dynamic',
+		'-Wl,-h,@0@'.format(LIB_GLUE),
+		],
+		soversion: dlopen_so_version,
+		install: true,
+		install_dir: dlopen_install_dir,
+	)
+endif
diff --git a/meson_options.txt b/meson_options.txt
index c843278587..444a380d97 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,7 @@
 option('allow_invalid_socket_id', type: 'boolean', value: false,
 	description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly')
+option('enable_driver_mlx_glue', type: 'boolean', value: false,
+	description: 'Enable glue library for Mellanox PMDs')
 option('enable_kmods', type: 'boolean', value: true,
 	description: 'build kernel modules')
 option('examples', type: 'string', value: '',
-- 
2.12.0

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v6 2/2] net/mlx4: support meson build
  2018-09-05 11:47       ` [dpdk-dev] [PATCH v5] " Shahaf Shuler
  2018-09-07 10:34         ` Bruce Richardson
  2018-09-13 12:11         ` [dpdk-dev] [PATCH v6 1/2] net/mlx5: support meson build Shahaf Shuler
@ 2018-09-13 12:11         ` Shahaf Shuler
  2 siblings, 0 replies; 26+ messages in thread
From: Shahaf Shuler @ 2018-09-13 12:11 UTC (permalink / raw)
  To: yskoh, matan, nelio.laranjeiro, bluca, bruce.richardson; +Cc: dev

From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Compile Mellanox driver when their external dependencies are met.  A
glue version of the driver can still be requested by using the
-Denable_driver_mlx_glue=true

To avoid modifying the whole sources and keep the compatibility with
current build systems (e.g. make), the mlx4_autoconf.h is still
generated by invoking DPDK scripts though meson's run_command() instead
of using has_types, has_members, ... commands.

Meson will try to find the required external libraries.  When they are
not installed system wide, they can be provided though CFLAGS, LDFLAGS
and LD_LIBRARY_PATH environment variables, example (considering
RDMA-Core is installed in /tmp/rdma-core):

 # CLFAGS=-I/tmp/rdma-core/build/include \
   LDFLAGS=-L/tmp/rdma-core/build/lib \
   LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   meson output
 # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
   ninja -C output install

Note: LD_LIBRARY_PATH before ninja is necessary when the meson
configuration has changed (e.g. meson configure has been called), in
such situation the LD_LIBRARY_PATH is necessary to invoke the
autoconfiguration script.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>

---
Changes in v6:
- split into two patches for mlx5 and mlx4
- ident with tabs instead of spaces
- no need to remove the confiugration file, meson will override it
- split configuration file creation into two loops: symbols and structs

Changes in v5:

- use meson tool to generate Mellanox config file instead of DPDK custom scripts.

Changes in v4:

- remove implicit -Wall flag (set by default by meson),
- add item information in the autoconfiguration failure error message,
- reword the help for the glue library option,

Changes in v3:

Sanitize the build files:
- remove enable_driver_mlx{4,5} options,
- test cflags capabilities before using them,
- remove old autoconfiguration file,
- use an array for autoconfiguration and put them in the build directory,
- use dependencies in shared_library for link arguments.

Changes in v2:

- dropped patch https://patches.dpdk.org/patch/43897/
- remove extra_{cflags,ldflags} as already honored by meson through
environment variables.
---
 drivers/net/meson.build      |   1 +
 drivers/net/mlx4/meson.build | 102 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+)
 create mode 100644 drivers/net/mlx4/meson.build

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index d444c3287f..c7a2d0e7db 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -18,6 +18,7 @@ drivers = ['af_packet',
 	'ixgbe',
 	'kni',
 	'liquidio',
+	'mlx4',
 	'mlx5',
 	'mvpp2',
 	'netvsc',
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
new file mode 100644
index 0000000000..7de571e2a2
--- /dev/null
+++ b/drivers/net/mlx4/meson.build
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 6WIND S.A.
+# Copyright 2018 Mellanox Technologies, Ltd
+
+pmd_dlopen = get_option('enable_driver_mlx_glue')
+LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
+LIB_GLUE_VERSION = '18.02.0'
+LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
+if pmd_dlopen
+	dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1)
+	cflags += [
+		'-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
+		'-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
+	]
+endif
+libs = [
+	cc.find_library('mnl', required:false),
+	cc.find_library('mlx4', required:false),
+	cc.find_library('ibverbs', required:false),
+]
+build = true
+foreach lib:libs
+	if not lib.found()
+		build = false
+	endif
+endforeach
+# Compile PMD
+if build
+	allow_experimental_apis = true
+	ext_deps += libs
+	sources = files(
+		'mlx4.c',
+		'mlx4_ethdev.c',
+		'mlx4_flow.c',
+		'mlx4_intr.c',
+		'mlx4_mr.c',
+		'mlx4_rxq.c',
+		'mlx4_rxtx.c',
+		'mlx4_txq.c',
+		'mlx4_utils.c',
+	)
+	if not pmd_dlopen
+		sources += files('mlx4_glue.c')
+	endif
+	cflags_options = [
+		'-Wextra',
+		'-std=c11',
+		'-Wno-strict-prototypes',
+		'-D_BSD_SOURCE',
+		'-D_DEFAULT_SOURCE',
+		'-D_XOPEN_SOURCE=600'
+	]
+	foreach option:cflags_options
+		if cc.has_argument(option)
+			cflags += option
+		endif
+	endforeach
+	if get_option('buildtype').contains('debug')
+		cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
+	else
+		cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
+	endif
+	# To maintain the compatibility with the make build system
+	# mlx4_autoconf.h file is still generated.
+	# input array for meson member search:
+	# [ "MACRO to define if found", "header for the search",
+	#   "symbol to search","struct member to search" ]
+	#
+	has_member_args = [
+		[ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h',
+		'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ],
+	]
+	config = configuration_data()
+	foreach arg:has_member_args
+		file_prefix = '#include<' + arg[1] + '>'
+		config.set(arg[0], cc.has_member(arg[2], arg[3],
+			prefix : file_prefix))
+	endforeach
+	configure_file(output : 'mlx4_autoconf.h', configuration : config)
+endif
+# Build Glue Library
+if pmd_dlopen and build
+	dlopen_name = 'mlx4_glue'
+	dlopen_lib_name = driver_name_fmt.format(dlopen_name)
+	dlopen_so_version = LIB_GLUE_VERSION
+	dlopen_sources = files('mlx4_glue.c')
+	dlopen_install_dir = [ eal_pmd_path + '-glue' ]
+	shared_lib = shared_library(
+		dlopen_lib_name,
+		dlopen_sources,
+		include_directories: global_inc,
+		c_args: cflags,
+		dependencies: libs,
+		link_args: [
+		'-Wl,-export-dynamic',
+		'-Wl,-h,@0@'.format(LIB_GLUE),
+		],
+		soversion: dlopen_so_version,
+		install: true,
+		install_dir: dlopen_install_dir,
+	)
+endif
-- 
2.12.0

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/2] net/mlx5: support meson build
  2018-09-13 12:11         ` [dpdk-dev] [PATCH v6 1/2] net/mlx5: support meson build Shahaf Shuler
@ 2018-09-13 12:41           ` Bruce Richardson
  2018-09-16  9:01             ` Shahaf Shuler
  0 siblings, 1 reply; 26+ messages in thread
From: Bruce Richardson @ 2018-09-13 12:41 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: yskoh, matan, nelio.laranjeiro, bluca, dev

On Thu, Sep 13, 2018 at 03:11:05PM +0300, Shahaf Shuler wrote:
> From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> 
> Compile Mellanox driver when its external dependencies are met.  A
> glue version of the driver can still be requested by using the
> -Denable_driver_mlx_glue=true
> 
> To avoid modifying the whole sources and keep the compatibility with
> current build systems (e.g. make), the mlx5_autoconf.h is still
> generated by invoking DPDK scripts though meson's run_command() instead
> of using has_types, has_members, ... commands.
> 

This part of the commit message is no longer accurate.

> Meson will try to find the required external libraries.  When they are
> not installed system wide, they can be provided though CFLAGS, LDFLAGS
> and LD_LIBRARY_PATH environment variables, example (considering
> RDMA-Core is installed in /tmp/rdma-core):
> 
>  # CLFAGS=-I/tmp/rdma-core/build/include \
>    LDFLAGS=-L/tmp/rdma-core/build/lib \
>    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
>    meson output
>  # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
>    ninja -C output install
> 
> Note: LD_LIBRARY_PATH before ninja is necessary when the meson
> configuration has changed (e.g. meson configure has been called), in
> such situation the LD_LIBRARY_PATH is necessary to invoke the
> autoconfiguration script.
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>

The signoffs should be together, followed by the ack.

Otherwise LGTM (for both patches)

/Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/2] net/mlx5: support meson build
  2018-09-13 12:41           ` Bruce Richardson
@ 2018-09-16  9:01             ` Shahaf Shuler
  0 siblings, 0 replies; 26+ messages in thread
From: Shahaf Shuler @ 2018-09-16  9:01 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Yongseok Koh, Matan Azrad, Nélio Laranjeiro, bluca, dev

Thursday, September 13, 2018 3:42 PM, Bruce Richardson:
> Subject: Re: [PATCH v6 1/2] net/mlx5: support meson build
> 
> On Thu, Sep 13, 2018 at 03:11:05PM +0300, Shahaf Shuler wrote:
> > From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> >
> > Compile Mellanox driver when its external dependencies are met.  A
> > glue version of the driver can still be requested by using the
> > -Denable_driver_mlx_glue=true
> >
> > To avoid modifying the whole sources and keep the compatibility with
> > current build systems (e.g. make), the mlx5_autoconf.h is still
> > generated by invoking DPDK scripts though meson's run_command()
> > instead of using has_types, has_members, ... commands.
> >
> 
> This part of the commit message is no longer accurate.
> 
> > Meson will try to find the required external libraries.  When they are
> > not installed system wide, they can be provided though CFLAGS, LDFLAGS
> > and LD_LIBRARY_PATH environment variables, example (considering
> > RDMA-Core is installed in /tmp/rdma-core):
> >
> >  # CLFAGS=-I/tmp/rdma-core/build/include \
> >    LDFLAGS=-L/tmp/rdma-core/build/lib \
> >    LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    meson output
> >  # LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> >    ninja -C output install
> >
> > Note: LD_LIBRARY_PATH before ninja is necessary when the meson
> > configuration has changed (e.g. meson configure has been called), in
> > such situation the LD_LIBRARY_PATH is necessary to invoke the
> > autoconfiguration script.
> >
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> 
> The signoffs should be together, followed by the ack.
> 
> Otherwise LGTM (for both patches)

Series applied to next-net-mlx with the above modification, thanks.

> 
> /Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2018-09-16  9:01 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Message-Id: <7812af2267017898332783e934bef9478814ae96.1535361299.git.nelio.laranjeiro@6wind.com>
2018-08-27 12:42 ` [dpdk-dev] [PATCH v2] net/mlx: add meson build support Nelio Laranjeiro
2018-08-28 15:45   ` Bruce Richardson
2018-08-29  9:34     ` Nélio Laranjeiro
2018-08-29 10:01       ` Bruce Richardson
2018-08-29 12:44         ` Nélio Laranjeiro
2018-08-29 10:00     ` Luca Boccassi
2018-08-29 11:59       ` Nélio Laranjeiro
2018-08-29 12:28         ` Luca Boccassi
2018-08-31 16:24         ` Luca Boccassi
2018-08-29 13:48   ` [dpdk-dev] [PATCH v3] " Nelio Laranjeiro
2018-08-30 14:46     ` Bruce Richardson
2018-08-31  7:05       ` Nélio Laranjeiro
2018-08-31  7:16     ` [dpdk-dev] [PATCH v4] " Nelio Laranjeiro
2018-09-05 11:47       ` [dpdk-dev] [PATCH v5] " Shahaf Shuler
2018-09-07 10:34         ` Bruce Richardson
2018-09-13  9:22           ` Bruce Richardson
2018-09-13 10:12             ` Shahaf Shuler
2018-09-13 10:51               ` Bruce Richardson
2018-09-13 12:11         ` [dpdk-dev] [PATCH v6 1/2] net/mlx5: support meson build Shahaf Shuler
2018-09-13 12:41           ` Bruce Richardson
2018-09-16  9:01             ` Shahaf Shuler
2018-09-13 12:11         ` [dpdk-dev] [PATCH v6 2/2] net/mlx4: " Shahaf Shuler
2018-08-27 11:10 [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Nelio Laranjeiro
2018-08-27 11:10 ` [dpdk-dev] [PATCH 2/2] net/mlx: add meson build support Nelio Laranjeiro
2018-08-27 11:24 ` [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Bruce Richardson
2018-08-27 12:20   ` Nélio Laranjeiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).