Split libopenvswitch into two libraries:

 - libopenvswitchutils: containers, utilities, I/O, threading,
   logging, and OVSDB client modules.
 - libopenvswitch: datapath, OpenFlow, netdev, dpif, flow,
   conntrack, and related modules.

Programs that do not need datapath functionality now link only
libopenvswitchutils, reducing their dependency footprint:
ovsdb-server, ovsdb-client, ovsdb-tool, ovs-appctl, vtep-ctl,
test-lib.

When OVS is built with static DPDK (--with-dpdk=static), these
programs no longer pull in DPDK code at all.  Stripped binary
sizes (x86_64, DPDK 25.11.2):

  Binary          Before    After    Saved
  ovs-appctl     4,434 KB   355 KB    -92%
  ovsdb-server   4,742 KB   775 KB    -84%
  ovsdb-client   4,729 KB   758 KB    -84%
  ovsdb-tool     4,709 KB   738 KB    -84%
  vtep-ctl       4,752 KB   856 KB    -82%
  test-lib       4,430 KB   351 KB    -92%

Binaries that still need libopenvswitch (ovs-vsctl, ovs-dpctl,
ovs-ofctl, ovs-vswitchd) are unaffected by this change.  Further
reducing their DPDK dependency requires decoupling dp-packet from
netdev-dpdk, which is separate follow-up work.

Changes since v6:
  - Split the series into two patches per Ilya's review:
    1/2 extracts address functions from packets.[ch] into a new
    netaddr.[ch] module (Ilya Maximets).
    2/2 introduces the library split using netaddr.[ch] as part
    of libopenvswitchutils.
  - Replaced the static inline wrappers (ip_parse, ipv6_parse,
    ipv6_string_mapped) in packets.h with proper function
    definitions in netaddr.c, resolving the logical isolation
    concern (Ilya Maximets).
  - Both libraries now absorb a shared noinst convenience library
    (libovsutil) so header-only code (hashes, atomics) is compiled
    once with identical CFLAGS, addressing the hash divergence
    concern (Ilya Maximets).
  - Programs that link libopenvswitch no longer need to also list
    libopenvswitchutils in LDADD, since libopenvswitch already
    contains all utils symbols through the convenience library
    (Ilya Maximets).
  - Moved unaligned.h to the utils library where it belongs
    (Ilya Maximets).
  - Updated USDT probe scripts to also search libopenvswitchutils
    for struct definitions (Ilya Maximets).
  - Fixed pre-existing checkpatch warnings and errors in code
    moved to netaddr.[ch] (cast spacing, operator spacing,
    line length, for-loop whitespace).

Changes since v5:
  - test-lib: removed unused vconn.h include and switched LDADD
    from libopenvswitch to libopenvswitchutils only (David Marchand).
  - Added static DPDK size measurements to the commit message.

Changes since v4:
  - Squashed into a single patch.
  - Dropped net-proto rename per Ilya's review: keep packets.c/h
    as-is, no new net-proto.c/h files.
  - Dropped pop_mpls and other function moves to dp-packet per
    Ilya's review.
  - Inlined ip_parse(), ipv6_parse(), ipv6_string_mapped() in
    packets.h to resolve cross-library dependency (trivial
    wrappers around inet_pton/inet_ntop).
  - Fixed shared library builds: link libopenvswitchutils.la
    explicitly in every executable that also links libopenvswitch.la
    (utilities, vswitchd, tests, oss-fuzz), so the directly
    referenced utils symbols resolve under --enable-shared.
  - Fixed debian Python extension: link libopenvswitchutils
    instead of libopenvswitch.
  - Fixed sparse checker: include ordering in packets.h.
  - Kept the generated vswitch-idl in libopenvswitch (datapath and
    schema consumers); only dirs and ovsdb-server-idl moved to the
    libopenvswitchutils sources.
  - Dropped the redundant @LIBS@ from libopenvswitch.pc.in; it is
    chained in through Requires.private: libopenvswitchutils.

Changes since v3:
  - Rebased on current main (resolved conflict in NEWS).

Changes since v2:
  - Fixed checkpatch warnings and errors (cast spacing, operator spacing,
    line length, for-loop whitespace, commit subject length).
  - Separated the public header rename into its own commit for clarity.
  - Moved dirs.h from libopenvswitch to libopenvswitchutils sources
    to be consistent with dirs.c.

Changes since v1 (Aaron Conole <[email protected]>):
  - Reordered: flow_tnl_equal removal moved to patch 1 as suggested by
    David Marchand (independent cleanup, easier to review first)
  - Fixed: flow_tnl_src()/flow_tnl_dst() moved from lib/dp-packet.c to
    lib/flow.c as requested by David Marchand and Ilya Maximets
  - Fixed: missing packet_set_ipv6_flow_label and packet_set_ipv6_tc
    renames added to NEWS as pointed out by David Marchand

Timothy Redaelli (2):
  lib: Extract address functions from packets into netaddr module.
  libs: Introduce libopenvswitchutils for common routines.

 NEWS                                         |   6 +
 configure.ac                                 |   2 +
 debian/rules                                 |   4 +-
 lib/.gitignore                               |   1 +
 lib/automake.mk                              | 372 ++++++-----
 lib/libopenvswitchutils.pc.in                |  11 +
 lib/libopenvswitchutils.sym.in               |   4 +
 lib/netaddr.c                                | 667 +++++++++++++++++++
 lib/netaddr.h                                | 418 ++++++++++++
 lib/packets.c                                | 641 ------------------
 lib/packets.h                                | 390 +----------
 ovsdb/automake.mk                            |   6 +-
 python/setup.py.template                     |   2 +-
 tests/automake.mk                            |   6 +-
 tests/oss-fuzz/automake.mk                   |   2 +-
 tests/test-lib.c                             |   1 -
 utilities/automake.mk                        |   2 +-
 utilities/usdt-scripts/flow_reval_monitor.py |   1 +
 utilities/usdt-scripts/reval_monitor.py      |   4 +-
 vtep/automake.mk                             |   2 +-
 20 files changed, 1320 insertions(+), 1222 deletions(-)
 create mode 100644 lib/libopenvswitchutils.pc.in
 create mode 100644 lib/libopenvswitchutils.sym.in
 create mode 100644 lib/netaddr.c
 create mode 100644 lib/netaddr.h

-- 
2.55.0

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

Reply via email to