From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02E51CD3445 for ; Sat, 9 May 2026 18:00:11 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16A50402B9; Sat, 9 May 2026 20:00:11 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mails.dpdk.org (Postfix) with ESMTP id 3245040151 for ; Sat, 9 May 2026 20:00:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778349609; x=1809885609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8zDedIM3z02TX5ebbLKA5XzV3/pZTmJ0wwoOvBWds98=; b=li2u/NE/PCEdz2jdGmFy1YVn6R9XxszWUIx40T0DsQzL31VHyD9QPEyP mCNo/QJ20LQ0A7y3pmXXSS31YPK3tTvuoqIcyPGyzd+U1isGITqg/GitO 9o5PVOF1/BsJm+Ud5gFWNPV64w9bArxssbk1wZzIZT8tjaOLQ7YhBrU5G yiGAsoFtmwd72C0yruL40CrsJ1EiI3HnQMiJPkkl5vZSm/1I4ic0hWfHx wHB5bBiVigIWQOY2ABHuIXS/5BN/xA/GqD8Mtl83fVDcJ/VBRaE7NcuRx 1naka0whOCOPK1S/HNyvOocUo5D0y+V4nJHyc0hVsLw52BLK8cK4CXag9 A==; X-CSE-ConnectionGUID: /ZjfZrMTSNyKEyd9qOhD1w== X-CSE-MsgGUID: tpgcZlnkRHSyMVK32zVIvA== X-IronPort-AV: E=McAfee;i="6800,10657,11781"; a="96865014" X-IronPort-AV: E=Sophos;i="6.23,225,1770624000"; d="scan'208";a="96865014" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2026 11:00:08 -0700 X-CSE-ConnectionGUID: iNtSyOheSh+jJhhyDLbKPA== X-CSE-MsgGUID: radzR/aKSlaBfgYJ+VqfWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,225,1770624000"; d="scan'208";a="267426401" Received: from icx008.iind.intel.com ([10.190.212.196]) by orviesa002.jf.intel.com with ESMTP; 09 May 2026 11:00:06 -0700 From: Rajesh Kumar To: dev@dpdk.org Cc: bruce.richardson@intel.com, aman.deep.singh@intel.com, stephen@networkplumber.org, mb@smartsharesystems.com, Rajesh Kumar Subject: [PATCH v8 0/4] IEEE 1588 PTP v2 protocol support in lib/net Date: Sun, 10 May 2026 04:55:47 +0530 Message-ID: <20260509232551.2844201-1-rajesh3.kumar@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260428010117.692626-1-rajesh3.kumar@intel.com> References: <20260428010117.692626-1-rajesh3.kumar@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add IEEE 1588-2019 Precision Time Protocol (PTP) support to DPDK via a new header library in lib/net/. This patchset provides wire-format packet structure definitions and inline helpers for Transparent Clock and ordinary clock applications. Design Rationale ================ Following DPDK conventions for protocol libraries (rte_tcp.h, rte_ip.h), PTP definitions are provided as a header-only library with inline functions for zero-overhead packet processing. All functions are suitable for real-time, performance-critical code paths. Contents ======== Patch 1: lib/net/rte_ptp.h - Header structures and inline helpers - rte_ptp_port_id: 10-byte port identity with EUI-64 clock ID - rte_ptp_hdr: 34-byte PTP v2 common message header with nibble bitfields for msg_type/transportSpecific and version/minorVersion - rte_ptp_timestamp: 10-byte nanosecond-precision timestamp - Message type constants (Sync, Delay_Req, Announce, etc.) - Flag field bits (two-step, unicast, leap indicator) - Port and MAC address constants (RTE_IPPORT_PTP_*, RTE_ETHER_ADDR_PTP_*) - Inline helpers: rte_ptp_is_event(), rte_ptp_is_two_step(), rte_ptp_add_correction(), rte_ptp_timestamp_to_ns() Patch 2: examples/ptp_tap_relay_sw - Software PTP Transparent Clock relay - Relays PTP packets between a DPDK-bound physical NIC and Linux TAP - Software timestamp-based residence time measurement (CLOCK_MONOTONIC) - Accumulates residence time to correctionField per IEEE 1588-2019 ยง10.2 - Handles L2, VLAN/QinQ, UDP/IPv4, UDP/IPv6 PTP encapsulations - Works with unmodified Linux kernel and stock DPDK (no patches required) - Compatible with standard linuxptp (ptp4l) tooling Patch 3: doc/guides/rel_notes/release_26_07.rst - Release notes update Patch 4: examples/ptpclient - Update to use lib/net PTP definitions - Replace local struct ptp_header with struct rte_ptp_hdr - Replace local struct tstamp with struct rte_ptp_timestamp - Replace local struct clock_id with uint8_t[8] arrays - Use RTE_PTP_MSGTYPE_* constants instead of local defines - Use hdr->msg_type bitfield and rte_be_to_cpu_16(hdr->sequence_id) for direct field access - Remove local PTP_PROTOCOL macro (use RTE_ETHER_TYPE_1588) - Add lib/net dependency in meson.build Testing ======= - Build: `ninja -C build` - clean compilation - Examples: Both ptpclient and ptp_tap_relay_sw compile and link correctly - Checkpatches: All 4 patches pass validation - Functional: ptpclient tested with ptp4l in L2 mode (HW timestamps) - Functional: ptp_tap_relay_sw tested with E810 master and TAP slave Changelog ========= v8 changes: - Renamed port macros: RTE_IPPORT_PTP_EVENT, RTE_IPPORT_PTP_GENERAL - Renamed MAC macros: RTE_ETHER_ADDR_PTP_MULTICAST, RTE_ETHER_ADDR_PTP_MULTICAST_PDELAY - Renamed RTE_PTP_MSGTYPE_FOLLOW_UP to RTE_PTP_MSGTYPE_FU for consistency with RTE_PTP_MSGTYPE_PDELAY_RESP_FU - Split msg_type and version bytes into 4-bit bitfields using __extension__ union pattern (matching rte_ipv4_hdr convention) - Changed flag bits to use UINT16_C(1) << N - Removed 6 accessor functions (rte_ptp_msg_type, rte_ptp_seq_id, rte_ptp_version, rte_ptp_domain, rte_ptp_transport_specific, rte_ptp_correction_ns) - use direct field access instead - Changed rte_ptp_is_event() parameter from int to const struct rte_ptp_hdr * - Changed rte_ptp_add_correction() parameter from int64_t to uint64_t - Used UINT64_C(1000000000) in rte_ptp_timestamp_to_ns() - Added "(general)" to PDELAY_RESP_FU description - Documented PTP timestamp epoch - Updated MAINTAINERS headline - Updated ptpclient and ptp_tap_relay_sw for direct field access v7 changes: - Added sample app guide to sample_app_ug toctree to fix Sphinx warning - Fixed all checkpatch warnings (commit message line lengths <= 75 chars) - Refactored ptpclient to use shared lib/net/rte_ptp.h definitions - All 5 patches (cover + 4 functional) pass checkpatch validation v6 changes: - Restructured to lib/net (header-only, following lib/net conventions) - Removed separate DPI library functions (moved to example local parser) - Removed app/test unit tests (header-only, example-driven testing) - Removed programmer's guide (lib/net headers use Doxygen API docs only) Rajesh Kumar (4): lib/net: add IEEE 1588 PTP v2 protocol header definitions examples/ptp_tap_relay_sw: add PTP software transparent clock relay doc: update release notes for PTP protocol library examples/ptpclient: use shared PTP library definitions MAINTAINERS | 6 + doc/guides/rel_notes/release_26_07.rst | 12 + doc/guides/sample_app_ug/index.rst | 1 + doc/guides/sample_app_ug/ptp_tap_relay_sw.rst | 212 +++++++++ examples/ptp_tap_relay_sw/Makefile | 41 ++ examples/ptp_tap_relay_sw/meson.build | 13 + examples/ptp_tap_relay_sw/ptp_parse.h | 211 +++++++++ examples/ptp_tap_relay_sw/ptp_tap_relay_sw.c | 432 ++++++++++++++++++ examples/ptpclient/meson.build | 1 + examples/ptpclient/ptpclient.c | 204 ++++----- lib/net/meson.build | 1 + lib/net/rte_ptp.h | 205 +++++++++ 12 files changed, 1215 insertions(+), 124 deletions(-) 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_parse.h create mode 100644 examples/ptp_tap_relay_sw/ptp_tap_relay_sw.c create mode 100644 lib/net/rte_ptp.h -- 2.53.0