Skip to contentSkip to conversation

Add config-time dependency tracking

RFC PATCH In review Bruce Richardson 2 participants 17 messages Oct 16

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

cover Add config-time dependency tracking

Add configuration time dependency tracking for libs and drivers in DPDK, so that when a user requests a driver, all dependent drivers also get enabled. Similarly with libraries. What is not enabled in this RFC is support for enabling libraries based on driver requests, or enabling either libs or drivers based on the enable-apps config option. I've omitted the former for now, because it would involve moving more logic out of the lib/meson.build file and drivers/meson.build files into the top-level one, something I'm a little hesitant to do for now. The addition of apps only adds value once the cross-type dependency tracking is enabled, since no app depends on any others.

The first 5 patches in this series are cleanups and bug fixes. The following patches then implement the dependency tracking. While I investigated having meson parse each components meson.build file initially, without actually building it, this failed to work due to logic other than variable assignments in many drivers.

Instead, python scripts are used to manage the dependency list. For easier debug, and future introspection this dependency management is split between two scripts - the first generates a dependency table file which it writes to the build folder, allowing us to analyse this post-build if so desired. The second script uses this file to actually compute the necessary per-component dependencies.

The final patch of the series is a major reduction in the number of required components for doing DPDK builds. We completely remove the list of required libraries, and assume that a minimal build should only require enough libraries to build EAL. However, EAL does assume that we have a few additional buses, for example, EAL args are present for pci and vdev. Also, in order for mempools to work, we always need to have the default mempool ring driver build. That means that our de-facto minimal build target set is the set of components needed to build "bus/pci,bus/vdev,mempool/ring" (which would include EAL in the output, which is why we can remove any hard-coded library lists)

Bruce Richardson (12):
build: fix name of base library object
build: fix ignoring requested driver when class is disabled
build: prevent overlap of enable and disable lists
build: add direct support for optional dependencies net/bond: rename directory for consistency
build: add script to generate dependencies list
build: use recursive addition for enabled libraries option
build: use recursive addition for enabled drivers option
build: improve error reporting for unbuildable components
build: add EAL common directory to global include list
build: make EAL an explicit dependency
build: simplify mandatory library lists

 MAINTAINERS                                   |   2 +-
 app/meson.build                               |  15 +-
 app/proc-info/meson.build                     |   4 +-
 app/test-bbdev/meson.build                    |  18 +-
 app/test-crypto-perf/meson.build              |   4 +-
 app/test-pmd/meson.build                      |  50 ++---
 app/test/meson.build                          |   6 -
 buildtools/get-deps.py                        | 203 ++++++++++++++++++
 buildtools/meson.build                        |   2 +
 buildtools/resolve-deps.py                    |  80 +++++++
 devtools/test-meson-builds.sh                 |   3 +-
 doc/api/doxy-api.conf.in                      |   2 +-
 .../link_bonding_poll_mode_drv_lib.rst        |   2 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |   2 +-
 drivers/common/mlx5/linux/meson.build         |   1 -
 drivers/meson.build                           |  85 ++++++--
 .../net/{bonding => bond}/bonding_testpmd.c   |   0
 .../eth_bond_8023ad_private.h                 |   0
 .../net/{bonding => bond}/eth_bond_private.h  |   0
 drivers/net/{bonding => bond}/meson.build     |   1 -
 drivers/net/{bonding => bond}/rte_eth_bond.h  |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.c   |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.h   |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.h  |   0
 .../net/{bonding => bond}/rte_eth_bond_api.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_args.c |   0
 .../net/{bonding => bond}/rte_eth_bond_flow.c |   0
 .../net/{bonding => bond}/rte_eth_bond_pmd.c  |   0
 drivers/net/intel/ice/meson.build             |   7 +-
 drivers/net/meson.build                       |   2 +-
 lib/acl/meson.build                           |   1 +
 lib/cfgfile/meson.build                       |   1 +
 lib/cryptodev/meson.build                     |   2 +-
 lib/dmadev/meson.build                        |   2 +-
 lib/eal/meson.build                           |   6 +-
 lib/ethdev/meson.build                        |   2 +-
 lib/eventdev/meson.build                      |   1 -
 lib/ipsec/meson.build                         |   2 +-
 lib/jobstats/meson.build                      |   1 +
 lib/log/meson.build                           |   1 -
 lib/mempool/meson.build                       |   2 +-
 lib/meson.build                               |  76 +++----
 lib/meter/meson.build                         |   1 +
 lib/metrics/meson.build                       |   2 +-
 lib/pci/meson.build                           |   1 +
 lib/ptr_compress/meson.build                  |   1 +
 lib/rawdev/meson.build                        |   2 +-
 lib/ring/meson.build                          |   2 +-
 lib/stack/meson.build                         |   1 +
 lib/timer/meson.build                         |   1 +
 meson.build                                   |  21 ++
 52 files changed, 478 insertions(+), 140 deletions(-)
 create mode 100644 buildtools/get-deps.py
 create mode 100644 buildtools/resolve-deps.py
 rename drivers/net/{bonding => bond}/bonding_testpmd.c (100%)
 rename drivers/net/{bonding => bond}/eth_bond_8023ad_private.h (100%)
 rename drivers/net/{bonding => bond}/eth_bond_private.h (100%)
 rename drivers/net/{bonding => bond}/meson.build (95%)
 rename drivers/net/{bonding => bond}/rte_eth_bond.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_api.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_args.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_flow.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_pmd.c (100%)

--
2.53.0

#1 lore raw

RFC PATCH 1/12 build: fix name of base library object

The generation of the base code objects, in the case where the base code needs separate C files, used the lib_name value, but that was not actually assigned till later in the loop, meaning the name used was for the previous driver built. Fix this by moving the 3-line block up in the loop.

Fixes 8fa3af6c05f8 ("build: add generic support for base code in drivers")
---
 drivers/meson.build | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/meson.build +4 -4
index 102a8262e5..02adf51173 100644
@@ -249,6 +249,10 @@ foreach subpath:subdirs
             continue
         endif
 
+        enabled_drivers += name
+        lib_name = '_'.join(['rte', class, name])
+        dpdk_conf.set(lib_name.to_upper(), 1)
+
         # 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.
@@ -263,10 +267,6 @@ foreach subpath:subdirs
             sources += base_sources
         endif
 
-        enabled_drivers += name
-        lib_name = '_'.join(['rte', class, name])
-        dpdk_conf.set(lib_name.to_upper(), 1)
-
         if developer_mode and is_windows and use_function_versioning
             message('@0@: Function versioning is not supported by Windows.'.format(name))
         endif
Signature · 1 line
2.53.0
#2 lore raw

RFC PATCH 2/12 build: fix ignoring requested driver when class is disabled

In reply to Bruce Richardson

When a whole driver class is disabled due to missing dependencies, we are silently ignoring the fact that the user may have requested drivers of that class and therefore that the build configuration should fail. This can be seen by configuring a build with parameters "-Denable_drivers=event/sw -Ddisable_libs=eventdev". With eventdev disabled, all event drivers are never considered and no error from this misconfiguration results.

Fix this by adding a check for requested drivers when disabling a whole class of devices.

Fixes 70b6941e4e22 ("build: check drivers class dependencies early")
---
 drivers/meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/meson.build +8 -0
index 02adf51173..b761e19be5 100644
@@ -119,6 +119,14 @@ foreach subpath:subdirs
                 endif
                 message('Disabling @1@/* drivers: missing internal dependency "@0@"'
                         .format(d, class))
+                # error out if a driver in this class was explicitly requested,
+                # i.e. not via wildcard, since it can now never be built.
+                foreach drv_path : get_option('enable_drivers').split(',')
+                    if drv_path.startswith(class + '/')
+                        error('Cannot build explicitly requested driver "@0@".\n'.format(drv_path)
+                                +'\tReason: missing internal dependency "@0@"'.format(d))
+                    endif
+                endforeach
                 break
             endif
         endforeach
Signature · 1 line
2.53.0
#3 lore raw

RFC PATCH 3/12 build: prevent overlap of enable and disable lists

In reply to Bruce Richardson

For enable_libs/disable_libs option, and the driver and app equivalents, detect if a component is in both enable and disable lists and error out if so.

---
 app/meson.build     | 5 +++++
 drivers/meson.build | 5 +++++
 lib/meson.build     | 5 +++++
 3 files changed, 15 insertions(+)
app/meson.build +5 -0
index 4515688471..7472d925b2 100644
@@ -6,6 +6,11 @@ disable_apps = run_command(list_dir_globs, disable_apps, check: true).stdout().s
 
 enable_apps = ',' + get_option('enable_apps')
 enable_apps = run_command(list_dir_globs, enable_apps, check: true).stdout().split()
+foreach a:enable_apps
+    if disable_apps.contains(a)
+        error('Application "@0@" is in both "enable_apps" and "disable_apps".'.format(a))
+    endif
+endforeach
 require_apps = true
 if enable_apps.length() == 0
     require_apps = false
drivers/meson.build +5 -0
index b761e19be5..440c3959cf 100644
@@ -71,6 +71,11 @@ endforeach
 
 disable_drivers = run_command(list_dir_globs, disable_drivers, check: true).stdout().split()
 enable_drivers = run_command(list_dir_globs, enable_drivers, check: true).stdout().split()
+foreach d:enable_drivers
+    if disable_drivers.contains(d)
+        error('Driver "@0@" is in both "enable_drivers" and "disable_drivers".'.format(d))
+    endif
+endforeach
 require_drivers = true
 if enable_drivers.length() == 0
     require_drivers = false
lib/meson.build +5 -0
index af5c160cb8..0c5da21522 100644
@@ -101,6 +101,11 @@ endforeach
 disable_libs = run_command(list_dir_globs, get_option('disable_libs'), check: true).stdout().split()
 
 enable_libs = run_command(list_dir_globs, get_option('enable_libs'), check: true).stdout().split()
+foreach l:enable_libs
+    if disable_libs.contains(l)
+        error('Library "@0@" is in both "enable_libs" and "disable_libs".'.format(l))
+    endif
+endforeach
 require_libs = true
 if enable_libs.length() == 0
     require_libs = false
Signature · 1 line
2.53.0
#4 lore raw

RFC PATCH 4/12 build: add direct support for optional dependencies

In reply to Bruce Richardson

