From 7f97f7c5da3c6926c879addfec1d703a862d65d0 Mon Sep 17 00:00:00 2001 From: MD Danish Anwar Date: Mon, 30 Mar 2026 13:57:46 +0530 Subject: [PATCH] feat(linux): Add PTP support documentation for HSR and PRP offload Add a new standalone page HSR_PRP_PTP.rst documenting PTP synchronization support for HSR and PRP interfaces using the linuxptp-hsr implementation (hsr_prp_v2_plus branch). The page covers: - Cloning and building linuxptp-hsr - Patching config files with interface names and p2p_dst_mac - Running ptp4l with primary/secondary configs - Verifying sync via master offset values HSR_Offload.rst and PRP_Offload.rst each get a brief PTP Support section with a cross-reference to the new page. HSR_PRP_PTP.rst is added to the toctree in Foundational_Components_Kernel_Drivers.rst. Signed-off-by: MD Danish Anwar --- configs/AM64X/AM64X_linux_toc.txt | 1 + .../Kernel_Drivers/Network/HSR_Offload.rst | 6 ++ .../Kernel_Drivers/Network/HSR_PRP_PTP.rst | 69 +++++++++++++++++++ .../Kernel_Drivers/Network/PRP_Offload.rst | 6 ++ ...Foundational_Components_Kernel_Drivers.rst | 1 + 5 files changed, 83 insertions(+) create mode 100644 source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_PTP.rst diff --git a/configs/AM64X/AM64X_linux_toc.txt b/configs/AM64X/AM64X_linux_toc.txt index 493e99c6f..5517f38f2 100644 --- a/configs/AM64X/AM64X_linux_toc.txt +++ b/configs/AM64X/AM64X_linux_toc.txt @@ -64,6 +64,7 @@ linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW-IET linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW-TSN-Tuning linux/Foundational_Components/Kernel/Kernel_Drivers/Network/NETCONF-YANG linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_Non_Offload +linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_PTP linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload linux/Foundational_Components/Kernel/Kernel_Drivers/SPI diff --git a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload.rst b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload.rst index dd806847c..5db7cd5e7 100644 --- a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload.rst +++ b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload.rst @@ -339,6 +339,12 @@ Example: # ip maddr del 01:80:c4:00:00:0e dev hsr0.5 +.. ifconfig:: CONFIG_part_variant in ('AM64X') + + .. rubric:: *PTP Support* + + For PTP support over HSR, see :ref:`hsr-prp-ptp`. + .. rubric:: Performance This section describes the throughput and CPU usage metrics in the offload case diff --git a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_PTP.rst b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_PTP.rst new file mode 100644 index 000000000..ae9b6dcb8 --- /dev/null +++ b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_PTP.rst @@ -0,0 +1,69 @@ +.. _hsr-prp-ptp: + +======================= +HSR and PRP PTP support +======================= + +The `linuxptp-hsr `_ +implementation on the ``hsr_prp_v2_plus`` branch supports PTP (Precision Time Protocol) +synchronization over High-availability Seamless Redundancy (HSR) and Parallel Redundancy +Protocol (PRP) interfaces. + +In the following commands, replace ```` with ``hsr`` or ``prp`` as appropriate. + +.. rubric:: Prerequisites + +Complete the following steps on each node. + +Clone linuxptp-hsr: + +.. code-block:: console + + git clone https://git.kernel.org/pub/scm/linux/kernel/git/bigeasy/linuxptp-hsr.git + cd linuxptp-hsr + git checkout hsr_prp_v2_plus + +Patch the config files with the actual interface names and the P2P destination MAC +address. The config files use INI-style sections where ``[eth1]`` and ``[eth2]`` +denote the two physical interfaces. The first command appends the ``p2p_dst_mac`` +key (destination MAC for P2P delay-request messages) into the ``[global]`` +section just after the ``delay_mechanism`` key. The second command replaces the +``[eth1]`` and ``[eth2]`` section headers with the actual interface names: + +.. code-block:: console + + sed -i '/^delay_mechanism/a p2p_dst_mac 01:1B:19:00:00:01' configs/-master.cfg configs/-slave.cfg + sed -i 's/^\[eth1\]/[]/; s/^\[eth2\]/[]/' configs/-master.cfg configs/-slave.cfg + +Build and install: + +.. code-block:: console + + make && make install + +.. rubric:: Running PTP + +Set up the HSR or PRP interface as described in the respective offload documentation. +On the PTP primary node: + +.. code-block:: console + + ./ptp4l -f configs/-master.cfg + +On each PTP secondary node: + +.. code-block:: console + + ./ptp4l -f configs/-slave.cfg + +.. rubric:: Verifying PTP synchronization + +Inspect the ``master offset`` values in the ptp4l log output to verify PTP synchronization. + +Sample ptp4l output showing a synchronized secondary node: + +.. code-block:: text + + ptp4l[xx.xxx]: master offset -123 s2 freq +4321 path delay 543 + ptp4l[xx.xxx]: master offset 45 s2 freq +4290 path delay 541 + ptp4l[xx.xxx]: master offset -78 s2 freq +4310 path delay 544 diff --git a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload.rst b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload.rst index cf1d305bd..b1c984b2b 100644 --- a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload.rst +++ b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload.rst @@ -309,6 +309,12 @@ Example: # ip maddr del 01:80:c4:00:00:0e dev prp0.5 +.. ifconfig:: CONFIG_part_variant in ('AM64X') + + .. rubric:: *PTP Support* + + For PTP support over PRP, see :ref:`hsr-prp-ptp`. + .. rubric:: Performance This section describes the throughput and CPU usage metrics in the offload case diff --git a/source/linux/Foundational_Components_Kernel_Drivers.rst b/source/linux/Foundational_Components_Kernel_Drivers.rst index a742b2c58..a51527367 100644 --- a/source/linux/Foundational_Components_Kernel_Drivers.rst +++ b/source/linux/Foundational_Components_Kernel_Drivers.rst @@ -29,6 +29,7 @@ Kernel Drivers Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_Non_Offload Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload + Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_PTP Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW-Ethernet Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW2g Foundational_Components/Kernel/Kernel_Drivers/Network/NETCONF-YANG