3.2.2.11. 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 <proto> with hsr or prp as appropriate.

Prerequisites

Complete the following steps on each node.

Clone linuxptp-hsr:

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:

sed -i '/^delay_mechanism/a p2p_dst_mac 01:1B:19:00:00:01' configs/<proto>-master.cfg configs/<proto>-slave.cfg
sed -i 's/^\[eth1\]/[<INTF_A>]/; s/^\[eth2\]/[<INTF_B>]/' configs/<proto>-master.cfg configs/<proto>-slave.cfg

Build and install:

make && make install

Running PTP

Set up the HSR or PRP interface as described in the respective offload documentation. On the PTP primary node:

./ptp4l -f configs/<proto>-master.cfg

On each PTP secondary node:

./ptp4l -f configs/<proto>-slave.cfg

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:

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