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.
Signed-off-by: Maciek Machnikowski <mac...@machnikowski.net> --- config.c | 1 + configs/default.cfg | 1 + ptp4l.8 | 5 +++++ ptp4l.c | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/config.c b/config.c index cb4421f..a34c56d 100644 --- a/config.c +++ b/config.c @@ -279,6 +279,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("interface_rate_tlv", 0, 0, 1), GLOB_ITEM_INT("kernel_leap", 1, 0, 1), GLOB_ITEM_STR("leapfile", NULL), + GLOB_ITEM_INT("legacy_ptp_ver", 0, 0, 1), PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logMinPdelayReqInterval", 0, INT8_MIN, INT8_MAX), diff --git a/configs/default.cfg b/configs/default.cfg index a21ec66..4ba8c28 100644 --- a/configs/default.cfg +++ b/configs/default.cfg @@ -46,6 +46,7 @@ power_profile.2011.networkTimeInaccuracy 0 power_profile.2017.totalTimeInaccuracy 0xFFFFFFFF power_profile.grandmasterID 0 power_profile.version none +legacy_ptp_ver 0 # # Run time options # diff --git a/ptp4l.8 b/ptp4l.8 index bb678c9..e759c38 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -987,6 +987,11 @@ Clock. If supported by the device, this mode uses the hardware's built in phase offset control instead of frequency offset control. The default value is 0 (disabled). +.TP +.B legacy_ptp_ver +This option forces legacy PTP header version 2.0. May be required on some +legacy hardware that expects exact match on PTP header version. + .SH UNICAST DISCOVERY OPTIONS .TP diff --git a/ptp4l.c b/ptp4l.c index c61175b..8eaeaf3 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -192,6 +192,10 @@ 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"); + if(config_get_int(cfg, NULL, "legacy_ptp_ver")) { + ptp_hdr_ver = 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.37.1 (Apple Git-137.1) _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel