Merge "Fix HA clock selection algorithm"

This commit is contained in:
Zuul 2024-10-17 14:16:54 +00:00 committed by Gerrit Code Review
commit a06e842233
62 changed files with 127 additions and 61 deletions

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon, 31 May 2021 11:07:52 +0200
Subject: [PATCH 01/60] clock: Reset state when switching port with same best
Subject: [PATCH 01/61] 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

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon, 31 May 2021 11:07:53 +0200
Subject: [PATCH 02/60] clock: Reset clock check on best clock/port change.
Subject: [PATCH 02/61] 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

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon, 31 May 2021 11:07:54 +0200
Subject: [PATCH 03/60] port: Don't check timestamps from non-slave ports.
Subject: [PATCH 03/61] 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

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon, 31 May 2021 11:07:55 +0200
Subject: [PATCH 04/60] port: Don't renew raw transport.
Subject: [PATCH 04/61] 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

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon, 31 May 2021 11:07:56 +0200
Subject: [PATCH 05/60] clockcheck: Increase minimum interval.
Subject: [PATCH 05/61] 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

View File

@ -1,6 +1,6 @@
From: Cole Walker <cole.walker@windriver.com>
Date: Wed, 23 Jun 2021 11:14:41 -0400
Subject: [PATCH 06/60] Add option to disable default port selection in
Subject: [PATCH 06/61] Add option to disable default port selection in
phc2sys
This change serves to address an issue in phc2sys

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 18 May 2022 11:33:35 +0200
Subject: [PATCH 07/60] sysoff: Change sysoff_measure() to return errno.
Subject: [PATCH 07/61] 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.

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 18 May 2022 11:33:36 +0200
Subject: [PATCH 08/60] sysoff: Change log level of ioctl error messages.
Subject: [PATCH 08/61] 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

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 18 May 2022 11:33:37 +0200
Subject: [PATCH 09/60] sysoff: Retry on EBUSY when probing supported ioctls.
Subject: [PATCH 09/61] 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

View File

@ -1,6 +1,6 @@
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 18 May 2022 11:33:38 +0200
Subject: [PATCH 10/60] phc2sys: Don't exit when reading of PHC fails with
Subject: [PATCH 10/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 13:47:47 -0300
Subject: [PATCH 11/60] phc2sys: extract PMC functionality into a smaller
Subject: [PATCH 11/61] phc2sys: extract PMC functionality into a smaller
struct pmc_node
This creates a smaller structure within phc2sys_private, which embeds

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 13:59:48 -0300
Subject: [PATCH 12/60] phc2sys: make PMC functions non-static
Subject: [PATCH 12/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 14:34:19 -0300
Subject: [PATCH 13/60] phc2sys: break out pmc code into pmc_common.c
Subject: [PATCH 13/61] 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.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 14:40:59 -0300
Subject: [PATCH 14/60] Introduce the PMC agent module.
Subject: [PATCH 14/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 14:47:36 -0300
Subject: [PATCH 15/60] pmc_agent: Rename pmc_node to something more
Subject: [PATCH 15/61] pmc_agent: Rename pmc_node to something more
descriptive.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 14:55:29 -0300
Subject: [PATCH 16/60] pmc_agent: Hide the implementation.
Subject: [PATCH 16/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 14:58:09 -0300
Subject: [PATCH 17/60] Find a better home for the management TLV ID helper
Subject: [PATCH 17/61] Find a better home for the management TLV ID helper
function.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 14:59:57 -0300
Subject: [PATCH 18/60] Find a better home for the management TLV data helper
Subject: [PATCH 18/61] Find a better home for the management TLV data helper
function.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 15:04:11 -0300
Subject: [PATCH 19/60] Introduce error codes for the run_pmc method.
Subject: [PATCH 19/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 15:08:01 -0300
Subject: [PATCH 20/60] pmc_agent: Convert the subscribe method into the
Subject: [PATCH 20/61] pmc_agent: Convert the subscribe method into the
canonical form.
This patch renames the function to have the module prefix and corrects the

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 15:17:26 -0300
Subject: [PATCH 21/60] pmc_agent: Simplify the update method.
Subject: [PATCH 21/61] 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.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 15:18:36 -0300
Subject: [PATCH 22/60] pmc_agent: Simplify logic in update method.
Subject: [PATCH 22/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 15:33:43 -0300
Subject: [PATCH 23/60] pmc_agent: Remove bogus comparison between last update
Subject: [PATCH 23/61] pmc_agent: Remove bogus comparison between last update
and now.
The monotonic clock can never go backwards. If you take T1 and later T2

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 15:35:23 -0300
Subject: [PATCH 24/60] pmc_agent: Perform time comparison using positive
Subject: [PATCH 24/61] pmc_agent: Perform time comparison using positive
logic.
In the update_pmc_node() method, reduce the expression

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 15:36:38 -0300
Subject: [PATCH 25/60] pmc_agent: Rename the update method and attempt to
Subject: [PATCH 25/61] pmc_agent: Rename the update method and attempt to
document it.
This patch renames the function to have the module prefix and tries to

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 15:37:46 -0300
Subject: [PATCH 26/60] phc2sys: Fix null pointer de-reference in manual mode.
Subject: [PATCH 26/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 17:20:04 -0300
Subject: [PATCH 27/60] pmc_agent: Convert the method that queries TAI-UTC
Subject: [PATCH 27/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 17:23:29 -0300
Subject: [PATCH 28/60] pmc_agent: Convert the method that queries the port
Subject: [PATCH 28/61] pmc_agent: Convert the method that queries the port
properties.
Prefix the function with the module name and correct the return code

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 17:29:30 -0300
Subject: [PATCH 29/60] pmc_agent: Generalize the method that queries the
Subject: [PATCH 29/61] pmc_agent: Generalize the method that queries the
local clock identity.
When started in automatic mode, the phc2sys program first queries the

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 17:30:57 -0300
Subject: [PATCH 30/60] pmc_agent: Simplify the method that gets of the number
Subject: [PATCH 30/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 17:32:27 -0300
Subject: [PATCH 31/60] pmc_agent: Let the update method poll for push events.
Subject: [PATCH 31/61] pmc_agent: Let the update method poll for push events.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 17:51:10 -0300
Subject: [PATCH 32/60] phc2sys: Fix regression in the automatic mode.
Subject: [PATCH 32/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 17:57:11 -0300
Subject: [PATCH 33/60] Implement push notification for TIME_STATUS_NP
Subject: [PATCH 33/61] Implement push notification for TIME_STATUS_NP
Subscribers to NOTIFY_TIME_SYNC will be notified on every clock
synchronization.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 18:16:31 -0300
Subject: [PATCH 34/60] clock: Rename UDS variables to read-write.
Subject: [PATCH 34/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 18:18:29 -0300
Subject: [PATCH 35/60] clock: Add read-only UDS port for monitoring.
Subject: [PATCH 35/61] 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.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 12 Jun 2023 18:20:50 -0300
Subject: [PATCH 36/60] Rename management ID macros.
Subject: [PATCH 36/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Sun, 18 Jun 2023 20:58:34 -0300
Subject: [PATCH 37/60] Enhance phc2sys to accept multiple ptp4l inputs
Subject: [PATCH 37/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Tue, 4 Jul 2023 17:27:50 -0300
Subject: [PATCH 38/60] Best source selection algorithm
Subject: [PATCH 38/61] Best source selection algorithm
An algorithm to select the best available clock and use it
as clock source.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Sat, 8 Jul 2023 19:02:50 -0300
Subject: [PATCH 39/60] Select best source clock after state changes
Subject: [PATCH 39/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Wed, 26 Jul 2023 15:08:15 -0300
Subject: [PATCH 40/60] Forced lock a clock source in configuration
Subject: [PATCH 40/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Thu, 27 Jul 2023 14:22:47 -0300
Subject: [PATCH 41/60] HA phc2sys com socket
Subject: [PATCH 41/61] HA phc2sys com socket
A new communication path was created to retrieve status and to control
the high availability algorithm.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Fri, 4 Aug 2023 15:44:12 -0300
Subject: [PATCH 42/60] Commands 'enable lock' and 'disable lock.
Subject: [PATCH 42/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Fri, 4 Aug 2023 19:01:57 -0300
Subject: [PATCH 43/60] Commands 'enable source' and 'disable source'.
Subject: [PATCH 43/61] Commands 'enable source' and 'disable source'.
These commands controls the list of clocks available to clock
selection algorithm.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 7 Aug 2023 14:55:12 -0300
Subject: [PATCH 44/60] Stream type phc2sys com socket
Subject: [PATCH 44/61] Stream type phc2sys com socket
The type of the socket was changed from datagram to stream.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Tue, 8 Aug 2023 13:10:50 -0300
Subject: [PATCH 45/60] Functions starts_with and str_at_column
Subject: [PATCH 45/61] Functions starts_with and str_at_column
Renaming starts_with and str_at_column functions to match ptp4l code
style.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Tue, 8 Aug 2023 14:06:55 -0300
Subject: [PATCH 46/60] Robustness improvements to phc2sys socket
Subject: [PATCH 46/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 7 Aug 2023 18:19:37 -0300
Subject: [PATCH 47/60] phc2sys without -w option.
Subject: [PATCH 47/61] phc2sys without -w option.
Fix bad clock and pmc initialization when -w command argument
is not provided.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 21 Aug 2023 14:28:20 -0300
Subject: [PATCH 48/60] HA domain number
Subject: [PATCH 48/61] HA domain number
Support multiple domain numbers for each uds socket used in HA phc2sys.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Wed, 23 Aug 2023 19:18:08 -0300
Subject: [PATCH 49/60] GM clock accuracy and offset scaled log variance
Subject: [PATCH 49/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Tue, 29 Aug 2023 19:06:23 -0300
Subject: [PATCH 50/60] Select matching requirements clock if active doesn't
Subject: [PATCH 50/61] Select matching requirements clock if active doesn't
match them
Fix clock selection algorithm behavior where a clock source starts

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Wed, 30 Aug 2023 13:28:34 -0300
Subject: [PATCH 51/60] Time traceable flag
Subject: [PATCH 51/61] Time traceable flag
A new time traceable flag was added to pmc agent to store the current
time traceable status.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Wed, 30 Aug 2023 15:43:42 -0300
Subject: [PATCH 52/60] Command 'valid sources'
Subject: [PATCH 52/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Thu, 31 Aug 2023 12:36:02 -0300
Subject: [PATCH 53/60] GM time traceable check enabled by default
Subject: [PATCH 53/61] 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.

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Thu, 31 Aug 2023 16:05:15 -0300
Subject: [PATCH 54/60] Disable active interface failing
Subject: [PATCH 54/61] 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>'

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Thu, 4 Jan 2024 13:27:09 -0300
Subject: [PATCH 55/60] Ignore interface in conf file when HA is disabled
Subject: [PATCH 55/61] 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

View File

@ -1,6 +1,6 @@
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 15 Jan 2024 16:19:59 -0300
Subject: [PATCH 56/60] Fixed event port id map
Subject: [PATCH 56/61] 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.

View File

@ -1,6 +1,6 @@
From: cwalker <cole.walker@windriver.com>
Date: Fri, 1 Mar 2024 17:50:29 +0000
Subject: [PATCH 57/60] Fix uninitialized variable in nmea_scan_rmc
Subject: [PATCH 57/61] Fix uninitialized variable in nmea_scan_rmc
Initialize the tm_isdst variable to ensure that mktime does not fail on
recent versions of glibc.

View File

@ -1,6 +1,6 @@
From: cwalker <cole.walker@windriver.com>
Date: Tue, 20 Feb 2024 17:25:17 +0000
Subject: [PATCH 58/60] Implement logic to skip updates with offset spike.
Subject: [PATCH 58/61] 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

View File

@ -1,6 +1,6 @@
From: Cole Walker <cole.walker@windriver.com>
Date: Wed, 1 May 2024 17:56:14 +0000
Subject: [PATCH 59/60] clock: Downgrade log message about failed uds forward.
Subject: [PATCH 59/61] clock: Downgrade log message about failed uds forward.
If multiple management clients are used in the network and ptp4l
responded at least once over UDS, it will try to forward all management

View File

@ -1,7 +1,7 @@
From 718853cf344bc6ebc17c06e7a6c82601d8d76365 Mon Sep 17 00:00:00 2001
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Thu, 10 Oct 2024 16:56:34 -0300
Subject: [PATCH 60/60] Fix HA clock selection of priority 0 source
Subject: [PATCH 60/61] Fix HA clock selection of priority 0 source
Fixed behavior where a clock set with ha_priority equal 0
is not select, even when it matches all the requirements.

View File

@ -0,0 +1,65 @@
From 06d3e581486cc8f931c8599e4b7b3faea3ddf64f Mon Sep 17 00:00:00 2001
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Wed, 16 Oct 2024 18:10:24 -0300
Subject: [PATCH 61/61] Fix HA clock selection algorithm
The issue reported is a particular case of a BC configured with
redundant PTP clocks with same priority. When a clock recovers
from a failure, as both clock were configured with same priority
it's expected the active clock source to remain active. But if
the recovered clock presented a better local clock class than
active, it was being selected active. This specific case was fixed.
Closes-bug: 2084723
Test plan: BC with same priority
PASS: Start the PTP service with all clocks out of requirements,
one is selected, no matter which one.
PASS: Then, when the backup clock recovers from failure it is
selected active.
PASS: Then, when the other clock recovers from failure it remains
as backup, no matter the local clock class.
PASS: Then, when the active goes out of requirement, the backup
is set active.
Test plan: GM with same priority
PASS: Start the PTP service with all clocks out of requirements,
one is selected, no matter which one.
PASS: Then, when the backup clock recovers from failure it is selected
active.
PASS: Then, when the other clock recovers from failure it remains
as backup, no matter the local clock class.
PASS: Then, when the active goes out of requirement, the backup
is set active.
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
---
phc2sys.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/phc2sys.c b/phc2sys.c
index 9e8751f..e493b34 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -1160,7 +1160,6 @@ static struct clock* check_and_select_clock(struct phc2sys_private *priv, struct
struct clock *active = priv->master, *candidate = NULL;
int stability_timer = 0;
struct timespec now;
- int active_clock_class, candidate_clock_class;
/* Active source degrades - re-run ha_select_clock algorithm */
if ((active->node->new_dds && !clock_match_ha_dds_requirements(active, cfg)) ||
@@ -1195,10 +1194,7 @@ static struct clock* check_and_select_clock(struct phc2sys_private *priv, struct
/* new clock candidate */
/* candidate has equal priority and clockClass than active - don't change active */
- active_clock_class = active->node->dds.clockQuality.clockClass;
- candidate_clock_class = candidate->node->dds.clockQuality.clockClass;
if ((active->ha_priority == candidate->ha_priority) &&
- (active_clock_class == candidate_clock_class) &&
clock_match_ha_requirements(active, cfg)) {
return NULL;
}
--
2.34.1

View File

@ -57,4 +57,5 @@
0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch
0058-ts2phc-skip-updates-after-offset-spike.patch
0059-clock-Downgrade-log-message-about-failed-uds-forward.patch
0060-Fix-HA-clock-selection-of-priority-0-source.patch
0060-Fix-HA-clock-selection-of-priority-0-source.patch
0061-Fix-HA-clock-selection-algorithm.patch