When OVS is built with --with-dpdk, every binary is currently linked against all DPDK libraries, even though only ovs-vswitchd actually uses DPDK at runtime. This causes significant binary bloat: with a static DPDK build, tools like ovs-ofctl and ovsdb-server balloon from ~2-3 MB to ~14-16 MB.
This series fixes that by isolating DPDK linking to ovs-vswitchd only. Patch 1 is a prerequisite: it moves the registration of dpif_offload_dpdk_class from a compile-time static initializer in dpif-offload.c to an explicit call in dpdk_init__(), mirroring how netdev_dpdk_register() is already handled. This eliminates the link-time reference from libopenvswitch objects to DPDK-specific object files. Patch 2 does the main work: DPDK source files are collected into a separate libopenvswitchdpdk.la static library, dpdk-stub.c is compiled unconditionally into libopenvswitch to provide no-op stubs for all binaries that don't need DPDK, and a new dpdk-link-stubs.c provides OVS_WEAK stubs for the two symbols (free_dpdk_buf, rte_get_tsc_hz) that have definitions in both dpdk-stub.c and the real DPDK objects. Only ovs-vswitchd links libopenvswitchdpdk.la and DPDK_LIBS. Measured results (static DPDK, stripped binaries): - ovs-vswitchd: ~25 MB (unchanged) - ovs-ofctl, ovsdb-server: ~2-3 MB (was ~14-16 MB) Reported-at: https://issues.redhat.com/browse/FDP-3277 Timothy Redaelli (2): dpif-offload: Register DPDK offload class at runtime. build: Isolate DPDK linking to ovs-vswitchd only. acinclude.m4 | 4 +++ include/openvswitch/compiler.h | 2 ++ lib/automake.mk | 11 ++++--- lib/dpdk-link-stubs.c | 54 ++++++++++++++++++++++++++++++++++ lib/dpdk.c | 2 ++ lib/dpif-offload-provider.h | 1 + lib/dpif-offload.c | 5 +--- vswitchd/automake.mk | 8 ++++- 8 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 lib/dpdk-link-stubs.c -- 2.53.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
