PTP: smooth/transparent HA switchover
Currently we have following inconsistency between linuxptp and ptp-notification app. 1) pmc_agent.cc: PMC polling interval (PMC_UPDATE_INTERVAL of 60 sec on pmc_agent_update) 2) ptp-notification app: 'overalltracker_context': {'holdover_seconds': '15'} In context of HA switchover, there is pmc polling in 60 sec interval (pmc_agent_update uses PMC_UPDATE_INTERVAL i.e 60s ). This means when primary ptp source lost, it would take 60 sec to switchover to secondary clock. On ptp-application app side, we have 'ptptracker_context': {'holdover_seconds': 15} 'overalltracker_context': {'holdover_seconds': '15'} With this, when the selected ptp source is lost more than 15 sec, the ptp state and overall state would go holdover and then freerun. For smooth transition, PMC_UPDATE_INTERVAL should be << holdover_seconds. This commit introduces configurable value for PMC_UPDATE_INTERVAL with "phc2sys .. -p <int value [1, 3600]>", and without configuration, the default value would be of 7 sec. TEST PLAN: PASS: deploy PTP with HA phy2sys parameter of "-p 60" or with file global parameter "pmc_update_interval_sec 60" stop primary ptp4l instance and check users.log to see the "timeout reading pmc" in 60 secs. PASS: deploy PTP with HA Phy2sys without parameter of "-p" stop primary ptp4l instance and check users.log to see the "timeout reading pmc" in 7 secs. check HA switchover happens in 7 secs, and overall state won't change from Locked to holdover/freerun. Story: 2011370 Task: 52061 Change-Id: I8a9123b15acbbff41954db42822b9f501cd5f2c9 Signed-off-by: Tara Nath Subedi <tara.subedi@windriver.com>
This commit is contained in:
parent
6b6b254062
commit
12e86c6fa5
@ -1,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Mon, 31 May 2021 11:07:52 +0200
|
||||
Subject: [PATCH 01/62] clock: Reset state when switching port with same best
|
||||
Subject: [PATCH 01/63] 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,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Mon, 31 May 2021 11:07:53 +0200
|
||||
Subject: [PATCH 02/62] clock: Reset clock check on best clock/port change.
|
||||
Subject: [PATCH 02/63] 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,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Mon, 31 May 2021 11:07:54 +0200
|
||||
Subject: [PATCH 03/62] port: Don't check timestamps from non-slave ports.
|
||||
Subject: [PATCH 03/63] 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,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Mon, 31 May 2021 11:07:55 +0200
|
||||
Subject: [PATCH 04/62] port: Don't renew raw transport.
|
||||
Subject: [PATCH 04/63] 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,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Mon, 31 May 2021 11:07:56 +0200
|
||||
Subject: [PATCH 05/62] clockcheck: Increase minimum interval.
|
||||
Subject: [PATCH 05/63] 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,6 +1,6 @@
|
||||
From: Cole Walker <cole.walker@windriver.com>
|
||||
Date: Wed, 23 Jun 2021 11:14:41 -0400
|
||||
Subject: [PATCH 06/62] Add option to disable default port selection in
|
||||
Subject: [PATCH 06/63] Add option to disable default port selection in
|
||||
phc2sys
|
||||
|
||||
This change serves to address an issue in phc2sys
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Wed, 18 May 2022 11:33:35 +0200
|
||||
Subject: [PATCH 07/62] sysoff: Change sysoff_measure() to return errno.
|
||||
Subject: [PATCH 07/63] 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,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Wed, 18 May 2022 11:33:36 +0200
|
||||
Subject: [PATCH 08/62] sysoff: Change log level of ioctl error messages.
|
||||
Subject: [PATCH 08/63] 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,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Wed, 18 May 2022 11:33:37 +0200
|
||||
Subject: [PATCH 09/62] sysoff: Retry on EBUSY when probing supported ioctls.
|
||||
Subject: [PATCH 09/63] 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,6 +1,6 @@
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Wed, 18 May 2022 11:33:38 +0200
|
||||
Subject: [PATCH 10/62] phc2sys: Don't exit when reading of PHC fails with
|
||||
Subject: [PATCH 10/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 13:47:47 -0300
|
||||
Subject: [PATCH 11/62] phc2sys: extract PMC functionality into a smaller
|
||||
Subject: [PATCH 11/63] phc2sys: extract PMC functionality into a smaller
|
||||
struct pmc_node
|
||||
|
||||
This creates a smaller structure within phc2sys_private, which embeds
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 13:59:48 -0300
|
||||
Subject: [PATCH 12/62] phc2sys: make PMC functions non-static
|
||||
Subject: [PATCH 12/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 14:34:19 -0300
|
||||
Subject: [PATCH 13/62] phc2sys: break out pmc code into pmc_common.c
|
||||
Subject: [PATCH 13/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 14:40:59 -0300
|
||||
Subject: [PATCH 14/62] Introduce the PMC agent module.
|
||||
Subject: [PATCH 14/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 14:47:36 -0300
|
||||
Subject: [PATCH 15/62] pmc_agent: Rename pmc_node to something more
|
||||
Subject: [PATCH 15/63] pmc_agent: Rename pmc_node to something more
|
||||
descriptive.
|
||||
|
||||
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 14:55:29 -0300
|
||||
Subject: [PATCH 16/62] pmc_agent: Hide the implementation.
|
||||
Subject: [PATCH 16/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 14:58:09 -0300
|
||||
Subject: [PATCH 17/62] Find a better home for the management TLV ID helper
|
||||
Subject: [PATCH 17/63] Find a better home for the management TLV ID helper
|
||||
function.
|
||||
|
||||
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 14:59:57 -0300
|
||||
Subject: [PATCH 18/62] Find a better home for the management TLV data helper
|
||||
Subject: [PATCH 18/63] Find a better home for the management TLV data helper
|
||||
function.
|
||||
|
||||
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 15:04:11 -0300
|
||||
Subject: [PATCH 19/62] Introduce error codes for the run_pmc method.
|
||||
Subject: [PATCH 19/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 15:08:01 -0300
|
||||
Subject: [PATCH 20/62] pmc_agent: Convert the subscribe method into the
|
||||
Subject: [PATCH 20/63] pmc_agent: Convert the subscribe method into the
|
||||
canonical form.
|
||||
|
||||
This patch renames the function to have the module prefix and corrects the
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 15:17:26 -0300
|
||||
Subject: [PATCH 21/62] pmc_agent: Simplify the update method.
|
||||
Subject: [PATCH 21/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 15:18:36 -0300
|
||||
Subject: [PATCH 22/62] pmc_agent: Simplify logic in update method.
|
||||
Subject: [PATCH 22/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 15:33:43 -0300
|
||||
Subject: [PATCH 23/62] pmc_agent: Remove bogus comparison between last update
|
||||
Subject: [PATCH 23/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 15:35:23 -0300
|
||||
Subject: [PATCH 24/62] pmc_agent: Perform time comparison using positive
|
||||
Subject: [PATCH 24/63] pmc_agent: Perform time comparison using positive
|
||||
logic.
|
||||
|
||||
In the update_pmc_node() method, reduce the expression
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 15:36:38 -0300
|
||||
Subject: [PATCH 25/62] pmc_agent: Rename the update method and attempt to
|
||||
Subject: [PATCH 25/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 15:37:46 -0300
|
||||
Subject: [PATCH 26/62] phc2sys: Fix null pointer de-reference in manual mode.
|
||||
Subject: [PATCH 26/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 17:20:04 -0300
|
||||
Subject: [PATCH 27/62] pmc_agent: Convert the method that queries TAI-UTC
|
||||
Subject: [PATCH 27/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 17:23:29 -0300
|
||||
Subject: [PATCH 28/62] pmc_agent: Convert the method that queries the port
|
||||
Subject: [PATCH 28/63] pmc_agent: Convert the method that queries the port
|
||||
properties.
|
||||
|
||||
Prefix the function with the module name and correct the return code
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 17:29:30 -0300
|
||||
Subject: [PATCH 29/62] pmc_agent: Generalize the method that queries the
|
||||
Subject: [PATCH 29/63] pmc_agent: Generalize the method that queries the
|
||||
local clock identity.
|
||||
|
||||
When started in automatic mode, the phc2sys program first queries the
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 17:30:57 -0300
|
||||
Subject: [PATCH 30/62] pmc_agent: Simplify the method that gets of the number
|
||||
Subject: [PATCH 30/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 17:32:27 -0300
|
||||
Subject: [PATCH 31/62] pmc_agent: Let the update method poll for push events.
|
||||
Subject: [PATCH 31/63] pmc_agent: Let the update method poll for push events.
|
||||
|
||||
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 17:51:10 -0300
|
||||
Subject: [PATCH 32/62] phc2sys: Fix regression in the automatic mode.
|
||||
Subject: [PATCH 32/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 17:57:11 -0300
|
||||
Subject: [PATCH 33/62] Implement push notification for TIME_STATUS_NP
|
||||
Subject: [PATCH 33/63] Implement push notification for TIME_STATUS_NP
|
||||
|
||||
Subscribers to NOTIFY_TIME_SYNC will be notified on every clock
|
||||
synchronization.
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 18:16:31 -0300
|
||||
Subject: [PATCH 34/62] clock: Rename UDS variables to read-write.
|
||||
Subject: [PATCH 34/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 18:18:29 -0300
|
||||
Subject: [PATCH 35/62] clock: Add read-only UDS port for monitoring.
|
||||
Subject: [PATCH 35/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 12 Jun 2023 18:20:50 -0300
|
||||
Subject: [PATCH 36/62] Rename management ID macros.
|
||||
Subject: [PATCH 36/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Sun, 18 Jun 2023 20:58:34 -0300
|
||||
Subject: [PATCH 37/62] Enhance phc2sys to accept multiple ptp4l inputs
|
||||
Subject: [PATCH 37/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Tue, 4 Jul 2023 17:27:50 -0300
|
||||
Subject: [PATCH 38/62] Best source selection algorithm
|
||||
Subject: [PATCH 38/63] Best source selection algorithm
|
||||
|
||||
An algorithm to select the best available clock and use it
|
||||
as clock source.
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Sat, 8 Jul 2023 19:02:50 -0300
|
||||
Subject: [PATCH 39/62] Select best source clock after state changes
|
||||
Subject: [PATCH 39/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Wed, 26 Jul 2023 15:08:15 -0300
|
||||
Subject: [PATCH 40/62] Forced lock a clock source in configuration
|
||||
Subject: [PATCH 40/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Thu, 27 Jul 2023 14:22:47 -0300
|
||||
Subject: [PATCH 41/62] HA phc2sys com socket
|
||||
Subject: [PATCH 41/63] HA phc2sys com socket
|
||||
|
||||
A new communication path was created to retrieve status and to control
|
||||
the high availability algorithm.
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Fri, 4 Aug 2023 15:44:12 -0300
|
||||
Subject: [PATCH 42/62] Commands 'enable lock' and 'disable lock.
|
||||
Subject: [PATCH 42/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Fri, 4 Aug 2023 19:01:57 -0300
|
||||
Subject: [PATCH 43/62] Commands 'enable source' and 'disable source'.
|
||||
Subject: [PATCH 43/63] Commands 'enable source' and 'disable source'.
|
||||
|
||||
These commands controls the list of clocks available to clock
|
||||
selection algorithm.
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 7 Aug 2023 14:55:12 -0300
|
||||
Subject: [PATCH 44/62] Stream type phc2sys com socket
|
||||
Subject: [PATCH 44/63] Stream type phc2sys com socket
|
||||
|
||||
The type of the socket was changed from datagram to stream.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Tue, 8 Aug 2023 13:10:50 -0300
|
||||
Subject: [PATCH 45/62] Functions starts_with and str_at_column
|
||||
Subject: [PATCH 45/63] Functions starts_with and str_at_column
|
||||
|
||||
Renaming starts_with and str_at_column functions to match ptp4l code
|
||||
style.
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Tue, 8 Aug 2023 14:06:55 -0300
|
||||
Subject: [PATCH 46/62] Robustness improvements to phc2sys socket
|
||||
Subject: [PATCH 46/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 7 Aug 2023 18:19:37 -0300
|
||||
Subject: [PATCH 47/62] phc2sys without -w option.
|
||||
Subject: [PATCH 47/63] phc2sys without -w option.
|
||||
|
||||
Fix bad clock and pmc initialization when -w command argument
|
||||
is not provided.
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 21 Aug 2023 14:28:20 -0300
|
||||
Subject: [PATCH 48/62] HA domain number
|
||||
Subject: [PATCH 48/63] HA domain number
|
||||
|
||||
Support multiple domain numbers for each uds socket used in HA phc2sys.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Wed, 23 Aug 2023 19:18:08 -0300
|
||||
Subject: [PATCH 49/62] GM clock accuracy and offset scaled log variance
|
||||
Subject: [PATCH 49/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Tue, 29 Aug 2023 19:06:23 -0300
|
||||
Subject: [PATCH 50/62] Select matching requirements clock if active doesn't
|
||||
Subject: [PATCH 50/63] Select matching requirements clock if active doesn't
|
||||
match them
|
||||
|
||||
Fix clock selection algorithm behavior where a clock source starts
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Wed, 30 Aug 2023 13:28:34 -0300
|
||||
Subject: [PATCH 51/62] Time traceable flag
|
||||
Subject: [PATCH 51/63] Time traceable flag
|
||||
|
||||
A new time traceable flag was added to pmc agent to store the current
|
||||
time traceable status.
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Wed, 30 Aug 2023 15:43:42 -0300
|
||||
Subject: [PATCH 52/62] Command 'valid sources'
|
||||
Subject: [PATCH 52/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Thu, 31 Aug 2023 12:36:02 -0300
|
||||
Subject: [PATCH 53/62] GM time traceable check enabled by default
|
||||
Subject: [PATCH 53/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Thu, 31 Aug 2023 16:05:15 -0300
|
||||
Subject: [PATCH 54/62] Disable active interface failing
|
||||
Subject: [PATCH 54/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Thu, 4 Jan 2024 13:27:09 -0300
|
||||
Subject: [PATCH 55/62] Ignore interface in conf file when HA is disabled
|
||||
Subject: [PATCH 55/63] 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,6 +1,6 @@
|
||||
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
||||
Date: Mon, 15 Jan 2024 16:19:59 -0300
|
||||
Subject: [PATCH 56/62] Fixed event port id map
|
||||
Subject: [PATCH 56/63] 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,6 +1,6 @@
|
||||
From: cwalker <cole.walker@windriver.com>
|
||||
Date: Fri, 1 Mar 2024 17:50:29 +0000
|
||||
Subject: [PATCH 57/62] Fix uninitialized variable in nmea_scan_rmc
|
||||
Subject: [PATCH 57/63] Fix uninitialized variable in nmea_scan_rmc
|
||||
|
||||
Initialize the tm_isdst variable to ensure that mktime does not fail on
|
||||
recent versions of glibc.
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: cwalker <cole.walker@windriver.com>
|
||||
Date: Tue, 20 Feb 2024 17:25:17 +0000
|
||||
Subject: [PATCH 58/62] Implement logic to skip updates with offset spike.
|
||||
Subject: [PATCH 58/63] 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Cole Walker <cole.walker@windriver.com>
|
||||
Date: Wed, 1 May 2024 17:56:14 +0000
|
||||
Subject: [PATCH 59/62] clock: Downgrade log message about failed uds forward.
|
||||
Subject: [PATCH 59/63] 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
|
||||
|
@ -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/62] Fix HA clock selection of priority 0 source
|
||||
Subject: [PATCH 60/63] 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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
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/62] Fix HA clock selection algorithm
|
||||
Subject: [PATCH 61/63] 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
From: Tara Subedi <Tara.Subedi@windriver.com>
|
||||
Date: Mon Apr 21 13:43:49 2025 -0400
|
||||
Subject: [PATCH 62/62] Fix HA clock selection when poll timeout
|
||||
Subject: [PATCH 62/63] Fix HA clock selection when poll timeout
|
||||
|
||||
PTP HA phc2sys not switching over when primary ptp instance is down
|
||||
|
||||
|
@ -0,0 +1,233 @@
|
||||
From: Tara Subedi <Tara.Subedi@windriver.com>
|
||||
Date: Mon Apr 28 13:12:23 2025 -0400
|
||||
Subject: [PATCH 63/63] Smooth/Transparent HA Switchover - Configurable Pmc Update Interval
|
||||
|
||||
PTP: smooth/transparent HA switchover
|
||||
|
||||
Currently we have following inconsistency between linuxptp and
|
||||
ptp-notification app.
|
||||
1) pmc_agent.cc: PMC polling interval (PMC_UPDATE_INTERVAL of 60
|
||||
sec on pmc_agent_update)
|
||||
2) ptp-notification app: 'overalltracker_context': {'holdover_seconds':
|
||||
'15'}
|
||||
|
||||
In context of HA switchover, there is pmc polling in 60 sec interval
|
||||
(pmc_agent_update uses PMC_UPDATE_INTERVAL i.e 60s ). This means when
|
||||
primary ptp source lost, it would take 60 sec to switchover to secondary
|
||||
clock.
|
||||
On ptp-application app side, we have 'ptptracker_context': {'holdover_seconds':
|
||||
15} 'overalltracker_context': {'holdover_seconds': '15'}
|
||||
With this, when the selected ptp source is lost more than 15 sec, the ptp
|
||||
state and overall state would go holdover and then freerun.
|
||||
|
||||
For smooth transition, PMC_UPDATE_INTERVAL should be << holdover_seconds.
|
||||
This commit introduces configurable value for PMC_UPDATE_INTERVAL with
|
||||
"phc2sys .. -p <int value [1, 3600]>", and without configuration, the
|
||||
default value would be of 7 sec.
|
||||
|
||||
TEST PLAN:
|
||||
PASS: deploy PTP with HA phy2sys parameter of "-p 60"
|
||||
or with file global parameter "pmc_update_interval_sec 60"
|
||||
stop primary ptp4l instance and check users.log to see the "timeout
|
||||
reading pmc" in 60 secs.
|
||||
PASS: deploy PTP with HA Phy2sys without parameter of "-p"
|
||||
stop primary ptp4l instance and check users.log to see the "timeout
|
||||
reading pmc" in 7 secs.
|
||||
check HA switchover happens in 7 secs, and overall state won't
|
||||
change from Locked to holdover/freerun.
|
||||
|
||||
Story: 2011370
|
||||
Task: 52061
|
||||
|
||||
Signed-off-by: Tara Nath Subedi <tara.subedi@windriver.com>
|
||||
---
|
||||
config.c | 1 +
|
||||
phc2sys.c | 26 +++++++++++++++++++++++---
|
||||
pmc_agent.c | 15 +++++----------
|
||||
pmc_agent.h | 12 ++++++++----
|
||||
4 files changed, 37 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/config.c b/config.c
|
||||
index 249c9ca..319f825 100644
|
||||
--- a/config.c
|
||||
+++ b/config.c
|
||||
@@ -348,6 +348,7 @@ struct config_item config_tab[] = {
|
||||
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),
|
||||
+ GLOB_ITEM_INT("pmc_update_interval_sec", 7, 1, 3600),
|
||||
};
|
||||
|
||||
static struct unicast_master_table *current_uc_mtab;
|
||||
diff --git a/phc2sys.c b/phc2sys.c
|
||||
index d89fb23..5f3e6c7 100644
|
||||
--- a/phc2sys.c
|
||||
+++ b/phc2sys.c
|
||||
@@ -69,6 +69,7 @@
|
||||
#define HA_SCK_N_FD 1
|
||||
#define HA_SCK_BUFFER_SIZE 1024
|
||||
#define HA_SCK_FILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) /*0660*/
|
||||
+#define MAX_PMC_UPDATE_INTERVAL_SEC 3600 /* 1 hour */
|
||||
|
||||
#define PORT_INDEX_TO_PORT_ID(port, index) (((((unsigned int) port) & 0xFF) << 8) | (((unsigned int) index) & 0xFF))
|
||||
#define PORT_ID_TO_PORT(id) ((((unsigned int) id) >> 8) & 0xFF)
|
||||
@@ -1993,6 +1994,7 @@ static void usage(char *progname)
|
||||
" common options:\n"
|
||||
" -f [file] configuration file\n"
|
||||
" -E [pi|linreg] clock servo (pi)\n"
|
||||
+ " -p [num] PMC update interval in seconds (7)\n"
|
||||
" -P [kp] proportional constant (0.7)\n"
|
||||
" -I [ki] integration constant (0.3)\n"
|
||||
" -S [step] step threshold (disabled)\n"
|
||||
@@ -2024,6 +2026,12 @@ int main(int argc, char *argv[])
|
||||
int autocfg = 0, c, domain_number = 0, index, ntpshm_segment, offset;
|
||||
int pps_fd = -1, print_level = LOG_INFO, r = -1, rt = 0;
|
||||
int wait_sync = 0;
|
||||
+ /* Note that pmc_subscribe_duration_sec has to be longer than
|
||||
+ * pmc_update_interval_sec otherwise subscription will time out before it is
|
||||
+ * renewed.
|
||||
+ */
|
||||
+ int pmc_update_interval_sec = 7;
|
||||
+ int pmc_subscribe_duration_sec = 3 * pmc_update_interval_sec;
|
||||
struct clock *src, *dst;
|
||||
struct config *cfg;
|
||||
struct option *opts;
|
||||
@@ -2062,7 +2070,7 @@ int main(int argc, char *argv[])
|
||||
progname = strrchr(argv[0], '/');
|
||||
progname = progname ? 1+progname : argv[0];
|
||||
while (EOF != (c = getopt_long(argc, argv,
|
||||
- "arc:d:f:s:E:P:I:S:F:R:N:O:L:M:D:i:u:wn:xz:l:t:mqvh",
|
||||
+ "arc:d:f:s:E:p:P:I:S:F:R:N:O:L:M:D:i:u:wn:xz:l:t:mqvh",
|
||||
opts, &index))) {
|
||||
switch (c) {
|
||||
case 0:
|
||||
@@ -2117,6 +2125,12 @@ int main(int argc, char *argv[])
|
||||
goto end;
|
||||
}
|
||||
break;
|
||||
+ case 'p':
|
||||
+ if (get_arg_val_i(c, optarg, &pmc_update_interval_sec, 1, MAX_PMC_UPDATE_INTERVAL_SEC) ||
|
||||
+ config_set_int(cfg, "pmc_update_interval_sec", pmc_update_interval_sec)) {
|
||||
+ goto end;
|
||||
+ }
|
||||
+ break;
|
||||
case 'P':
|
||||
if (get_arg_val_d(c, optarg, &tmp, 0.0, DBL_MAX) ||
|
||||
config_set_double(cfg, "pi_proportional_const", tmp))
|
||||
@@ -2289,10 +2303,15 @@ int main(int argc, char *argv[])
|
||||
snprintf(uds_local, sizeof(uds_local), "/var/run/phc2sys.%d",
|
||||
getpid());
|
||||
|
||||
+ pmc_update_interval_sec = config_get_int(cfg, NULL, "pmc_update_interval_sec");
|
||||
+ pmc_subscribe_duration_sec = 3 * pmc_update_interval_sec;
|
||||
+ pr_info("pmc_update_interval_sec %d, pmc_subscribe_duration_sec %d",
|
||||
+ pmc_update_interval_sec, pmc_subscribe_duration_sec);
|
||||
if (autocfg) {
|
||||
domain_number = config_get_int(cfg, NULL, "domainNumber");
|
||||
if (init_pmc_node(cfg, node, uds_local, domain_number,
|
||||
- phc2sys_recv_subscribed, &priv))
|
||||
+ phc2sys_recv_subscribed, &priv, pmc_update_interval_sec,
|
||||
+ pmc_subscribe_duration_sec))
|
||||
goto end;
|
||||
if (auto_init_ports(&priv, rt) < 0)
|
||||
goto end;
|
||||
@@ -2376,7 +2395,8 @@ int main(int argc, char *argv[])
|
||||
domain_number = config_get_int(cfg, NULL, "domainNumber");
|
||||
}
|
||||
if (init_pmc_node(cfg, src->node, uds_local, domain_number,
|
||||
- phc2sys_recv_subscribed, &priv))
|
||||
+ phc2sys_recv_subscribed, &priv, pmc_update_interval_sec,
|
||||
+ pmc_subscribe_duration_sec))
|
||||
goto end;
|
||||
|
||||
while (is_running()) {
|
||||
diff --git a/pmc_agent.c b/pmc_agent.c
|
||||
index 7b25e01..64012f8 100644
|
||||
--- a/pmc_agent.c
|
||||
+++ b/pmc_agent.c
|
||||
@@ -27,19 +27,12 @@
|
||||
#include "print.h"
|
||||
#include "util.h"
|
||||
|
||||
-#define PMC_UPDATE_INTERVAL (60 * NS_PER_SEC)
|
||||
-#define PMC_SUBSCRIBE_DURATION 180 /* 3 minutes */
|
||||
-/* Note that PMC_SUBSCRIBE_DURATION has to be longer than
|
||||
- * PMC_UPDATE_INTERVAL otherwise subscription will time out before it is
|
||||
- * renewed.
|
||||
- */
|
||||
-
|
||||
static void send_subscription(struct pmc_agent *node)
|
||||
{
|
||||
struct subscribe_events_np sen;
|
||||
|
||||
memset(&sen, 0, sizeof(sen));
|
||||
- sen.duration = PMC_SUBSCRIBE_DURATION;
|
||||
+ sen.duration = node->pmc_subscribe_duration_sec;
|
||||
event_bitmask_set(sen.bitmask, NOTIFY_PORT_STATE, TRUE);
|
||||
pmc_send_set_action(node->pmc, MID_SUBSCRIBE_EVENTS_NP, &sen, sizeof(sen));
|
||||
}
|
||||
@@ -221,7 +214,7 @@ void run_pmc_events(struct pmc_agent *node)
|
||||
|
||||
int init_pmc_node(struct config *cfg, struct pmc_agent *node, const char *uds,
|
||||
int domain_number, pmc_node_recv_subscribed_t *recv_subscribed,
|
||||
- void *context)
|
||||
+ void *context, int pmc_update_interval_sec, int pmc_subscribe_duration_sec)
|
||||
{
|
||||
node->pmc = pmc_create(cfg, TRANS_UDS, uds, 0, domain_number,
|
||||
config_get_int(cfg, NULL, "transportSpecific") << 4, 1);
|
||||
@@ -231,6 +224,8 @@ int init_pmc_node(struct config *cfg, struct pmc_agent *node, const char *uds,
|
||||
}
|
||||
node->recv_subscribed = recv_subscribed;
|
||||
node->recv_context = context;
|
||||
+ node->pmc_update_interval_sec = pmc_update_interval_sec;
|
||||
+ node->pmc_subscribe_duration_sec = pmc_subscribe_duration_sec;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -497,7 +492,7 @@ int pmc_agent_update(struct pmc_agent *node)
|
||||
}
|
||||
ts = tp.tv_sec * NS_PER_SEC + tp.tv_nsec;
|
||||
|
||||
- if (ts - node->pmc_last_update >= PMC_UPDATE_INTERVAL) {
|
||||
+ if (ts - node->pmc_last_update >= (uint64_t)node->pmc_update_interval_sec * NS_PER_SEC) {
|
||||
if (node->stay_subscribed) {
|
||||
renew_subscription(node, 0);
|
||||
}
|
||||
diff --git a/pmc_agent.h b/pmc_agent.h
|
||||
index 4e70606..9fbe780 100644
|
||||
--- a/pmc_agent.h
|
||||
+++ b/pmc_agent.h
|
||||
@@ -51,6 +51,9 @@ struct pmc_agent {
|
||||
bool pds_valid;
|
||||
bool new_pds;
|
||||
|
||||
+ int pmc_update_interval_sec;
|
||||
+ int pmc_subscribe_duration_sec;
|
||||
+
|
||||
/* Callback on message reception */
|
||||
pmc_node_recv_subscribed_t *recv_subscribed;
|
||||
void *recv_context;
|
||||
@@ -58,7 +61,7 @@ struct pmc_agent {
|
||||
|
||||
int init_pmc_node(struct config *cfg, struct pmc_agent *agent, const char *uds,
|
||||
int domain_number, pmc_node_recv_subscribed_t *recv_subscribed,
|
||||
- void *context);
|
||||
+ void *context, int pmc_update_interval_sec, int pmc_subscribe_duration_sec);
|
||||
int run_pmc_wait_sync(struct pmc_agent *agent, int timeout);
|
||||
void run_pmc_events(struct pmc_agent *agent);
|
||||
|
||||
@@ -187,10 +190,11 @@ int pmc_agent_subscribe(struct pmc_agent *agent, int timeout);
|
||||
* - The port state notification callback might be invoked.
|
||||
*
|
||||
* This function should be called periodically at least once per
|
||||
- * minute to keep both the port state and the leap second flags up to
|
||||
+ * 7s (configurable on agent->pmc_update_interval_sec) to keep both the
|
||||
+ * port state and the leap second flags up to
|
||||
* date. Note that the PMC agent rate limits the query to once per
|
||||
- * minute, and so the caller may safely invoke this method more often
|
||||
- * than that.
|
||||
+ * 7s (configurable on agent->pmc_update_interval_sec), and so the caller
|
||||
+ * may safely invoke this method more often than that.
|
||||
*
|
||||
* @param agent Pointer to a PMC instance obtained via @ref pmc_agent_create().
|
||||
* @return Zero on success, negative error code otherwise.
|
@ -60,3 +60,4 @@
|
||||
0060-Fix-HA-clock-selection-of-priority-0-source.patch
|
||||
0061-Fix-HA-clock-selection-algorithm.patch
|
||||
0062-Fix-HA-clock-selection-when-poll-timeout.patch
|
||||
0063-smooth-transparent-ha-switchover-configurable-pmc-update-interval.patch
|
||||
|
Loading…
x
Reference in New Issue
Block a user