Skip to content

Commit 02a13b0

Browse files
MaciekMachnirichardcochran
authored andcommitted
ptp4l: Allow advertisement of legacy PTP 2.0 protocol
Some hardware can't properly timestamp packets with the new PTP header version 2.1. This patch adds legacy_ptp_ver config option that allows advertising of the legacy 2.0 protocol. Additionally, forcing PTP minor version to be nonzero causes interoperability issues with some legacy grandmasters. v2: rebase on top, clarify compatibility issues v3: fix subject line v4: change argument to ptp_minor_version Signed-off-by: Maciek Machnikowski <[email protected]>
1 parent 5eb0aff commit 02a13b0

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

config.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ struct config_item config_tab[] = {
318318
GLOB_ITEM_STR("productDescription", ";;"),
319319
PORT_ITEM_STR("ptp_dst_mac", "01:1B:19:00:00:00"),
320320
PORT_ITEM_STR("p2p_dst_mac", "01:80:C2:00:00:0E"),
321+
GLOB_ITEM_INT("ptp_minor_version", 1, 0, 1),
321322
GLOB_ITEM_STR("refclock_sock_address", "/var/run/refclock.ptp.sock"),
322323
GLOB_ITEM_STR("revisionData", ";;"),
323324
GLOB_ITEM_INT("sanity_freq_limit", 200000000, 0, INT_MAX),

configs/default.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ power_profile.2011.networkTimeInaccuracy -1
4646
power_profile.2017.totalTimeInaccuracy -1
4747
power_profile.grandmasterID 0
4848
power_profile.version none
49+
ptp_minor_version 1
4950
#
5051
# Run time options
5152
#

ptp4l.8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,11 @@ selection algorithm, lower values take precedence. Must be in the range 0 to
810810
255.
811811
The default is 128.
812812

813+
.TP
814+
.B ptp_minor_version
815+
This option sets the minorVersionPTP in the common PTP message header.
816+
The default is 1.
817+
813818
.TP
814819
.B refclock_sock_address
815820
The address of the UNIX domain socket to be used by the refclock_sock servo.

ptp4l.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ int main(int argc, char *argv[])
192192
sk_tx_timeout = config_get_int(cfg, NULL, "tx_timestamp_timeout");
193193
sk_hwts_filter_mode = config_get_int(cfg, NULL, "hwts_filter");
194194

195+
ptp_hdr_ver = config_get_int(cfg, NULL, "ptp_minor_version");
196+
ptp_hdr_ver = (ptp_hdr_ver << 4) | PTP_MAJOR_VERSION;
197+
195198
if (config_get_int(cfg, NULL, "clock_servo") == CLOCK_SERVO_NTPSHM) {
196199
config_set_int(cfg, "kernel_leap", 0);
197200
config_set_int(cfg, "sanity_freq_limit", 0);

0 commit comments

Comments
 (0)