From: Timothy Redaelli <[email protected]>

When building userspace utilities, having all the symbols and code
in a singular library is quite handy.  However, the downside is that
sizes will bloat under statically linked conditions.  Additionally,
some environments allow library constructors as code which executes
before the main executable which would run even for utilities that
don't need them.

Split the most common code into a separate library that can be used
by the ovsdb, appctl, and the openflow + datapath code that gets
used by the ofctl, vsctl, dpctl, and vswitchd executables.  Future
work could try to split this even further (although, the dependency
split in the ofp area might be difficult to untangle).

Co-authored-by: Aaron Conole <[email protected]>
Signed-off-by: Aaron Conole <[email protected]>
Signed-off-by: Timothy Redaelli <[email protected]>
---
 NEWS                           |  18 +-
 configure.ac                   |   2 +
 debian/rules                   |   4 +-
 lib/.gitignore                 |   1 +
 lib/automake.mk                | 591 +++++++++++++++++----------------
 lib/libopenvswitchutils.pc.in  |  11 +
 lib/libopenvswitchutils.sym.in |   4 +
 ovsdb/automake.mk              |   6 +-
 tests/automake.mk              |   8 +-
 utilities/automake.mk          |  15 +-
 vswitchd/automake.mk           |   3 +-
 vtep/automake.mk               |   2 +-
 12 files changed, 362 insertions(+), 303 deletions(-)
 create mode 100644 lib/libopenvswitchutils.pc.in
 create mode 100644 lib/libopenvswitchutils.sym.in

diff --git a/NEWS b/NEWS
index 1a3044cbf..65f72a9fe 100644
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,23 @@ Post-v3.7.0
    - Userspace datapath:
      * ARP/ND lookups for native tunnel are now rate limited. The holdout
        timer can be configured with 'tnl/neigh/retrans_time'.
-
+   - libopenvswitch API/ABI change:
+     * To make the link time dependencies (and disk space) a bit clearer,
+       the libopenvswitch library has been split into two:
+       - libopenvswitch (which is mostly datapath related)
+       - libopenvswitchutils (which contains the container datastructures,
+         general utilities, etc).
+     * Several functions were renamed as part of a net-proto module
+       separation:
+       - packet_csum_pseudoheader => ip_csum_pseudoheader
+       - packet_csum_pseudoheader6 => ip_csum_pseudoheader6
+       - packet_csum_upperlayer6 => ip_csum_upperlayer6
+       - packet_tcp_flag_to_string => tcp_flag_to_string
+       - packet_format_tcp_flags => format_tcp_flags
+       - packet_set_ipv6_flow_label => ip_set_ipv6_flow_label
+       - packet_set_ipv6_tc => ip_set_ipv6_tc
+     * The public header openvswitch/packets.h was renamed to
+       openvswitch/net-proto.h.
 
 v3.7.0 - 16 Feb 2026
 --------------------
diff --git a/configure.ac b/configure.ac
index 56eacbbc7..3d4d9edb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,6 +152,7 @@ AC_CONFIG_FILES([
     ovsdb/libovsdb.sym
     ofproto/libofproto.sym
     lib/libsflow.sym
+    lib/libopenvswitchutils.sym
     lib/libopenvswitch.sym
     vtep/libvtep.sym])
 
@@ -212,6 +213,7 @@ AC_SUBST([OVS_LDFLAGS])
 
 AC_CONFIG_FILES(Makefile)
 AC_CONFIG_FILES(tests/atlocal)
+AC_CONFIG_FILES(lib/libopenvswitchutils.pc)
 AC_CONFIG_FILES(lib/libopenvswitch.pc)
 AC_CONFIG_FILES(lib/libsflow.pc)
 AC_CONFIG_FILES(ofproto/libofproto.pc)
diff --git a/debian/rules b/debian/rules
index f36d45593..8941f67ba 100755
--- a/debian/rules
+++ b/debian/rules
@@ -88,8 +88,8 @@ pybuild = \
        export PKG_CONFIG_SYSTEM_INCLUDE_PATH=/; \
        export PKG_CONFIG_SYSTEM_LIBRARY_PATH=/; \
        enable_shared=no \
-       extra_cflags="`pkg-config --cflags libopenvswitch`" \
-       extra_libs="-Wl,-Bstatic -lopenvswitch -Wl,-Bdynamic `pkg-config --libs 
--static libopenvswitch`" \
+       extra_cflags="`pkg-config --cflags libopenvswitchutils`" \
+       extra_libs="-Wl,-Bstatic -lopenvswitchutils -Wl,-Bdynamic `pkg-config 
--libs --static libopenvswitchutils`" \
        pybuild
 
 override_dh_auto_build:
diff --git a/lib/.gitignore b/lib/.gitignore
index ec9bdb092..31575a202 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -19,4 +19,5 @@
 /vswitch-idl.h
 /vswitch-idl.ovsidl
 /libopenvswitch.pc
+/libopenvswitchutils.pc
 /libsflow.pc
diff --git a/lib/automake.mk b/lib/automake.mk
index dd38762ad..d065800c6 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -5,76 +5,33 @@
 # notice and this notice are preserved.  This file is offered as-is,
 # without warranty of any kind.
 
-lib_LTLIBRARIES += lib/libopenvswitch.la
-
-lib_libopenvswitch_la_LIBADD = $(SSL_LIBS)
-lib_libopenvswitch_la_LIBADD += $(CAPNG_LDADD)
+# libopenvswitchutils: The common libraries used by any/all included utilities.
+# Contains the container structures (maps, lists, etc), threading, i/o,
+# logging, ovsdb-client, etc.
+lib_LTLIBRARIES += lib/libopenvswitchutils.la
 
+lib_libopenvswitchutils_la_LIBADD = $(SSL_LIBS)
+lib_libopenvswitchutils_la_LIBADD += $(CAPNG_LDADD)
 
 if WIN32
-lib_libopenvswitch_la_LIBADD += ${PTHREAD_LIBS}
+lib_libopenvswitchutils_la_LIBADD += ${PTHREAD_LIBS}
 endif
 
-lib_libopenvswitch_la_LDFLAGS = \
+lib_libopenvswitchutils_la_LDFLAGS = \
         $(OVS_LTINFO) \
-        -Wl,--version-script=$(top_builddir)/lib/libopenvswitch.sym \
+        -Wl,--version-script=$(top_builddir)/lib/libopenvswitchutils.sym \
         $(AM_LDFLAGS)
 
-if HAVE_AVX512F
-if HAVE_LD_AVX512_GOOD
-# Build library of avx512 code with CPU ISA CFLAGS enabled. This allows the
-# compiler to use the ISA features required for the ISA optimized code-paths.
-# Use LDFLAGS to compile only static library of this code, as it should be
-# statically linked into vswitchd even if vswitchd is a shared build.
-noinst_LTLIBRARIES += lib/libopenvswitchavx512.la
-lib_libopenvswitch_la_LIBADD += lib/libopenvswitchavx512.la
-lib_libopenvswitchavx512_la_CFLAGS = \
-       -mavx512f \
-       -mbmi \
-       -mbmi2 \
-       -fPIC \
-       $(AM_CFLAGS)
-lib_libopenvswitchavx512_la_SOURCES = \
-       lib/dpif-netdev-avx512.c
-if HAVE_AVX512BW
-if HAVE_AVX512VL
-lib_libopenvswitchavx512_la_CFLAGS += \
-       -mavx512bw \
-       -mavx512vl
-lib_libopenvswitchavx512_la_SOURCES += \
-       lib/dpif-netdev-extract-avx512.c \
-       lib/dpif-netdev-lookup-avx512-gather.c
-if HAVE_GCC_AVX512VL_GOOD
-lib_libopenvswitchavx512_la_SOURCES += \
-       lib/odp-execute-avx512.c
-endif # HAVE_GCC_AVX512VL_GOOD
-endif # HAVE_AVX512VL
-endif # HAVE_AVX512BW
-lib_libopenvswitchavx512_la_LDFLAGS = \
-       -static
-endif # HAVE_LD_AVX512_GOOD
-endif # HAVE_AVX512F
-
-# Build core vswitch libraries as before
-lib_libopenvswitch_la_SOURCES = \
+lib_libopenvswitchutils_la_SOURCES = \
        lib/aes128.c \
        lib/aes128.h \
        lib/async-append.h \
        lib/backtrace.c \
        lib/backtrace.h \
-       lib/bfd.c \
-       lib/bfd.h \
        lib/bitmap.h \
-       lib/bundle.c \
-       lib/bundle.h \
        lib/byte-order.h \
        lib/byteq.c \
        lib/byteq.h \
-       lib/cfm.c \
-       lib/cfm.h \
-       lib/classifier.c \
-       lib/classifier.h \
-       lib/classifier-private.h \
        lib/ccmap.c \
        lib/ccmap.h \
        lib/cmap.c \
@@ -84,75 +41,22 @@ lib_libopenvswitch_la_SOURCES = \
        lib/command-line.c \
        lib/command-line.h \
        lib/compiler.h \
-       lib/connectivity.c \
-       lib/connectivity.h \
-       lib/conntrack-icmp.c \
-       lib/conntrack-private.h \
-       lib/conntrack-tcp.c \
-       lib/conntrack-tp.c \
-       lib/conntrack-tp.h \
-       lib/conntrack-other.c \
-       lib/conntrack.c \
-       lib/conntrack.h \
        lib/cooperative-multitasking.c \
        lib/cooperative-multitasking.h \
        lib/cooperative-multitasking-private.h \
        lib/coverage.c \
        lib/coverage.h \
-       lib/ct-state.h \
        lib/cpu.c \
        lib/cpu.h \
        lib/crc32c.c \
        lib/crc32c.h \
        lib/csum.c \
        lib/csum.h \
-       lib/ct-dpif.c \
-       lib/ct-dpif.h \
        lib/daemon.c \
        lib/daemon.h \
        lib/daemon-private.h \
        lib/db-ctl-base.c \
        lib/db-ctl-base.h \
-       lib/dhcp.h \
-       lib/dummy.c \
-       lib/dummy.h \
-       lib/dhparams.h \
-       lib/dirs.h \
-       lib/dpctl.c \
-       lib/dpctl.h \
-       lib/dp-packet.h \
-       lib/dp-packet.c \
-       lib/dp-packet-gso.c \
-       lib/dp-packet-gso.h \
-       lib/dpdk.h \
-       lib/dpif-netdev-extract-study.c \
-       lib/dpif-netdev-lookup.h \
-       lib/dpif-netdev-lookup.c \
-       lib/dpif-netdev-lookup-autovalidator.c \
-       lib/dpif-netdev-lookup-generic.c \
-       lib/dpif-netdev.c \
-       lib/dpif-netdev.h \
-       lib/dpif-netdev-private-dfc.c \
-       lib/dpif-netdev-private-dfc.h \
-       lib/dpif-netdev-private-dpcls.h \
-       lib/dpif-netdev-private-dpif.c \
-       lib/dpif-netdev-private-dpif.h \
-       lib/dpif-netdev-private-extract.c \
-       lib/dpif-netdev-private-extract.h \
-       lib/dpif-netdev-private-flow.h \
-       lib/dpif-netdev-private-thread.h \
-       lib/dpif-netdev-private.h \
-       lib/dpif-netdev-perf.c \
-       lib/dpif-netdev-perf.h \
-       lib/dpif-offload.c \
-       lib/dpif-offload.h \
-       lib/dpif-offload-dummy.c \
-       lib/dpif-offload-provider.h \
-       lib/dpif-provider.h \
-       lib/dpif.c \
-       lib/dpif.h \
-       lib/heap.c \
-       lib/heap.h \
        lib/dynamic-string.c \
        lib/entropy.c \
        lib/entropy.h \
@@ -160,13 +64,13 @@ lib_libopenvswitch_la_SOURCES = \
        lib/fat-rwlock.h \
        lib/fatal-signal.c \
        lib/fatal-signal.h \
-       lib/flow.c \
-       lib/flow.h \
        lib/guarded-list.c \
        lib/guarded-list.h \
        lib/hash.c \
        lib/hash.h \
        lib/hash-aarch64.h \
+       lib/heap.c \
+       lib/heap.h \
        lib/hindex.c \
        lib/hindex.h \
        lib/hmap.c \
@@ -176,89 +80,23 @@ lib_libopenvswitch_la_SOURCES = \
        lib/id-fpool.h \
        lib/id-pool.c \
        lib/id-pool.h \
-       lib/if-notifier-manual.c \
-       lib/if-notifier.h \
-       lib/ipf.c \
-       lib/ipf.h \
        lib/jhash.c \
        lib/jhash.h \
        lib/json.c \
        lib/json.h \
        lib/jsonrpc.c \
        lib/jsonrpc.h \
-       lib/lacp.c \
-       lib/lacp.h \
        lib/latch.h \
-       lib/learn.c \
-       lib/learn.h \
-       lib/learning-switch.c \
-       lib/learning-switch.h \
        lib/lockfile.c \
        lib/lockfile.h \
-       lib/mac-learning.c \
-       lib/mac-learning.h \
-       lib/match.c \
-       lib/mcast-snooping.c \
-       lib/mcast-snooping.h \
        lib/memory.c \
        lib/memory.h \
-       lib/meta-flow.c \
        lib/mov-avg.h \
        lib/mpsc-queue.c \
        lib/mpsc-queue.h \
-       lib/multipath.c \
-       lib/multipath.h \
        lib/namemap.c \
-       lib/net-proto.h \
-       lib/net-proto.c \
-       lib/netdev-dpdk.h \
-       lib/netdev-dummy.c \
-       lib/netdev-provider.h \
-       lib/netdev-vport.c \
-       lib/netdev-vport.h \
-       lib/netdev-vport-private.h \
-       lib/netdev.c \
-       lib/netdev.h \
-       lib/netflow.h \
-       lib/netlink.c \
-       lib/netlink.h \
-       lib/netnsid.h \
-       lib/nx-match.c \
-       lib/nx-match.h \
        lib/object-collection.c \
        lib/object-collection.h \
-       lib/odp-execute.c \
-       lib/odp-execute.h \
-       lib/odp-execute-private.c \
-       lib/odp-execute-private.h \
-       lib/odp-util.c \
-       lib/odp-util.h \
-       lib/ofp-actions.c \
-       lib/ofp-bundle.c \
-       lib/ofp-connection.c \
-       lib/ofp-ct.c \
-       lib/ofp-ed-props.c \
-       lib/ofp-errors.c \
-       lib/ofp-flow.c \
-       lib/ofp-group.c \
-       lib/ofp-ipfix.c \
-       lib/ofp-match.c \
-       lib/ofp-meter.c \
-       lib/ofp-monitor.c \
-       lib/ofp-msgs.c \
-       lib/ofp-packet.c \
-       lib/ofp-parse.c \
-       lib/ofp-port.c \
-       lib/ofp-print.c \
-       lib/ofp-prop.c \
-       lib/ofp-protocol.c \
-       lib/ofp-queue.c \
-       lib/ofp-switch.c \
-       lib/ofp-table.c \
-       lib/ofp-util.c \
-       lib/ofp-version-opt.h \
-       lib/ofp-version-opt.c \
-       lib/ofpbuf.c \
        lib/ovs-atomic-c++.h \
        lib/ovs-atomic-c11.h \
        lib/ovs-atomic-clang.h \
@@ -272,18 +110,16 @@ lib_libopenvswitch_la_SOURCES = \
        lib/ovs-atomic-pthreads.h \
        lib/ovs-atomic-x86_64.h \
        lib/ovs-atomic.h \
-       lib/ovs-lldp.c \
-       lib/ovs-lldp.h \
        lib/ovs-numa.c \
        lib/ovs-numa.h \
        lib/ovs-rcu.c \
        lib/ovs-rcu.h \
        lib/ovs-replay.c \
        lib/ovs-replay.h \
-       lib/ovs-router.h \
-       lib/ovs-router.c \
        lib/ovs-thread.c \
        lib/ovs-thread.h \
+       lib/ovsdb-condition.h \
+       lib/ovsdb-condition.c \
        lib/ovsdb-cs.c \
        lib/ovsdb-cs.h \
        lib/ovsdb-data.c \
@@ -295,24 +131,19 @@ lib_libopenvswitch_la_SOURCES = \
        lib/ovsdb-idl.h \
        lib/ovsdb-map-op.c \
        lib/ovsdb-map-op.h \
-       lib/ovsdb-set-op.c \
-       lib/ovsdb-set-op.h \
-       lib/ovsdb-condition.h \
-       lib/ovsdb-condition.c \
        lib/ovsdb-parser.c \
        lib/ovsdb-parser.h \
        lib/ovsdb-session.c \
        lib/ovsdb-session.h \
+       lib/ovsdb-set-op.c \
+       lib/ovsdb-set-op.h \
        lib/ovsdb-types.c \
        lib/ovsdb-types.h \
-       lib/ox-stat.c \
-       lib/ox-stat.h \
-       lib/pcap-file.c \
-       lib/pcap-file.h \
        lib/perf-counter.h \
        lib/perf-counter.c \
-       lib/stopwatch.h \
-       lib/stopwatch.c \
+       lib/net-proto.c \
+       lib/net-proto.h \
+       lib/ofpbuf.c \
        lib/poll-loop.c \
        lib/process.c \
        lib/process.h \
@@ -320,15 +151,9 @@ lib_libopenvswitch_la_SOURCES = \
        lib/pvector.h \
        lib/random.c \
        lib/random.h \
-       lib/rconn.c \
        lib/rculist.h \
        lib/reconnect.c \
        lib/reconnect.h \
-       lib/rstp.c \
-       lib/rstp.h \
-       lib/rstp-common.h \
-       lib/rstp-state-machines.c \
-       lib/rstp-state-machines.h \
        lib/sat-math.h \
        lib/seq.c \
        lib/seq.h \
@@ -347,8 +172,9 @@ lib_libopenvswitch_la_SOURCES = \
        lib/sort.h \
        lib/sset.c \
        lib/sset.h \
-       lib/stp.c \
-       lib/stp.h \
+       lib/stdio.c \
+       lib/stopwatch.h \
+       lib/stopwatch.c \
        lib/stream-fd.c \
        lib/stream-fd.h \
        lib/stream-provider.h \
@@ -357,7 +183,6 @@ lib_libopenvswitch_la_SOURCES = \
        lib/stream-tcp.c \
        lib/stream.c \
        lib/stream.h \
-       lib/stdio.c \
        lib/string.c \
        lib/svec.c \
        lib/svec.h \
@@ -374,22 +199,11 @@ lib_libopenvswitch_la_SOURCES = \
        lib/timer.h \
        lib/timeval.c \
        lib/timeval.h \
-       lib/tnl-neigh-cache.c \
-       lib/tnl-neigh-cache.h \
-       lib/tnl-ports.c \
-       lib/tnl-ports.h \
-       lib/netdev-native-tnl.c \
-       lib/netdev-native-tnl.h \
        lib/token-bucket.c \
-       lib/tun-metadata.c \
-       lib/tun-metadata.h \
-       lib/unaligned.h \
        lib/unicode.c \
        lib/unicode.h \
        lib/unixctl.c \
        lib/unixctl.h \
-       lib/userspace-tso.c \
-       lib/userspace-tso.h \
        lib/util.c \
        lib/util.h \
        lib/uuid.c \
@@ -397,35 +211,18 @@ lib_libopenvswitch_la_SOURCES = \
        lib/uuidset.c \
        lib/uuidset.h \
        lib/valgrind.h \
-       lib/vconn-provider.h \
-       lib/vconn-stream.c \
-       lib/vconn.c \
-       lib/versions.h \
-       lib/vl-mff-map.h \
-       lib/vlan-bitmap.c \
-       lib/vlan-bitmap.h \
-       lib/vlog.c \
-       lib/lldp/aa-structs.h \
-       lib/lldp/lldp.c \
-       lib/lldp/lldp-const.h \
-       lib/lldp/lldp-tlv.h \
-       lib/lldp/lldpd.c \
-       lib/lldp/lldpd.h \
-       lib/lldp/lldpd-structs.c \
-       lib/lldp/lldpd-structs.h
+       lib/vlog.c
 
 if WIN32
-lib_libopenvswitch_la_SOURCES += \
+lib_libopenvswitchutils_la_SOURCES += \
        lib/daemon-windows.c \
        lib/getopt_long.c \
        lib/getrusage-windows.c \
        lib/latch-windows.c \
-       lib/route-table-stub.c \
-       lib/if-notifier-stub.c \
        lib/stream-windows.c \
        lib/strsep.c
 else
-lib_libopenvswitch_la_SOURCES += \
+lib_libopenvswitchutils_la_SOURCES += \
        lib/daemon-unix.c \
        lib/latch-unix.c \
        lib/signals.c \
@@ -434,37 +231,269 @@ lib_libopenvswitch_la_SOURCES += \
        lib/stream-unix.c
 endif
 
-EXTRA_DIST += \
-       lib/stdio.h.in \
-       lib/string.h.in
+if HAVE_POSIX_AIO
+lib_libopenvswitchutils_la_SOURCES += lib/async-append-aio.c
+else
+lib_libopenvswitchutils_la_SOURCES += lib/async-append-null.c
+endif
+
+if HAVE_OPENSSL
+lib_libopenvswitchutils_la_SOURCES += lib/stream-ssl.c lib/dhparams.c
+else
+lib_libopenvswitchutils_la_SOURCES += lib/stream-nossl.c
+endif
+
+lib_libopenvswitchutils_la_SOURCES += lib/dns-resolve.h
+if HAVE_UNBOUND
+lib_libopenvswitchutils_la_SOURCES += lib/dns-resolve.c
+else
+lib_libopenvswitchutils_la_SOURCES += lib/dns-resolve-stub.c
+endif
 
-nodist_lib_libopenvswitch_la_SOURCES = \
+nodist_lib_libopenvswitchutils_la_SOURCES = \
        lib/dirs.c \
        lib/ovsdb-server-idl.c \
        lib/ovsdb-server-idl.h \
        lib/vswitch-idl.c \
        lib/vswitch-idl.h
-CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
+CLEANFILES += $(nodist_lib_libopenvswitchutils_la_SOURCES)
 
-lib_LTLIBRARIES += lib/libsflow.la
-lib_libsflow_la_LDFLAGS = \
-        $(OVS_LTINFO) \
-        -Wl,--version-script=$(top_builddir)/lib/libsflow.sym \
-        $(AM_LDFLAGS)
-lib_libsflow_la_SOURCES = \
-       lib/sflow_api.h \
-       lib/sflow.h \
-       lib/sflow_agent.c \
-       lib/sflow_sampler.c \
-       lib/sflow_poller.c \
-       lib/sflow_receiver.c
-lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
-lib_libsflow_la_CFLAGS = $(AM_CFLAGS) -D_BSD_SOURCE -D_DEFAULT_SOURCE
-if HAVE_WNO_UNUSED
-lib_libsflow_la_CFLAGS += -Wno-unused
-endif
-if HAVE_WNO_UNUSED_PARAMETER
-lib_libsflow_la_CFLAGS += -Wno-unused-parameter
+pkgconfig_DATA += lib/libopenvswitchutils.pc
+
+# libopenvswitch: switching datapath library.
+# Contains the openflow handling, flow processing, netdev, dpif, etc.
+
+lib_LTLIBRARIES += lib/libopenvswitch.la
+
+lib_libopenvswitch_la_LIBADD = lib/libopenvswitchutils.la
+
+lib_libopenvswitch_la_LDFLAGS = \
+        $(OVS_LTINFO) \
+        -Wl,--version-script=$(top_builddir)/lib/libopenvswitch.sym \
+        $(AM_LDFLAGS)
+
+if HAVE_AVX512F
+if HAVE_LD_AVX512_GOOD
+# Build library of avx512 code with CPU ISA CFLAGS enabled. This allows the
+# compiler to use the ISA features required for the ISA optimized code-paths.
+# Use LDFLAGS to compile only static library of this code, as it should be
+# statically linked into vswitchd even if vswitchd is a shared build.
+noinst_LTLIBRARIES += lib/libopenvswitchavx512.la
+lib_libopenvswitch_la_LIBADD += lib/libopenvswitchavx512.la
+lib_libopenvswitchavx512_la_CFLAGS = \
+       -mavx512f \
+       -mbmi \
+       -mbmi2 \
+       -fPIC \
+       $(AM_CFLAGS)
+lib_libopenvswitchavx512_la_SOURCES = \
+       lib/dpif-netdev-avx512.c
+if HAVE_AVX512BW
+if HAVE_AVX512VL
+lib_libopenvswitchavx512_la_CFLAGS += \
+       -mavx512bw \
+       -mavx512vl
+lib_libopenvswitchavx512_la_SOURCES += \
+       lib/dpif-netdev-extract-avx512.c \
+       lib/dpif-netdev-lookup-avx512-gather.c
+if HAVE_GCC_AVX512VL_GOOD
+lib_libopenvswitchavx512_la_SOURCES += \
+       lib/odp-execute-avx512.c
+endif # HAVE_GCC_AVX512VL_GOOD
+endif # HAVE_AVX512VL
+endif # HAVE_AVX512BW
+lib_libopenvswitchavx512_la_LDFLAGS = \
+       -static
+endif # HAVE_LD_AVX512_GOOD
+endif # HAVE_AVX512F
+
+# Build core vswitch libraries as before
+lib_libopenvswitch_la_SOURCES = \
+       lib/bfd.c \
+       lib/bfd.h \
+       lib/bundle.c \
+       lib/bundle.h \
+       lib/cfm.c \
+       lib/cfm.h \
+       lib/classifier.c \
+       lib/classifier.h \
+       lib/classifier-private.h \
+       lib/connectivity.c \
+       lib/connectivity.h \
+       lib/conntrack-icmp.c \
+       lib/conntrack-private.h \
+       lib/conntrack-tcp.c \
+       lib/conntrack-tp.c \
+       lib/conntrack-tp.h \
+       lib/conntrack-other.c \
+       lib/conntrack.c \
+       lib/conntrack.h \
+       lib/ct-dpif.c \
+       lib/ct-dpif.h \
+       lib/ct-state.h \
+       lib/dhcp.h \
+       lib/dummy.c \
+       lib/dummy.h \
+       lib/dhparams.h \
+       lib/dirs.h \
+       lib/dp-packet.h \
+       lib/dp-packet.c \
+       lib/dp-packet-gso.c \
+       lib/dp-packet-gso.h \
+       lib/pcap-file.c \
+       lib/pcap-file.h \
+       lib/dpdk.h \
+       lib/dpctl.c \
+       lib/dpctl.h \
+       lib/dpif-netdev-extract-study.c \
+       lib/dpif-netdev-lookup.h \
+       lib/dpif-netdev-lookup.c \
+       lib/dpif-netdev-lookup-autovalidator.c \
+       lib/dpif-netdev-lookup-generic.c \
+       lib/dpif-netdev.c \
+       lib/dpif-netdev.h \
+       lib/dpif-netdev-private-dfc.c \
+       lib/dpif-netdev-private-dfc.h \
+       lib/dpif-netdev-private-dpcls.h \
+       lib/dpif-netdev-private-dpif.c \
+       lib/dpif-netdev-private-dpif.h \
+       lib/dpif-netdev-private-extract.c \
+       lib/dpif-netdev-private-extract.h \
+       lib/dpif-netdev-private-flow.h \
+       lib/dpif-netdev-private-thread.h \
+       lib/dpif-netdev-private.h \
+       lib/dpif-netdev-perf.c \
+       lib/dpif-netdev-perf.h \
+       lib/dpif-offload.c \
+       lib/dpif-offload.h \
+       lib/dpif-offload-dummy.c \
+       lib/dpif-offload-provider.h \
+       lib/dpif-provider.h \
+       lib/dpif.c \
+       lib/dpif.h \
+       lib/flow.c \
+       lib/flow.h \
+       lib/if-notifier.h \
+       lib/if-notifier-manual.c \
+       lib/ipf.c \
+       lib/ipf.h \
+       lib/lacp.c \
+       lib/lacp.h \
+       lib/learn.c \
+       lib/learn.h \
+       lib/learning-switch.c \
+       lib/learning-switch.h \
+       lib/mac-learning.c \
+       lib/mac-learning.h \
+       lib/match.c \
+       lib/mcast-snooping.c \
+       lib/mcast-snooping.h \
+       lib/meta-flow.c \
+       lib/multipath.c \
+       lib/multipath.h \
+       lib/netdev-dpdk.h \
+       lib/netdev-dummy.c \
+       lib/netdev-provider.h \
+       lib/netdev-vport.c \
+       lib/netdev-vport.h \
+       lib/netdev-vport-private.h \
+       lib/netdev.c \
+       lib/netdev.h \
+       lib/netflow.h \
+       lib/netlink.c \
+       lib/netlink.h \
+       lib/netnsid.h \
+       lib/nx-match.c \
+       lib/nx-match.h \
+       lib/odp-execute.c \
+       lib/odp-execute.h \
+       lib/odp-execute-private.c \
+       lib/odp-execute-private.h \
+       lib/odp-util.c \
+       lib/odp-util.h \
+       lib/ofp-actions.c \
+       lib/ofp-bundle.c \
+       lib/ofp-connection.c \
+       lib/ofp-ct.c \
+       lib/ofp-ed-props.c \
+       lib/ofp-errors.c \
+       lib/ofp-flow.c \
+       lib/ofp-group.c \
+       lib/ofp-ipfix.c \
+       lib/ofp-match.c \
+       lib/ofp-meter.c \
+       lib/ofp-monitor.c \
+       lib/ofp-msgs.c \
+       lib/ofp-packet.c \
+       lib/ofp-parse.c \
+       lib/ofp-port.c \
+       lib/ofp-print.c \
+       lib/ofp-prop.c \
+       lib/ofp-protocol.c \
+       lib/ofp-queue.c \
+       lib/ofp-switch.c \
+       lib/ofp-table.c \
+       lib/ofp-util.c \
+       lib/ofp-version-opt.h \
+       lib/ofp-version-opt.c \
+       lib/ovs-lldp.c \
+       lib/ovs-lldp.h \
+       lib/ovs-router.h \
+       lib/ovs-router.c \
+       lib/ox-stat.c \
+       lib/ox-stat.h \
+       lib/rconn.c \
+       lib/rstp.c \
+       lib/rstp.h \
+       lib/rstp-common.h \
+       lib/rstp-state-machines.c \
+       lib/rstp-state-machines.h \
+       lib/stp.c \
+       lib/stp.h \
+       lib/tnl-neigh-cache.c \
+       lib/tnl-neigh-cache.h \
+       lib/tnl-ports.c \
+       lib/tnl-ports.h \
+       lib/netdev-native-tnl.c \
+       lib/netdev-native-tnl.h \
+       lib/tun-metadata.c \
+       lib/tun-metadata.h \
+       lib/unaligned.h \
+       lib/userspace-tso.c \
+       lib/userspace-tso.h \
+       lib/vconn-provider.h \
+       lib/vconn-stream.c \
+       lib/vconn.c \
+       lib/versions.h \
+       lib/vl-mff-map.h \
+       lib/vlan-bitmap.c \
+       lib/vlan-bitmap.h \
+       lib/lldp/aa-structs.h \
+       lib/lldp/lldp.c \
+       lib/lldp/lldp-const.h \
+       lib/lldp/lldp-tlv.h \
+       lib/lldp/lldpd.c \
+       lib/lldp/lldpd.h \
+       lib/lldp/lldpd-structs.c \
+       lib/lldp/lldpd-structs.h
+
+if WIN32
+lib_libopenvswitch_la_SOURCES += \
+       lib/dpif-netlink.c \
+       lib/dpif-netlink.h \
+       lib/dpif-netlink-rtnl.h \
+       lib/netdev-windows.c \
+       lib/netlink-conntrack.c \
+       lib/netlink-conntrack.h \
+       lib/netlink-notifier.c \
+       lib/netlink-notifier.h \
+       lib/netlink-protocol.h \
+       lib/netlink-socket.c \
+       lib/netlink-socket.h \
+       lib/route-table-stub.c \
+       lib/if-notifier-stub.c \
+       lib/wmi.c \
+       lib/wmi.h
 endif
 
 if LINUX
@@ -515,29 +544,6 @@ lib_libopenvswitch_la_SOURCES += \
        lib/dpdk-stub.c
 endif
 
-if WIN32
-lib_libopenvswitch_la_SOURCES += \
-       lib/dpif-netlink.c \
-       lib/dpif-netlink.h \
-       lib/dpif-netlink-rtnl.h \
-       lib/netdev-windows.c \
-       lib/netlink-conntrack.c \
-       lib/netlink-conntrack.h \
-       lib/netlink-notifier.c \
-       lib/netlink-notifier.h \
-       lib/netlink-protocol.h \
-       lib/netlink-socket.c \
-       lib/netlink-socket.h \
-       lib/wmi.c \
-       lib/wmi.h
-endif
-
-if HAVE_POSIX_AIO
-lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
-else
-lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
-endif
-
 if HAVE_IF_DL
 lib_libopenvswitch_la_SOURCES += \
        lib/if-notifier-bsd.c \
@@ -547,10 +553,13 @@ lib_libopenvswitch_la_SOURCES += \
        lib/route-table-bsd.c
 endif
 
+EXTRA_DIST += \
+       lib/stdio.h.in \
+       lib/string.h.in
+
+
 .PHONY: generate-dhparams-c
 if HAVE_OPENSSL
-lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c lib/dhparams.c
-
 # Manually regenerates lib/dhparams.c.  Not normally necessary since
 # lib/dhparams.c is part of the repository and doesn't normally need
 # updates.
@@ -558,15 +567,27 @@ generate-dhparams-c:
        $(AM_V_GEN)cd $(srcdir) && \
        build-aux/generate-dhparams-c > lib/dhparams.c.tmp && \
        mv lib/dhparams.c.tmp lib/dhparams.c
-else
-lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
 endif
 
-lib_libopenvswitch_la_SOURCES += lib/dns-resolve.h
-if HAVE_UNBOUND
-lib_libopenvswitch_la_SOURCES += lib/dns-resolve.c
-else
-lib_libopenvswitch_la_SOURCES += lib/dns-resolve-stub.c
+lib_LTLIBRARIES += lib/libsflow.la
+lib_libsflow_la_LDFLAGS = \
+        $(OVS_LTINFO) \
+        -Wl,--version-script=$(top_builddir)/lib/libsflow.sym \
+        $(AM_LDFLAGS)
+lib_libsflow_la_SOURCES = \
+       lib/sflow_api.h \
+       lib/sflow.h \
+       lib/sflow_agent.c \
+       lib/sflow_sampler.c \
+       lib/sflow_poller.c \
+       lib/sflow_receiver.c
+lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
+lib_libsflow_la_CFLAGS = $(AM_CFLAGS) -D_BSD_SOURCE -D_DEFAULT_SOURCE
+if HAVE_WNO_UNUSED
+lib_libsflow_la_CFLAGS += -Wno-unused
+endif
+if HAVE_WNO_UNUSED_PARAMETER
+lib_libsflow_la_CFLAGS += -Wno-unused-parameter
 endif
 
 pkgconfig_DATA += \
@@ -649,7 +670,7 @@ lib/meta-flow.inc: $(srcdir)/build-aux/extract-ofp-fields 
include/openvswitch/me
        $(AM_V_GEN)$(run_python) $< meta-flow 
$(srcdir)/include/openvswitch/meta-flow.h > [email protected]
        $(AM_V_at)mv [email protected] $@
 lib/meta-flow.lo: lib/meta-flow.inc
-lib/nx-match.inc: $(srcdir)/build-aux/extract-ofp-fields 
include/openvswitch/meta-flow.h 
+lib/nx-match.inc: $(srcdir)/build-aux/extract-ofp-fields 
include/openvswitch/meta-flow.h
        $(AM_V_GEN)$(run_python) $< nx-match 
$(srcdir)/include/openvswitch/meta-flow.h > [email protected]
        $(AM_V_at)mv [email protected] $@
 lib/nx-match.lo: lib/nx-match.inc
diff --git a/lib/libopenvswitchutils.pc.in b/lib/libopenvswitchutils.pc.in
new file mode 100644
index 000000000..d8915d4eb
--- /dev/null
+++ b/lib/libopenvswitchutils.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libopenvswitchutils
+Description: Open vSwitch common library
+Version: @VERSION@
+Libs: -L${libdir} -lopenvswitchutils
+Libs.private: @LIBS@ @SSL_LIBS@ @CAPNG_LDADD@
+Cflags: -I${includedir}
diff --git a/lib/libopenvswitchutils.sym.in b/lib/libopenvswitchutils.sym.in
new file mode 100644
index 000000000..f7e32afba
--- /dev/null
+++ b/lib/libopenvswitchutils.sym.in
@@ -0,0 +1,4 @@
+libopenvswitchutils_@LT_CURRENT@ {
+global:
+        *;
+};
diff --git a/ovsdb/automake.mk b/ovsdb/automake.mk
index d484fe9de..de9489442 100644
--- a/ovsdb/automake.mk
+++ b/ovsdb/automake.mk
@@ -63,7 +63,7 @@ MAN_FRAGMENTS += ovsdb/ovsdb-schemas.man
 # ovsdb-tool
 bin_PROGRAMS += ovsdb/ovsdb-tool
 ovsdb_ovsdb_tool_SOURCES = ovsdb/ovsdb-tool.c
-ovsdb_ovsdb_tool_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
+ovsdb_ovsdb_tool_LDADD = ovsdb/libovsdb.la lib/libopenvswitchutils.la
 # ovsdb-tool.1
 man_MANS += ovsdb/ovsdb-tool.1
 CLEANFILES += ovsdb/ovsdb-tool.1
@@ -72,7 +72,7 @@ MAN_ROOTS += ovsdb/ovsdb-tool.1.in
 # ovsdb-client
 bin_PROGRAMS += ovsdb/ovsdb-client
 ovsdb_ovsdb_client_SOURCES = ovsdb/ovsdb-client.c
-ovsdb_ovsdb_client_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
+ovsdb_ovsdb_client_LDADD = ovsdb/libovsdb.la lib/libopenvswitchutils.la
 # ovsdb-client.1
 man_MANS += ovsdb/ovsdb-client.1
 CLEANFILES += ovsdb/ovsdb-client.1
@@ -81,7 +81,7 @@ MAN_ROOTS += ovsdb/ovsdb-client.1.in
 # ovsdb-server
 sbin_PROGRAMS += ovsdb/ovsdb-server
 ovsdb_ovsdb_server_SOURCES = ovsdb/ovsdb-server.c
-ovsdb_ovsdb_server_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
+ovsdb_ovsdb_server_LDADD = ovsdb/libovsdb.la lib/libopenvswitchutils.la
 # ovsdb-server.1
 man_MANS += ovsdb/ovsdb-server.1
 CLEANFILES += ovsdb/ovsdb-server.1
diff --git a/tests/automake.mk b/tests/automake.mk
index 685d4d2de..1e0260169 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -450,12 +450,12 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
 noinst_PROGRAMS += tests/test-ovsdb
 tests_test_ovsdb_SOURCES = tests/test-ovsdb.c
 nodist_tests_test_ovsdb_SOURCES = tests/idltest.c tests/idltest.h
-tests_test_ovsdb_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
+tests_test_ovsdb_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la 
lib/libopenvswitchutils.la
 
 noinst_PROGRAMS += tests/test-lib
 tests_test_lib_SOURCES = \
        tests/test-lib.c
-tests_test_lib_LDADD = lib/libopenvswitch.la
+tests_test_lib_LDADD = lib/libopenvswitch.la lib/libopenvswitchutils.la
 
 # idltest schema and IDL
 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
@@ -530,11 +530,11 @@ tests_ovstest_SOURCES += \
        tests/test-psample.c
 endif
 
-tests_ovstest_LDADD = lib/libopenvswitch.la
+tests_ovstest_LDADD = lib/libopenvswitch.la lib/libopenvswitchutils.la
 
 noinst_PROGRAMS += tests/test-stream
 tests_test_stream_SOURCES = tests/test-stream.c
-tests_test_stream_LDADD = lib/libopenvswitch.la
+tests_test_stream_LDADD = lib/libopenvswitch.la lib/libopenvswitchutils.la
 
 noinst_PROGRAMS += tests/test-strtok_r
 tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
diff --git a/utilities/automake.mk b/utilities/automake.mk
index 45fcdff2c..6343ffcbe 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -120,26 +120,29 @@ man_MANS += \
        utilities/ovs-vsctl.8
 
 utilities_ovs_appctl_SOURCES = utilities/ovs-appctl.c
-utilities_ovs_appctl_LDADD = lib/libopenvswitch.la
+utilities_ovs_appctl_LDADD = lib/libopenvswitchutils.la
 
 utilities_ovs_testcontroller_SOURCES = utilities/ovs-testcontroller.c
-utilities_ovs_testcontroller_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
+utilities_ovs_testcontroller_LDADD = lib/libopenvswitch.la \
+       lib/libopenvswitchutils.la \
+       $(SSL_LIBS)
 
 utilities_ovs_dpctl_SOURCES = utilities/ovs-dpctl.c
-utilities_ovs_dpctl_LDADD = lib/libopenvswitch.la
+utilities_ovs_dpctl_LDADD = lib/libopenvswitch.la lib/libopenvswitchutils.la
 
 utilities_ovs_ofctl_SOURCES = utilities/ovs-ofctl.c
 utilities_ovs_ofctl_LDADD = \
        ofproto/libofproto.la \
-       lib/libopenvswitch.la
+       lib/libopenvswitch.la \
+       lib/libopenvswitchutils.la
 
 utilities_ovs_vsctl_SOURCES = utilities/ovs-vsctl.c
-utilities_ovs_vsctl_LDADD = lib/libopenvswitch.la
+utilities_ovs_vsctl_LDADD = lib/libopenvswitch.la lib/libopenvswitchutils.la
 
 if LINUX
 noinst_PROGRAMS += utilities/nlmon
 utilities_nlmon_SOURCES = utilities/nlmon.c
-utilities_nlmon_LDADD = lib/libopenvswitch.la
+utilities_nlmon_LDADD = lib/libopenvswitch.la lib/libopenvswitchutils.la
 endif
 
 FLAKE8_PYFILES += utilities/ovs-pcap.in \
diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk
index 830c9a188..9f3f26bdd 100644
--- a/vswitchd/automake.mk
+++ b/vswitchd/automake.mk
@@ -12,7 +12,8 @@ vswitchd_ovs_vswitchd_SOURCES = \
 vswitchd_ovs_vswitchd_LDADD = \
        ofproto/libofproto.la \
        lib/libsflow.la \
-       lib/libopenvswitch.la
+       lib/libopenvswitch.la \
+       lib/libopenvswitchutils.la
 vswitchd_ovs_vswitchd_LDFLAGS = $(AM_LDFLAGS) $(DPDK_vswitchd_LDFLAGS)
 MAN_ROOTS += vswitchd/ovs-vswitchd.8.in
 
diff --git a/vtep/automake.mk b/vtep/automake.mk
index e549922d9..e513abeea 100644
--- a/vtep/automake.mk
+++ b/vtep/automake.mk
@@ -34,7 +34,7 @@ man_MANS += \
    vtep/vtep-ctl.8
 
 vtep_vtep_ctl_SOURCES = vtep/vtep-ctl.c
-vtep_vtep_ctl_LDADD = vtep/libvtep.la lib/libopenvswitch.la
+vtep_vtep_ctl_LDADD = vtep/libvtep.la lib/libopenvswitchutils.la
 
 # ovs-vtep
 scripts_SCRIPTS += \
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to