DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Rajesh Kumar <rajesh3.kumar@intel.com>
Cc: dev@dpdk.org, bruce.richardson@intel.com, aman.deep.singh@intel.com
Subject: Re: [RFC v3 0/6] introduce PTP protocol library and software relay
Date: Mon, 4 May 2026 10:56:21 -0700	[thread overview]
Message-ID: <20260504105621.0eb6dbab@phoenix.local> (raw)
In-Reply-To: <20260504091728.1406661-1-rajesh3.kumar@intel.com>

On Mon,  4 May 2026 14:47:16 +0530
Rajesh Kumar <rajesh3.kumar@intel.com> wrote:

> This series introduces a new DPDK library (lib/ptp) for IEEE 1588-2019
> PTP protocol packet processing and a companion example application
> (ptp_tap_relay_sw) that demonstrates its usage.
> 
> Motivation
> ----------
> Several DPDK applications need to classify and manipulate PTP packets
> (e.g. ptpclient, ptp_tap_relay, custom Transparent Clocks). Today each
> application re-implements its own PTP header parsing and correctionField
> handling. A shared library avoids duplication and provides a tested,
> standards-compliant foundation.
> 
> Library: lib/ptp
> ----------------
> The library provides:
>   - PTP header structures (IEEE 1588-2019 common header, timestamp,
>     port identity)
>   - Packet classification: rte_ptp_classify() detects PTP over L2
>     (EtherType 0x88F7), VLAN-tagged L2 (TPIDs 0x8100/0x88A8, single
>     or double), UDP/IPv4, UDP/IPv6 (ports 319/320), and VLAN-tagged
>     UDP variants
>   - Header access: rte_ptp_hdr_get() returns a pointer to the PTP
>     header inside an mbuf
>   - Inline helpers: correctionField manipulation (48.16 fixed-point),
>     message type extraction, two-step flag check, timestamp conversion
>   - Debug: rte_ptp_msg_type_str() for human-readable message names
> 
> Example: ptp_tap_relay_sw
> -------------------------
> A minimal PTP Transparent Clock relay between a DPDK-bound physical NIC
> and a kernel TAP interface using software timestamps only. No patched
> kernel modules, custom TAP PMD, or hardware timestamp support is
> required.
> 
> The relay:
>   1. Receives packets on the physical NIC via DPDK
>   2. Parses packets using rte_ptp_hdr_get()
>   3. For event messages, records software timestamps
>      (clock_gettime(CLOCK_MONOTONIC)) at ingress and egress
>   4. Adds residence time to correctionField via rte_ptp_add_correction()
>      (IEEE 1588-2019 10.2 Transparent Clock)
>   5. Forwards bidirectionally: PHY <-> TAP
> 
> Unit Tests: app/test
> --------------------
> A comprehensive test suite (ptp_autotest) covers all library APIs,
> including VLAN/QinQ/IPv4/IPv6 transports, correctionField helpers,
> flags, and negative tests. This v3 also adds coverage for IPv4 options
> (IHL > 5).
> 
> v3:
>   - Reused RTE_ETHER_TYPE_1588 via RTE_PTP_ETHERTYPE alias
>   - Updated version field comment to minorVersionPTP|versionPTP
>   - Fixed prog guide rte_ptp_hdr_get() signature (non-const mbuf)
>   - Added ALLOW_EXPERIMENTAL_API to ptp_tap_relay_sw Makefile
>   - Updated relay example to parse once (rte_ptp_hdr_get + msg_type)
>   - Updated relay sample app limitations wording to match capabilities
>   - Added hdr_get NULL checks in correction tests
>   - Added IPv4 options classification test (IHL > 5)
>   - Made correction counter update style consistent via pointer arg
> 
> v2:
>   - Fixed flag bit positions for host-order representation after
>     rte_be_to_cpu_16(): TWO_STEP (1<<9), UNICAST (1<<10),
>     LI_61 (1<<0), LI_59 (1<<1)
>   - Fixed QinQ classification: outer 0x88A8 now enters VLAN parser
>   - Fixed signed left-shift UB in rte_ptp_add_correction()
>   - Fixed promiscuous enable failure handling in relay port_init()
>   - Replaced deprecated master/slave terminology with IEEE terms
>   - Added and documented IHL validation for IPv4 PTP-over-UDP
>   - Changed rte_ptp_is_event() parameter to int with negative guard
>   - Changed rte_ptp_hdr_get() parameter to non-const mbuf
>   - Added programmer's guide note about avoiding double-parse
> 
> Rajesh Kumar (6):
>   ptp: introduce PTP protocol library
>   doc: add PTP library programmer's guide
>   examples/ptp_tap_relay_sw: add software PTP relay example
>   doc: add PTP software relay sample app guide
>   app/test: add PTP library unit tests
>   examples/ptpclient: use shared PTP library definitions
> 
>  MAINTAINERS                                   |    8 +
>  app/test/meson.build                          |    1 +
>  app/test/test_ptp.c                           | 1106 +++++++++++++++++
>  doc/api/doxy-api-index.md                     |    1 +
>  doc/api/doxy-api.conf.in                      |    1 +
>  doc/guides/prog_guide/index.rst               |    1 +
>  doc/guides/prog_guide/ptp_lib.rst             |  205 +++
>  doc/guides/rel_notes/release_26_07.rst        |   13 +
>  doc/guides/sample_app_ug/index.rst            |    1 +
>  doc/guides/sample_app_ug/ptp_tap_relay_sw.rst |  212 ++++
>  examples/meson.build                          |    1 +
>  examples/ptp_tap_relay_sw/Makefile            |   43 +
>  examples/ptp_tap_relay_sw/meson.build         |   14 +
>  examples/ptp_tap_relay_sw/ptp_tap_relay_sw.c  |  433 +++++++
>  examples/ptpclient/meson.build                |    1 +
>  examples/ptpclient/ptpclient.c                |  188 ++-
>  lib/meson.build                               |    1 +
>  lib/ptp/meson.build                           |    6 +
>  lib/ptp/rte_ptp.c                             |  185 +++
>  lib/ptp/rte_ptp.h                             |  339 +++++
>  20 files changed, 2644 insertions(+), 116 deletions(-)
>  create mode 100644 app/test/test_ptp.c
>  create mode 100644 doc/guides/prog_guide/ptp_lib.rst
>  create mode 100644 doc/guides/sample_app_ug/ptp_tap_relay_sw.rst
>  create mode 100644 examples/ptp_tap_relay_sw/Makefile
>  create mode 100644 examples/ptp_tap_relay_sw/meson.build
>  create mode 100644 examples/ptp_tap_relay_sw/ptp_tap_relay_sw.c
>  create mode 100644 lib/ptp/meson.build
>  create mode 100644 lib/ptp/rte_ptp.c
>  create mode 100644 lib/ptp/rte_ptp.h
> 
> 
> base-commit: 7baf81674a011ab8a2fe329566b6d43d7377244c

