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 <cole.walker@windriver.com>
This commit is contained in:
parent
1b0db90e43
commit
aca42c6d4c
@ -1,7 +1,7 @@
|
||||
From edb8d92c8e3379c6b764eb033a1d872dee3c8802 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From cef81731404b339517e277bab9c0285ee239f065 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 7a507ff333c3c8046e84ca605ba4d386614c3a99 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From ab617c7f70e8d8bc66673412a536fc1a8cf3584c Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 01abb33c0851f89e4f96c757c928366df75484ab Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 901b4f776d7cf483e0f229eb10f78d14b9be5f17 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Walker <cole.walker@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 347548500e39e21037b4afea6179d5101695b28f Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 583e206c66f7af8847851530daf0728f9074b3a3 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From c36e970db481dc1d5482386418f046f46b25f645 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 2df24f632e8bde2022cc2005f4a8f2cb25181ee1 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From df691061d979ba6aa921b455f570365417e5700e Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From ab9b7dfcc503c21bce09ec4096498bc689c6a9ff Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 6f7e16dac861cb6bc1d2063c3fb47a9e6da4dc75 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 4d8fa2e0d4ed8c0ca79ee9123d8a5963a2a13ce5 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 77a246c6d6a865f11fe2fac14cdc9fa2746a06a2 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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 <richardcochran@gmail.com>
|
||||
|
@ -1,7 +1,7 @@
|
||||
From f6de4c4e2c1ae6d9762778baf18031fc42251657 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 8946d8e8eba908a213ba46844d697d7ff26e9bb6 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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 <richardcochran@gmail.com>
|
||||
|
@ -1,7 +1,7 @@
|
||||
From cd72c765ee2acc49ca5b78cd0e2c9659f456434c Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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 <richardcochran@gmail.com>
|
||||
|
@ -1,7 +1,7 @@
|
||||
From d798a871a0b27a953a80afa7b696a44cd8a93fdf Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 479301925d24906f03b13821ee8bd6cafb58c8c5 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From f221d3e5b7d5ebac532a1d02f0cfb74fda6a237c Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From f692885fbb0e1a1a379314b08d3108c1e54d3f4f Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 20cb57a86671fd1e60479de9e6ac0a5586ad5acd Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 4321cff2b53512d4027bc096bdef5df2610b18cf Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 9136345c69038a22d9b548863fb6afe64e54958d Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 95d2fad84edea1397f3484e6570bcbb29509bacd Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 4f37561dad0e8b163691f68cfd101e798d39248a Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From b469ea325783cfe906bd7e28e63a7eb26b4cad96 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From adb2a1eeb1083c72b4ae8d0c987a1bcbc64f2434 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 7acbb86b5d95709a6d87b898df5783c25fbb2d26 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 25d6be54bba7b2e9871da9700103a483ff355892 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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 <richardcochran@gmail.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From fdccd5ec965dee65d021eba76a1e75d28197be02 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 844bd2a0cb524079e5878cbdd7b24b1539970aaa Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 2a1a37e5617f9db8b7da67b87544afee2096cf69 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From c0f92de7977b4e11870865eabdb1b7d0b8a9d725 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 8307227fcd921d1025361d0c345b491258f9d190 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 644c90c0e341624e55ef49ab5b4c5a4d4008f63d Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From c2dedaa40232ac3df88df6774d249e687f2f4e16 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a7ecd33822f5d76918ccc0148249b7fdb05d11da Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From e269f17d01c324e70fb3ef8b8e88c0e57ac78eb1 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From bf767f48955399f27294d15e8f14a1ab0f3223bd Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 509fb3bfe38d8fafc6d4d14855d34bb985a15493 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 6323af225d205564a16fefefda9674feaf53ead5 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 6384ddb80bf82998d058f61adc4350c88820fe5a Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 1c518663448b8c8aaf914151f54b860bd946cea4 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From d14df9d1f0b239c2a5fbe587875448a2d10b12a6 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From c20f9c9b992b7ecf0f5d2ac9f137b369352bbba2 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 2b78be90379bf767961bec1b3f99462c54036cbf Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From afb5e76b98d7528bb36b860f9f0a6a8f04b094f8 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 0d36e8812291f5912d7344ff894976715baba53b Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 9ecbddcccbeadabb8cef295dd540dadc26f03d5b Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 2f4339ab555fdd90d5c5fd11296d5c17b19c37e3 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 76f07fac7536b525b74858dacc3e37f28583c703 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From d43854295382f20697ffb067dde9b6f8d610d1f9 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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 <interface>'
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a61444e795236013bfca2e45100a45e14f0474c9 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
From adfe866226b758f789a3127447d37e19f442311f Mon Sep 17 00:00:00 2001
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 8dd4e2b6c8b99952296319a0e0c0e0f3e6160e32 Mon Sep 17 00:00:00 2001
|
||||
From: cwalker <cole.walker@windriver.com>
|
||||
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.
|
||||
|
@ -0,0 +1,140 @@
|
||||
From 0cb3bd52e6dd3680aa900045d3c837d1098d8da8 Mon Sep 17 00:00:00 2001
|
||||
From: cwalker <cole.walker@windriver.com>
|
||||
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 <cole.walker@windriver.com>
|
||||
---
|
||||
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
|
@ -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
|
||||
0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch
|
||||
0058-ts2phc-skip-updates-after-offset-spike.patch
|
Loading…
x
Reference in New Issue
Block a user