From aca42c6d4c95c87c62bf4039beca2344470d65e9 Mon Sep 17 00:00:00 2001 From: Cole Walker Date: Mon, 1 Apr 2024 12:57:37 -0400 Subject: [PATCH] Implement logic to skip updates with offset spike in ts2phc. This change allows ts2phc to be configured to ignore timing updates that have a large offset spike in order to mitigate the resulting timing skew. In some circumstances on realtime systems with high CPU load, the timestamp consumed by ts2phc can be delayed in reaching ts2phc and results in the offset calculation attempting to speed the clock up by a large margin. This change causes ts2phc to ignore updates that would greatly skew the clock when ts2phc is already in a synchronized state. The global configuration option "max_phc_update_skip_cnt" is provided to allow users to specify how many consecutive offset spike incidents will be ignored before adjusting the clock. The default value is 120. The behaviour can be disabled by setting max_phc_update_skip_cnt to 0. This code is ported from a proposed upstream patch found here: https://sourceforge.net/p/linuxptp/mailman/message/44114092/ Test-plan: Pass: Verify linuxptp package build Pass: Deploy ts2phc binary and verify system time sync Pass: Manually trigger offset spike and verify that ts2phc maintains stable time sync Closes-bug: https://bugs.launchpad.net/starlingx/+bug/2059955 Change-Id: I13cd5c3440682ec9256e11449fe62d5fe28f66fa Signed-off-by: Cole Walker --- ...e-when-switching-port-with-same-best.patch | 2 +- ...lock-check-on-best-clock-port-change.patch | 2 +- ...heck-timestamps-from-non-slave-ports.patch | 2 +- .../0004-port-Don-t-renew-raw-transport.patch | 2 +- ...clockcheck-Increase-minimum-interval.patch | 2 +- ...sable-default-port-selection-in-phc2.patch | 2 +- ...hange-sysoff_measure-to-return-errno.patch | 2 +- ...ge-log-level-of-ioctl-error-messages.patch | 2 +- ...-EBUSY-when-probing-supported-ioctls.patch | 2 +- ...it-when-reading-of-PHC-fails-with-EB.patch | 2 +- ...PMC-functionality-into-a-smaller-str.patch | 2 +- ...hc2sys-make-PMC-functions-non-static.patch | 2 +- ...break-out-pmc-code-into-pmc_common.c.patch | 2 +- .../0014-Introduce-the-PMC-agent-module.patch | 2 +- ...-pmc_node-to-something-more-descript.patch | 2 +- ...16-pmc_agent-Hide-the-implementation.patch | 2 +- ...me-for-the-management-TLV-ID-helper-.patch | 2 +- ...me-for-the-management-TLV-data-helpe.patch | 2 +- ...e-error-codes-for-the-run_pmc-method.patch | 2 +- ...t-the-subscribe-method-into-the-cano.patch | 2 +- ...pmc_agent-Simplify-the-update-method.patch | 2 +- ...gent-Simplify-logic-in-update-method.patch | 2 +- ...-bogus-comparison-between-last-updat.patch | 2 +- ...m-time-comparison-using-positive-log.patch | 2 +- ...-the-update-method-and-attempt-to-do.patch | 2 +- ...-pointer-de-reference-in-manual-mode.patch | 2 +- ...t-the-method-that-queries-TAI-UTC-of.patch | 2 +- ...t-the-method-that-queries-the-port-p.patch | 2 +- ...lize-the-method-that-queries-the-loc.patch | 2 +- ...fy-the-method-that-gets-of-the-numbe.patch | 2 +- ...e-update-method-poll-for-push-events.patch | 2 +- ...Fix-regression-in-the-automatic-mode.patch | 2 +- ...push-notification-for-TIME_STATUS_NP.patch | 2 +- ...k-Rename-UDS-variables-to-read-write.patch | 2 +- ...dd-read-only-UDS-port-for-monitoring.patch | 2 +- .../0036-Rename-management-ID-macros.patch | 2 +- ...2sys-to-accept-multiple-ptp4l-inputs.patch | 2 +- ...0038-Best-source-selection-algorithm.patch | 2 +- ...est-source-clock-after-state-changes.patch | 2 +- ...lock-a-clock-source-in-configuration.patch | 2 +- .../patches/0041-HA-phc2sys-com-socket.patch | 2 +- ...ommands-enable-lock-and-disable-lock.patch | 2 +- ...nds-enable-source-and-disable-source.patch | 2 +- .../0044-Stream-type-phc2sys-com-socket.patch | 2 +- ...ctions-starts_with-and-str_at_column.patch | 2 +- ...tness-improvements-to-phc2sys-socket.patch | 2 +- .../0047-phc2sys-without-w-option.patch | 2 +- .../patches/0048-HA-domain-number.patch | 2 +- ...uracy-and-offset-scaled-log-variance.patch | 2 +- ...requirements-clock-if-active-doesn-t.patch | 2 +- .../patches/0051-Time-traceable-flag.patch | 2 +- .../patches/0052-Command-valid-sources.patch | 2 +- ...e-traceable-check-enabled-by-default.patch | 2 +- ...054-Disable-active-interface-failing.patch | 2 +- ...ace-in-conf-file-when-HA-is-disabled.patch | 2 +- .../0056-Fixed-event-port-id-map.patch | 2 +- ...nitialized-variable-in-nmea_scan_rmc.patch | 2 +- ...2phc-skip-updates-after-offset-spike.patch | 140 ++++++++++++++++++ base/linuxptp/debian/patches/series | 3 +- 59 files changed, 199 insertions(+), 58 deletions(-) create mode 100644 base/linuxptp/debian/patches/0058-ts2phc-skip-updates-after-offset-spike.patch diff --git a/base/linuxptp/debian/patches/0001-clock-Reset-state-when-switching-port-with-same-best.patch b/base/linuxptp/debian/patches/0001-clock-Reset-state-when-switching-port-with-same-best.patch index ffe9e1b37..d59f0c93a 100644 --- a/base/linuxptp/debian/patches/0001-clock-Reset-state-when-switching-port-with-same-best.patch +++ b/base/linuxptp/debian/patches/0001-clock-Reset-state-when-switching-port-with-same-best.patch @@ -1,7 +1,7 @@ From edb8d92c8e3379c6b764eb033a1d872dee3c8802 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 31 May 2021 11:07:52 +0200 -Subject: [PATCH 01/57] clock: Reset state when switching port with same best +Subject: [PATCH 01/58] clock: Reset state when switching port with same best clock. When the best port is changed, but the ID of the best clock doesn't diff --git a/base/linuxptp/debian/patches/0002-clock-Reset-clock-check-on-best-clock-port-change.patch b/base/linuxptp/debian/patches/0002-clock-Reset-clock-check-on-best-clock-port-change.patch index 4666ee01f..f5c688f20 100644 --- a/base/linuxptp/debian/patches/0002-clock-Reset-clock-check-on-best-clock-port-change.patch +++ b/base/linuxptp/debian/patches/0002-clock-Reset-clock-check-on-best-clock-port-change.patch @@ -1,7 +1,7 @@ From cef81731404b339517e277bab9c0285ee239f065 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 31 May 2021 11:07:53 +0200 -Subject: [PATCH 02/57] clock: Reset clock check on best clock/port change. +Subject: [PATCH 02/58] clock: Reset clock check on best clock/port change. Reset the clock check when the best clock or port changes, together with the other state like current estimated delay and frequency. This avoids diff --git a/base/linuxptp/debian/patches/0003-port-Don-t-check-timestamps-from-non-slave-ports.patch b/base/linuxptp/debian/patches/0003-port-Don-t-check-timestamps-from-non-slave-ports.patch index 0ad7ba207..5adf4dae4 100644 --- a/base/linuxptp/debian/patches/0003-port-Don-t-check-timestamps-from-non-slave-ports.patch +++ b/base/linuxptp/debian/patches/0003-port-Don-t-check-timestamps-from-non-slave-ports.patch @@ -1,7 +1,7 @@ From 7a507ff333c3c8046e84ca605ba4d386614c3a99 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 31 May 2021 11:07:54 +0200 -Subject: [PATCH 03/57] port: Don't check timestamps from non-slave ports. +Subject: [PATCH 03/58] port: Don't check timestamps from non-slave ports. Don't perform the sanity check on receive timestamps from ports in non-slave states to avoid false positives in the jbod mode, where diff --git a/base/linuxptp/debian/patches/0004-port-Don-t-renew-raw-transport.patch b/base/linuxptp/debian/patches/0004-port-Don-t-renew-raw-transport.patch index 69217a683..a20cc04cd 100644 --- a/base/linuxptp/debian/patches/0004-port-Don-t-renew-raw-transport.patch +++ b/base/linuxptp/debian/patches/0004-port-Don-t-renew-raw-transport.patch @@ -1,7 +1,7 @@ From ab617c7f70e8d8bc66673412a536fc1a8cf3584c Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 31 May 2021 11:07:55 +0200 -Subject: [PATCH 04/57] port: Don't renew raw transport. +Subject: [PATCH 04/58] port: Don't renew raw transport. Renewing of the transport on announce/sync timeout is needed in the client-only mode to avoid getting stuck with a broken multicast socket diff --git a/base/linuxptp/debian/patches/0005-clockcheck-Increase-minimum-interval.patch b/base/linuxptp/debian/patches/0005-clockcheck-Increase-minimum-interval.patch index 2893518ad..daf1f9a0e 100644 --- a/base/linuxptp/debian/patches/0005-clockcheck-Increase-minimum-interval.patch +++ b/base/linuxptp/debian/patches/0005-clockcheck-Increase-minimum-interval.patch @@ -1,7 +1,7 @@ From 01abb33c0851f89e4f96c757c928366df75484ab Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 31 May 2021 11:07:56 +0200 -Subject: [PATCH 05/57] clockcheck: Increase minimum interval. +Subject: [PATCH 05/58] clockcheck: Increase minimum interval. Increase the minimum check interval to 1 second to measure the frequency offset more accurately and with default configuration make false diff --git a/base/linuxptp/debian/patches/0006-Add-option-to-disable-default-port-selection-in-phc2.patch b/base/linuxptp/debian/patches/0006-Add-option-to-disable-default-port-selection-in-phc2.patch index f4710b55d..5870e4d18 100644 --- a/base/linuxptp/debian/patches/0006-Add-option-to-disable-default-port-selection-in-phc2.patch +++ b/base/linuxptp/debian/patches/0006-Add-option-to-disable-default-port-selection-in-phc2.patch @@ -1,7 +1,7 @@ From 901b4f776d7cf483e0f229eb10f78d14b9be5f17 Mon Sep 17 00:00:00 2001 From: Cole Walker Date: Wed, 23 Jun 2021 11:14:41 -0400 -Subject: [PATCH 06/57] Add option to disable default port selection in phc2sys +Subject: [PATCH 06/58] Add option to disable default port selection in phc2sys This change serves to address an issue in phc2sys where the local ptp clocks are not synced together properly if the local diff --git a/base/linuxptp/debian/patches/0007-sysoff-Change-sysoff_measure-to-return-errno.patch b/base/linuxptp/debian/patches/0007-sysoff-Change-sysoff_measure-to-return-errno.patch index ab031c83d..660850371 100644 --- a/base/linuxptp/debian/patches/0007-sysoff-Change-sysoff_measure-to-return-errno.patch +++ b/base/linuxptp/debian/patches/0007-sysoff-Change-sysoff_measure-to-return-errno.patch @@ -1,7 +1,7 @@ From 347548500e39e21037b4afea6179d5101695b28f Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 18 May 2022 11:33:35 +0200 -Subject: [PATCH 07/57] sysoff: Change sysoff_measure() to return errno. +Subject: [PATCH 07/58] sysoff: Change sysoff_measure() to return errno. Return -errno from failed ioctl instead of the SYSOFF_* enum from the measurement functions to allow the callers to check for specific errors. diff --git a/base/linuxptp/debian/patches/0008-sysoff-Change-log-level-of-ioctl-error-messages.patch b/base/linuxptp/debian/patches/0008-sysoff-Change-log-level-of-ioctl-error-messages.patch index 840e65c56..40569e3ca 100644 --- a/base/linuxptp/debian/patches/0008-sysoff-Change-log-level-of-ioctl-error-messages.patch +++ b/base/linuxptp/debian/patches/0008-sysoff-Change-log-level-of-ioctl-error-messages.patch @@ -1,7 +1,7 @@ From 583e206c66f7af8847851530daf0728f9074b3a3 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 18 May 2022 11:33:36 +0200 -Subject: [PATCH 08/57] sysoff: Change log level of ioctl error messages. +Subject: [PATCH 08/58] sysoff: Change log level of ioctl error messages. Change the log level of ioctl error messages to the error level to make them visible in default configuration, with the exception of EOPNOTSUPP diff --git a/base/linuxptp/debian/patches/0009-sysoff-Retry-on-EBUSY-when-probing-supported-ioctls.patch b/base/linuxptp/debian/patches/0009-sysoff-Retry-on-EBUSY-when-probing-supported-ioctls.patch index 305fb3426..fb54479b4 100644 --- a/base/linuxptp/debian/patches/0009-sysoff-Retry-on-EBUSY-when-probing-supported-ioctls.patch +++ b/base/linuxptp/debian/patches/0009-sysoff-Retry-on-EBUSY-when-probing-supported-ioctls.patch @@ -1,7 +1,7 @@ From c36e970db481dc1d5482386418f046f46b25f645 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 18 May 2022 11:33:37 +0200 -Subject: [PATCH 09/57] sysoff: Retry on EBUSY when probing supported ioctls. +Subject: [PATCH 09/58] sysoff: Retry on EBUSY when probing supported ioctls. Handle EBUSY when probing support for a PTP_SYS_OFFSET ioctl. Try each ioctl up to three times before giving up on it to make the detection diff --git a/base/linuxptp/debian/patches/0010-phc2sys-Don-t-exit-when-reading-of-PHC-fails-with-EB.patch b/base/linuxptp/debian/patches/0010-phc2sys-Don-t-exit-when-reading-of-PHC-fails-with-EB.patch index b1b051b27..c9e579d50 100644 --- a/base/linuxptp/debian/patches/0010-phc2sys-Don-t-exit-when-reading-of-PHC-fails-with-EB.patch +++ b/base/linuxptp/debian/patches/0010-phc2sys-Don-t-exit-when-reading-of-PHC-fails-with-EB.patch @@ -1,7 +1,7 @@ From 2df24f632e8bde2022cc2005f4a8f2cb25181ee1 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 18 May 2022 11:33:38 +0200 -Subject: [PATCH 10/57] phc2sys: Don't exit when reading of PHC fails with +Subject: [PATCH 10/58] phc2sys: Don't exit when reading of PHC fails with EBUSY. Reading of the PHC can occasionally fail with some drivers, e.g. the ice diff --git a/base/linuxptp/debian/patches/0011-phc2sys-extract-PMC-functionality-into-a-smaller-str.patch b/base/linuxptp/debian/patches/0011-phc2sys-extract-PMC-functionality-into-a-smaller-str.patch index 307efa032..19b86d7d0 100644 --- a/base/linuxptp/debian/patches/0011-phc2sys-extract-PMC-functionality-into-a-smaller-str.patch +++ b/base/linuxptp/debian/patches/0011-phc2sys-extract-PMC-functionality-into-a-smaller-str.patch @@ -1,7 +1,7 @@ From df691061d979ba6aa921b455f570365417e5700e Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 13:47:47 -0300 -Subject: [PATCH 11/57] phc2sys: extract PMC functionality into a smaller +Subject: [PATCH 11/58] phc2sys: extract PMC functionality into a smaller struct pmc_node This creates a smaller structure within phc2sys_private, which embeds diff --git a/base/linuxptp/debian/patches/0012-phc2sys-make-PMC-functions-non-static.patch b/base/linuxptp/debian/patches/0012-phc2sys-make-PMC-functions-non-static.patch index bb618c76f..8a8180754 100644 --- a/base/linuxptp/debian/patches/0012-phc2sys-make-PMC-functions-non-static.patch +++ b/base/linuxptp/debian/patches/0012-phc2sys-make-PMC-functions-non-static.patch @@ -1,7 +1,7 @@ From ab9b7dfcc503c21bce09ec4096498bc689c6a9ff Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 13:59:48 -0300 -Subject: [PATCH 12/57] phc2sys: make PMC functions non-static +Subject: [PATCH 12/58] phc2sys: make PMC functions non-static In preparation of a trivial movement of code to pmc_common.c, remove the "static" keyword from the functions that will end up there, since they diff --git a/base/linuxptp/debian/patches/0013-phc2sys-break-out-pmc-code-into-pmc_common.c.patch b/base/linuxptp/debian/patches/0013-phc2sys-break-out-pmc-code-into-pmc_common.c.patch index f2354297e..d422fa5db 100644 --- a/base/linuxptp/debian/patches/0013-phc2sys-break-out-pmc-code-into-pmc_common.c.patch +++ b/base/linuxptp/debian/patches/0013-phc2sys-break-out-pmc-code-into-pmc_common.c.patch @@ -1,7 +1,7 @@ From 6f7e16dac861cb6bc1d2063c3fb47a9e6da4dc75 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 14:34:19 -0300 -Subject: [PATCH 13/57] phc2sys: break out pmc code into pmc_common.c +Subject: [PATCH 13/58] phc2sys: break out pmc code into pmc_common.c The code through which phc2sys sends various PTP management messages to ptp4l via pmc can be reused. diff --git a/base/linuxptp/debian/patches/0014-Introduce-the-PMC-agent-module.patch b/base/linuxptp/debian/patches/0014-Introduce-the-PMC-agent-module.patch index 01a54cbb9..f938c0d10 100644 --- a/base/linuxptp/debian/patches/0014-Introduce-the-PMC-agent-module.patch +++ b/base/linuxptp/debian/patches/0014-Introduce-the-PMC-agent-module.patch @@ -1,7 +1,7 @@ From 4d8fa2e0d4ed8c0ca79ee9123d8a5963a2a13ce5 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 14:40:59 -0300 -Subject: [PATCH 14/57] Introduce the PMC agent module. +Subject: [PATCH 14/58] Introduce the PMC agent module. The logic for placing PTP management queries migrated out of phc2sys into pmc_common in order to be shared with other programs in the future. This diff --git a/base/linuxptp/debian/patches/0015-pmc_agent-Rename-pmc_node-to-something-more-descript.patch b/base/linuxptp/debian/patches/0015-pmc_agent-Rename-pmc_node-to-something-more-descript.patch index 55dd6da95..4240c6509 100644 --- a/base/linuxptp/debian/patches/0015-pmc_agent-Rename-pmc_node-to-something-more-descript.patch +++ b/base/linuxptp/debian/patches/0015-pmc_agent-Rename-pmc_node-to-something-more-descript.patch @@ -1,7 +1,7 @@ From 77a246c6d6a865f11fe2fac14cdc9fa2746a06a2 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 14:47:36 -0300 -Subject: [PATCH 15/57] pmc_agent: Rename pmc_node to something more +Subject: [PATCH 15/58] pmc_agent: Rename pmc_node to something more descriptive. Signed-off-by: Richard Cochran diff --git a/base/linuxptp/debian/patches/0016-pmc_agent-Hide-the-implementation.patch b/base/linuxptp/debian/patches/0016-pmc_agent-Hide-the-implementation.patch index 40bfa0374..7a3021fce 100644 --- a/base/linuxptp/debian/patches/0016-pmc_agent-Hide-the-implementation.patch +++ b/base/linuxptp/debian/patches/0016-pmc_agent-Hide-the-implementation.patch @@ -1,7 +1,7 @@ From f6de4c4e2c1ae6d9762778baf18031fc42251657 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 14:55:29 -0300 -Subject: [PATCH 16/57] pmc_agent: Hide the implementation. +Subject: [PATCH 16/58] pmc_agent: Hide the implementation. The PMC agent's implementation should not be exposed to its users. This patch hides the details and provides a method to create an instance. In diff --git a/base/linuxptp/debian/patches/0017-Find-a-better-home-for-the-management-TLV-ID-helper-.patch b/base/linuxptp/debian/patches/0017-Find-a-better-home-for-the-management-TLV-ID-helper-.patch index 944fd8020..968b6f16b 100644 --- a/base/linuxptp/debian/patches/0017-Find-a-better-home-for-the-management-TLV-ID-helper-.patch +++ b/base/linuxptp/debian/patches/0017-Find-a-better-home-for-the-management-TLV-ID-helper-.patch @@ -1,7 +1,7 @@ From 8946d8e8eba908a213ba46844d697d7ff26e9bb6 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 14:58:09 -0300 -Subject: [PATCH 17/57] Find a better home for the management TLV ID helper +Subject: [PATCH 17/58] Find a better home for the management TLV ID helper function. Signed-off-by: Richard Cochran diff --git a/base/linuxptp/debian/patches/0018-Find-a-better-home-for-the-management-TLV-data-helpe.patch b/base/linuxptp/debian/patches/0018-Find-a-better-home-for-the-management-TLV-data-helpe.patch index 9b43b9660..360902b46 100644 --- a/base/linuxptp/debian/patches/0018-Find-a-better-home-for-the-management-TLV-data-helpe.patch +++ b/base/linuxptp/debian/patches/0018-Find-a-better-home-for-the-management-TLV-data-helpe.patch @@ -1,7 +1,7 @@ From cd72c765ee2acc49ca5b78cd0e2c9659f456434c Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 14:59:57 -0300 -Subject: [PATCH 18/57] Find a better home for the management TLV data helper +Subject: [PATCH 18/58] Find a better home for the management TLV data helper function. Signed-off-by: Richard Cochran diff --git a/base/linuxptp/debian/patches/0019-Introduce-error-codes-for-the-run_pmc-method.patch b/base/linuxptp/debian/patches/0019-Introduce-error-codes-for-the-run_pmc-method.patch index 91da73b9a..45d9645d7 100644 --- a/base/linuxptp/debian/patches/0019-Introduce-error-codes-for-the-run_pmc-method.patch +++ b/base/linuxptp/debian/patches/0019-Introduce-error-codes-for-the-run_pmc-method.patch @@ -1,7 +1,7 @@ From d798a871a0b27a953a80afa7b696a44cd8a93fdf Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 15:04:11 -0300 -Subject: [PATCH 19/57] Introduce error codes for the run_pmc method. +Subject: [PATCH 19/58] Introduce error codes for the run_pmc method. The run_pmc function is used by several of the PMC agent methods, but it breaks the pattern of returning zero on success. However, the user facing diff --git a/base/linuxptp/debian/patches/0020-pmc_agent-Convert-the-subscribe-method-into-the-cano.patch b/base/linuxptp/debian/patches/0020-pmc_agent-Convert-the-subscribe-method-into-the-cano.patch index 0e39e05e8..4abfc62d4 100644 --- a/base/linuxptp/debian/patches/0020-pmc_agent-Convert-the-subscribe-method-into-the-cano.patch +++ b/base/linuxptp/debian/patches/0020-pmc_agent-Convert-the-subscribe-method-into-the-cano.patch @@ -1,7 +1,7 @@ From 479301925d24906f03b13821ee8bd6cafb58c8c5 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 15:08:01 -0300 -Subject: [PATCH 20/57] pmc_agent: Convert the subscribe method into the +Subject: [PATCH 20/58] pmc_agent: Convert the subscribe method into the canonical form. This patch renames the function to have the module prefix and corrects the diff --git a/base/linuxptp/debian/patches/0021-pmc_agent-Simplify-the-update-method.patch b/base/linuxptp/debian/patches/0021-pmc_agent-Simplify-the-update-method.patch index b081b489c..d38aad97d 100644 --- a/base/linuxptp/debian/patches/0021-pmc_agent-Simplify-the-update-method.patch +++ b/base/linuxptp/debian/patches/0021-pmc_agent-Simplify-the-update-method.patch @@ -1,7 +1,7 @@ From f221d3e5b7d5ebac532a1d02f0cfb74fda6a237c Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 15:17:26 -0300 -Subject: [PATCH 21/57] pmc_agent: Simplify the update method. +Subject: [PATCH 21/58] pmc_agent: Simplify the update method. The main method that causes the PMC agent to update its status takes a flag that results in different behavior when push notifications are active. diff --git a/base/linuxptp/debian/patches/0022-pmc_agent-Simplify-logic-in-update-method.patch b/base/linuxptp/debian/patches/0022-pmc_agent-Simplify-logic-in-update-method.patch index 5e295ebc3..384a839e7 100644 --- a/base/linuxptp/debian/patches/0022-pmc_agent-Simplify-logic-in-update-method.patch +++ b/base/linuxptp/debian/patches/0022-pmc_agent-Simplify-logic-in-update-method.patch @@ -1,7 +1,7 @@ From f692885fbb0e1a1a379314b08d3108c1e54d3f4f Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 15:18:36 -0300 -Subject: [PATCH 22/57] pmc_agent: Simplify logic in update method. +Subject: [PATCH 22/58] pmc_agent: Simplify logic in update method. If the pmc pointer is not set, then there is no need to read the time only to later discard the result. This patch simplifies the flow by returning diff --git a/base/linuxptp/debian/patches/0023-pmc_agent-Remove-bogus-comparison-between-last-updat.patch b/base/linuxptp/debian/patches/0023-pmc_agent-Remove-bogus-comparison-between-last-updat.patch index b7ec7c2a7..60b918d3a 100644 --- a/base/linuxptp/debian/patches/0023-pmc_agent-Remove-bogus-comparison-between-last-updat.patch +++ b/base/linuxptp/debian/patches/0023-pmc_agent-Remove-bogus-comparison-between-last-updat.patch @@ -1,7 +1,7 @@ From 20cb57a86671fd1e60479de9e6ac0a5586ad5acd Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 15:33:43 -0300 -Subject: [PATCH 23/57] pmc_agent: Remove bogus comparison between last update +Subject: [PATCH 23/58] pmc_agent: Remove bogus comparison between last update and now. The monotonic clock can never go backwards. If you take T1 and later T2 diff --git a/base/linuxptp/debian/patches/0024-pmc_agent-Perform-time-comparison-using-positive-log.patch b/base/linuxptp/debian/patches/0024-pmc_agent-Perform-time-comparison-using-positive-log.patch index bf67faba8..fa4ea5e30 100644 --- a/base/linuxptp/debian/patches/0024-pmc_agent-Perform-time-comparison-using-positive-log.patch +++ b/base/linuxptp/debian/patches/0024-pmc_agent-Perform-time-comparison-using-positive-log.patch @@ -1,7 +1,7 @@ From 4321cff2b53512d4027bc096bdef5df2610b18cf Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 15:35:23 -0300 -Subject: [PATCH 24/57] pmc_agent: Perform time comparison using positive +Subject: [PATCH 24/58] pmc_agent: Perform time comparison using positive logic. In the update_pmc_node() method, reduce the expression diff --git a/base/linuxptp/debian/patches/0025-pmc_agent-Rename-the-update-method-and-attempt-to-do.patch b/base/linuxptp/debian/patches/0025-pmc_agent-Rename-the-update-method-and-attempt-to-do.patch index 958232869..889236583 100644 --- a/base/linuxptp/debian/patches/0025-pmc_agent-Rename-the-update-method-and-attempt-to-do.patch +++ b/base/linuxptp/debian/patches/0025-pmc_agent-Rename-the-update-method-and-attempt-to-do.patch @@ -1,7 +1,7 @@ From 9136345c69038a22d9b548863fb6afe64e54958d Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 15:36:38 -0300 -Subject: [PATCH 25/57] pmc_agent: Rename the update method and attempt to +Subject: [PATCH 25/58] pmc_agent: Rename the update method and attempt to document it. This patch renames the function to have the module prefix and tries to diff --git a/base/linuxptp/debian/patches/0026-phc2sys-Fix-null-pointer-de-reference-in-manual-mode.patch b/base/linuxptp/debian/patches/0026-phc2sys-Fix-null-pointer-de-reference-in-manual-mode.patch index 0af294096..982756a06 100644 --- a/base/linuxptp/debian/patches/0026-phc2sys-Fix-null-pointer-de-reference-in-manual-mode.patch +++ b/base/linuxptp/debian/patches/0026-phc2sys-Fix-null-pointer-de-reference-in-manual-mode.patch @@ -1,7 +1,7 @@ From 95d2fad84edea1397f3484e6570bcbb29509bacd Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 15:37:46 -0300 -Subject: [PATCH 26/57] phc2sys: Fix null pointer de-reference in manual mode. +Subject: [PATCH 26/58] phc2sys: Fix null pointer de-reference in manual mode. If both the -w and -O command line options are specified (or when using -w when both source and destination clocks are PHCs), then diff --git a/base/linuxptp/debian/patches/0027-pmc_agent-Convert-the-method-that-queries-TAI-UTC-of.patch b/base/linuxptp/debian/patches/0027-pmc_agent-Convert-the-method-that-queries-TAI-UTC-of.patch index 5182837ba..a2aea2c1d 100644 --- a/base/linuxptp/debian/patches/0027-pmc_agent-Convert-the-method-that-queries-TAI-UTC-of.patch +++ b/base/linuxptp/debian/patches/0027-pmc_agent-Convert-the-method-that-queries-TAI-UTC-of.patch @@ -1,7 +1,7 @@ From 4f37561dad0e8b163691f68cfd101e798d39248a Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 17:20:04 -0300 -Subject: [PATCH 27/57] pmc_agent: Convert the method that queries TAI-UTC +Subject: [PATCH 27/58] pmc_agent: Convert the method that queries TAI-UTC offset into the canonical form. This patch renames the function to have the module prefix and corrects the diff --git a/base/linuxptp/debian/patches/0028-pmc_agent-Convert-the-method-that-queries-the-port-p.patch b/base/linuxptp/debian/patches/0028-pmc_agent-Convert-the-method-that-queries-the-port-p.patch index dd5543c6f..67bc85f61 100644 --- a/base/linuxptp/debian/patches/0028-pmc_agent-Convert-the-method-that-queries-the-port-p.patch +++ b/base/linuxptp/debian/patches/0028-pmc_agent-Convert-the-method-that-queries-the-port-p.patch @@ -1,7 +1,7 @@ From b469ea325783cfe906bd7e28e63a7eb26b4cad96 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 17:23:29 -0300 -Subject: [PATCH 28/57] pmc_agent: Convert the method that queries the port +Subject: [PATCH 28/58] pmc_agent: Convert the method that queries the port properties. Prefix the function with the module name and correct the return code diff --git a/base/linuxptp/debian/patches/0029-pmc_agent-Generalize-the-method-that-queries-the-loc.patch b/base/linuxptp/debian/patches/0029-pmc_agent-Generalize-the-method-that-queries-the-loc.patch index 64bfc90b6..14b377b1a 100644 --- a/base/linuxptp/debian/patches/0029-pmc_agent-Generalize-the-method-that-queries-the-loc.patch +++ b/base/linuxptp/debian/patches/0029-pmc_agent-Generalize-the-method-that-queries-the-loc.patch @@ -1,7 +1,7 @@ From adb2a1eeb1083c72b4ae8d0c987a1bcbc64f2434 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 17:29:30 -0300 -Subject: [PATCH 29/57] pmc_agent: Generalize the method that queries the local +Subject: [PATCH 29/58] pmc_agent: Generalize the method that queries the local clock identity. When started in automatic mode, the phc2sys program first queries the diff --git a/base/linuxptp/debian/patches/0030-pmc_agent-Simplify-the-method-that-gets-of-the-numbe.patch b/base/linuxptp/debian/patches/0030-pmc_agent-Simplify-the-method-that-gets-of-the-numbe.patch index bb6558372..f1849e4a5 100644 --- a/base/linuxptp/debian/patches/0030-pmc_agent-Simplify-the-method-that-gets-of-the-numbe.patch +++ b/base/linuxptp/debian/patches/0030-pmc_agent-Simplify-the-method-that-gets-of-the-numbe.patch @@ -1,7 +1,7 @@ From 7acbb86b5d95709a6d87b898df5783c25fbb2d26 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 17:30:57 -0300 -Subject: [PATCH 30/57] pmc_agent: Simplify the method that gets of the number +Subject: [PATCH 30/58] pmc_agent: Simplify the method that gets of the number of local ports. The number of ports is already available in the cached default data diff --git a/base/linuxptp/debian/patches/0031-pmc_agent-Let-the-update-method-poll-for-push-events.patch b/base/linuxptp/debian/patches/0031-pmc_agent-Let-the-update-method-poll-for-push-events.patch index 84a1e960b..ac11e4b9a 100644 --- a/base/linuxptp/debian/patches/0031-pmc_agent-Let-the-update-method-poll-for-push-events.patch +++ b/base/linuxptp/debian/patches/0031-pmc_agent-Let-the-update-method-poll-for-push-events.patch @@ -1,7 +1,7 @@ From 25d6be54bba7b2e9871da9700103a483ff355892 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 17:32:27 -0300 -Subject: [PATCH 31/57] pmc_agent: Let the update method poll for push events. +Subject: [PATCH 31/58] pmc_agent: Let the update method poll for push events. Signed-off-by: Richard Cochran diff --git a/base/linuxptp/debian/patches/0032-phc2sys-Fix-regression-in-the-automatic-mode.patch b/base/linuxptp/debian/patches/0032-phc2sys-Fix-regression-in-the-automatic-mode.patch index 8e914f07c..800a9bcf9 100644 --- a/base/linuxptp/debian/patches/0032-phc2sys-Fix-regression-in-the-automatic-mode.patch +++ b/base/linuxptp/debian/patches/0032-phc2sys-Fix-regression-in-the-automatic-mode.patch @@ -1,7 +1,7 @@ From fdccd5ec965dee65d021eba76a1e75d28197be02 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 17:51:10 -0300 -Subject: [PATCH 32/57] phc2sys: Fix regression in the automatic mode. +Subject: [PATCH 32/58] phc2sys: Fix regression in the automatic mode. Commit ac7d69bbc476 ("pmc_agent: Convert the method that queries the port properties.") had the well meant intention of the cleaning up the diff --git a/base/linuxptp/debian/patches/0033-Implement-push-notification-for-TIME_STATUS_NP.patch b/base/linuxptp/debian/patches/0033-Implement-push-notification-for-TIME_STATUS_NP.patch index 4bf5d2bfa..9dc99458d 100644 --- a/base/linuxptp/debian/patches/0033-Implement-push-notification-for-TIME_STATUS_NP.patch +++ b/base/linuxptp/debian/patches/0033-Implement-push-notification-for-TIME_STATUS_NP.patch @@ -1,7 +1,7 @@ From 844bd2a0cb524079e5878cbdd7b24b1539970aaa Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 17:57:11 -0300 -Subject: [PATCH 33/57] Implement push notification for TIME_STATUS_NP +Subject: [PATCH 33/58] Implement push notification for TIME_STATUS_NP Subscribers to NOTIFY_TIME_SYNC will be notified on every clock synchronization. diff --git a/base/linuxptp/debian/patches/0034-clock-Rename-UDS-variables-to-read-write.patch b/base/linuxptp/debian/patches/0034-clock-Rename-UDS-variables-to-read-write.patch index f480399d5..65026ce73 100644 --- a/base/linuxptp/debian/patches/0034-clock-Rename-UDS-variables-to-read-write.patch +++ b/base/linuxptp/debian/patches/0034-clock-Rename-UDS-variables-to-read-write.patch @@ -1,7 +1,7 @@ From 2a1a37e5617f9db8b7da67b87544afee2096cf69 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 18:16:31 -0300 -Subject: [PATCH 34/57] clock: Rename UDS variables to read-write. +Subject: [PATCH 34/58] clock: Rename UDS variables to read-write. In preparation for a new read-only UDS port, rename variables of the current UDS port to make it clear it is read-write, as opposed to diff --git a/base/linuxptp/debian/patches/0035-clock-Add-read-only-UDS-port-for-monitoring.patch b/base/linuxptp/debian/patches/0035-clock-Add-read-only-UDS-port-for-monitoring.patch index 3440c02d7..398dd5150 100644 --- a/base/linuxptp/debian/patches/0035-clock-Add-read-only-UDS-port-for-monitoring.patch +++ b/base/linuxptp/debian/patches/0035-clock-Add-read-only-UDS-port-for-monitoring.patch @@ -1,7 +1,7 @@ From c0f92de7977b4e11870865eabdb1b7d0b8a9d725 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 18:18:29 -0300 -Subject: [PATCH 35/57] clock: Add read-only UDS port for monitoring. +Subject: [PATCH 35/58] clock: Add read-only UDS port for monitoring. Add a second UDS port to allow untrusted applications to monitor ptp4l. On this "read-only" UDS port disable non-GET actions and forwarding. diff --git a/base/linuxptp/debian/patches/0036-Rename-management-ID-macros.patch b/base/linuxptp/debian/patches/0036-Rename-management-ID-macros.patch index 8d8182140..dd2375235 100644 --- a/base/linuxptp/debian/patches/0036-Rename-management-ID-macros.patch +++ b/base/linuxptp/debian/patches/0036-Rename-management-ID-macros.patch @@ -1,7 +1,7 @@ From 8307227fcd921d1025361d0c345b491258f9d190 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 12 Jun 2023 18:20:50 -0300 -Subject: [PATCH 36/57] Rename management ID macros. +Subject: [PATCH 36/58] Rename management ID macros. The management ID macros are prefixed with TLV. This is confusing, because the true TLV tags have the same prefix. Make the code more diff --git a/base/linuxptp/debian/patches/0037-Enhance-phc2sys-to-accept-multiple-ptp4l-inputs.patch b/base/linuxptp/debian/patches/0037-Enhance-phc2sys-to-accept-multiple-ptp4l-inputs.patch index 653bcff10..25b12105d 100644 --- a/base/linuxptp/debian/patches/0037-Enhance-phc2sys-to-accept-multiple-ptp4l-inputs.patch +++ b/base/linuxptp/debian/patches/0037-Enhance-phc2sys-to-accept-multiple-ptp4l-inputs.patch @@ -1,7 +1,7 @@ From 644c90c0e341624e55ef49ab5b4c5a4d4008f63d Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Sun, 18 Jun 2023 20:58:34 -0300 -Subject: [PATCH 37/57] Enhance phc2sys to accept multiple ptp4l inputs +Subject: [PATCH 37/58] Enhance phc2sys to accept multiple ptp4l inputs A new configuration option called ha_enabled was created. When it is set 1 multiple ptp4l inputs are accepted and the high availability algorithms diff --git a/base/linuxptp/debian/patches/0038-Best-source-selection-algorithm.patch b/base/linuxptp/debian/patches/0038-Best-source-selection-algorithm.patch index 0bddbc987..6f4077c5d 100644 --- a/base/linuxptp/debian/patches/0038-Best-source-selection-algorithm.patch +++ b/base/linuxptp/debian/patches/0038-Best-source-selection-algorithm.patch @@ -1,7 +1,7 @@ From c2dedaa40232ac3df88df6774d249e687f2f4e16 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Tue, 4 Jul 2023 17:27:50 -0300 -Subject: [PATCH 38/57] Best source selection algorithm +Subject: [PATCH 38/58] Best source selection algorithm An algorithm to select the best available clock and use it as clock source. diff --git a/base/linuxptp/debian/patches/0039-Select-best-source-clock-after-state-changes.patch b/base/linuxptp/debian/patches/0039-Select-best-source-clock-after-state-changes.patch index 50943e000..eafce0c7d 100644 --- a/base/linuxptp/debian/patches/0039-Select-best-source-clock-after-state-changes.patch +++ b/base/linuxptp/debian/patches/0039-Select-best-source-clock-after-state-changes.patch @@ -1,7 +1,7 @@ From a7ecd33822f5d76918ccc0148249b7fdb05d11da Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Sat, 8 Jul 2023 19:02:50 -0300 -Subject: [PATCH 39/57] Select best source clock after state changes +Subject: [PATCH 39/58] Select best source clock after state changes During operation, the clock states might change and require a new clock to be selected. For example, the local clock class of the current active diff --git a/base/linuxptp/debian/patches/0040-Forced-lock-a-clock-source-in-configuration.patch b/base/linuxptp/debian/patches/0040-Forced-lock-a-clock-source-in-configuration.patch index c32be0568..ad5ab07b6 100644 --- a/base/linuxptp/debian/patches/0040-Forced-lock-a-clock-source-in-configuration.patch +++ b/base/linuxptp/debian/patches/0040-Forced-lock-a-clock-source-in-configuration.patch @@ -1,7 +1,7 @@ From e269f17d01c324e70fb3ef8b8e88c0e57ac78eb1 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Wed, 26 Jul 2023 15:08:15 -0300 -Subject: [PATCH 40/57] Forced lock a clock source in configuration +Subject: [PATCH 40/58] Forced lock a clock source in configuration To help on maintenance and debuging tasks was implemented a configuration to forced lock to a single clock. It disables the automatic clock diff --git a/base/linuxptp/debian/patches/0041-HA-phc2sys-com-socket.patch b/base/linuxptp/debian/patches/0041-HA-phc2sys-com-socket.patch index 29869531d..0f1cf7b87 100644 --- a/base/linuxptp/debian/patches/0041-HA-phc2sys-com-socket.patch +++ b/base/linuxptp/debian/patches/0041-HA-phc2sys-com-socket.patch @@ -1,7 +1,7 @@ From bf767f48955399f27294d15e8f14a1ab0f3223bd Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Thu, 27 Jul 2023 14:22:47 -0300 -Subject: [PATCH 41/57] HA phc2sys com socket +Subject: [PATCH 41/58] HA phc2sys com socket A new communication path was created to retrieve status and to control the high availability algorithm. diff --git a/base/linuxptp/debian/patches/0042-Commands-enable-lock-and-disable-lock.patch b/base/linuxptp/debian/patches/0042-Commands-enable-lock-and-disable-lock.patch index 2231c9701..4457cd80e 100644 --- a/base/linuxptp/debian/patches/0042-Commands-enable-lock-and-disable-lock.patch +++ b/base/linuxptp/debian/patches/0042-Commands-enable-lock-and-disable-lock.patch @@ -1,7 +1,7 @@ From 509fb3bfe38d8fafc6d4d14855d34bb985a15493 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Fri, 4 Aug 2023 15:44:12 -0300 -Subject: [PATCH 42/57] Commands 'enable lock' and 'disable lock. +Subject: [PATCH 42/58] Commands 'enable lock' and 'disable lock. The 'enable lock' command is used to lock to a single clock source and disable the HA clock selection algorithm. The diff --git a/base/linuxptp/debian/patches/0043-Commands-enable-source-and-disable-source.patch b/base/linuxptp/debian/patches/0043-Commands-enable-source-and-disable-source.patch index 275f2b679..12ff88d62 100644 --- a/base/linuxptp/debian/patches/0043-Commands-enable-source-and-disable-source.patch +++ b/base/linuxptp/debian/patches/0043-Commands-enable-source-and-disable-source.patch @@ -1,7 +1,7 @@ From 6323af225d205564a16fefefda9674feaf53ead5 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Fri, 4 Aug 2023 19:01:57 -0300 -Subject: [PATCH 43/57] Commands 'enable source' and 'disable source'. +Subject: [PATCH 43/58] Commands 'enable source' and 'disable source'. These commands controls the list of clocks available to clock selection algorithm. diff --git a/base/linuxptp/debian/patches/0044-Stream-type-phc2sys-com-socket.patch b/base/linuxptp/debian/patches/0044-Stream-type-phc2sys-com-socket.patch index 3a7efd347..ebf377ce3 100644 --- a/base/linuxptp/debian/patches/0044-Stream-type-phc2sys-com-socket.patch +++ b/base/linuxptp/debian/patches/0044-Stream-type-phc2sys-com-socket.patch @@ -1,7 +1,7 @@ From 6384ddb80bf82998d058f61adc4350c88820fe5a Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 7 Aug 2023 14:55:12 -0300 -Subject: [PATCH 44/57] Stream type phc2sys com socket +Subject: [PATCH 44/58] Stream type phc2sys com socket The type of the socket was changed from datagram to stream. diff --git a/base/linuxptp/debian/patches/0045-Functions-starts_with-and-str_at_column.patch b/base/linuxptp/debian/patches/0045-Functions-starts_with-and-str_at_column.patch index 7800950a0..ae4774f06 100644 --- a/base/linuxptp/debian/patches/0045-Functions-starts_with-and-str_at_column.patch +++ b/base/linuxptp/debian/patches/0045-Functions-starts_with-and-str_at_column.patch @@ -1,7 +1,7 @@ From 1c518663448b8c8aaf914151f54b860bd946cea4 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Tue, 8 Aug 2023 13:10:50 -0300 -Subject: [PATCH 45/57] Functions starts_with and str_at_column +Subject: [PATCH 45/58] Functions starts_with and str_at_column Renaming starts_with and str_at_column functions to match ptp4l code style. diff --git a/base/linuxptp/debian/patches/0046-Robustness-improvements-to-phc2sys-socket.patch b/base/linuxptp/debian/patches/0046-Robustness-improvements-to-phc2sys-socket.patch index 7f5c1e4c2..5c08b05f6 100644 --- a/base/linuxptp/debian/patches/0046-Robustness-improvements-to-phc2sys-socket.patch +++ b/base/linuxptp/debian/patches/0046-Robustness-improvements-to-phc2sys-socket.patch @@ -1,7 +1,7 @@ From d14df9d1f0b239c2a5fbe587875448a2d10b12a6 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Tue, 8 Aug 2023 14:06:55 -0300 -Subject: [PATCH 46/57] Robustness improvements to phc2sys socket +Subject: [PATCH 46/58] Robustness improvements to phc2sys socket When phc2sys abnormally exits the socket file might remain created. To avoid error when phc2sys is relaunched, the exixting file is diff --git a/base/linuxptp/debian/patches/0047-phc2sys-without-w-option.patch b/base/linuxptp/debian/patches/0047-phc2sys-without-w-option.patch index d38f741da..981a8efcc 100644 --- a/base/linuxptp/debian/patches/0047-phc2sys-without-w-option.patch +++ b/base/linuxptp/debian/patches/0047-phc2sys-without-w-option.patch @@ -1,7 +1,7 @@ From c20f9c9b992b7ecf0f5d2ac9f137b369352bbba2 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 7 Aug 2023 18:19:37 -0300 -Subject: [PATCH 47/57] phc2sys without -w option. +Subject: [PATCH 47/58] phc2sys without -w option. Fix bad clock and pmc initialization when -w command argument is not provided. diff --git a/base/linuxptp/debian/patches/0048-HA-domain-number.patch b/base/linuxptp/debian/patches/0048-HA-domain-number.patch index cc2dba2cd..1cdf1ce15 100644 --- a/base/linuxptp/debian/patches/0048-HA-domain-number.patch +++ b/base/linuxptp/debian/patches/0048-HA-domain-number.patch @@ -1,7 +1,7 @@ From 2b78be90379bf767961bec1b3f99462c54036cbf Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 21 Aug 2023 14:28:20 -0300 -Subject: [PATCH 48/57] HA domain number +Subject: [PATCH 48/58] HA domain number Support multiple domain numbers for each uds socket used in HA phc2sys. diff --git a/base/linuxptp/debian/patches/0049-GM-clock-accuracy-and-offset-scaled-log-variance.patch b/base/linuxptp/debian/patches/0049-GM-clock-accuracy-and-offset-scaled-log-variance.patch index 0d2201c48..c4e1fd489 100644 --- a/base/linuxptp/debian/patches/0049-GM-clock-accuracy-and-offset-scaled-log-variance.patch +++ b/base/linuxptp/debian/patches/0049-GM-clock-accuracy-and-offset-scaled-log-variance.patch @@ -1,7 +1,7 @@ From afb5e76b98d7528bb36b860f9f0a6a8f04b094f8 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Wed, 23 Aug 2023 19:18:08 -0300 -Subject: [PATCH 49/57] GM clock accuracy and offset scaled log variance +Subject: [PATCH 49/58] GM clock accuracy and offset scaled log variance Include GM clock quality parameters clock accuracy and offset scaled log variance to the clock selection algorithm. Those diff --git a/base/linuxptp/debian/patches/0050-Select-matching-requirements-clock-if-active-doesn-t.patch b/base/linuxptp/debian/patches/0050-Select-matching-requirements-clock-if-active-doesn-t.patch index f3bb3e06c..28bd1e824 100644 --- a/base/linuxptp/debian/patches/0050-Select-matching-requirements-clock-if-active-doesn-t.patch +++ b/base/linuxptp/debian/patches/0050-Select-matching-requirements-clock-if-active-doesn-t.patch @@ -1,7 +1,7 @@ From 0d36e8812291f5912d7344ff894976715baba53b Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Tue, 29 Aug 2023 19:06:23 -0300 -Subject: [PATCH 50/57] Select matching requirements clock if active doesn't +Subject: [PATCH 50/58] Select matching requirements clock if active doesn't match them Fix clock selection algorithm behavior where a clock source starts diff --git a/base/linuxptp/debian/patches/0051-Time-traceable-flag.patch b/base/linuxptp/debian/patches/0051-Time-traceable-flag.patch index a730a450c..e8ee090a4 100644 --- a/base/linuxptp/debian/patches/0051-Time-traceable-flag.patch +++ b/base/linuxptp/debian/patches/0051-Time-traceable-flag.patch @@ -1,7 +1,7 @@ From 9ecbddcccbeadabb8cef295dd540dadc26f03d5b Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Wed, 30 Aug 2023 13:28:34 -0300 -Subject: [PATCH 51/57] Time traceable flag +Subject: [PATCH 51/58] Time traceable flag A new time traceable flag was added to pmc agent to store the current time traceable status. diff --git a/base/linuxptp/debian/patches/0052-Command-valid-sources.patch b/base/linuxptp/debian/patches/0052-Command-valid-sources.patch index 16053e252..6c1bc1552 100644 --- a/base/linuxptp/debian/patches/0052-Command-valid-sources.patch +++ b/base/linuxptp/debian/patches/0052-Command-valid-sources.patch @@ -1,7 +1,7 @@ From 2f4339ab555fdd90d5c5fd11296d5c17b19c37e3 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Wed, 30 Aug 2023 15:43:42 -0300 -Subject: [PATCH 52/57] Command 'valid sources' +Subject: [PATCH 52/58] Command 'valid sources' The 'valid sources' command is used to get a list of interfaces which the clock is matching the requirements. The response contains a space diff --git a/base/linuxptp/debian/patches/0053-GM-time-traceable-check-enabled-by-default.patch b/base/linuxptp/debian/patches/0053-GM-time-traceable-check-enabled-by-default.patch index 001f01562..c90503f62 100644 --- a/base/linuxptp/debian/patches/0053-GM-time-traceable-check-enabled-by-default.patch +++ b/base/linuxptp/debian/patches/0053-GM-time-traceable-check-enabled-by-default.patch @@ -1,7 +1,7 @@ From 76f07fac7536b525b74858dacc3e37f28583c703 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Thu, 31 Aug 2023 12:36:02 -0300 -Subject: [PATCH 53/57] GM time traceable check enabled by default +Subject: [PATCH 53/58] GM time traceable check enabled by default Now the GM time traceable check is enabled by default as it is an important check for both T-GM and T-BC scenarios. diff --git a/base/linuxptp/debian/patches/0054-Disable-active-interface-failing.patch b/base/linuxptp/debian/patches/0054-Disable-active-interface-failing.patch index b4ec4cdf9..ce929345c 100644 --- a/base/linuxptp/debian/patches/0054-Disable-active-interface-failing.patch +++ b/base/linuxptp/debian/patches/0054-Disable-active-interface-failing.patch @@ -1,7 +1,7 @@ From d43854295382f20697ffb067dde9b6f8d610d1f9 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Thu, 31 Aug 2023 16:05:15 -0300 -Subject: [PATCH 54/57] Disable active interface failing +Subject: [PATCH 54/58] Disable active interface failing Fixed the behavior when none clock is matching the requirements and the active clock source is disabled using the 'disable source ' diff --git a/base/linuxptp/debian/patches/0055-Ignore-interface-in-conf-file-when-HA-is-disabled.patch b/base/linuxptp/debian/patches/0055-Ignore-interface-in-conf-file-when-HA-is-disabled.patch index 5894bff18..4cdc06bf8 100644 --- a/base/linuxptp/debian/patches/0055-Ignore-interface-in-conf-file-when-HA-is-disabled.patch +++ b/base/linuxptp/debian/patches/0055-Ignore-interface-in-conf-file-when-HA-is-disabled.patch @@ -1,7 +1,7 @@ From a61444e795236013bfca2e45100a45e14f0474c9 Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Thu, 4 Jan 2024 13:27:09 -0300 -Subject: [PATCH 55/57] Ignore interface in conf file when HA is disabled +Subject: [PATCH 55/58] Ignore interface in conf file when HA is disabled Fixed the behavior when HA is disabled, one interface has been configured and '-a' autoconfiguration option is enabled. The behavior before HA feature was diff --git a/base/linuxptp/debian/patches/0056-Fixed-event-port-id-map.patch b/base/linuxptp/debian/patches/0056-Fixed-event-port-id-map.patch index 1290a9701..60123ac44 100644 --- a/base/linuxptp/debian/patches/0056-Fixed-event-port-id-map.patch +++ b/base/linuxptp/debian/patches/0056-Fixed-event-port-id-map.patch @@ -1,7 +1,7 @@ From adfe866226b758f789a3127447d37e19f442311f Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Mon, 15 Jan 2024 16:19:59 -0300 -Subject: [PATCH 56/57] Fixed event port id map +Subject: [PATCH 56/58] Fixed event port id map Fixed the port id map in the Port Data Set event handling. The port id is composed by port number and node index after the HA implementation. diff --git a/base/linuxptp/debian/patches/0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch b/base/linuxptp/debian/patches/0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch index 146308c27..82c39d1d8 100644 --- a/base/linuxptp/debian/patches/0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch +++ b/base/linuxptp/debian/patches/0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch @@ -1,7 +1,7 @@ From 8dd4e2b6c8b99952296319a0e0c0e0f3e6160e32 Mon Sep 17 00:00:00 2001 From: cwalker Date: Fri, 1 Mar 2024 17:50:29 +0000 -Subject: [PATCH 57/57] Fix uninitialized variable in nmea_scan_rmc +Subject: [PATCH 57/58] Fix uninitialized variable in nmea_scan_rmc Initialize the tm_isdst variable to ensure that mktime does not fail on recent versions of glibc. diff --git a/base/linuxptp/debian/patches/0058-ts2phc-skip-updates-after-offset-spike.patch b/base/linuxptp/debian/patches/0058-ts2phc-skip-updates-after-offset-spike.patch new file mode 100644 index 000000000..e235cb81a --- /dev/null +++ b/base/linuxptp/debian/patches/0058-ts2phc-skip-updates-after-offset-spike.patch @@ -0,0 +1,140 @@ +From 0cb3bd52e6dd3680aa900045d3c837d1098d8da8 Mon Sep 17 00:00:00 2001 +From: cwalker +Date: Tue, 20 Feb 2024 17:25:17 +0000 +Subject: [PATCH 58/58] Implement logic to skip updates with offset spike. + +This change allows ts2phc to be configured to ignore timing updates that +have a large offset spike in order to mitigate the resulting timing +skew. + +In some circumstances on realtime systems with high CPU load, the +timestamp consumed by ts2phc can be delayed in reaching ts2phc and +results in the offset calculation attempting to speed the clock up by a +large margin. + +This change causes ts2phc to ignore updates that would greatly skew the +clock when ts2phc is already in a synchronized state. + +The global configuration option "max_phc_update_skip_cnt" is provided to +allow users to specify how many consecutive offset spike incidents will +be ignored before adjusting the clock. The default value is 120. The +behaviour can be disabled by setting max_phc_update_skip_cnt to 0. + +This code is ported from a proposed upstream patch found here: +https://sourceforge.net/p/linuxptp/mailman/message/44114092/ + +Signed-off-by: cwalker +--- + config.c | 1 + + ts2phc.c | 3 +++ + ts2phc_slave.c | 26 ++++++++++++++++++++++++-- + 3 files changed, 28 insertions(+), 2 deletions(-) +diff --git a/config.c b/config.c +index ef17463..b53d8f4 100644 +--- a/config.c ++++ b/config.c +@@ -347,6 +347,7 @@ struct config_item config_tab[] = { + GLOB_ITEM_INT("verbose", 0, 0, 1), + GLOB_ITEM_INT("write_phase_mode", 0, 0, 1), + GLOB_ITEM_INT("default_sync", 1, 0, 1), ++ PORT_ITEM_INT("max_phc_update_skip_cnt", 120, 0, 14400), + }; + + static struct unicast_master_table *current_uc_mtab; +diff --git a/ts2phc.c b/ts2phc.c +index 2342858..a59dc5f 100644 +--- a/ts2phc.c ++++ b/ts2phc.c +@@ -15,6 +15,8 @@ + #include "ts2phc_slave.h" + #include "version.h" + ++int max_phc_update_skip_count; ++ + struct interface { + STAILQ_ENTRY(interface) list; + }; +@@ -146,6 +148,7 @@ int main(int argc, char *argv[]) + print_set_verbose(config_get_int(cfg, NULL, "verbose")); + print_set_syslog(config_get_int(cfg, NULL, "use_syslog")); + print_set_level(config_get_int(cfg, NULL, "logging_level")); ++ max_phc_update_skip_count = config_get_int(cfg, NULL, "max_phc_update_skip_cnt"); + + STAILQ_FOREACH(iface, &cfg->interfaces, list) { + if (1 == config_get_int(cfg, interface_name(iface), "ts2phc.master")) { +diff --git a/ts2phc_slave.c b/ts2phc_slave.c +index 749efe5..126c502 100644 +--- a/ts2phc_slave.c ++++ b/ts2phc_slave.c +@@ -29,6 +29,8 @@ + #define SAMPLE_WEIGHT 1.0 + #define SERVO_SYNC_INTERVAL 1.0 + ++extern int max_phc_update_skip_count; ++ + struct ts2phc_slave { + char *name; + STAILQ_ENTRY(ts2phc_slave) list; +@@ -42,6 +44,8 @@ struct ts2phc_slave { + clockid_t clk; + int no_adj; + int fd; ++ int max_offset_skip_count; ++ int current_offset_skip_count; + }; + + struct ts2phc_slave_array { +@@ -218,6 +222,9 @@ static struct ts2phc_slave *ts2phc_slave_create(struct config *cfg, const char * + if (ts2phc_slave_clear_fifo(slave)) { + goto no_ext_ts; + } ++ slave->max_offset_skip_count = max_phc_update_skip_count; ++ slave->current_offset_skip_count = 0; ++ pr_debug("PHC slave %s has skip cnt %d", device, slave->max_offset_skip_count); + + return slave; + no_ext_ts: +@@ -275,6 +282,18 @@ static int ts2phc_slave_event(struct ts2phc_slave *slave, + return 0; + } + ++ if ((slave->state == SERVO_LOCKED) || (slave->state == SERVO_LOCKED_STABLE)) { ++ if (llabs(offset) >= NS_PER_SEC / 2) { ++ if (slave->current_offset_skip_count < slave->max_offset_skip_count) { ++ pr_debug("Offset spike detected. Skip current PHC update %s offset %10" PRId64 " s%d freq %+7.0f", ++ slave->name, offset, slave->state, adj); ++ slave->current_offset_skip_count++; ++ pr_debug("Current skip count: %i", slave->current_offset_skip_count); ++ return 0; ++ } ++ } ++ } ++ + adj = servo_sample(slave->servo, offset, extts_ts, + SAMPLE_WEIGHT, &slave->state); + +@@ -290,6 +309,9 @@ static int ts2phc_slave_event(struct ts2phc_slave *slave, + break; + case SERVO_LOCKED: + case SERVO_LOCKED_STABLE: ++ if (llabs(offset) < 500) { ++ slave->current_offset_skip_count = 0; ++ } + clockadj_set_freq(slave->clk, -adj); + break; + } +@@ -336,10 +358,10 @@ static enum extts_result ts2phc_slave_offset(struct ts2phc_slave *slave, + *local_ts = event_ns + slave->correction; + + pr_debug("%s extts index %u at %lld.%09u corr %d src %" PRIi64 +- ".%ld diff %" PRId64, ++ ".%ld diff %" PRId64 " servo state %d", + slave->name, event.index, event.t.sec, event.t.nsec, + slave->correction, +- (int64_t) source_ts.tv_sec, source_ts.tv_nsec, *offset); ++ (int64_t) source_ts.tv_sec, source_ts.tv_nsec, *offset, slave->state); + + return EXTTS_OK; + } +-- +2.30.2 diff --git a/base/linuxptp/debian/patches/series b/base/linuxptp/debian/patches/series index 414575d82..8f7252e07 100644 --- a/base/linuxptp/debian/patches/series +++ b/base/linuxptp/debian/patches/series @@ -54,4 +54,5 @@ 0054-Disable-active-interface-failing.patch 0055-Ignore-interface-in-conf-file-when-HA-is-disabled.patch 0056-Fixed-event-port-id-map.patch -0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch \ No newline at end of file +0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch +0058-ts2phc-skip-updates-after-offset-spike.patch \ No newline at end of file