Lots of build failures in CI.
Looks like alot around c++ build of header etc.
g++ -Ibuildtools/chkincs/chkincs-cpp-exp.p -Ibuildtools/chkincs -I../buildtools/chkincs -I. -I.. -Iconfig -I../config -Ibuildtools/chkincs/staging -I../buildtools/chkincs/staging -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -g -include rte_config.h -march=corei7 -mrtm -Wno-missing-field-initializers -Wno-vla -DALLOW_EXPERIMENTAL_API -MD -MQ buildtools/chkincs/chkincs-cpp-exp.p/meson-generated_rte_ptp.cpp.o -MF buildtools/chkincs/chkincs-cpp-exp.p/meson-generated_rte_ptp.cpp.o.d -o buildtools/chkincs/chkincs-cpp-exp.p/meson-generated_rte_ptp.cpp.o -c buildtools/chkincs/chkincs-cpp-exp.p/rte_ptp.cpp
In file included from buildtools/chkincs/staging/rte_memory.h:18,
                 from buildtools/chkincs/staging/rte_ring_core.h:29,
                 from buildtools/chkincs/staging/rte_ring.h:38,
                 from buildtools/chkincs/staging/rte_mempool.h:49,
                 from buildtools/chkincs/staging/rte_mbuf.h:39,
                 from buildtools/chkincs/staging/rte_ether.h:20,
                 from /home/runner/work/dpdk/dpdk/lib/ptp/rte_ptp.h:32,
                 from buildtools/chkincs/chkincs-cpp-exp.p/rte_ptp.cpp:1:
buildtools/chkincs/staging/rte_bitops.h:1468:1: error: conflicting declaration of C function ‘bool rte_bit_test(const volatile uint32_t*, unsigned int)’
 1468 | rte_bit_ ## family ## fun(qualifier uint ## size ## _t *addr, arg1_type arg1_name) \
      | ^~~~~~~~
buildtools/chkincs/staging/rte_bitops.h:1475:9: note: in expansion of macro ‘__RTE_BIT_OVERLOAD_V_2R’
 1475 |         __RTE_BIT_OVERLOAD_V_2R(family, v_, fun, qualifier volatile, size, ret_type, arg1_type, \
      |         ^~~~~~~~~~~~~~~~~~~~~~~
buildtools/chkincs/staging/rte_bitops.h:1479:9: note: in expansion of macro ‘__RTE_BIT_OVERLOAD_SZ_2R’
 1479 |         __RTE_BIT_OVERLOAD_SZ_2R(family, fun, qualifier, 32, ret_type, arg1_type, arg1_name) \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
buildtools/chkincs/staging/rte_bitops.h:1575:1: note: in expansion of macro ‘__RTE_BIT_OVERLOAD_2R’
 1575 | __RTE_BIT_OVERLOAD_2R(, test, const, bool, unsigned int, nr)
      | ^~~~~~~~~~~~~~~~~~~~~
buildtools/chkincs/staging/rte_bitops.h:1468:1: note: previous declaration ‘bool rte_bit_test(const uint32_t*, unsigned int)’
 1468 | rte_bit_ ## family ## fun(qualifier uint ## size ## _t *addr, arg1_type arg1_name) \
      | ^~~~~~~~
buildtools/chkincs/staging/rte_bitops.h:1474:9: note: in expansion of macro ‘__RTE_BIT_OVERLOAD_V_2R’
 1474 |         __RTE_BIT_OVERLOAD_V_2R(family,, fun, qualifier, size, ret_type, arg1_type, arg1_name) \
      |         ^~~~~~~~~~~~~~~~~~~~~~~
buildtools/chkincs/staging/rte_bitops.h:1479:9: note: in expansion of macro ‘__RTE_BIT_OVERLOAD_SZ_2R’
 1479 |         __RTE_BIT_OVERLOAD_SZ_2R(family, fun, qualifier, 32, ret_type, arg1_type, arg1_name) \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
buildtools/chkincs/staging/rte_bitops.h:1575:1: note: in expansion of macro ‘__RTE_BIT_OVERLOAD_2R’
 1575 | __RTE_BIT_OVERLOAD_2R(, test, const, bool, unsigned int, nr)

  parent reply	other threads:[~2026-05-04 17:56 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  1:01 [RFC v1 0/4] introduce PTP protocol library and software relay example Rajesh Kumar
2026-04-27 23:42 ` Stephen Hemminger
2026-04-28 16:52   ` Kumar, Rajesh
2026-04-28  1:01 ` [RFC v1 1/4] ptp: introduce PTP protocol library Rajesh Kumar
2026-04-27 23:01   ` Stephen Hemminger
2026-04-28 16:50     ` Kumar, Rajesh
2026-04-28  1:01 ` [RFC v1 2/4] doc: add PTP library programmer's guide Rajesh Kumar
2026-04-28  1:01 ` [RFC v1 3/4] examples/ptp_tap_relay_sw: add software PTP relay example Rajesh Kumar
2026-04-28  1:01 ` [RFC v1 4/4] doc: add PTP software relay sample app guide Rajesh Kumar
2026-04-28 22:28 ` [RFC v2 0/6] introduce PTP protocol library and software relay Rajesh Kumar
2026-04-28 22:28   ` [RFC v2 1/6] ptp: introduce PTP protocol library Rajesh Kumar
2026-04-28 22:28   ` [RFC v2 2/6] doc: add PTP library programmer's guide Rajesh Kumar
2026-04-28 22:28   ` [RFC v2 3/6] examples/ptp_tap_relay_sw: add software PTP relay example Rajesh Kumar
2026-04-28 22:28   ` [RFC v2 4/6] doc: add PTP software relay sample app guide Rajesh Kumar
2026-04-28 22:28   ` [RFC v2 5/6] app/test: add PTP library unit tests Rajesh Kumar
2026-04-28 22:28   ` [RFC v2 6/6] examples/ptpclient: use shared PTP library definitions Rajesh Kumar
2026-04-29 15:37   ` [RFC v2 0/6] introduce PTP protocol library and software relay Stephen Hemminger
2026-05-04  3:49     ` Kumar, Rajesh3
2026-05-04  9:17 ` [RFC v3 " Rajesh Kumar
2026-05-04  9:17   ` [RFC v3 1/6] ptp: introduce PTP protocol library Rajesh Kumar
2026-05-04  9:17   ` [RFC v3 2/6] doc: add PTP library programmer's guide Rajesh Kumar
2026-05-04  9:17   ` [RFC v3 3/6] examples/ptp_tap_relay_sw: add software PTP relay example Rajesh Kumar
2026-05-04  9:17   ` [RFC v3 4/6] doc: add PTP software relay sample app guide Rajesh Kumar
2026-05-04  9:17   ` [RFC v3 5/6] app/test: add PTP library unit tests Rajesh Kumar
2026-05-04  9:17   ` [RFC v3 6/6] examples/ptpclient: use shared PTP library definitions Rajesh Kumar
2026-05-04 17:56   ` Stephen Hemminger [this message]
2026-05-05 16:38 ` [RFC v4 0/6] introduce PTP protocol library and software relay Rajesh Kumar
2026-05-05 16:38   ` [RFC v4 1/6] ptp: introduce PTP protocol library Rajesh Kumar
2026-05-05 16:38   ` [RFC v4 2/6] doc: add PTP library programmer's guide Rajesh Kumar
2026-05-05 16:38   ` [RFC v4 3/6] examples/ptp_tap_relay_sw: add software PTP relay example Rajesh Kumar
2026-05-05 16:38   ` [RFC v4 4/6] doc: add PTP software relay sample app guide Rajesh Kumar
2026-05-05 16:38   ` [RFC v4 5/6] app/test: add PTP library unit tests Rajesh Kumar
2026-05-05 16:38   ` [RFC v4 6/6] examples/ptpclient: use shared PTP library definitions Rajesh Kumar
2026-05-06 15:41 ` [RFC v5 0/6] introduce PTP protocol library and software relay Rajesh Kumar
2026-05-06 15:41   ` [RFC v5 1/6] ptp: introduce PTP protocol library Rajesh Kumar
2026-05-06 11:02     ` Morten Brørup
2026-05-07  4:45       ` Kumar, Rajesh
2026-05-06 15:41   ` [RFC v5 2/6] doc: add PTP library programmer's guide Rajesh Kumar
2026-05-06 15:41   ` [RFC v5 3/6] examples/ptp_tap_relay_sw: add software PTP relay example Rajesh Kumar
2026-05-06 15:41   ` [RFC v5 4/6] doc: add PTP software relay sample app guide Rajesh Kumar
2026-05-06 15:41   ` [RFC v5 5/6] app/test: add PTP library unit tests Rajesh Kumar
2026-05-06 15:41   ` [RFC v5 6/6] examples/ptpclient: use shared PTP library definitions Rajesh Kumar
2026-05-06 15:45   ` [RFC v5 0/6] introduce PTP protocol library and software relay Stephen Hemminger
2026-05-07 10:13 ` [PATCH v6 0/4] PTP protocol support in lib/net Rajesh Kumar
2026-05-07 10:13   ` [PATCH v6 1/4] lib/net: add IEEE 1588 PTP v2 protocol header definitions Rajesh Kumar
2026-05-07 10:13   ` [PATCH v6 2/4] examples/ptp_tap_relay_sw: add PTP software transparent clock relay Rajesh Kumar
2026-05-07 10:13   ` [PATCH v6 3/4] doc: update release notes for PTP protocol library Rajesh Kumar
2026-05-07 10:13   ` [PATCH v6 4/4] examples/ptpclient: use shared PTP library definitions Rajesh Kumar
2026-05-07 13:45 ` [PATCH v7 0/4] IEEE 1588 PTP v2 protocol support in lib/net Rajesh Kumar
2026-05-07 13:45   ` [PATCH v7 1/4] lib/net: add IEEE 1588 PTP v2 protocol header definitions Rajesh Kumar
2026-05-07 15:27     ` Morten Brørup
2026-05-09 17:57       ` Kumar, Rajesh
2026-05-07 13:45   ` [PATCH v7 2/4] examples/ptp_tap_relay_sw: add PTP software transparent clock relay Rajesh Kumar
2026-05-07 13:45   ` [PATCH v7 3/4] doc: update release notes for PTP protocol library Rajesh Kumar
2026-05-07 13:45   ` [PATCH v7 4/4] examples/ptpclient: use shared PTP library definitions Rajesh Kumar
2026-05-09 23:25 ` [PATCH v8 0/4] IEEE 1588 PTP v2 protocol support in lib/net Rajesh Kumar
2026-05-09 23:25   ` [PATCH v8 1/4] lib/net: add IEEE 1588 PTP v2 protocol header definitions Rajesh Kumar
2026-05-09 23:25   ` [PATCH v8 2/4] examples/ptp_tap_relay_sw: add PTP software transparent clock relay Rajesh Kumar
2026-05-09 23:25   ` [PATCH v8 3/4] doc: update release notes for PTP protocol library Rajesh Kumar
2026-05-09 23:25   ` [PATCH v8 4/4] examples/ptpclient: use shared PTP library definitions Rajesh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260504105621.0eb6dbab@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=aman.deep.singh@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=rajesh3.kumar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox