[RFC v5 1/6] ptp: introduce PTP protocol library
Morten Brørup
mb at smartsharesystems.com
Wed May 6 13:02:47 CEST 2026
> From: Rajesh Kumar [mailto:rajesh3.kumar at intel.com]
> Sent: Wednesday, 6 May 2026 17.41
>
> Add IEEE 1588-2019 Precision Time Protocol (PTP) processing library.
>
> The library provides packet classification, header structures, and
> helper functions for PTP packet processing in DPDK. This avoids
> duplicate PTP header definitions across multiple applications and
> drivers.
>
> Supported transports:
> 1. L2 PTP (EtherType 0x88F7)
> 2. VLAN-tagged L2 PTP (single and QinQ)
> 3. PTP over UDP/IPv4 (ports 319/320)
> 4. PTP over UDP/IPv6 (ports 319/320)
>
> Public APIs:
> 1. rte_ptp_classify()
> 2. rte_ptp_hdr_get()
> 3. rte_ptp_msg_type_str()
>
> Signed-off-by: Rajesh Kumar <rajesh3.kumar at intel.com>
> ---
Improved PTP support seems like a good addition to DPDK.
Here's some high level feedback to the library:
I think much of this belongs into /lib/net/, which holds similar protocol structure definitions and helper functions for many other protocols.
Please familiarize yourself with the code conventions in that directory, and move the relevant parts of the PTP library there (following the code conventions there).
Remember to define the packet structures with endianness in mind; e.g. use rte_be32_t instead of uint32_t where appropriate.
Don't define simple aliases, just use RTE_ETHER_TYPE_1588 directly.
Your DPI (deep packet inspection) parser function that can parse all kinds of PTP encapsulation does not belong in the library.
Applications would rely on a layered packet parser, such as rte_net_get_ptype().
If you need a DPI parser for the examples, feel free to add it there.
More information about the dev
mailing list