deeacbcdf3
Enhanced phc2sys to support multiple PTP timing clock sources, to select the best clock source available according to the clocks statuses. A series of changes were patched back from a newer version of the linuxptp package. They contain the support for multiple pmc nodes, necessary to communicate with multiple ptp4l instances. The phc2sys is now able to automatically select the best clock according to the clocks statuses, and also monitors any clock status change and act to keep the system synchronized to the best clock source available. A new set of configuration options were added to control the behavior of the automatic clock selection algorithm and to configure the clock source interfaces. And a new command interface was added to phc2sys to gather statuses about the clocks configured and the HA algorithm. This interface also provides commands to control the clock source selection for debug and maintenance proposes. Test plan: PASS: Verify the linuxptp package is built containing all the patches. PASS: Verify the .deb package produced in the build install and that all the PTP different deployments new and existing are OK. PASS: Verify that a new image containing the linuxptp packed can be installed and that all the PTP different deployments new and existing are OK. Story: 2010723 Task: 48642 Change-Id: Ic8c4d9bd335c582a91f1f4418947a81fc5e8b4f9 Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
67 lines
2.2 KiB
Diff
67 lines
2.2 KiB
Diff
From 38a530d94fc5aa73bde424d05e2e38348e64d7e5 Mon Sep 17 00:00:00 2001
|
|
From: Miroslav Lichvar <mlichvar@redhat.com>
|
|
Date: Wed, 18 May 2022 11:33:36 +0200
|
|
Subject: [PATCH 8/47] 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
|
|
which is expected in probing and should stay at the debug level to avoid
|
|
confusing users.
|
|
|
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
|
[commit 270709323a161ff1cb83af511ce50691152c75cf upstream]
|
|
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
|
|
---
|
|
sysoff.c | 14 +++++++++++---
|
|
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/sysoff.c b/sysoff.c
|
|
index 5d3b907..a425275 100644
|
|
--- a/sysoff.c
|
|
+++ b/sysoff.c
|
|
@@ -28,6 +28,14 @@
|
|
|
|
#define NS_PER_SEC 1000000000LL
|
|
|
|
+static void print_ioctl_error(const char *name)
|
|
+{
|
|
+ if (errno == EOPNOTSUPP)
|
|
+ pr_debug("ioctl %s: %s", name, strerror(errno));
|
|
+ else
|
|
+ pr_err("ioctl %s: %s", name, strerror(errno));
|
|
+}
|
|
+
|
|
static int64_t pctns(struct ptp_clock_time *t)
|
|
{
|
|
return t->sec * NS_PER_SEC + t->nsec;
|
|
@@ -38,7 +46,7 @@ static int sysoff_precise(int fd, int64_t *result, uint64_t *ts)
|
|
struct ptp_sys_offset_precise pso;
|
|
memset(&pso, 0, sizeof(pso));
|
|
if (ioctl(fd, PTP_SYS_OFFSET_PRECISE, &pso)) {
|
|
- pr_debug("ioctl PTP_SYS_OFFSET_PRECISE: %m");
|
|
+ print_ioctl_error("PTP_SYS_OFFSET_PRECISE");
|
|
return -errno;
|
|
}
|
|
*result = pctns(&pso.sys_realtime) - pctns(&pso.device);
|
|
@@ -98,7 +106,7 @@ static int sysoff_extended(int fd, int n_samples,
|
|
memset(&pso, 0, sizeof(pso));
|
|
pso.n_samples = n_samples;
|
|
if (ioctl(fd, PTP_SYS_OFFSET_EXTENDED, &pso)) {
|
|
- pr_debug("ioctl PTP_SYS_OFFSET_EXTENDED: %m");
|
|
+ print_ioctl_error("PTP_SYS_OFFSET_EXTENDED");
|
|
return -errno;
|
|
}
|
|
*result = sysoff_estimate(&pso.ts[0][0], 1, n_samples, ts, delay);
|
|
@@ -112,7 +120,7 @@ static int sysoff_basic(int fd, int n_samples,
|
|
memset(&pso, 0, sizeof(pso));
|
|
pso.n_samples = n_samples;
|
|
if (ioctl(fd, PTP_SYS_OFFSET, &pso)) {
|
|
- perror("ioctl PTP_SYS_OFFSET");
|
|
+ print_ioctl_error("PTP_SYS_OFFSET");
|
|
return -errno;
|
|
}
|
|
*result = sysoff_estimate(pso.ts, 0, n_samples, ts, delay);
|
|
--
|
|
2.29.2
|
|
|