A number of DPDK components sometimes expose extra capabilities if other drivers are present, without actually requiring that to be always present. Standardize that design by way of an "optional_deps" variable to be set in meson.build files.

---
 app/meson.build                   | 10 ++++++-
 app/proc-info/meson.build         |  4 +--
 app/test-bbdev/meson.build        | 18 ++++-------
 app/test-crypto-perf/meson.build  |  4 +--
 app/test-pmd/meson.build          | 50 ++++++++++---------------------
 app/test/meson.build              |  6 ----
 drivers/meson.build               |  9 ++++++
 drivers/net/intel/ice/meson.build |  7 +++--
 lib/meson.build                   | 10 ++++++-
 9 files changed, 55 insertions(+), 63 deletions(-)
app/meson.build +9 -1
index 7472d925b2..79a0672edc 100644
@@ -63,9 +63,11 @@ foreach app:apps
               # instruction-set optimized versions of code
 
     # use "deps" for internal DPDK dependencies, and "ext_deps" for
-    # external package/library requirements
+    # external package/library requirements. Use "optional_deps" for internal
+    # dependencies to link against only if they are already being built.
     ext_deps = []
     deps = []
+    optional_deps = []
 
     if not enable_apps.contains(app)
         build = false
@@ -99,6 +101,12 @@ foreach app:apps
             endif
             dep_objs += [get_variable(var_name)]
         endforeach
+        foreach d:optional_deps
+            var_name = get_option('default_library') + '_rte_' + d
+            if is_variable(var_name) and not deps.contains(d)
+                dep_objs += [get_variable(var_name)]
+            endif
+        endforeach
     endif
 
     if not build
app/proc-info/meson.build +1 -3
index 316253cd5d..60c4eb2a90 100644
@@ -9,8 +9,6 @@ endif
 
 sources = files('main.c')
 deps += ['ethdev', 'security', 'eventdev']
-if dpdk_conf.has('RTE_LIB_METRICS')
-    deps += 'metrics'
-endif
+optional_deps = ['metrics']
 
 cflags += no_wvla_cflag
app/test-bbdev/meson.build +6 -12
index f85a20c5b0..c3cdd4d7c5 100644
@@ -8,17 +8,11 @@ sources = files(
         'test_bbdev_vector.c',
 )
 deps += ['bbdev', 'bus_vdev']
-if dpdk_conf.has('RTE_BASEBAND_FPGA_LTE_FEC')
-    deps += ['baseband_fpga_lte_fec']
-endif
-if dpdk_conf.has('RTE_BASEBAND_FPGA_5GNR_FEC')
-    deps += ['baseband_fpga_5gnr_fec']
-endif
-if dpdk_conf.has('RTE_BASEBAND_ACC')
-    deps += ['baseband_acc']
-endif
-if dpdk_conf.has('RTE_BASEBAND_LA12XX')
-    deps += ['baseband_la12xx']
-endif
+optional_deps = [
+        'baseband_acc',
+        'baseband_fpga_5gnr_fec',
+        'baseband_fpga_lte_fec',
+        'baseband_la12xx',
+]
 
 cflags += no_wvla_cflag
app/test-crypto-perf/meson.build +1 -3
index 87dd3bc5f1..76de68bfaf 100644
@@ -20,8 +20,6 @@ sources = files(
         'main.c',
 )
 deps += ['cryptodev', 'net', 'security']
-if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
-    deps += 'crypto_scheduler'
-endif
+optional_deps = ['crypto_scheduler']
 
 cflags += no_wvla_cflag
app/test-pmd/meson.build +16 -34

58 lines not on this page · raw message

app/test/meson.build +0 -6
index 881b919b63..0b2f4fd708 100644
@@ -259,12 +259,6 @@ foreach f, f_deps : source_file_deps
         sources += files(f)
     endif
 endforeach
-# add the optional dependencies
-foreach d:optional_deps
-    if is_variable(def_lib + '_rte_' + d) and d not in deps
-        deps += d
-    endif
-endforeach
 
 cflags += no_wvla_cflag
 cflags += no_shadow_cflag
drivers/meson.build +9 -0
index 440c3959cf..e75fa983e2 100644
@@ -174,6 +174,9 @@ foreach subpath:subdirs
         includes = [include_directories(drv_path)]
         # set up internal deps. Drivers can append/override as necessary
         deps = std_deps
+        # optional_deps: internal dependencies to link against only if they are
+        # already being built, rather than being always required
+        optional_deps = []
         # ext_deps: Stores external library dependency got
         # using dependency() (preferred) or find_library().
         # For the find_library() case (but not with dependency()) we also
@@ -249,6 +252,12 @@ foreach subpath:subdirs
                     static_deps += [get_variable('static_rte_' + d)]
                 endif
             endforeach
+            foreach d:optional_deps
+                if build and is_variable('shared_rte_' + d) and not deps.contains(d)
+                    shared_deps += [get_variable('shared_rte_' + d)]
+                    static_deps += [get_variable('static_rte_' + d)]
+                endif
+            endforeach
         endif
 
         if not build
drivers/net/intel/ice/meson.build +4 -3
index 322d9597d2..e5ba7ac92c 100644
@@ -22,9 +22,10 @@ testpmd_sources = files('ice_testpmd.c')
 
 deps += ['hash', 'net']
 
-if dpdk_conf.has('RTE_NET_IAVF')
-    deps += 'net_iavf'
-else
+# link against the iavf driver if it is being built, otherwise build the parts
+# of it needed here directly into this driver
+optional_deps = ['net_iavf']
+if not dpdk_conf.has('RTE_NET_IAVF')
     includes += include_directories(
             '../iavf',
             '../iavf/base'
lib/meson.build +9 -1
index 0c5da21522..87bfb914e8 100644
@@ -137,9 +137,11 @@ foreach l:libraries
               # instruction-set optimized versions of code
 
     # use "deps" for internal DPDK dependencies, and "ext_deps" for
-    # external package/library requirements
+    # external package/library requirements. Use "optional_deps" for internal
+    # dependencies to link against only if they are already being built.
     ext_deps = []
     deps = []
+    optional_deps = []
     if dpdk_conf.has('RTE_LIB_EAL')
         # eal is standard dependency once built
         deps += ['eal']
@@ -201,6 +203,12 @@ foreach l:libraries
             static_deps += [get_variable('static_rte_' + d)]
         endif
     endforeach
+    foreach d:optional_deps
+        if build and is_variable('shared_rte_' + d) and not deps.contains(d)
+            shared_deps += [get_variable('shared_rte_' + d)]
+            static_deps += [get_variable('static_rte_' + d)]
+        endif
+    endforeach
 
     if not build
         dpdk_libs_disabled += name
Signature · 1 line
2.53.0
#5 lore raw

RFC PATCH 5/12 net/bond: rename directory for consistency

In reply to Bruce Richardson

All libraries and drivers in DPDK have the directory name match the resulting .so library name, with the exception of "net/bonding" which is internally renamed to "net/bond". The shorter name is used for the .so object and for dependency tracking in other DPDK components. Remove the inconsistency by renaming the directory from "bonding" to "bond", thereby removing the need for any tooling to take account of the fact that directory names may not be the same as object or dependency names.

---
 MAINTAINERS                                              | 2 +-
 doc/api/doxy-api.conf.in                                 | 2 +-
 doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst | 2 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst              | 2 +-
 drivers/meson.build                                      | 1 +
 drivers/net/{bonding => bond}/bonding_testpmd.c          | 0
 drivers/net/{bonding => bond}/eth_bond_8023ad_private.h  | 0
 drivers/net/{bonding => bond}/eth_bond_private.h         | 0
 drivers/net/{bonding => bond}/meson.build                | 1 -
 drivers/net/{bonding => bond}/rte_eth_bond.h             | 0
 drivers/net/{bonding => bond}/rte_eth_bond_8023ad.c      | 0
 drivers/net/{bonding => bond}/rte_eth_bond_8023ad.h      | 0
 drivers/net/{bonding => bond}/rte_eth_bond_alb.c         | 0
 drivers/net/{bonding => bond}/rte_eth_bond_alb.h         | 0
 drivers/net/{bonding => bond}/rte_eth_bond_api.c         | 0
 drivers/net/{bonding => bond}/rte_eth_bond_args.c        | 0
 drivers/net/{bonding => bond}/rte_eth_bond_flow.c        | 0
 drivers/net/{bonding => bond}/rte_eth_bond_pmd.c         | 0
 drivers/net/meson.build                                  | 2 +-
 19 files changed, 6 insertions(+), 6 deletions(-)
 rename drivers/net/{bonding => bond}/bonding_testpmd.c (100%)
 rename drivers/net/{bonding => bond}/eth_bond_8023ad_private.h (100%)
 rename drivers/net/{bonding => bond}/eth_bond_private.h (100%)
 rename drivers/net/{bonding => bond}/meson.build (95%)
 rename drivers/net/{bonding => bond}/rte_eth_bond.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_api.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_args.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_flow.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_pmd.c (100%)
MAINTAINERS +1 -1
index 482bc7df76..02a06d9506 100644
@@ -671,7 +671,7 @@ F: doc/guides/nics/features/default.ini
 Link bonding
 M: Chas Williams <[email protected]>
 M: Min Hu (Connor) <[email protected]>
-F: drivers/net/bonding/
+F: drivers/net/bond/
 F: doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
 F: app/test/test_link_bonding*
 F: examples/bond/
doc/api/doxy-api.conf.in +1 -1
index 94096ee710..f8b80e1110 100644
@@ -15,7 +15,7 @@ INPUT                   = @TOPDIR@/doc/api/doxy-api-index.md \
                           @TOPDIR@/drivers/mempool/dpaa2 \
                           @TOPDIR@/drivers/net/ark \
                           @TOPDIR@/drivers/net/bnxt \
-                          @TOPDIR@/drivers/net/bonding \
+                          @TOPDIR@/drivers/net/bond \
                           @TOPDIR@/drivers/net/cnxk \
                           @TOPDIR@/drivers/net/dpaa \
                           @TOPDIR@/drivers/net/dpaa2 \
doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst +1 -1
index 2fa1ac4028..469a8f1d9e 100644
@@ -29,7 +29,7 @@ bonding device and its member devices.
 
     The Link Bonding PMD Library is enabled by default in the build
     configuration, the library can be disabled using the meson option
-    "-Ddisable_drivers=net/bonding".
+    "-Ddisable_drivers=net/bond".
 
 
 Link Bonding Modes Overview
doc/guides/testpmd_app_ug/testpmd_funcs.rst +1 -1
index 30cac0ad8c..72c4f5bec7 100644
@@ -5738,6 +5738,6 @@ Driver specific commands
 Some drivers provide specific features.
 See:
 
-- :ref:`net/bonding testpmd driver specific commands <bonding_testpmd_commands>`
+- :ref:`net/bond testpmd driver specific commands <bonding_testpmd_commands>`
 - :ref:`net/i40e testpmd driver specific commands <i40e_testpmd_commands>`
 - :ref:`net/ixgbe testpmd driver specific commands <ixgbe_testpmd_commands>`
drivers/meson.build +1 -0
index e75fa983e2..cb71bc8231 100644
@@ -35,6 +35,7 @@ endif
 
 # map legacy driver names
 driver_map = {
+    'net/bonding': 'net/bond',
     'net/cpfl': 'net/intel/cpfl',
     'net/e1000': 'net/intel/e1000',
     'net/fm10k': 'net/intel/fm10k',
drivers/net/bond/bonding_testpmd.c renamed from drivers/net/bonding/bonding_testpmd.c +0 -0
similarity index 100%
rename from drivers/net/bonding/bonding_testpmd.c
rename to drivers/net/bond/bonding_testpmd.c
drivers/net/bond/eth_bond_8023ad_private.h renamed from drivers/net/bonding/eth_bond_8023ad_private.h +0 -0
similarity index 100%
rename from drivers/net/bonding/eth_bond_8023ad_private.h
rename to drivers/net/bond/eth_bond_8023ad_private.h
drivers/net/bond/eth_bond_private.h renamed from drivers/net/bonding/eth_bond_private.h +0 -0
similarity index 100%
rename from drivers/net/bonding/eth_bond_private.h
rename to drivers/net/bond/eth_bond_private.h
drivers/net/bond/meson.build renamed from drivers/net/bonding/meson.build +0 -1
similarity index 95%
rename from drivers/net/bonding/meson.build
rename to drivers/net/bond/meson.build
index 14304b68a8..bf73ce2e57 100644
@@ -7,7 +7,6 @@ if is_windows
     subdir_done()
 endif
 
-name = 'bond' #, james bond :-)
 sources = files(
         'rte_eth_bond_8023ad.c',
         'rte_eth_bond_alb.c',
drivers/net/bond/rte_eth_bond.h renamed from drivers/net/bonding/rte_eth_bond.h +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond.h
rename to drivers/net/bond/rte_eth_bond.h
drivers/net/bond/rte_eth_bond_8023ad.c renamed from drivers/net/bonding/rte_eth_bond_8023ad.c +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond_8023ad.c
rename to drivers/net/bond/rte_eth_bond_8023ad.c
drivers/net/bond/rte_eth_bond_8023ad.h renamed from drivers/net/bonding/rte_eth_bond_8023ad.h +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond_8023ad.h
rename to drivers/net/bond/rte_eth_bond_8023ad.h
drivers/net/bond/rte_eth_bond_alb.c renamed from drivers/net/bonding/rte_eth_bond_alb.c +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond_alb.c
rename to drivers/net/bond/rte_eth_bond_alb.c
drivers/net/bond/rte_eth_bond_alb.h renamed from drivers/net/bonding/rte_eth_bond_alb.h +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond_alb.h
rename to drivers/net/bond/rte_eth_bond_alb.h
drivers/net/bond/rte_eth_bond_api.c renamed from drivers/net/bonding/rte_eth_bond_api.c +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond_api.c
rename to drivers/net/bond/rte_eth_bond_api.c
drivers/net/bond/rte_eth_bond_args.c renamed from drivers/net/bonding/rte_eth_bond_args.c +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond_args.c
rename to drivers/net/bond/rte_eth_bond_args.c
drivers/net/bond/rte_eth_bond_flow.c renamed from drivers/net/bonding/rte_eth_bond_flow.c +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond_flow.c
rename to drivers/net/bond/rte_eth_bond_flow.c
drivers/net/bond/rte_eth_bond_pmd.c renamed from drivers/net/bonding/rte_eth_bond_pmd.c +0 -0
similarity index 100%
rename from drivers/net/bonding/rte_eth_bond_pmd.c
rename to drivers/net/bond/rte_eth_bond_pmd.c
drivers/net/meson.build +1 -1
index 4e8ccb945f..0de3e30cf2 100644
@@ -11,7 +11,7 @@ drivers = [
         'axgbe',
         'bnx2x',
         'bnxt',
-        'bonding',
+        'bond',
         'cnxk',
         'cxgbe',
         'dpaa',
Signature · 1 line
2.53.0
#6 lore raw

RFC PATCH 6/12 build: add script to generate dependencies list

In reply to Bruce Richardson

At start of the build configuration, generate a list of all components and their dependencies on other internal components. Future changes can use this list to have smarter behaviour for enabling and disabling drivers and libs.

---
 buildtools/get-deps.py | 203 +++++++++++++++++++++++++++++++++++++++++
 buildtools/meson.build |   1 +
 meson.build            |   7 ++
 3 files changed, 211 insertions(+)
 create mode 100644 buildtools/get-deps.py
buildtools/get-deps.py new file +203 -0
new file mode 100644
index 0000000000..ca3ee35ff7
@@ -0,0 +1,203 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2026 Intel Corporation
+
+"""Report the internal DPDK dependencies of every library, driver and app.
+
+Scans the meson.build file of each component for "deps" and "optional_deps"
+assignments, without needing to execute them.  This lets the build work out what
+each component requires before any component has been configured, which in turn
+allows enabling a component to also enable whatever it depends on.
+
+Output is one line per component:
+
+    kind|name|path|deps|optional_deps
+
+"kind" is one of lib, drv or app, and the two dependency fields are
+comma-separated and may be empty.  Dependency names are the names components are
+known by once built, i.e. a library is named after its directory, while a driver
+is "<class>_<name>".
+"""
+
+import re
+import sys
+from pathlib import Path
+from typing import NamedTuple
+
+# an assignment to one of the dependency variables, capturing the operator so
+# that "deps = " (replacing the class defaults) can be told from "deps += "
+ASSIGN = re.compile(r"^(deps|std_deps|optional_deps)\s*(\+?=)\s*(.*)$")
+# meson has no double-quoted strings, so anything quoted is quoted with '
+QUOTED = re.compile(r"'([^']+)'")
+
+
+class Component(NamedTuple):
+    kind: str  # lib, drv or app
+    name: str  # the name the component is known by once built
+    path: str  # source directory, relative to the DPDK root
+    deps: list
+    optional_deps: list
+
+
+def strip_comment(line):
+    """Remove a trailing comment. Dependency names never contain '#'."""
+    return line.split("#", 1)[0]
+
+
+def logical_lines(path):
+    """Yield (indent, text) with multi-line list literals joined into one line."""
+    if not path.is_file():
+        return
+    pending = ""
+    depth = 0
+    indent = 0
+    for raw in path.read_text().splitlines():
+        text = strip_comment(raw)
+        if not text.strip():
+            continue
+        # depth == 0 means we are not inside any brackets or parentheses
+        if depth == 0:
+            indent = len(text) - len(text.lstrip())
+            pending = text.strip()
+        else:
+            # inside a multi-line list or parentheses, so just append the stripped text
+            pending += " " + text.strip()
+        # brackets and the parentheses of calls such as files(...) may both span lines
+        depth = pending.count("[") - pending.count("]") + pending.count("(") - pending.count(")")
+        if depth <= 0:
+            depth = 0
+            yield indent, pending
+            pending = ""
+
+
+def dedup(items):
+    return list(dict.fromkeys(items))
+
+
+def list_variable(path, varname):
+    """Collect every value assigned or appended to a list variable."""
+    found = []
+    pattern = re.compile(r"^%s\s*\+?=\s*(.*)$" % re.escape(varname))
+    for _, line in logical_lines(path):
+        m = pattern.match(line)
+        if m:
+            found += QUOTED.findall(m.group(1))
+    return dedup(found)
+
+
+def scan(path):
+    """Return (deps, optional_deps, replaces_std_deps) for a component.
+
+    Conditions around an assignment are deliberately ignored: a dependency that
+    is only needed on some platforms is still recorded, which over-approximates
+    in the safe direction.  Use "optional_deps" for a dependency that should be
+    linked against only when it is already being built.
+    """
+    deps = []
+    optional = []
+    replaces = False
+
+    for indent, line in logical_lines(path):
+        m = ASSIGN.match(line)
+        if not m:
+            continue
+        var, op, rhs = m.groups()
+
+        items = QUOTED.findall(rhs)
+        if not items:
+            # a computed value such as "deps += some_variable" cannot be scanned
+            continue
+
+        if var == "optional_deps":
+            optional += items
+        elif op == "=" and var == "deps" and indent == 0:
+            # only a top-level "deps =" discards the class defaults; one inside a
+            # conditional may not run at all, so treat it as an addition
+            replaces = True
+            deps = list(items)
+        else:
+            deps += items
+
+    return dedup(deps), dedup(optional), replaces
+
+
+def scan_libs(root):
+    libdir = root / "lib"
+    for lib in list_variable(libdir / "meson.build", "libraries"):
+        deps, optional, _ = scan(libdir / lib / "meson.build")
+        yield Component("lib", lib, "lib/" + lib, deps, optional)
+
+
+def scan_drivers(root):
+    drvdir = root / "drivers"
+    for subpath in list_variable(drvdir / "meson.build", "subdirs"):
+        if "/" in subpath:
+            # a driver listed on its own gets no class-wide default dependencies
+            cls, rest = subpath.split("/", 1)
+            drivers, std_deps = [rest], []
+        else:
+            cls = subpath
+            classfile = drvdir / cls / "meson.build"
+            drivers = list_variable(classfile, "drivers")
+            std_deps, _, _ = scan(classfile)
+
+        for drv in drivers:
+            path = cls + "/" + drv
+            deps, optional, replaces = scan(drvdir / path / "meson.build")
+            if not replaces:
+                deps = dedup(std_deps + deps)
+            yield Component(
+                "drv", cls + "_" + drv.split("/")[-1], "drivers/" + path, deps, optional
+            )
+
+
+def scan_apps(root):
+    appdir = root / "app"
+    for app in list_variable(appdir / "meson.build", "apps"):
+        deps, optional, _ = scan(appdir / app / "meson.build")
+        yield Component("app", app, "app/" + app, deps, optional)
+
+
+def validate(components):
+    """Reject anything that would make the dependency graph unusable."""
+    errors = []
+    provider = {}
+    for c in components:
+        # apps are never depended upon, so they are outside the component namespace
+        if c.kind == "app":
+            continue
+        if c.name in provider:
+            errors.append(
+                '"%s" is provided by both %s and %s' % (c.name, provider[c.name], c.path)
+            )
+        provider[c.name] = c.path
+
+    for c in components:
+        for d in c.deps + c.optional_deps:
+            if d not in provider:
+                errors.append('%s depends on "%s", which is not a known component' % (c.path, d))
+    return errors
+
+
+def main():
+    if len(sys.argv) != 2:
+        sys.exit("usage: %s <dpdk-source-root>" % sys.argv[0])
+    root = Path(sys.argv[1])
+
+    components = list(scan_libs(root)) + list(scan_drivers(root)) + list(scan_apps(root))
+
+    errors = validate(components)
+    if errors:
+        for e in errors:
+            print("error: " + e, file=sys.stderr)
+        sys.exit(1)
+
+    for c in components:
+        print(
+            "%s|%s|%s|%s|%s"
+            % (c.kind, c.name, c.path, ",".join(c.deps), ",".join(c.optional_deps))
+        )
+
+
+if __name__ == "__main__":
+    main()
buildtools/meson.build +1 -0
index 32cea7cff7..02c66a5580 100644
@@ -22,6 +22,7 @@ gen_version_map = py3 + files('gen-version-map.py')
 list_dir_globs = py3 + files('list-dir-globs.py')
 sphinx_wrapper = py3 + files('call-sphinx-build.py')
 get_cpu_count_cmd = py3 + files('get-cpu-count.py')
+get_deps_cmd = py3 + files('get-deps.py')
 get_numa_count_cmd = py3 + files('get-numa-count.py')
 get_min_meson_version_cmd = py3 + files('get-min-meson-version.py')
 get_test_suites_cmd = py3 + files('get-test-suites.py')
meson.build +7 -0
index 6b8cfa8b2e..e153894ac7 100644
@@ -88,6 +88,13 @@ if is_linux
     global_inc += include_directories('kernel/linux')
 endif
 
+# record what each component depends on, so that enabling a component can also
+# enable the components it needs
+dpdk_deps_graph = configure_file(
+        command: [get_deps_cmd, dpdk_source_root],
+        capture: true,
+        output: 'dependencies.txt')
+
 # build libs and drivers
 subdir('lib')
 subdir('drivers')
Signature · 1 line
2.53.0
#7 lore raw

RFC PATCH 7/12 build: use recursive addition for enabled libraries option

In reply to Bruce Richardson

When a user configures the build using "--enable_libs" there is no automatic handling of dependencies for the requested libraries. For example, if "ipsec" is a requested library, the user must know that security and cryptodev libs must also be in the enabled set.

Fix this omission by using a python script to parse the previously generated dependency set for the DPDK components and report out the necessary libraries. This allows for the automatic addition of extra libraries if they are needed to enable an explicitly-requested library. If a dependency of a requested lib is explicitly in the disable list, then error out.

---
 buildtools/meson.build     |  1 +
 buildtools/resolve-deps.py | 80 ++++++++++++++++++++++++++++++++++++++
 lib/meson.build            | 18 +++++----
 3 files changed, 91 insertions(+), 8 deletions(-)
 create mode 100644 buildtools/resolve-deps.py
buildtools/meson.build +1 -0
index 02c66a5580..b3aa7197f9 100644
@@ -26,6 +26,7 @@ get_deps_cmd = py3 + files('get-deps.py')
 get_numa_count_cmd = py3 + files('get-numa-count.py')
 get_min_meson_version_cmd = py3 + files('get-min-meson-version.py')
 get_test_suites_cmd = py3 + files('get-test-suites.py')
+resolve_deps_cmd = py3 + files('resolve-deps.py')
 header_gen_cmd = py3 + files('gen-header.py')
 has_hugepages_cmd = py3 + files('has-hugepages.py')
 cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py')
buildtools/resolve-deps.py new file +80 -0

80 lines not on this page · raw message

lib/meson.build +10 -8
index 87bfb914e8..f7705d7ebe 100644
@@ -100,18 +100,20 @@ endforeach
 
 disable_libs = run_command(list_dir_globs, get_option('disable_libs'), check: true).stdout().split()
 
-enable_libs = run_command(list_dir_globs, get_option('enable_libs'), check: true).stdout().split()
-foreach l:enable_libs
+requested_libs = run_command(list_dir_globs, get_option('enable_libs'), check: true).stdout().split()
+foreach l:requested_libs
     if disable_libs.contains(l)
         error('Library "@0@" is in both "enable_libs" and "disable_libs".'.format(l))
     endif
 endforeach
-require_libs = true
-if enable_libs.length() == 0
-    require_libs = false
-    enable_libs = libraries
-else
-    enable_libs += always_enable
+require_libs = requested_libs.length() != 0
+
+# expand the requested libraries to also include the libraries they depend on,
+# with an empty request meaning every library is wanted
+enable_libs = libraries
+if requested_libs.length() > 0
+    enable_libs = run_command(resolve_deps_cmd, dpdk_deps_graph, '--libs',
+            requested_libs + always_enable, check: true).stdout().strip().split(',')
 endif
 
 default_cflags = machine_args
Signature · 1 line
2.53.0
#8 lore raw

RFC PATCH 8/12 build: use recursive addition for enabled drivers option

In reply to Bruce Richardson

As with the libraries, recursively add dependencies of the enabled drivers to the build list to enable building with, for example, just --enable_drivers=net/mlx5 or --enable_drivers=net/cpfl.

---
 drivers/meson.build | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/meson.build +12 -9
index cb71bc8231..fe514a0b15 100644
@@ -71,23 +71,26 @@ foreach driver_option : ['disable_drivers', 'enable_drivers']
 endforeach
 
 disable_drivers = run_command(list_dir_globs, disable_drivers, check: true).stdout().split()
-enable_drivers = run_command(list_dir_globs, enable_drivers, check: true).stdout().split()
-foreach d:enable_drivers
+requested_drivers = run_command(list_dir_globs, enable_drivers, check: true).stdout().split()
+foreach d:requested_drivers
     if disable_drivers.contains(d)
         error('Driver "@0@" is in both "enable_drivers" and "disable_drivers".'.format(d))
     endif
 endforeach
-require_drivers = true
-if enable_drivers.length() == 0
-    require_drivers = false
-    enable_drivers = run_command(list_dir_globs, '**', check: true).stdout().split()
-endif
+require_drivers = requested_drivers.length() != 0
 
 # these drivers must always be enabled, otherwise the build breaks
 always_enable = ['bus/pci', 'bus/vdev']
 # we always need a mempool driver, and ring is default, so make it mandatory
 always_enable += ['mempool/ring']
-enable_drivers += always_enable
+
+# expand the requested drivers to also include the drivers they depend on; with
+# no drivers requested every driver is wanted, so no list is needed
+enable_drivers = []
+if require_drivers
+    enable_drivers = run_command(resolve_deps_cmd, dpdk_deps_graph, '--drivers',
+            requested_drivers + always_enable, check: true).stdout().strip().split(',')
+endif
 
 default_cflags = machine_args
 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
@@ -200,7 +203,7 @@ foreach subpath:subdirs
             name = name.split('/')[1]
         endif
 
-        if not enable_drivers.contains(drv_path)
+        if require_drivers and not enable_drivers.contains(drv_path)
             build = false
             reason = 'not in enabled drivers build config'
         elif disable_drivers.contains(drv_path)
Signature · 1 line
2.53.0
#9 lore raw

RFC PATCH 9/12 build: improve error reporting for unbuildable components

In reply to Bruce Richardson

With the addition of automatic dependency tracking so that dependencies are automatically enabled for libraries and drivers, the error message for a missing library is now inaccurate (although following it will lead eventually to a solution by way of other error messages!).

Improve this situation by correctly reporting if a necessary component is explicitly disabled or cannot be built for some other reason.

drivers

---
 drivers/meson.build | 27 ++++++++++++++++++++++++++-
 lib/meson.build     | 16 ++++++++++++----
 2 files changed, 38 insertions(+), 5 deletions(-)
drivers/meson.build +26 -1
index fe514a0b15..aacfe29c46 100644
@@ -248,8 +248,33 @@ foreach subpath:subdirs
                     # error out if we can't build a driver and that driver was explicitly
                     # requested, i.e. not via wildcard.
                     if require_drivers and get_option('enable_drivers').contains(drv_path)
+                        # reconstruct the path from the name by replacing the first
+                        # "_" with a "/"; the class never contains an underscore
+                        d_parts = d.split('_')
+                        d_rest = []
+                        foreach i : range(1, d_parts.length())
+                            d_rest += d_parts[i]
+                        endforeach
+                        missing_path = d_parts[0] + '/' + '_'.join(d_rest)
+                        if driver_map.has_key(missing_path)
+                            # disable_drivers/dpdk_drvs_disabled store the canonical
+                            # path, e.g. net/intel/idpf rather than the legacy net/idpf
+                            missing_path = driver_map[missing_path]
+                        endif
+                        if disable_drivers.contains(missing_path)
+                            advice = 'Remove "@0@" from the "disable_drivers" option.'.format(
+                                    missing_path)
+                        elif dpdk_drvs_disabled.contains(missing_path)
+                            advice = 'Driver "@0@" cannot be built: @1@'.format(missing_path,
+                                    get_variable('drv_' + missing_path.underscorify()
+                                            + '_disable_reason'))
+                        else
+                            advice = 'Please check the build configuration for driver "@0@".'.format(
+                                    missing_path)
+                        endif
                         error('Cannot build explicitly requested driver "@0@".\n'.format(drv_path)
-                                +'\tPlease enable missing dependency "@0@"'.format(d))
+                                + '\tMissing dependency "@0@".\n'.format(d)
+                                + '\t' + advice)
                     endif
                 else
                     shared_deps += [get_variable('shared_rte_' + d)]
lib/meson.build +12 -4
index f7705d7ebe..8adb510513 100644
@@ -106,7 +106,6 @@ foreach l:requested_libs
         error('Library "@0@" is in both "enable_libs" and "disable_libs".'.format(l))
     endif
 endforeach
-require_libs = requested_libs.length() != 0
 
 # expand the requested libraries to also include the libraries they depend on,
 # with an empty request meaning every library is wanted
@@ -173,7 +172,7 @@ foreach l:libraries
 
     if build
         subdir(l)
-        if not build and require_libs
+        if not build and requested_libs.contains(l)
             error('Cannot build explicitly requested lib "@0@".\n'.format(name)
                     +'\tReason: ' + reason)
         endif
@@ -196,9 +195,18 @@ foreach l:libraries
             endif
             message('Disabling @1@ [@2@]: missing internal dependency "@0@"'
                     .format(d, name, 'lib/' + l))
-            if require_libs
+            if requested_libs.contains(l)
+                if disable_libs.contains(d)
+                    advice = 'Remove "@0@" from the "disable_libs" option.'.format(d)
+                elif dpdk_libs_disabled.contains(d)
+                    advice = 'Library "@0@" cannot be built: @1@'.format(d,
+                            get_variable('lib_' + d.underscorify() + '_disable_reason'))
+                else
+                    advice = 'Please check the build configuration for library "@0@".'.format(d)
+                endif
                 error('Cannot build explicitly requested lib "@0@".\n'.format(name)
-                        + '\tPlease add missing dependency "@0@" to "enable_libs" option'.format(d))
+                        + '\tMissing dependency "@0@".\n'.format(d)
+                        + '\t' + advice)
             endif
         else
             shared_deps += [get_variable('shared_rte_' + d)]
Signature · 1 line
2.53.0
#10 lore raw

RFC PATCH 10/12 build: add EAL common directory to global include list

In reply to Bruce Richardson

The eal/common directory includes many headers needed internally to build various libraries, so add it to the global include rather than relying on it being added separately in the lib meson.build file. To simplify things further we can then just use global_inc as a standard set of includes for building libraries - both pre and post-eal. While those built with a dependency on EAL don't need this include, having it there is harmless.

---
 drivers/common/mlx5/linux/meson.build | 1 -
 lib/eal/meson.build                   | 1 -
 lib/log/meson.build                   | 1 -
 lib/meson.build                       | 5 +----
 meson.build                           | 1 +
 5 files changed, 2 insertions(+), 7 deletions(-)
drivers/common/mlx5/linux/meson.build +0 -1
index 3767e7a69b..69dbbc8593 100644
@@ -239,7 +239,6 @@ if dlopen_ibverbs
     dlopen_sources = files('mlx5_glue.c')
     dlopen_install_dir = [ eal_pmd_path + '-glue' ]
     dlopen_includes = [global_inc]
-    dlopen_includes += include_directories('../../../../lib/eal/common')
     dlopen_includes += include_directories('..')
     shared_lib = shared_library(
             dlopen_lib_name,
lib/eal/meson.build +0 -1
index 092f5c5261..e72276a7ca 100644
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2019 Intel Corporation
 
-includes += global_inc
 subdir('include')
 
 subdir('common')
lib/log/meson.build +0 -1
index b3de57b9c7..00f45b6bae 100644
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2023 Intel Corporation
 
-includes += global_inc
 sources = files(
         'log.c',
         'log_color.c',
lib/meson.build +1 -4
index 8adb510513..16c7a65786 100644
@@ -132,7 +132,7 @@ foreach l:libraries
     headers = []
     indirect_headers = [] # public headers not directly included by apps
     driver_sdk_headers = [] # public headers included by drivers
-    includes = []
+    includes = global_inc
     cflags = default_cflags
     objs = [] # other object files to link against, used e.g. for
               # instruction-set optimized versions of code
@@ -146,9 +146,6 @@ foreach l:libraries
     if dpdk_conf.has('RTE_LIB_EAL')
         # eal is standard dependency once built
         deps += ['eal']
-    else
-        # otherwise, make private headers available (like eal_export.h)
-        includes += include_directories('eal/common')
     endif
 
     if dpdk_libs_deprecated.contains(l)
meson.build +1 -0
index e153894ac7..4536f7e9c5 100644
@@ -76,6 +76,7 @@ endif
 config_inc = [include_directories('.', 'config')]
 global_inc = [config_inc, include_directories(
     'lib/eal/include',
+    'lib/eal/common',
     'lib/eal/@0@/include'.format(host_machine.system()),
     'lib/eal/@0@/include'.format(arch_subdir),
 )]
Signature · 1 line
2.53.0
#11 lore raw

RFC PATCH 11/12 build: make EAL an explicit dependency

In reply to Bruce Richardson

To improve dependency tracking using the querying script, remove EAL as an automatic dependency of libraries, and instead include it explicitly in the dependency list of libraries that need it (and don't have it via other existing dependencies).

In the process, we can simplify dependency lists a bit more by removing the conditional link between EAL and telemetry on windows. Since telemetry is always built, it can always be present as a dependency of EAL, and so need not be specified as a dependency when EAL is.

---
 lib/acl/meson.build          | 1 +
 lib/cfgfile/meson.build      | 1 +
 lib/cryptodev/meson.build    | 2 +-
 lib/dmadev/meson.build       | 2 +-
 lib/eal/meson.build          | 5 +----
 lib/ethdev/meson.build       | 2 +-
 lib/eventdev/meson.build     | 1 -
 lib/ipsec/meson.build        | 2 +-
 lib/jobstats/meson.build     | 1 +
 lib/mempool/meson.build      | 2 +-
 lib/meson.build              | 4 ----
 lib/meter/meson.build        | 1 +
 lib/metrics/meson.build      | 2 +-
 lib/pci/meson.build          | 1 +
 lib/ptr_compress/meson.build | 1 +
 lib/rawdev/meson.build       | 2 +-
 lib/ring/meson.build         | 2 +-
 lib/stack/meson.build        | 1 +
 lib/timer/meson.build        | 1 +
 19 files changed, 17 insertions(+), 17 deletions(-)
lib/acl/meson.build +1 -0
index a26c111395..e41e1d1d4d 100644
@@ -9,6 +9,7 @@ endif
 
 cflags += no_wvla_cflag
 
+deps += ['eal']
 sources = files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c',
         'rte_acl.c', 'tb_mem.c')
 headers = files('rte_acl.h', 'rte_acl_osdep.h')
lib/cfgfile/meson.build +1 -0
index 88eb819856..d6d690ccaa 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+deps += ['eal']
 sources = files('rte_cfgfile.c')
 headers = files('rte_cfgfile.h')
lib/cryptodev/meson.build +1 -1
index 4734acf321..2dcadb3513 100644
@@ -20,4 +20,4 @@ driver_sdk_headers += files(
         'cryptodev_pmd.h',
 )
 
-deps += ['kvargs', 'mbuf', 'rcu', 'telemetry']
+deps += ['kvargs', 'mbuf', 'rcu']
lib/dmadev/meson.build +1 -1
index 62b0650b9b..4352178783 100644
@@ -6,4 +6,4 @@ headers = files('rte_dmadev.h')
 indirect_headers += files('rte_dmadev_core.h', 'rte_dmadev_trace_fp.h')
 driver_sdk_headers += files('rte_dmadev_pmd.h')
 
-deps += ['telemetry']
+deps += ['eal']
lib/eal/meson.build +1 -4
index e72276a7ca..ee84f4852a 100644
@@ -13,10 +13,7 @@ subdir(exec_env)
 
 subdir(arch_subdir)
 
-deps += ['argparse', 'kvargs']
-if not is_windows
-    deps += ['telemetry']
-endif
+deps += ['argparse', 'kvargs', 'telemetry']
 
 if dpdk_conf.has('RTE_HAS_LIBARCHIVE')
     ext_deps += libarchive
lib/ethdev/meson.build +1 -1
index 8ba6c708a2..c9c141db02 100644
@@ -53,7 +53,7 @@ if is_linux
     )
 endif
 
-deps += ['net', 'kvargs', 'meter', 'telemetry']
+deps += ['net', 'kvargs', 'meter']
 
 if is_freebsd
     annotate_locks = false
lib/eventdev/meson.build +0 -1
index 0797c145e7..6df290bd23 100644
@@ -44,4 +44,3 @@ driver_sdk_headers += files(
 )
 
 deps += ['ring', 'ethdev', 'hash', 'mempool', 'mbuf', 'timer', 'cryptodev', 'dmadev']
-deps += ['telemetry']
lib/ipsec/meson.build +1 -1
index 02d18f5829..7c5cb44128 100644
@@ -16,6 +16,6 @@ sources = files('esp_inb.c', 'esp_outb.c',
 headers = files('rte_ipsec.h', 'rte_ipsec_sa.h', 'rte_ipsec_sad.h')
 indirect_headers += files('rte_ipsec_group.h')
 
-deps += ['mbuf', 'net', 'cryptodev', 'security', 'hash', 'telemetry']
+deps += ['mbuf', 'net', 'cryptodev', 'security', 'hash']
 
 annotate_locks = false
lib/jobstats/meson.build +1 -0
index 6da2a95b75..b7544aa035 100644
@@ -7,5 +7,6 @@ if is_windows
     subdir_done()
 endif
 
+deps += ['eal']
 sources = files('rte_jobstats.c')
 headers = files('rte_jobstats.h')
lib/mempool/meson.build +1 -1
index 8099a56466..db67349668 100644
@@ -19,4 +19,4 @@ headers = files(
         'rte_mempool.h',
         'rte_mempool_trace_fp.h',
 )
-deps += ['ring', 'telemetry']
+deps += ['ring']
lib/meson.build +0 -4
index 16c7a65786..34fbd93977 100644
@@ -143,10 +143,6 @@ foreach l:libraries
     ext_deps = []
     deps = []
     optional_deps = []
-    if dpdk_conf.has('RTE_LIB_EAL')
-        # eal is standard dependency once built
-        deps += ['eal']
-    endif
 
     if dpdk_libs_deprecated.contains(l)
         if not enable_deprecated_libs.contains(l)
lib/meter/meson.build +1 -0
index 646fd4d43f..e9e4aba506 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+deps += ['eal']
 sources = files('rte_meter.c')
 headers = files('rte_meter.h')
lib/metrics/meson.build +1 -1
index 6722f666d2..7dfc48b3ec 100644
@@ -8,6 +8,6 @@ if dpdk_conf.has('RTE_HAS_JANSSON')
     ext_deps += jansson_dep
 endif
 
-deps += ['ethdev', 'telemetry']
+deps += ['ethdev']
 
 cflags += no_wvla_cflag
lib/pci/meson.build +1 -0
index dd41cd5068..3b42932ac7 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+deps += ['eal']
 sources = files('rte_pci.c')
 headers = files('rte_pci.h')
lib/ptr_compress/meson.build +1 -0
index e92706a45f..07705034ac 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2024 Arm Limited
 
+deps += ['eal']
 headers = files('rte_ptr_compress.h')
lib/rawdev/meson.build +1 -1
index ccfd922fda..9a2478492c 100644
@@ -11,4 +11,4 @@ sources = files('rte_rawdev.c')
 headers = files('rte_rawdev.h')
 driver_sdk_headers = files('rte_rawdev_pmd.h')
 
-deps += ['telemetry']
+deps += ['eal']
lib/ring/meson.build +1 -1
index 2ba160b178..a1b709836d 100644
@@ -18,4 +18,4 @@ indirect_headers += files (
         'rte_ring_rts.h',
         'rte_ring_rts_elem_pvt.h',
 )
-deps += ['telemetry']
+deps += ['eal']
lib/stack/meson.build +1 -0
index 18177a742f..cd569665b9 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+deps += ['eal']
 sources = files('rte_stack.c', 'rte_stack_std.c', 'rte_stack_lf.c')
 headers = files('rte_stack.h')
 # subheaders, not for direct inclusion by apps
lib/timer/meson.build +1 -0
index 66ef89ac00..a8d89a8d93 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+deps += ['eal']
 sources = files('rte_timer.c')
 headers = files('rte_timer.h')
 
Signature · 1 line
2.53.0
#12 lore raw

RFC PATCH 12/12 build: simplify mandatory library lists

In reply to Bruce Richardson

Rather than listing out all the libraries we think need to be built, let's just have a minimal set that are necessary to build the minimal set of drivers. Use the existing dependency resolution script to build that minimal required library and driver set.

This change necessitates a change to test-meson-builds.sh since ethdev is no longer in the always-required set, meaning that a minimal build will error out if net/null is added as a required driver.

---
The change to test-meson-builds.sh will cause issues for anyone who is using an already-configured set of build directories, as the script does not attempt any reconfiguration. For now, to avoid any potential testing issues, I've side-stepped the issue by adjusting the directory name from build-mini to build-minimal. This will configure a new directory rather than reusing the old one with the broken config.

---
 devtools/test-meson-builds.sh |  3 +--
 drivers/meson.build           |  8 ++++----
 lib/meson.build               | 22 ++++------------------
 meson.build                   | 13 +++++++++++++
 4 files changed, 22 insertions(+), 24 deletions(-)
devtools/test-meson-builds.sh +1 -2
index 501034f398..9128d6bda7 100755
@@ -249,8 +249,7 @@ for c in gcc clang ; do
 	done
 done
 
-build build-mini cc skipABI $use_shared -Ddisable_libs=* \
-	-Denable_drivers=net/null
+build build-minimal cc skipABI $use_shared -Ddisable_libs=*
 
 # test compilation with minimal x86 instruction set
 # Set the install path for libraries to "lib" explicitly to prevent problems
drivers/meson.build +4 -4
index aacfe29c46..29b473eb04 100644
@@ -79,10 +79,10 @@ foreach d:requested_drivers
 endforeach
 require_drivers = requested_drivers.length() != 0
 
-# these drivers must always be enabled, otherwise the build breaks
-always_enable = ['bus/pci', 'bus/vdev']
-# we always need a mempool driver, and ring is default, so make it mandatory
-always_enable += ['mempool/ring']
+# these drivers must always be enabled, otherwise the build breaks; the
+# full set, including their own dependencies, is computed once at the top
+# level
+always_enable = dpdk_min_required_drivers
 
 # expand the requested drivers to also include the drivers they depend on; with
 # no drivers requested every driver is wanted, so no list is needed
lib/meson.build +4 -18
index 34fbd93977..e4998d1090 100644
@@ -70,24 +70,10 @@ libraries = [
         'node',
 ]
 
-always_enable = [
-        'argparse',
-        'cmdline',
-        'eal',
-        'ethdev',
-        'hash',
-        'kvargs',
-        'log',
-        'mbuf',
-        'mempool',
-        'meter',
-        'net',
-        'pci',
-        'rcu',
-        'ring',
-        'stack',
-        'telemetry',
-]
+# these libraries must always be enabled, otherwise the build breaks; the
+# full set, including their own dependencies, is computed once at the top
+# level, from the libraries that the mandatory drivers need
+always_enable = dpdk_min_required_libs
 
 enable_deprecated_libs = []
 foreach l:run_command(list_dir_globs, get_option('enable_deprecated_libs'),
meson.build +13 -0
index 4536f7e9c5..8d31230528 100644
@@ -96,6 +96,19 @@ dpdk_deps_graph = configure_file(
         capture: true,
         output: 'dependencies.txt')
 
+# these drivers must always be enabled, otherwise the build breaks: a PCI bus
+# driver, a vdev bus driver, and a mempool driver, with ring as the default
+dpdk_min_required_driver_paths = ['bus/pci', 'bus/vdev', 'mempool/ring']
+
+# the mandatory drivers' own dependencies are mandatory too, as are the
+# libraries they need, so none of them can be left out of the build
+dpdk_min_required_drivers = run_command(resolve_deps_cmd, dpdk_deps_graph,
+        '--drivers', dpdk_min_required_driver_paths,
+        check: true).stdout().strip().split(',')
+dpdk_min_required_libs = run_command(resolve_deps_cmd, dpdk_deps_graph,
+        '--libs', dpdk_min_required_driver_paths,
+        check: true).stdout().strip().split(',')
+
 # build libs and drivers
 subdir('lib')
 subdir('drivers')
Signature · 1 line
2.53.0
#13 lore raw
In reply to Bruce Richardson
Quoted 110 lines · Bruce Richardson

Add configuration time dependency tracking for libs and drivers in DPDK, so that when a user requests a driver, all dependent drivers also get enabled. Similarly with libraries. What is not enabled in this RFC is support for enabling libraries based on driver requests, or enabling either libs or drivers based on the enable-apps config option. I've omitted the former for now, because it would involve moving more logic out of the lib/meson.build file and drivers/meson.build files into the top-level one, something I'm a little hesitant to do for now. The addition of apps only adds value once the cross-type dependency tracking is enabled, since no app depends on any others.

The first 5 patches in this series are cleanups and bug fixes. The following patches then implement the dependency tracking. While I investigated having meson parse each components meson.build file initially, without actually building it, this failed to work due to logic other than variable assignments in many drivers.

Instead, python scripts are used to manage the dependency list. For easier debug, and future introspection this dependency management is split between two scripts - the first generates a dependency table file which it writes to the build folder, allowing us to analyse this post-build if so desired. The second script uses this file to actually compute the necessary per-component dependencies.

The final patch of the series is a major reduction in the number of required components for doing DPDK builds. We completely remove the list of required libraries, and assume that a minimal build should only require enough libraries to build EAL. However, EAL does assume that we have a few additional buses, for example, EAL args are present for pci and vdev. Also, in order for mempools to work, we always need to have the default mempool ring driver build. That means that our de-facto minimal build target set is the set of components needed to build "bus/pci,bus/vdev,mempool/ring" (which would include EAL in the output, which is why we can remove any hard-coded library lists)

Bruce Richardson (12):
build: fix name of base library object
build: fix ignoring requested driver when class is disabled
build: prevent overlap of enable and disable lists
build: add direct support for optional dependencies net/bond: rename directory for consistency
build: add script to generate dependencies list
build: use recursive addition for enabled libraries option
build: use recursive addition for enabled drivers option
build: improve error reporting for unbuildable components
build: add EAL common directory to global include list
build: make EAL an explicit dependency
build: simplify mandatory library lists

 MAINTAINERS                                   |   2 +-
 app/meson.build                               |  15 +-
 app/proc-info/meson.build                     |   4 +-
 app/test-bbdev/meson.build                    |  18 +-
 app/test-crypto-perf/meson.build              |   4 +-
 app/test-pmd/meson.build                      |  50 ++---
 app/test/meson.build                          |   6 -
 buildtools/get-deps.py                        | 203 ++++++++++++++++++
 buildtools/meson.build                        |   2 +
 buildtools/resolve-deps.py                    |  80 +++++++
 devtools/test-meson-builds.sh                 |   3 +-
 doc/api/doxy-api.conf.in                      |   2 +-
 .../link_bonding_poll_mode_drv_lib.rst        |   2 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |   2 +-
 drivers/common/mlx5/linux/meson.build         |   1 -
 drivers/meson.build                           |  85 ++++++--
 .../net/{bonding => bond}/bonding_testpmd.c   |   0
 .../eth_bond_8023ad_private.h                 |   0
 .../net/{bonding => bond}/eth_bond_private.h  |   0
 drivers/net/{bonding => bond}/meson.build     |   1 -
 drivers/net/{bonding => bond}/rte_eth_bond.h  |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.c   |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.h   |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.h  |   0
 .../net/{bonding => bond}/rte_eth_bond_api.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_args.c |   0
 .../net/{bonding => bond}/rte_eth_bond_flow.c |   0
 .../net/{bonding => bond}/rte_eth_bond_pmd.c  |   0
 drivers/net/intel/ice/meson.build             |   7 +-
 drivers/net/meson.build                       |   2 +-
 lib/acl/meson.build                           |   1 +
 lib/cfgfile/meson.build                       |   1 +
 lib/cryptodev/meson.build                     |   2 +-
 lib/dmadev/meson.build                        |   2 +-
 lib/eal/meson.build                           |   6 +-
 lib/ethdev/meson.build                        |   2 +-
 lib/eventdev/meson.build                      |   1 -
 lib/ipsec/meson.build                         |   2 +-
 lib/jobstats/meson.build                      |   1 +
 lib/log/meson.build                           |   1 -
 lib/mempool/meson.build                       |   2 +-
 lib/meson.build                               |  76 +++----
 lib/meter/meson.build                         |   1 +
 lib/metrics/meson.build                       |   2 +-
 lib/pci/meson.build                           |   1 +
 lib/ptr_compress/meson.build                  |   1 +
 lib/rawdev/meson.build                        |   2 +-
 lib/ring/meson.build                          |   2 +-
 lib/stack/meson.build                         |   1 +
 lib/timer/meson.build                         |   1 +
 meson.build                                   |  21 ++
 52 files changed, 478 insertions(+), 140 deletions(-)
 create mode 100644 buildtools/get-deps.py
 create mode 100644 buildtools/resolve-deps.py
 rename drivers/net/{bonding => bond}/bonding_testpmd.c (100%)
 rename drivers/net/{bonding => bond}/eth_bond_8023ad_private.h (100%)
 rename drivers/net/{bonding => bond}/eth_bond_private.h (100%)
 rename drivers/net/{bonding => bond}/meson.build (95%)
 rename drivers/net/{bonding => bond}/rte_eth_bond.h (100%)
Quoted 8 lines
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_api.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_args.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_flow.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_pmd.c (100%)

Interesting series.

I did not review in depth, but it seems promising.
The first 4 (and maybe the 5th one) patches can go to 26.11 right now.

I noticed a little formatting issue in patch 9 commitlog.

One thing bothers me.. but I did not play enough with the options maybe...

Could we use new build options (request_libs/apps/drivers or better named) ? This series changes the enable_libs/apps/drivers semantics and will likely result in confused users.
(and we would need no support for mixing old and new options)

Signature · 1 line
David Marchand
#14 lore raw
Quoted 126 lines · David Marchand
Quoted 110 lines · Bruce Richardson

Add configuration time dependency tracking for libs and drivers in DPDK, so that when a user requests a driver, all dependent drivers also get enabled. Similarly with libraries. What is not enabled in this RFC is support for enabling libraries based on driver requests, or enabling either libs or drivers based on the enable-apps config option. I've omitted the former for now, because it would involve moving more logic out of the lib/meson.build file and drivers/meson.build files into the top-level one, something I'm a little hesitant to do for now. The addition of apps only adds value once the cross-type dependency tracking is enabled, since no app depends on any others.

The first 5 patches in this series are cleanups and bug fixes. The following patches then implement the dependency tracking. While I investigated having meson parse each components meson.build file initially, without actually building it, this failed to work due to logic other than variable assignments in many drivers.

Instead, python scripts are used to manage the dependency list. For easier debug, and future introspection this dependency management is split between two scripts - the first generates a dependency table file which it writes to the build folder, allowing us to analyse this post-build if so desired. The second script uses this file to actually compute the necessary per-component dependencies.

The final patch of the series is a major reduction in the number of required components for doing DPDK builds. We completely remove the list of required libraries, and assume that a minimal build should only require enough libraries to build EAL. However, EAL does assume that we have a few additional buses, for example, EAL args are present for pci and vdev. Also, in order for mempools to work, we always need to have the default mempool ring driver build. That means that our de-facto minimal build target set is the set of components needed to build "bus/pci,bus/vdev,mempool/ring" (which would include EAL in the output, which is why we can remove any hard-coded library lists)

Bruce Richardson (12):
build: fix name of base library object
build: fix ignoring requested driver when class is disabled
build: prevent overlap of enable and disable lists
build: add direct support for optional dependencies net/bond: rename directory for consistency
build: add script to generate dependencies list
build: use recursive addition for enabled libraries option
build: use recursive addition for enabled drivers option
build: improve error reporting for unbuildable components
build: add EAL common directory to global include list
build: make EAL an explicit dependency
build: simplify mandatory library lists

 MAINTAINERS                                   |   2 +-
 app/meson.build                               |  15 +-
 app/proc-info/meson.build                     |   4 +-
 app/test-bbdev/meson.build                    |  18 +-
 app/test-crypto-perf/meson.build              |   4 +-
 app/test-pmd/meson.build                      |  50 ++---
 app/test/meson.build                          |   6 -
 buildtools/get-deps.py                        | 203 ++++++++++++++++++
 buildtools/meson.build                        |   2 +
 buildtools/resolve-deps.py                    |  80 +++++++
 devtools/test-meson-builds.sh                 |   3 +-
 doc/api/doxy-api.conf.in                      |   2 +-
 .../link_bonding_poll_mode_drv_lib.rst        |   2 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |   2 +-
 drivers/common/mlx5/linux/meson.build         |   1 -
 drivers/meson.build                           |  85 ++++++--
 .../net/{bonding => bond}/bonding_testpmd.c   |   0
 .../eth_bond_8023ad_private.h                 |   0
 .../net/{bonding => bond}/eth_bond_private.h  |   0
 drivers/net/{bonding => bond}/meson.build     |   1 -
 drivers/net/{bonding => bond}/rte_eth_bond.h  |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.c   |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.h   |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.h  |   0
 .../net/{bonding => bond}/rte_eth_bond_api.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_args.c |   0
 .../net/{bonding => bond}/rte_eth_bond_flow.c |   0
 .../net/{bonding => bond}/rte_eth_bond_pmd.c  |   0
 drivers/net/intel/ice/meson.build             |   7 +-
 drivers/net/meson.build                       |   2 +-
 lib/acl/meson.build                           |   1 +
 lib/cfgfile/meson.build                       |   1 +
 lib/cryptodev/meson.build                     |   2 +-
 lib/dmadev/meson.build                        |   2 +-
 lib/eal/meson.build                           |   6 +-
 lib/ethdev/meson.build                        |   2 +-
 lib/eventdev/meson.build                      |   1 -
 lib/ipsec/meson.build                         |   2 +-
 lib/jobstats/meson.build                      |   1 +
 lib/log/meson.build                           |   1 -
 lib/mempool/meson.build                       |   2 +-
 lib/meson.build                               |  76 +++----
 lib/meter/meson.build                         |   1 +
 lib/metrics/meson.build                       |   2 +-
 lib/pci/meson.build                           |   1 +
 lib/ptr_compress/meson.build                  |   1 +
 lib/rawdev/meson.build                        |   2 +-
 lib/ring/meson.build                          |   2 +-
 lib/stack/meson.build                         |   1 +
 lib/timer/meson.build                         |   1 +
 meson.build                                   |  21 ++
 52 files changed, 478 insertions(+), 140 deletions(-)
 create mode 100644 buildtools/get-deps.py
 create mode 100644 buildtools/resolve-deps.py
 rename drivers/net/{bonding => bond}/bonding_testpmd.c (100%)
 rename drivers/net/{bonding => bond}/eth_bond_8023ad_private.h (100%)
 rename drivers/net/{bonding => bond}/eth_bond_private.h (100%)
 rename drivers/net/{bonding => bond}/meson.build (95%)
 rename drivers/net/{bonding => bond}/rte_eth_bond.h (100%)
Quoted 8 lines
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_api.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_args.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_flow.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_pmd.c (100%)

Interesting series.

I did not review in depth, but it seems promising.
The first 4 (and maybe the 5th one) patches can go to 26.11 right now.

Quoted 9 lines

I noticed a little formatting issue in patch 9 commitlog.

One thing bothers me.. but I did not play enough with the options maybe...

Could we use new build options (request_libs/apps/drivers or better named) ? This series changes the enable_libs/apps/drivers semantics and will likely result in confused users.
(and we would need no support for mixing old and new options)

Can you clarify how it changes the semantic from a user viewpoint? Unless I'm missing something, the only change is automatically fixing a broken build for a user who didn't know the dependencies of the driver they want enabled.

/Bruce

#15 lore raw
Quoted 137 lines · Bruce Richardson
Quoted 126 lines · David Marchand
Quoted 110 lines · Bruce Richardson

Add configuration time dependency tracking for libs and drivers in DPDK, so that when a user requests a driver, all dependent drivers also get enabled. Similarly with libraries. What is not enabled in this RFC is support for enabling libraries based on driver requests, or enabling either libs or drivers based on the enable-apps config option. I've omitted the former for now, because it would involve moving more logic out of the lib/meson.build file and drivers/meson.build files into the top-level one, something I'm a little hesitant to do for now. The addition of apps only adds value once the cross-type dependency tracking is enabled, since no app depends on any others.

The first 5 patches in this series are cleanups and bug fixes. The following patches then implement the dependency tracking. While I investigated having meson parse each components meson.build file initially, without actually building it, this failed to work due to logic other than variable assignments in many drivers.

Instead, python scripts are used to manage the dependency list. For easier debug, and future introspection this dependency management is split between two scripts - the first generates a dependency table file which it writes to the build folder, allowing us to analyse this post-build if so desired. The second script uses this file to actually compute the necessary per-component dependencies.

The final patch of the series is a major reduction in the number of required components for doing DPDK builds. We completely remove the list of required libraries, and assume that a minimal build should only require enough libraries to build EAL. However, EAL does assume that we have a few additional buses, for example, EAL args are present for pci and vdev. Also, in order for mempools to work, we always need to have the default mempool ring driver build. That means that our de-facto minimal build target set is the set of components needed to build "bus/pci,bus/vdev,mempool/ring" (which would include EAL in the output, which is why we can remove any hard-coded library lists)

Bruce Richardson (12):
build: fix name of base library object
build: fix ignoring requested driver when class is disabled
build: prevent overlap of enable and disable lists
build: add direct support for optional dependencies net/bond: rename directory for consistency
build: add script to generate dependencies list
build: use recursive addition for enabled libraries option
build: use recursive addition for enabled drivers option
build: improve error reporting for unbuildable components
build: add EAL common directory to global include list
build: make EAL an explicit dependency
build: simplify mandatory library lists

 MAINTAINERS                                   |   2 +-
 app/meson.build                               |  15 +-
 app/proc-info/meson.build                     |   4 +-
 app/test-bbdev/meson.build                    |  18 +-
 app/test-crypto-perf/meson.build              |   4 +-
 app/test-pmd/meson.build                      |  50 ++---
 app/test/meson.build                          |   6 -
 buildtools/get-deps.py                        | 203 ++++++++++++++++++
 buildtools/meson.build                        |   2 +
 buildtools/resolve-deps.py                    |  80 +++++++
 devtools/test-meson-builds.sh                 |   3 +-
 doc/api/doxy-api.conf.in                      |   2 +-
 .../link_bonding_poll_mode_drv_lib.rst        |   2 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |   2 +-
 drivers/common/mlx5/linux/meson.build         |   1 -
 drivers/meson.build                           |  85 ++++++--
 .../net/{bonding => bond}/bonding_testpmd.c   |   0
 .../eth_bond_8023ad_private.h                 |   0
 .../net/{bonding => bond}/eth_bond_private.h  |   0
 drivers/net/{bonding => bond}/meson.build     |   1 -
 drivers/net/{bonding => bond}/rte_eth_bond.h  |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.c   |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.h   |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.h  |   0
 .../net/{bonding => bond}/rte_eth_bond_api.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_args.c |   0
 .../net/{bonding => bond}/rte_eth_bond_flow.c |   0
 .../net/{bonding => bond}/rte_eth_bond_pmd.c  |   0
 drivers/net/intel/ice/meson.build             |   7 +-
 drivers/net/meson.build                       |   2 +-
 lib/acl/meson.build                           |   1 +
 lib/cfgfile/meson.build                       |   1 +
 lib/cryptodev/meson.build                     |   2 +-
 lib/dmadev/meson.build                        |   2 +-
 lib/eal/meson.build                           |   6 +-
 lib/ethdev/meson.build                        |   2 +-
 lib/eventdev/meson.build                      |   1 -
 lib/ipsec/meson.build                         |   2 +-
 lib/jobstats/meson.build                      |   1 +
 lib/log/meson.build                           |   1 -
 lib/mempool/meson.build                       |   2 +-
 lib/meson.build                               |  76 +++----
 lib/meter/meson.build                         |   1 +
 lib/metrics/meson.build                       |   2 +-
 lib/pci/meson.build                           |   1 +
 lib/ptr_compress/meson.build                  |   1 +
 lib/rawdev/meson.build                        |   2 +-
 lib/ring/meson.build                          |   2 +-
 lib/stack/meson.build                         |   1 +
 lib/timer/meson.build                         |   1 +
 meson.build                                   |  21 ++
 52 files changed, 478 insertions(+), 140 deletions(-)
 create mode 100644 buildtools/get-deps.py
 create mode 100644 buildtools/resolve-deps.py
 rename drivers/net/{bonding => bond}/bonding_testpmd.c (100%)
 rename drivers/net/{bonding => bond}/eth_bond_8023ad_private.h (100%)
 rename drivers/net/{bonding => bond}/eth_bond_private.h (100%)
 rename drivers/net/{bonding => bond}/meson.build (95%)
 rename drivers/net/{bonding => bond}/rte_eth_bond.h (100%)
Quoted 8 lines
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_api.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_args.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_flow.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_pmd.c (100%)

Interesting series.

I did not review in depth, but it seems promising.
The first 4 (and maybe the 5th one) patches can go to 26.11 right now.

Quoted 9 lines

I noticed a little formatting issue in patch 9 commitlog.

One thing bothers me.. but I did not play enough with the options maybe...

Could we use new build options (request_libs/apps/drivers or better named) ? This series changes the enable_libs/apps/drivers semantics and will likely result in confused users.
(and we would need no support for mixing old and new options)

Quoted 4 lines

Can you clarify how it changes the semantic from a user viewpoint? Unless I'm missing something, the only change is automatically fixing a broken build for a user who didn't know the dependencies of the driver they want enabled.

Well, the fact that everything becomes optional is a change in behavior, and enable_drivers=net/null not enabling ethdev is a problem to me.
Or I misunderstood the last patch comments.

Signature · 1 line
David Marchand
#16 lore raw
Quoted 144 lines · David Marchand
Quoted 137 lines · Bruce Richardson
Quoted 126 lines · David Marchand
Quoted 110 lines · Bruce Richardson

Add configuration time dependency tracking for libs and drivers in DPDK, so that when a user requests a driver, all dependent drivers also get enabled. Similarly with libraries. What is not enabled in this RFC is support for enabling libraries based on driver requests, or enabling either libs or drivers based on the enable-apps config option. I've omitted the former for now, because it would involve moving more logic out of the lib/meson.build file and drivers/meson.build files into the top-level one, something I'm a little hesitant to do for now. The addition of apps only adds value once the cross-type dependency tracking is enabled, since no app depends on any others.

The first 5 patches in this series are cleanups and bug fixes. The following patches then implement the dependency tracking. While I investigated having meson parse each components meson.build file initially, without actually building it, this failed to work due to logic other than variable assignments in many drivers.

Instead, python scripts are used to manage the dependency list. For easier debug, and future introspection this dependency management is split between two scripts - the first generates a dependency table file which it writes to the build folder, allowing us to analyse this post-build if so desired. The second script uses this file to actually compute the necessary per-component dependencies.

The final patch of the series is a major reduction in the number of required components for doing DPDK builds. We completely remove the list of required libraries, and assume that a minimal build should only require enough libraries to build EAL. However, EAL does assume that we have a few additional buses, for example, EAL args are present for pci and vdev. Also, in order for mempools to work, we always need to have the default mempool ring driver build. That means that our de-facto minimal build target set is the set of components needed to build "bus/pci,bus/vdev,mempool/ring" (which would include EAL in the output, which is why we can remove any hard-coded library lists)

Bruce Richardson (12):
build: fix name of base library object
build: fix ignoring requested driver when class is disabled
build: prevent overlap of enable and disable lists
build: add direct support for optional dependencies net/bond: rename directory for consistency
build: add script to generate dependencies list
build: use recursive addition for enabled libraries option
build: use recursive addition for enabled drivers option
build: improve error reporting for unbuildable components
build: add EAL common directory to global include list
build: make EAL an explicit dependency
build: simplify mandatory library lists

 MAINTAINERS                                   |   2 +-
 app/meson.build                               |  15 +-
 app/proc-info/meson.build                     |   4 +-
 app/test-bbdev/meson.build                    |  18 +-
 app/test-crypto-perf/meson.build              |   4 +-
 app/test-pmd/meson.build                      |  50 ++---
 app/test/meson.build                          |   6 -
 buildtools/get-deps.py                        | 203 ++++++++++++++++++
 buildtools/meson.build                        |   2 +
 buildtools/resolve-deps.py                    |  80 +++++++
 devtools/test-meson-builds.sh                 |   3 +-
 doc/api/doxy-api.conf.in                      |   2 +-
 .../link_bonding_poll_mode_drv_lib.rst        |   2 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |   2 +-
 drivers/common/mlx5/linux/meson.build         |   1 -
 drivers/meson.build                           |  85 ++++++--
 .../net/{bonding => bond}/bonding_testpmd.c   |   0
 .../eth_bond_8023ad_private.h                 |   0
 .../net/{bonding => bond}/eth_bond_private.h  |   0
 drivers/net/{bonding => bond}/meson.build     |   1 -
 drivers/net/{bonding => bond}/rte_eth_bond.h  |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.c   |   0
 .../{bonding => bond}/rte_eth_bond_8023ad.h   |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_alb.h  |   0
 .../net/{bonding => bond}/rte_eth_bond_api.c  |   0
 .../net/{bonding => bond}/rte_eth_bond_args.c |   0
 .../net/{bonding => bond}/rte_eth_bond_flow.c |   0
 .../net/{bonding => bond}/rte_eth_bond_pmd.c  |   0
 drivers/net/intel/ice/meson.build             |   7 +-
 drivers/net/meson.build                       |   2 +-
 lib/acl/meson.build                           |   1 +
 lib/cfgfile/meson.build                       |   1 +
 lib/cryptodev/meson.build                     |   2 +-
 lib/dmadev/meson.build                        |   2 +-
 lib/eal/meson.build                           |   6 +-
 lib/ethdev/meson.build                        |   2 +-
 lib/eventdev/meson.build                      |   1 -
 lib/ipsec/meson.build                         |   2 +-
 lib/jobstats/meson.build                      |   1 +
 lib/log/meson.build                           |   1 -
 lib/mempool/meson.build                       |   2 +-
 lib/meson.build                               |  76 +++----
 lib/meter/meson.build                         |   1 +
 lib/metrics/meson.build                       |   2 +-
 lib/pci/meson.build                           |   1 +
 lib/ptr_compress/meson.build                  |   1 +
 lib/rawdev/meson.build                        |   2 +-
 lib/ring/meson.build                          |   2 +-
 lib/stack/meson.build                         |   1 +
 lib/timer/meson.build                         |   1 +
 meson.build                                   |  21 ++
 52 files changed, 478 insertions(+), 140 deletions(-)
 create mode 100644 buildtools/get-deps.py
 create mode 100644 buildtools/resolve-deps.py
 rename drivers/net/{bonding => bond}/bonding_testpmd.c (100%)
 rename drivers/net/{bonding => bond}/eth_bond_8023ad_private.h (100%)
 rename drivers/net/{bonding => bond}/eth_bond_private.h (100%)
 rename drivers/net/{bonding => bond}/meson.build (95%)
 rename drivers/net/{bonding => bond}/rte_eth_bond.h (100%)
Quoted 8 lines
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_8023ad.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_alb.h (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_api.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_args.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_flow.c (100%)
 rename drivers/net/{bonding => bond}/rte_eth_bond_pmd.c (100%)

Interesting series.

I did not review in depth, but it seems promising.
The first 4 (and maybe the 5th one) patches can go to 26.11 right now.

Quoted 9 lines

I noticed a little formatting issue in patch 9 commitlog.

One thing bothers me.. but I did not play enough with the options maybe...

Could we use new build options (request_libs/apps/drivers or better named) ? This series changes the enable_libs/apps/drivers semantics and will likely result in confused users.
(and we would need no support for mixing old and new options)

Quoted 4 lines

Can you clarify how it changes the semantic from a user viewpoint? Unless I'm missing something, the only change is automatically fixing a broken build for a user who didn't know the dependencies of the driver they want enabled.

Quoted 5 lines

Well, the fact that everything becomes optional is a change in behavior, and enable_drivers=net/null not enabling ethdev is a problem to me.
Or I misunderstood the last patch comments.

Ok, I take the point, but that's actually a separate difference from the majority of the changes. We can actually take the last patch and still keep ethdev and other libraries as mandatory for compatibility. I just dropped them since in the past we removed other libs from always_enable without notice or compat concerns.

/Bruce