centralise base code handling for drivers
Subsystems (2)
cover centralise base code handling for drivers
Many DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the drivers/meson.build file, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".
Depends-on: Series-34946 ("net/intel: clean up base code build")
Bruce Richardson (10):
build: add generic support for base code in drivers common/sfc_efx: use common base code build handling net/hinic: use common base code build handling net/intel: use common base code build handling net/ngbe: use common base code build handling net/octeontx: use common base code build handling net/qede: use common base code build handling net/thunderx: use common base code build handling net/txgbe: use common base code build handling raw/ifpga: use common base code build handling
drivers/common/sfc_efx/base/meson.build | 18 +++--------------- drivers/common/sfc_efx/meson.build | 3 --- drivers/meson.build | 20 ++++++++++++++++++++ drivers/net/hinic/base/meson.build | 16 +++++----------- drivers/net/hinic/meson.build | 1 - drivers/net/intel/e1000/meson.build | 3 --- drivers/net/intel/fm10k/meson.build | 3 --- drivers/net/intel/i40e/meson.build | 2 -- drivers/net/intel/iavf/meson.build | 1 - drivers/net/intel/ice/base/meson.build | 22 +++++++--------------- drivers/net/intel/ice/meson.build | 2 -- drivers/net/intel/idpf/meson.build | 1 - drivers/net/intel/ixgbe/meson.build | 3 --- drivers/net/ngbe/base/meson.build | 12 ++---------- drivers/net/ngbe/meson.build | 3 --- drivers/net/octeontx/base/meson.build | 19 +------------------ drivers/net/octeontx/meson.build | 3 --- drivers/net/qede/base/meson.build | 17 +++++------------ drivers/net/qede/meson.build | 1 - drivers/net/thunderx/base/meson.build | 10 +--------- drivers/net/thunderx/meson.build | 3 --- drivers/net/txgbe/base/meson.build | 18 ++---------------- drivers/net/txgbe/meson.build | 3 --- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 25 files changed, 60 insertions(+), 160 deletions(-)
--
2.45.2
PATCH 1/10 build: add generic support for base code in drivers
Add support to the drivers meson.build file for base code files with extra cflags for compilation. This should remove the need for custom logic in each driver.
In future, we may want to move the base code handling down the file a little in order to get lock checking. However, this lock checking is not done currently on base code builds, so not all drivers can safely pass these checks. Therefore, we handle the base code files before we add on the extra lock annotation flags.
--- drivers/meson.build | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/meson.build +20 -0
@@ -145,7 +145,13 @@ foreach subpath:subdirs pkgconfig_extra_libs = [] testpmd_sources = [] require_iova_in_mbuf = true + # for handling base code files which may need extra cflags + base_sources = [] + base_cflags = [] + if fs.is_dir(drv_path / 'base') + includes += include_directories(drv_path / 'base') + endif if name.contains('/') name = name.split('/')[1] endif
@@ -216,6 +222,20 @@ foreach subpath:subdirs continue endif + # not all drivers base code is lock annotation safe, so do base code builds before + # adding on the lock annotation flags. NOTE: If no custom cflags, the lock annotation + # checks will be done though. + if base_cflags != [] + base_lib = static_library(lib_name + '_base_lib', + base_sources, + dependencies: static_deps, + include_directories: includes, + c_args: cflags + base_cflags) + objs += base_lib.extract_objects(base_sources) + else + sources += base_sources + endif + enabled_drivers += name lib_name = '_'.join(['rte', class, name]) cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=' + '.'.join([log_prefix, name])
Signature · 1 line
2.45.2
PATCH 2/10 common/sfc_efx: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/common/sfc_efx/base/meson.build | 18 +++--------------- drivers/common/sfc_efx/meson.build | 3 --- 2 files changed, 3 insertions(+), 18 deletions(-)
drivers/common/sfc_efx/base/meson.build +3 -15
@@ -5,7 +5,7 @@ # This software was jointly developed between OKTET Labs (under contract # for Solarflare) and Solarflare Communications, Inc. -sources = [ +base_sources = files( 'efx_bootcfg.c', 'efx_crc32.c', 'efx_ev.c',
@@ -64,7 +64,7 @@ sources = [ 'rhead_tunnel.c', 'rhead_tx.c', 'rhead_virtio.c', -] +) if is_ms_compiler extra_flags = [
@@ -80,20 +80,8 @@ else ] endif -c_args = cflags foreach flag: extra_flags if cc.has_argument(flag) - c_args += flag + base_cflags += flag endif endforeach - -if build - base_lib = static_library('sfc_base', sources, - include_directories: includes, - dependencies: static_rte_eal, - c_args: c_args) - - base_objs = base_lib.extract_all_objects(recursive: true) -else - base_objs = [] -endif
drivers/common/sfc_efx/meson.build +0 -3
@@ -35,12 +35,9 @@ foreach flag: extra_flags endforeach subdir('base') -objs = [base_objs] deps += ['bus_pci'] sources = files( 'sfc_efx.c', 'sfc_efx_mcdi.c', ) - -includes += include_directories('base')
Signature · 1 line
2.45.2
Re: [PATCH 02/10] common/sfc_efx: use common base code build handling
Quoted 4 lines · Bruce Richardson
Use the base code build handling logic in the
drivers/meson.buildfile, rather than re-implementing it in the driver itself.Signed-off-by Bruce Richardson <[email protected]>
PATCH 3/10 net/hinic: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
---
Minor note: while working on this driver, I noticed that the dependencies of it, and the overall C flags, not the base code C flags, are set in the "base/meson.build" file. Most drivers in DPDK have those set in the top-level driver file, and only to have the base-code specific changes in the base directory.
--- drivers/net/hinic/base/meson.build | 16 +++++----------- drivers/net/hinic/meson.build | 1 - 2 files changed, 5 insertions(+), 12 deletions(-)
drivers/net/hinic/base/meson.build +5 -11
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Huawei Technologies Co., Ltd -sources = [ +base_sources = files( 'hinic_pmd_api_cmd.c', 'hinic_pmd_cfg.c', 'hinic_pmd_cmdq.c',
@@ -13,7 +13,7 @@ sources = [ 'hinic_pmd_nicio.c', 'hinic_pmd_wq.c', 'hinic_pmd_mbox.c', -] +) extra_flags = [] # The driver runs only on arch64 machine, remove 32bit warnings
@@ -22,16 +22,10 @@ if not dpdk_conf.get('RTE_ARCH_64') endif foreach flag: extra_flags - if cc.has_argument(flag) - cflags += flag - endif + if cc.has_argument(flag) + cflags += flag + endif endforeach deps += ['hash'] -c_args = cflags - -base_lib = static_library('hinic_base', sources, - dependencies: [static_rte_eal, static_rte_ethdev, static_rte_bus_pci, static_rte_hash], - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/hinic/meson.build +0 -1
@@ -8,7 +8,6 @@ if is_windows endif subdir('base') -objs = [base_objs] sources = files( 'hinic_pmd_ethdev.c',
Signature · 1 line
2.45.2
PATCH 4/10 net/intel: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the drivers.
--- drivers/net/intel/e1000/meson.build | 3 --- drivers/net/intel/fm10k/meson.build | 3 --- drivers/net/intel/i40e/meson.build | 2 -- drivers/net/intel/iavf/meson.build | 1 - drivers/net/intel/ice/base/meson.build | 22 +++++++--------------- drivers/net/intel/ice/meson.build | 2 -- drivers/net/intel/idpf/meson.build | 1 - drivers/net/intel/ixgbe/meson.build | 3 --- 8 files changed, 7 insertions(+), 30 deletions(-)
drivers/net/intel/e1000/meson.build +0 -3
@@ -3,7 +3,6 @@ subdir('base') -sources += base_sources sources += files( 'e1000_logs.c', 'em_ethdev.c',
@@ -24,5 +23,3 @@ if not is_windows 'igc_txrx.c', ) endif - -includes += include_directories('base')
drivers/net/intel/fm10k/meson.build +0 -3
@@ -9,7 +9,6 @@ endif subdir('base') -sources += base_sources sources += files( 'fm10k_ethdev.c', 'fm10k_rxtx.c',
@@ -17,5 +16,3 @@ sources += files( if arch_subdir == 'x86' sources += files('fm10k_rxtx_vec.c') endif - -includes += include_directories('base')
drivers/net/intel/i40e/meson.build +0 -2
@@ -19,7 +19,6 @@ endif subdir('base') -sources += base_sources sources += files( 'i40e_ethdev.c', 'i40e_rxtx.c',
@@ -36,7 +35,6 @@ sources += files( testpmd_sources = files('i40e_testpmd.c') deps += ['hash'] -includes += include_directories('base') if arch_subdir == 'x86' sources += files('i40e_rxtx_vec_sse.c')
drivers/net/intel/iavf/meson.build +0 -1
@@ -24,7 +24,6 @@ sources = files( 'iavf_ipsec_crypto.c', 'iavf_fsub.c', ) -includes += include_directories('base') if arch_subdir == 'x86' sources += files('iavf_rxtx_vec_sse.c')
drivers/net/intel/ice/base/meson.build +7 -15
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018-2021 Intel Corporation -sources = [ +base_sources = files( 'ice_controlq.c', 'ice_common.c', 'ice_sched.c',
@@ -29,7 +29,7 @@ sources = [ 'ice_ddp.c', 'ice_fwlog.c', 'ice_vf_mbx.c', -] +) if is_ms_compiler error_cflags = [
@@ -41,22 +41,14 @@ else '-Wno-unused-but-set-variable', '-Wno-unused-parameter', ] + # Bugzilla ID: 678 + #if (toolchain == 'gcc' and cc.version().version_compare('>=11.0.0')) + # error_cflags += ['-Wno-array-bounds'] + #endif endif -# Bugzilla ID: 678 -if (toolchain == 'gcc' and cc.version().version_compare('>=11.0.0')) - error_cflags += ['-Wno-array-bounds'] -endif - -c_args = cflags - foreach flag: error_cflags if cc.has_argument(flag) - c_args += flag + base_cflags += flag endif endforeach - -base_lib = static_library('ice_base', sources, - dependencies: static_rte_eal, - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/intel/ice/meson.build +0 -2
@@ -2,7 +2,6 @@ # Copyright(c) 2018 Intel Corporation subdir('base') -objs = [base_objs] sources = files( 'ice_acl_filter.c',
@@ -19,7 +18,6 @@ sources = files( testpmd_sources = files('ice_testpmd.c') deps += ['hash', 'net'] -includes += include_directories('base') if dpdk_conf.has('RTE_NET_IAVF') deps += 'net_iavf'
drivers/net/intel/idpf/meson.build +0 -1
@@ -11,7 +11,6 @@ subdir('base') includes += include_directories('../iavf/base') -sources += base_sources sources += files( 'idpf_common_device.c', 'idpf_common_rxtx.c',
drivers/net/intel/ixgbe/meson.build +0 -3
@@ -5,7 +5,6 @@ cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS'] subdir('base') -sources += base_sources sources += files( 'ixgbe_82599_bypass.c', 'ixgbe_bypass.c',
@@ -32,6 +31,4 @@ elif arch_subdir == 'arm' sources += files('ixgbe_recycle_mbufs_vec_common.c') endif -includes += include_directories('base') - headers = files('rte_pmd_ixgbe.h')
Signature · 1 line
2.45.2
Re: [PATCH 04/10] net/intel: use common base code build handling
Quoted 23 lines · Bruce Richardson
drivers/net/intel/ice/base/meson.build +2
-2@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018-2021 Intel Corporation -sources = [ +base_sources = files( 'ice_controlq.c', 'ice_common.c', 'ice_sched.c',@@ -29,7 +29,7 @@ sources = [ 'ice_ddp.c', 'ice_fwlog.c', 'ice_vf_mbx.c', -] +) if is_ms_compiler error_cflags = [
drivers/net/intel/ice/base/meson.build else · line 47
Quoted 7 lines
drivers/net/intel/ice/base/meson.build +4
-0@@ -41,22 +41,14 @@ else '-Wno-unused-but-set-variable', '-Wno-unused-parameter', ] + # Bugzilla ID: 678 + #if (toolchain == 'gcc' and cc.version().version_compare('>=11.0.0')) + # error_cflags += ['-Wno-array-bounds'] + #endif
Why keep it commented?
Quoted 9 lines
drivers/net/intel/ice/base/meson.build +0
-7endif -# Bugzilla ID: 678 -if (toolchain == 'gcc' and cc.version().version_compare('>=11.0.0')) - error_cflags += ['-Wno-array-bounds'] -endif - -c_args = cflags -
Signature · 1 line
David Marchand
Re: [PATCH 04/10] net/intel: use common base code build handling
Quoted 22 lines · David Marchand
Quoted 20 lines · Bruce Richardson
drivers/net/intel/ice/base/meson.build +2
-2@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018-2021 Intel Corporation -sources = [ +base_sources = files( 'ice_controlq.c', 'ice_common.c', 'ice_sched.c',@@ -29,7 +29,7 @@ sources = [ 'ice_ddp.c', 'ice_fwlog.c', 'ice_vf_mbx.c', -] +)
Quoted 14 lines
drivers/net/intel/ice/base/meson.build else · line 47
Quoted 10 lines
drivers/net/intel/ice/base/meson.build +4
-0if is_ms_compiler error_cflags = [@@ -41,22 +41,14 @@ else '-Wno-unused-but-set-variable', '-Wno-unused-parameter', ] + # Bugzilla ID: 678 + #if (toolchain == 'gcc' and cc.version().version_compare('>=11.0.0')) + # error_cflags += ['-Wno-array-bounds'] + #endifWhy keep it commented?
This was an accidental change added in. In my testing with gcc 14, I discovered that the warning flag was not necessary. However, I assume it is still necessary for GCC 11 as originally added. I have not tested with a range of GCC versions to be sure. Therefore, I'll just drop this diff in next patch revision.
/Bruce
PATCH 5/10 net/ngbe: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/ngbe/base/meson.build | 12 ++---------- drivers/net/ngbe/meson.build | 3 --- 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/net/ngbe/base/meson.build +2 -10
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd. -sources = [ +base_sources = files( 'ngbe_eeprom.c', 'ngbe_hw.c', 'ngbe_mbx.c',
@@ -11,14 +11,6 @@ sources = [ 'ngbe_phy_mvl.c', 'ngbe_phy_yt.c', 'ngbe_vf.c', -] - -error_cflags = [] +) cflags += no_wvla_cflag -c_args = cflags - -base_lib = static_library('ngbe_base', sources, - dependencies: [static_rte_eal, static_rte_ethdev, static_rte_bus_pci], - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/ngbe/meson.build +0 -3
@@ -8,7 +8,6 @@ if is_windows endif subdir('base') -objs = [base_objs] sources = files( 'ngbe_ethdev.c',
@@ -25,5 +24,3 @@ if arch_subdir == 'x86' elif arch_subdir == 'arm' sources += files('ngbe_rxtx_vec_neon.c') endif - -includes += include_directories('base')
Signature · 1 line
2.45.2
PATCH 6/10 net/octeontx: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/octeontx/base/meson.build | 19 +------------------ drivers/net/octeontx/meson.build | 3 --- 2 files changed, 1 insertion(+), 21 deletions(-)
drivers/net/octeontx/base/meson.build +1 -18
@@ -1,25 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Cavium, Inc -sources = [ +base_sources = files( 'octeontx_pkovf.c', 'octeontx_pkivf.c', 'octeontx_bgx.c', -] - -depends = ['ethdev', 'mempool_octeontx'] -static_objs = [] -foreach d: depends - if not is_variable('shared_rte_' + d) - subdir_done() - endif - static_objs += get_variable('static_rte_' + d) -endforeach - -c_args = cflags -base_lib = static_library('octeontx_base', sources, - c_args: c_args, - dependencies: static_objs, ) - -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/octeontx/meson.build +0 -3
@@ -8,7 +8,6 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64') endif subdir('base') -objs = [base_objs] sources = files( 'octeontx_ethdev.c',
@@ -18,6 +17,4 @@ sources = files( deps += ['mempool_octeontx', 'eventdev'] -includes += include_directories('base') - cflags += no_wvla_cflag
Signature · 1 line
2.45.2
PATCH 7/10 net/qede: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/qede/base/meson.build | 17 +++++------------ drivers/net/qede/meson.build | 1 - 2 files changed, 5 insertions(+), 13 deletions(-)
drivers/net/qede/base/meson.build +5 -12
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi <[email protected]> -sources = [ +base_sources = files( 'bcm_osal.c', 'ecore_cxt.c', 'ecore_dcbx.c',
@@ -16,8 +16,7 @@ sources = [ 'ecore_spq.c', 'ecore_sriov.c', 'ecore_vf.c', -] - +) if is_ms_compiler error_cflags = [
@@ -51,14 +50,8 @@ else ] endif -c_args = cflags foreach flag: error_cflags - if cc.has_argument(flag) - c_args += flag - endif + if cc.has_argument(flag) + base_cflags += flag + endif endforeach - -base_lib = static_library('qede_base', sources, - dependencies: [static_rte_net, static_rte_bus_pci], - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/qede/meson.build +0 -1
@@ -8,7 +8,6 @@ if is_windows endif subdir('base') -objs = [base_objs] sources = files( 'qede_debug.c',
Signature · 1 line
2.45.2
PATCH 8/10 net/thunderx: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/thunderx/base/meson.build | 10 +--------- drivers/net/thunderx/meson.build | 3 --- 2 files changed, 1 insertion(+), 12 deletions(-)
drivers/net/thunderx/base/meson.build +1 -9
@@ -1,16 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Cavium, Inc -sources = [ +base_sources = files( 'nicvf_hw.c', 'nicvf_mbox.c', 'nicvf_bsvf.c', -] - -c_args = cflags -base_lib = static_library('nicvf_base', sources, - c_args: c_args, - dependencies: static_rte_ethdev ) - -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/thunderx/meson.build +0 -3
@@ -8,7 +8,6 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64') endif subdir('base') -objs = [base_objs] sources = files( 'nicvf_ethdev.c',
@@ -23,5 +22,3 @@ endif if cc.has_argument('-Wno-maybe-uninitialized') cflags += '-Wno-maybe-uninitialized' endif - -includes += include_directories('base')
Signature · 1 line
2.45.2
PATCH 9/10 net/txgbe: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/txgbe/base/meson.build | 18 ++---------------- drivers/net/txgbe/meson.build | 3 --- 2 files changed, 2 insertions(+), 19 deletions(-)
drivers/net/txgbe/base/meson.build +2 -16
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2015-2020 Beijing WangXun Technology Co., Ltd. -sources = [ +base_sources = files( 'txgbe_dcb_hw.c', 'txgbe_dcb.c', 'txgbe_eeprom.c',
@@ -10,18 +10,4 @@ sources = [ 'txgbe_mng.c', 'txgbe_phy.c', 'txgbe_vf.c', -] - -error_cflags = [] - -c_args = cflags -foreach flag: error_cflags - if cc.has_argument(flag) - c_args += flag - endif -endforeach - -base_lib = static_library('txgbe_base', sources, - dependencies: [static_rte_eal, static_rte_net, static_rte_bus_pci], - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true) +)
drivers/net/txgbe/meson.build +0 -3
@@ -8,7 +8,6 @@ if is_windows endif subdir('base') -objs = [base_objs] sources = files( 'txgbe_ethdev.c',
@@ -32,6 +31,4 @@ elif arch_subdir == 'arm' sources += files('txgbe_rxtx_vec_neon.c') endif -includes += include_directories('base') - install_headers('rte_pmd_txgbe.h')
Signature · 1 line
2.45.2
PATCH 10/10 raw/ifpga: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
While making changes similar to that in other drivers, also move content around dependencies from the base/meson.build file to the main driver meson.build file, so that the base code file only contains the list of base code files.
--- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 22 deletions(-)
drivers/raw/ifpga/base/meson.build +2 -19
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation -sources = [ +base_sources = files( 'ifpga_api.c', 'ifpga_enumerate.c', 'ifpga_feature_dev.c',
@@ -23,21 +23,4 @@ sources = [ 'opae_i2c.c', 'opae_at24_eeprom.c', 'opae_eth_group.c', -] - -rtdep = dependency('librt', required: false) -if not rtdep.found() - rtdep = cc.find_library('rt', required: false) -endif -if not rtdep.found() - build = false - reason = 'missing dependency, "librt"' - subdir_done() -endif - -ext_deps += rtdep - -base_lib = static_library('ifpga_rawdev_base', sources, - dependencies: static_rte_eal, - c_args: cflags) -base_objs = base_lib.extract_all_objects(recursive: true) +)
drivers/raw/ifpga/meson.build +12 -3
@@ -7,8 +7,19 @@ if not has_libfdt subdir_done() endif +rtdep = dependency('librt', required: false) +if not rtdep.found() + rtdep = cc.find_library('rt', required: false) +endif +if not rtdep.found() + build = false + reason = 'missing dependency, "librt"' + subdir_done() +endif + +ext_deps += rtdep + subdir('base') -objs = [base_objs] deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', 'bus_vdev', 'bus_ifpga', 'net', 'net_i40e', 'net_ipn3ke']
@@ -17,6 +28,4 @@ sources = files('ifpga_rawdev.c', 'rte_pmd_ifpga.c', 'afu_pmd_core.c', 'afu_pmd_n3000.c', 'afu_pmd_he_lpbk.c', 'afu_pmd_he_mem.c', 'afu_pmd_he_hssi.c') -includes += include_directories('base') - headers = files('rte_pmd_ifpga.h')
Signature · 1 line
2.45.2
RE: [PATCH 10/10] raw/ifpga: use common base code build handling
Hi,
Quoted 92 lines
-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Tuesday, April 1, 2025 12:10 AM
To: [email protected]
Cc: Bruce Richardson <[email protected]>; Xu, Rosen <[email protected]>
Subject: [PATCH 10/10] raw/ifpga: use common base code build handling[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Use the base code build handling logic in the
drivers/meson.buildfile, rather than re-implementing it in the driver itself.While making changes similar to that in other drivers, also move content around dependencies from the base/meson.build file to the main driver meson.build file, so that the base code file only contains the list of base code files.
Signed-off-by Bruce Richardson <[email protected]>--- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 22 deletions(-)drivers/raw/ifpga/base/meson.build +0
-0@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 IntelCorporation
drivers/raw/ifpga/base/meson.build +2
-18-sources = [ +base_sources = files( 'ifpga_api.c', 'ifpga_enumerate.c', 'ifpga_feature_dev.c',@@ -23,21 +23,4 @@ sources = [ 'opae_i2c.c', 'opae_at24_eeprom.c', 'opae_eth_group.c', -] - -rtdep = dependency('librt', required: false) -if not rtdep.found() - rtdep = cc.find_library('rt', required: false) -endif -if not rtdep.found() - build = false - reason = 'missing dependency, "librt"' - subdir_done() -endif - -ext_deps += rtdep - -base_lib = static_library('ifpga_rawdev_base', sources, - dependencies: static_rte_eal, - c_args: cflags) -base_objs = base_lib.extract_all_objects(recursive: true) +)drivers/raw/ifpga/meson.build +10
-1@@ -7,8 +7,19 @@ if not has_libfdt subdir_done() endif +rtdep = dependency('librt', required: false) if not rtdep.found() + rtdep = cc.find_library('rt', required: false) endif if not +rtdep.found() + build = false + reason = 'missing dependency, "librt"' + subdir_done() +endif + +ext_deps += rtdep + subdir('base') -objs = [base_objs] deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', 'bus_vdev', 'bus_ifpga', 'net', 'net_i40e', 'net_ipn3ke'] @@ -17,6 +28,4 @@sources = files('ifpga_rawdev.c', '
rte_pmd_ifpga.c', 'afu_pmd_core.c','afu_pmd_n3000.c', 'afu_pmd_he_lpbk.c', 'afu_pmd_he_mem.c', 'afu_pmd_he_hssi.c')drivers/raw/ifpga/meson.build +0
-3-includes += include_directories('base') - headers = files('rte_pmd_ifpga.h') --
Quoted 1 line
2.45.2
Quoted 11 lines · Bruce Richardson
Many DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the
drivers/meson.buildfile, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".
In general, this series lgtm.
Quoted 1 line
Depends-on: Series-34946 ("net/intel: clean up base code build")
This dependency is a bit problematic, as this series is already merged in next-net-intel.
There will be some merge conflict to resolve.
Instead, it would have been better if next-net-intel relied on this new series.
After this series, the only remaining special case is for SVE stuff in net/hns3 and we would have all source compiling handled by drivers/meson.build.
Do you plan to clean it too?
Signature · 1 line
David Marchand
Quoted 14 lines · David Marchand
Quoted 11 lines · Bruce Richardson
Many DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the
drivers/meson.buildfile, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".
Quoted 9 lines
In general, this series lgtm.
Quoted 1 line
Depends-on: Series-34946 ("net/intel: clean up base code build")
This dependency is a bit problematic, as this series is already merged in next-net-intel.
There will be some merge conflict to resolve.
Instead, it would have been better if next-net-intel relied on this new series.
Maybe so, however, this was the order in which the work was done, and when doing the next-net work I wasn't sure I'd be doing this set in this release!
Quoted 6 lines
After this series, the only remaining special case is for SVE stuff in net/hns3 and we would have all source compiling handled by
drivers/meson.build.
Do you plan to clean it too?
I wasn't aware of it, but I can take a look, hopefully soon.
/Bruce
Quoted 24 lines · David Marchand
Quoted 11 lines · Bruce Richardson
Many DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the
drivers/meson.buildfile, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".In general, this series lgtm.
Quoted 1 line
Depends-on: Series-34946 ("net/intel: clean up base code build")
This dependency is a bit problematic, as this series is already merged in next-net-intel.
There will be some merge conflict to resolve.
Instead, it would have been better if next-net-intel relied on this new series.
Quoted 5 lines
After this series, the only remaining special case is for SVE stuff in net/hns3 and we would have all source compiling handled by
drivers/meson.build.
Do you plan to clean it too?
I took a quick look, and I've done up an RFC based on what I see in the code[1]. Unfortunately, I have no way to test it, so it would be good if someone from the Arm side takes the patch and improves it from here. Hopefully, it's a start point though.
/Bruce
[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
v2 cover centralize base code handling for drivers
In reply to Bruce RichardsonMany DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the drivers/meson.build file, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".
v2:
* rebase on latest main
* fix inclusion of accident diff in v1
Bruce Richardson (10):
build: add generic support for base code in drivers common/sfc_efx: use common base code build handling net/hinic: use common base code build handling net/intel: use common base code build handling net/ngbe: use common base code build handling net/octeontx: use common base code build handling net/qede: use common base code build handling net/thunderx: use common base code build handling net/txgbe: use common base code build handling raw/ifpga: use common base code build handling
drivers/common/sfc_efx/base/meson.build | 18 +++--------------- drivers/common/sfc_efx/meson.build | 3 --- drivers/meson.build | 20 ++++++++++++++++++++ drivers/net/hinic/base/meson.build | 16 +++++----------- drivers/net/hinic/meson.build | 1 - drivers/net/intel/e1000/meson.build | 3 --- drivers/net/intel/fm10k/meson.build | 3 --- drivers/net/intel/i40e/meson.build | 2 -- drivers/net/intel/iavf/meson.build | 1 - drivers/net/intel/ice/base/meson.build | 13 +++---------- drivers/net/intel/ice/meson.build | 2 -- drivers/net/intel/idpf/meson.build | 1 - drivers/net/intel/ixgbe/meson.build | 3 --- drivers/net/ngbe/base/meson.build | 12 ++---------- drivers/net/ngbe/meson.build | 3 --- drivers/net/octeontx/base/meson.build | 19 +------------------ drivers/net/octeontx/meson.build | 3 --- drivers/net/qede/base/meson.build | 17 +++++------------ drivers/net/qede/meson.build | 1 - drivers/net/thunderx/base/meson.build | 10 +--------- drivers/net/thunderx/meson.build | 3 --- drivers/net/txgbe/base/meson.build | 18 ++---------------- drivers/net/txgbe/meson.build | 3 --- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 25 files changed, 56 insertions(+), 155 deletions(-)
--
2.45.2
PATCH v2 1/10 build: add generic support for base code in drivers
Add support to the drivers meson.build file for base code files with extra cflags for compilation. This should remove the need for custom logic in each driver.
In future, we may want to move the base code handling down the file a little in order to get lock checking. However, this lock checking is not done currently on base code builds, so not all drivers can safely pass these checks. Therefore, we handle the base code files before we add on the extra lock annotation flags.
--- drivers/meson.build | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/meson.build +20 -0
@@ -145,7 +145,13 @@ foreach subpath:subdirs pkgconfig_extra_libs = [] testpmd_sources = [] require_iova_in_mbuf = true + # for handling base code files which may need extra cflags + base_sources = [] + base_cflags = [] + if fs.is_dir(drv_path / 'base') + includes += include_directories(drv_path / 'base') + endif if name.contains('/') name = name.split('/')[1] endif
@@ -216,6 +222,20 @@ foreach subpath:subdirs continue endif + # not all drivers base code is lock annotation safe, so do base code builds before + # adding on the lock annotation flags. NOTE: If no custom cflags, the lock annotation + # checks will be done though. + if base_cflags != [] + base_lib = static_library(lib_name + '_base_lib', + base_sources, + dependencies: static_deps, + include_directories: includes, + c_args: cflags + base_cflags) + objs += base_lib.extract_objects(base_sources) + else + sources += base_sources + endif + enabled_drivers += name lib_name = '_'.join(['rte', class, name]) cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=' + '.'.join([log_prefix, name])
Signature · 1 line
2.45.2
PATCH v2 2/10 common/sfc_efx: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/common/sfc_efx/base/meson.build | 18 +++--------------- drivers/common/sfc_efx/meson.build | 3 --- 2 files changed, 3 insertions(+), 18 deletions(-)
drivers/common/sfc_efx/base/meson.build +3 -15
@@ -5,7 +5,7 @@ # This software was jointly developed between OKTET Labs (under contract # for Solarflare) and Solarflare Communications, Inc. -sources = [ +base_sources = files( 'efx_bootcfg.c', 'efx_crc32.c', 'efx_ev.c',
@@ -64,7 +64,7 @@ sources = [ 'rhead_tunnel.c', 'rhead_tx.c', 'rhead_virtio.c', -] +) if is_ms_compiler extra_flags = [
@@ -80,20 +80,8 @@ else ] endif -c_args = cflags foreach flag: extra_flags if cc.has_argument(flag) - c_args += flag + base_cflags += flag endif endforeach - -if build - base_lib = static_library('sfc_base', sources, - include_directories: includes, - dependencies: static_rte_eal, - c_args: c_args) - - base_objs = base_lib.extract_all_objects(recursive: true) -else - base_objs = [] -endif
drivers/common/sfc_efx/meson.build +0 -3
@@ -35,12 +35,9 @@ foreach flag: extra_flags endforeach subdir('base') -objs = [base_objs] deps += ['bus_pci'] sources = files( 'sfc_efx.c', 'sfc_efx_mcdi.c', ) - -includes += include_directories('base')
Signature · 1 line
2.45.2
PATCH v2 3/10 net/hinic: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/hinic/base/meson.build | 16 +++++----------- drivers/net/hinic/meson.build | 1 - 2 files changed, 5 insertions(+), 12 deletions(-)
drivers/net/hinic/base/meson.build +5 -11
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Huawei Technologies Co., Ltd -sources = [ +base_sources = files( 'hinic_pmd_api_cmd.c', 'hinic_pmd_cfg.c', 'hinic_pmd_cmdq.c',
@@ -13,7 +13,7 @@ sources = [ 'hinic_pmd_nicio.c', 'hinic_pmd_wq.c', 'hinic_pmd_mbox.c', -] +) extra_flags = [] # The driver runs only on arch64 machine, remove 32bit warnings
@@ -22,16 +22,10 @@ if not dpdk_conf.get('RTE_ARCH_64') endif foreach flag: extra_flags - if cc.has_argument(flag) - cflags += flag - endif + if cc.has_argument(flag) + cflags += flag + endif endforeach deps += ['hash'] -c_args = cflags - -base_lib = static_library('hinic_base', sources, - dependencies: [static_rte_eal, static_rte_ethdev, static_rte_bus_pci, static_rte_hash], - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/hinic/meson.build +0 -1
@@ -8,7 +8,6 @@ if is_windows endif subdir('base') -objs = [base_objs] sources = files( 'hinic_pmd_ethdev.c',
Signature · 1 line
2.45.2
PATCH v2 4/10 net/intel: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the drivers.
--- drivers/net/intel/e1000/meson.build | 3 --- drivers/net/intel/fm10k/meson.build | 3 --- drivers/net/intel/i40e/meson.build | 2 -- drivers/net/intel/iavf/meson.build | 1 - drivers/net/intel/ice/base/meson.build | 13 +++---------- drivers/net/intel/ice/meson.build | 2 -- drivers/net/intel/idpf/meson.build | 1 - drivers/net/intel/ixgbe/meson.build | 3 --- 8 files changed, 3 insertions(+), 25 deletions(-)
drivers/net/intel/e1000/meson.build +0 -3
@@ -3,7 +3,6 @@ subdir('base') -sources += base_sources sources += files( 'e1000_logs.c', 'em_ethdev.c',
@@ -24,5 +23,3 @@ if not is_windows 'igc_txrx.c', ) endif - -includes += include_directories('base')
drivers/net/intel/fm10k/meson.build +0 -3
@@ -9,7 +9,6 @@ endif subdir('base') -sources += base_sources sources += files( 'fm10k_ethdev.c', 'fm10k_rxtx.c',
@@ -17,5 +16,3 @@ sources += files( if arch_subdir == 'x86' sources += files('fm10k_rxtx_vec.c') endif - -includes += include_directories('base')
drivers/net/intel/i40e/meson.build +0 -2
@@ -19,7 +19,6 @@ endif subdir('base') -sources += base_sources sources += files( 'i40e_ethdev.c', 'i40e_rxtx.c',
@@ -36,7 +35,6 @@ sources += files( testpmd_sources = files('i40e_testpmd.c') deps += ['hash'] -includes += include_directories('base') if arch_subdir == 'x86' sources += files('i40e_rxtx_vec_sse.c')
drivers/net/intel/iavf/meson.build +0 -1
@@ -24,7 +24,6 @@ sources = files( 'iavf_ipsec_crypto.c', 'iavf_fsub.c', ) -includes += include_directories('base') if arch_subdir == 'x86' sources += files('iavf_rxtx_vec_sse.c')
drivers/net/intel/ice/base/meson.build +3 -10
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018-2021 Intel Corporation -sources = [ +base_sources = files( 'ice_controlq.c', 'ice_common.c', 'ice_sched.c',
@@ -29,7 +29,7 @@ sources = [ 'ice_ddp.c', 'ice_fwlog.c', 'ice_vf_mbx.c', -] +) if is_ms_compiler error_cflags = [
@@ -48,15 +48,8 @@ if (toolchain == 'gcc' and cc.version().version_compare('>=11.0.0')) error_cflags += ['-Wno-array-bounds'] endif -c_args = cflags - foreach flag: error_cflags if cc.has_argument(flag) - c_args += flag + base_cflags += flag endif endforeach - -base_lib = static_library('ice_base', sources, - dependencies: static_rte_eal, - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/intel/ice/meson.build +0 -2
@@ -2,7 +2,6 @@ # Copyright(c) 2018 Intel Corporation subdir('base') -objs = [base_objs] sources = files( 'ice_acl_filter.c',
@@ -19,7 +18,6 @@ sources = files( testpmd_sources = files('ice_testpmd.c') deps += ['hash', 'net'] -includes += include_directories('base') if dpdk_conf.has('RTE_NET_IAVF') deps += 'net_iavf'
drivers/net/intel/idpf/meson.build +0 -1
@@ -11,7 +11,6 @@ subdir('base') includes += include_directories('../iavf/base') -sources += base_sources sources += files( 'idpf_common_device.c', 'idpf_common_rxtx.c',
drivers/net/intel/ixgbe/meson.build +0 -3
@@ -5,7 +5,6 @@ cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS'] subdir('base') -sources += base_sources sources += files( 'ixgbe_82599_bypass.c', 'ixgbe_bypass.c',
@@ -32,6 +31,4 @@ elif arch_subdir == 'arm' sources += files('ixgbe_recycle_mbufs_vec_common.c') endif -includes += include_directories('base') - headers = files('rte_pmd_ixgbe.h')
Signature · 1 line
2.45.2
PATCH v2 5/10 net/ngbe: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/ngbe/base/meson.build | 12 ++---------- drivers/net/ngbe/meson.build | 3 --- 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/net/ngbe/base/meson.build +2 -10
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd. -sources = [ +base_sources = files( 'ngbe_eeprom.c', 'ngbe_hw.c', 'ngbe_mbx.c',
@@ -11,14 +11,6 @@ sources = [ 'ngbe_phy_mvl.c', 'ngbe_phy_yt.c', 'ngbe_vf.c', -] - -error_cflags = [] +) cflags += no_wvla_cflag -c_args = cflags - -base_lib = static_library('ngbe_base', sources, - dependencies: [static_rte_eal, static_rte_ethdev, static_rte_bus_pci], - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/ngbe/meson.build +0 -3
@@ -8,7 +8,6 @@ if is_windows endif subdir('base') -objs = [base_objs] sources = files( 'ngbe_ethdev.c',
@@ -25,5 +24,3 @@ if arch_subdir == 'x86' elif arch_subdir == 'arm' sources += files('ngbe_rxtx_vec_neon.c') endif - -includes += include_directories('base')
Signature · 1 line
2.45.2
PATCH v2 6/10 net/octeontx: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/octeontx/base/meson.build | 19 +------------------ drivers/net/octeontx/meson.build | 3 --- 2 files changed, 1 insertion(+), 21 deletions(-)
drivers/net/octeontx/base/meson.build +1 -18
@@ -1,25 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Cavium, Inc -sources = [ +base_sources = files( 'octeontx_pkovf.c', 'octeontx_pkivf.c', 'octeontx_bgx.c', -] - -depends = ['ethdev', 'mempool_octeontx'] -static_objs = [] -foreach d: depends - if not is_variable('shared_rte_' + d) - subdir_done() - endif - static_objs += get_variable('static_rte_' + d) -endforeach - -c_args = cflags -base_lib = static_library('octeontx_base', sources, - c_args: c_args, - dependencies: static_objs, ) - -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/octeontx/meson.build +0 -3
@@ -8,7 +8,6 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64') endif subdir('base') -objs = [base_objs] sources = files( 'octeontx_ethdev.c',
@@ -18,6 +17,4 @@ sources = files( deps += ['mempool_octeontx', 'eventdev'] -includes += include_directories('base') - cflags += no_wvla_cflag
Signature · 1 line
2.45.2
PATCH v2 7/10 net/qede: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/qede/base/meson.build | 17 +++++------------ drivers/net/qede/meson.build | 1 - 2 files changed, 5 insertions(+), 13 deletions(-)
drivers/net/qede/base/meson.build +5 -12
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi <[email protected]> -sources = [ +base_sources = files( 'bcm_osal.c', 'ecore_cxt.c', 'ecore_dcbx.c',
@@ -16,8 +16,7 @@ sources = [ 'ecore_spq.c', 'ecore_sriov.c', 'ecore_vf.c', -] - +) if is_ms_compiler error_cflags = [
@@ -51,14 +50,8 @@ else ] endif -c_args = cflags foreach flag: error_cflags - if cc.has_argument(flag) - c_args += flag - endif + if cc.has_argument(flag) + base_cflags += flag + endif endforeach - -base_lib = static_library('qede_base', sources, - dependencies: [static_rte_net, static_rte_bus_pci], - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/qede/meson.build +0 -1
@@ -8,7 +8,6 @@ if is_windows endif subdir('base') -objs = [base_objs] sources = files( 'qede_debug.c',
Signature · 1 line
2.45.2
PATCH v2 8/10 net/thunderx: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/thunderx/base/meson.build | 10 +--------- drivers/net/thunderx/meson.build | 3 --- 2 files changed, 1 insertion(+), 12 deletions(-)
drivers/net/thunderx/base/meson.build +1 -9
@@ -1,16 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Cavium, Inc -sources = [ +base_sources = files( 'nicvf_hw.c', 'nicvf_mbox.c', 'nicvf_bsvf.c', -] - -c_args = cflags -base_lib = static_library('nicvf_base', sources, - c_args: c_args, - dependencies: static_rte_ethdev ) - -base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/thunderx/meson.build +0 -3
@@ -8,7 +8,6 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64') endif subdir('base') -objs = [base_objs] sources = files( 'nicvf_ethdev.c',
@@ -23,5 +22,3 @@ endif if cc.has_argument('-Wno-maybe-uninitialized') cflags += '-Wno-maybe-uninitialized' endif - -includes += include_directories('base')
Signature · 1 line
2.45.2
PATCH v2 9/10 net/txgbe: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
--- drivers/net/txgbe/base/meson.build | 18 ++---------------- drivers/net/txgbe/meson.build | 3 --- 2 files changed, 2 insertions(+), 19 deletions(-)
drivers/net/txgbe/base/meson.build +2 -16
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2015-2020 Beijing WangXun Technology Co., Ltd. -sources = [ +base_sources = files( 'txgbe_dcb_hw.c', 'txgbe_dcb.c', 'txgbe_eeprom.c',
@@ -10,18 +10,4 @@ sources = [ 'txgbe_mng.c', 'txgbe_phy.c', 'txgbe_vf.c', -] - -error_cflags = [] - -c_args = cflags -foreach flag: error_cflags - if cc.has_argument(flag) - c_args += flag - endif -endforeach - -base_lib = static_library('txgbe_base', sources, - dependencies: [static_rte_eal, static_rte_net, static_rte_bus_pci], - c_args: c_args) -base_objs = base_lib.extract_all_objects(recursive: true) +)
drivers/net/txgbe/meson.build +0 -3
@@ -8,7 +8,6 @@ if is_windows endif subdir('base') -objs = [base_objs] sources = files( 'txgbe_ethdev.c',
@@ -32,6 +31,4 @@ elif arch_subdir == 'arm' sources += files('txgbe_rxtx_vec_neon.c') endif -includes += include_directories('base') - install_headers('rte_pmd_txgbe.h')
Signature · 1 line
2.45.2
PATCH v2 10/10 raw/ifpga: use common base code build handling
In reply to Bruce RichardsonUse the base code build handling logic in the drivers/meson.build file, rather than re-implementing it in the driver itself.
While making changes similar to that in other drivers, also move content around dependencies from the base/meson.build file to the main driver meson.build file, so that the base code file only contains the list of base code files.
--- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 22 deletions(-)
drivers/raw/ifpga/base/meson.build +2 -19
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation -sources = [ +base_sources = files( 'ifpga_api.c', 'ifpga_enumerate.c', 'ifpga_feature_dev.c',
@@ -23,21 +23,4 @@ sources = [ 'opae_i2c.c', 'opae_at24_eeprom.c', 'opae_eth_group.c', -] - -rtdep = dependency('librt', required: false) -if not rtdep.found() - rtdep = cc.find_library('rt', required: false) -endif -if not rtdep.found() - build = false - reason = 'missing dependency, "librt"' - subdir_done() -endif - -ext_deps += rtdep - -base_lib = static_library('ifpga_rawdev_base', sources, - dependencies: static_rte_eal, - c_args: cflags) -base_objs = base_lib.extract_all_objects(recursive: true) +)
drivers/raw/ifpga/meson.build +12 -3
@@ -7,8 +7,19 @@ if not has_libfdt subdir_done() endif +rtdep = dependency('librt', required: false) +if not rtdep.found() + rtdep = cc.find_library('rt', required: false) +endif +if not rtdep.found() + build = false + reason = 'missing dependency, "librt"' + subdir_done() +endif + +ext_deps += rtdep + subdir('base') -objs = [base_objs] deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', 'bus_vdev', 'bus_ifpga', 'net', 'net_i40e', 'net_ipn3ke']
@@ -17,6 +28,4 @@ sources = files('ifpga_rawdev.c', 'rte_pmd_ifpga.c', 'afu_pmd_core.c', 'afu_pmd_n3000.c', 'afu_pmd_he_lpbk.c', 'afu_pmd_he_mem.c', 'afu_pmd_he_hssi.c') -includes += include_directories('base') - headers = files('rte_pmd_ifpga.h')
Signature · 1 line
2.45.2
Quoted 43 lines · On Mon, 31 Mar 2025 17:09:49 +0100 Bruce Richardson…
Many DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the
drivers/meson.buildfile, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".Depends-on: Series-34946 ("net/intel: clean up base code build")
Bruce Richardson (10):
build: add generic support for base code in drivers common/sfc_efx: use common base code build handling net/hinic: use common base code build handling net/intel: use common base code build handling net/ngbe: use common base code build handling net/octeontx: use common base code build handling net/qede: use common base code build handling net/thunderx: use common base code build handling net/txgbe: use common base code build handling raw/ifpga: use common base code build handlingdrivers/common/sfc_efx/base/meson.build | 18 +++--------------- drivers/common/sfc_efx/meson.build | 3 --- drivers/meson.build | 20 ++++++++++++++++++++ drivers/net/hinic/base/meson.build | 16 +++++----------- drivers/net/hinic/meson.build | 1 - drivers/net/intel/e1000/meson.build | 3 --- drivers/net/intel/fm10k/meson.build | 3 --- drivers/net/intel/i40e/meson.build | 2 -- drivers/net/intel/iavf/meson.build | 1 - drivers/net/intel/ice/base/meson.build | 22 +++++++--------------- drivers/net/intel/ice/meson.build | 2 -- drivers/net/intel/idpf/meson.build | 1 - drivers/net/intel/ixgbe/meson.build | 3 --- drivers/net/ngbe/base/meson.build | 12 ++---------- drivers/net/ngbe/meson.build | 3 --- drivers/net/octeontx/base/meson.build | 19 +------------------ drivers/net/octeontx/meson.build | 3 --- drivers/net/qede/base/meson.build | 17 +++++------------
Quoted 8 lines
drivers/net/qede/meson.build | 1 - drivers/net/thunderx/base/meson.build | 10 +--------- drivers/net/thunderx/meson.build | 3 --- drivers/net/txgbe/base/meson.build | 18 ++---------------- drivers/net/txgbe/meson.build | 3 --- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 25 files changed, 60 insertions(+), 160 deletions(-)
Looks ok to me. Since depends on the Intel part, lets take this through next-intel tree.
Quoted 56 lines · Stephen Hemminger
Quoted 43 lines · On Mon, 31 Mar 2025 17:09:49 +0100 Bruce Richardson…
Many DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the
drivers/meson.buildfile, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".Depends-on: Series-34946 ("net/intel: clean up base code build")
Bruce Richardson (10):
build: add generic support for base code in drivers common/sfc_efx: use common base code build handling net/hinic: use common base code build handling net/intel: use common base code build handling net/ngbe: use common base code build handling net/octeontx: use common base code build handling net/qede: use common base code build handling net/thunderx: use common base code build handling net/txgbe: use common base code build handling raw/ifpga: use common base code build handlingdrivers/common/sfc_efx/base/meson.build | 18 +++--------------- drivers/common/sfc_efx/meson.build | 3 --- drivers/meson.build | 20 ++++++++++++++++++++ drivers/net/hinic/base/meson.build | 16 +++++----------- drivers/net/hinic/meson.build | 1 - drivers/net/intel/e1000/meson.build | 3 --- drivers/net/intel/fm10k/meson.build | 3 --- drivers/net/intel/i40e/meson.build | 2 -- drivers/net/intel/iavf/meson.build | 1 - drivers/net/intel/ice/base/meson.build | 22 +++++++--------------- drivers/net/intel/ice/meson.build | 2 -- drivers/net/intel/idpf/meson.build | 1 - drivers/net/intel/ixgbe/meson.build | 3 --- drivers/net/ngbe/base/meson.build | 12 ++---------- drivers/net/ngbe/meson.build | 3 --- drivers/net/octeontx/base/meson.build | 19 +------------------ drivers/net/octeontx/meson.build | 3 --- drivers/net/qede/base/meson.build | 17 +++++------------Quoted 8 lines
drivers/net/qede/meson.build | 1 - drivers/net/thunderx/base/meson.build | 10 +--------- drivers/net/thunderx/meson.build | 3 --- drivers/net/txgbe/base/meson.build | 18 ++---------------- drivers/net/txgbe/meson.build | 3 --- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 25 files changed, 60 insertions(+), 160 deletions(-)
Quoted 3 lines
Looks ok to me. Since depends on the Intel part, lets take this through next-intel tree.
Series-Acked-by Stephen Hemminger <[email protected]>
While I can take this in next-intel, the required changes from the Intel side are already present in main, so this should be ok to take through either the net tree or, better, the main tree (since it's not just net drivers it affects).
Thomas, David, do you want to take this (well, the v2) through main tree?
/Bruce
Quoted 60 lines · Bruce Richardson
Quoted 58 lines · Stephen Hemminger
Quoted 43 lines · On Mon, 31 Mar 2025 17:09:49 +0100 Bruce Richardson…
Many DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the
drivers/meson.buildfile, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".Depends-on: Series-34946 ("net/intel: clean up base code build")
Bruce Richardson (10):
build: add generic support for base code in drivers common/sfc_efx: use common base code build handling net/hinic: use common base code build handling net/intel: use common base code build handling net/ngbe: use common base code build handling net/octeontx: use common base code build handling net/qede: use common base code build handling net/thunderx: use common base code build handling net/txgbe: use common base code build handling raw/ifpga: use common base code build handlingdrivers/common/sfc_efx/base/meson.build | 18 +++--------------- drivers/common/sfc_efx/meson.build | 3 --- drivers/meson.build | 20 ++++++++++++++++++++ drivers/net/hinic/base/meson.build | 16 +++++----------- drivers/net/hinic/meson.build | 1 - drivers/net/intel/e1000/meson.build | 3 --- drivers/net/intel/fm10k/meson.build | 3 --- drivers/net/intel/i40e/meson.build | 2 -- drivers/net/intel/iavf/meson.build | 1 - drivers/net/intel/ice/base/meson.build | 22 +++++++--------------- drivers/net/intel/ice/meson.build | 2 -- drivers/net/intel/idpf/meson.build | 1 - drivers/net/intel/ixgbe/meson.build | 3 --- drivers/net/ngbe/base/meson.build | 12 ++---------- drivers/net/ngbe/meson.build | 3 --- drivers/net/octeontx/base/meson.build | 19 +------------------ drivers/net/octeontx/meson.build | 3 --- drivers/net/qede/base/meson.build | 17 +++++------------Quoted 8 lines
drivers/net/qede/meson.build | 1 - drivers/net/thunderx/base/meson.build | 10 +--------- drivers/net/thunderx/meson.build | 3 --- drivers/net/txgbe/base/meson.build | 18 ++---------------- drivers/net/txgbe/meson.build | 3 --- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 25 files changed, 60 insertions(+), 160 deletions(-)Looks ok to me. Since depends on the Intel part, lets take this through next-intel tree.
Quoted 8 lines
Quoted 1 line
Series-Acked-by Stephen Hemminger <[email protected]>While I can take this in next-intel, the required changes from the Intel side are already present in main, so this should be ok to take through either the net tree or, better, the main tree (since it's not just net drivers it affects).
Thomas, David, do you want to take this (well, the v2) through main tree?
Sorry, I was looking at v2, but I replied on the v1 thread. In any case, yes, I merged it to main.
Signature · 1 line
David Marchand
Quoted 44 lines · Bruce Richardson
Many DPDK drivers use the same pattern for base code handling, having a meson.build file in the base code directory which optionally defines some custom cflags for the base code build, then builds the code as a static library and extracts the objects from it. (The reason behind this is that, in meson, cflags apply per-object, so we need to have a separate build object for the base code to use custom flags)
This patchset deduplicates this logic by putting it into the
drivers/meson.buildfile, and allowing individual drivers to then just specify values for "base_sources" and "base_cflags".Depends-on: Series-34946 ("net/intel: clean up base code build")
Bruce Richardson (10):
build: add generic support for base code in drivers common/sfc_efx: use common base code build handling net/hinic: use common base code build handling net/intel: use common base code build handling net/ngbe: use common base code build handling net/octeontx: use common base code build handling net/qede: use common base code build handling net/thunderx: use common base code build handling net/txgbe: use common base code build handling raw/ifpga: use common base code build handlingdrivers/common/sfc_efx/base/meson.build | 18 +++--------------- drivers/common/sfc_efx/meson.build | 3 --- drivers/meson.build | 20 ++++++++++++++++++++ drivers/net/hinic/base/meson.build | 16 +++++----------- drivers/net/hinic/meson.build | 1 - drivers/net/intel/e1000/meson.build | 3 --- drivers/net/intel/fm10k/meson.build | 3 --- drivers/net/intel/i40e/meson.build | 2 -- drivers/net/intel/iavf/meson.build | 1 - drivers/net/intel/ice/base/meson.build | 22 +++++++--------------- drivers/net/intel/ice/meson.build | 2 -- drivers/net/intel/idpf/meson.build | 1 - drivers/net/intel/ixgbe/meson.build | 3 --- drivers/net/ngbe/base/meson.build | 12 ++---------- drivers/net/ngbe/meson.build | 3 --- drivers/net/octeontx/base/meson.build | 19 +------------------ drivers/net/octeontx/meson.build | 3 --- drivers/net/qede/base/meson.build | 17 +++++------------
Quoted 8 lines
drivers/net/qede/meson.build | 1 - drivers/net/thunderx/base/meson.build | 10 +--------- drivers/net/thunderx/meson.build | 3 --- drivers/net/txgbe/base/meson.build | 18 ++---------------- drivers/net/txgbe/meson.build | 3 --- drivers/raw/ifpga/base/meson.build | 21 ++------------------- drivers/raw/ifpga/meson.build | 15 ++++++++++++--- 25 files changed, 60 insertions(+), 160 deletions(-)
Series applied.
Thanks for this cleanup Bruce.
Signature · 1 line
David Marchand