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 <mac...@machnikowski.net> --- config.c | 1 + configs/default.cfg | 1 + ptp4l.8 | 5 +++++ ptp4l.c | 3 +++ 4 files changed, 10 insertions(+) diff --git a/config.c b/config.c index b104f1b..95458ed 100644 --- a/config.c +++ b/config.c @@ -318,6 +318,7 @@ struct config_item config_tab[] = { GLOB_ITEM_STR("productDescription", ";;"), PORT_ITEM_STR("ptp_dst_mac", "01:1B:19:00:00:00"), PORT_ITEM_STR("p2p_dst_mac", "01:80:C2:00:00:0E"), + GLOB_ITEM_INT("ptp_minor_version", 1, 0, 1), GLOB_ITEM_STR("refclock_sock_address", "/var/run/refclock.ptp.sock"), GLOB_ITEM_STR("revisionData", ";;"), GLOB_ITEM_INT("sanity_freq_limit", 200000000, 0, INT_MAX), diff --git a/configs/default.cfg b/configs/default.cfg index 00429b9..0c7661c 100644 --- a/configs/default.cfg +++ b/configs/default.cfg @@ -46,6 +46,7 @@ power_profile.2011.networkTimeInaccuracy -1 power_profile.2017.totalTimeInaccuracy -1 power_profile.grandmasterID 0 power_profile.version none +ptp_minor_version 1 # # Run time options # diff --git a/ptp4l.8 b/ptp4l.8 index 40c66c2..a23f30b 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -809,6 +809,11 @@ selection algorithm, lower values take precedence. Must be in the range 0 to 255. The default is 128. +.TP +.B ptp_minor_version +This option sets the minorVersionPTP in the common PTP message header. +The default is 1. + .TP .B refclock_sock_address The address of the UNIX domain socket to be used by the refclock_sock servo. diff --git a/ptp4l.c b/ptp4l.c index c61175b..59ce105 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -192,6 +192,9 @@ int main(int argc, char *argv[]) sk_tx_timeout = config_get_int(cfg, NULL, "tx_timestamp_timeout"); sk_hwts_filter_mode = config_get_int(cfg, NULL, "hwts_filter"); + ptp_hdr_ver = config_get_int(cfg, NULL, "ptp_minor_version"); + ptp_hdr_ver = (ptp_hdr_ver << 4) | PTP_MAJOR_VERSION; + if (config_get_int(cfg, NULL, "clock_servo") == CLOCK_SERVO_NTPSHM) { config_set_int(cfg, "kernel_leap", 0); config_set_int(cfg, "sanity_freq_limit", 0); -- 2.30.2 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel