import linuxptp-2.0-5.el8
This commit is contained in:
parent
1cb58b0988
commit
5b0daa12de
@ -401,3 +401,86 @@ index 2cd477a..b8f1ea0 100644
|
|||||||
} else {
|
} else {
|
||||||
/* use phc */
|
/* use phc */
|
||||||
if (!read_phc(node->master->clkid, clock->clkid,
|
if (!read_phc(node->master->clkid, clock->clkid,
|
||||||
|
commit e0580929f451e685d92cd10d80b76f39e9b09a97
|
||||||
|
Author: Richard Cochran <richardcochran@gmail.com>
|
||||||
|
Date: Tue Dec 24 11:09:34 2019 -0800
|
||||||
|
|
||||||
|
phc2sys: Fix frequency estimation when synchronizing a PHC to the system clock.
|
||||||
|
|
||||||
|
When synchronizing a PHC to the Linux system clock (CLOCK_REALTIME),
|
||||||
|
the phc2sys uses the sysoff method, reversing the master and slave
|
||||||
|
roles.
|
||||||
|
|
||||||
|
The offset between a master clock and a slave clock is given by
|
||||||
|
|
||||||
|
offset = slave_ts - master_ts,
|
||||||
|
|
||||||
|
and the call to sysoff_measure() provides the 'offset' and 'slave_ts'
|
||||||
|
values. The needed local time stamp on the 'master' is given by
|
||||||
|
|
||||||
|
master_ts = slave_ts - offset,
|
||||||
|
|
||||||
|
but the code calcuates
|
||||||
|
|
||||||
|
master_ts = slave_ts + offset.
|
||||||
|
|
||||||
|
When passed to the servo, the local time stamp is used to estimate the
|
||||||
|
frequency offset between the two clocks before starting the main
|
||||||
|
synchronization loop. The effect of the bug may be seen with a simple
|
||||||
|
test. Here is a sample output with the existing code.
|
||||||
|
|
||||||
|
$ sudo testptp -d /dev/ptp1 -f 62400000
|
||||||
|
frequency adjustment okay
|
||||||
|
$ sudo ./phc2sys -m -q -c eth6 -s CLOCK_REALTIME -O0
|
||||||
|
phc2sys[90221.239]: eth6 sys offset 191001318 s0 freq -62400000 delay 5547
|
||||||
|
phc2sys[90222.239]: eth6 sys offset 253380897 s1 freq +8265884 delay 5507
|
||||||
|
phc2sys[90223.239]: eth6 sys offset -8301685 s2 freq -35801 delay 5487
|
||||||
|
phc2sys[90224.239]: eth6 sys offset -8297136 s2 freq -2521757 delay 5531
|
||||||
|
phc2sys[90225.239]: eth6 sys offset -5806117 s2 freq -2519879 delay 5542
|
||||||
|
phc2sys[90226.239]: eth6 sys offset -3317009 s2 freq -1772606 delay 5495
|
||||||
|
phc2sys[90227.240]: eth6 sys offset -1575231 s2 freq -1025931 delay 5505
|
||||||
|
phc2sys[90228.240]: eth6 sys offset -580249 s2 freq -503518 delay 5524
|
||||||
|
phc2sys[90229.240]: eth6 sys offset -107770 s2 freq -205114 delay 5519
|
||||||
|
phc2sys[90230.240]: eth6 sys offset 66298 s2 freq -63377 delay 5490
|
||||||
|
phc2sys[90230.881]: eth6 sys offset 86942 s2 freq -22844 delay 5495
|
||||||
|
|
||||||
|
And this is the output with the bug fix in place.
|
||||||
|
|
||||||
|
$ sudo testptp -d /dev/ptp1 -f 62400000
|
||||||
|
frequency adjustment okay
|
||||||
|
$ sudo ./phc2sys -m -q -c eth6 -s CLOCK_REALTIME -O0
|
||||||
|
phc2sys[90365.624]: eth6 sys offset 311912675 s0 freq -62400000 delay 5490
|
||||||
|
phc2sys[90366.624]: eth6 sys offset 374292766 s1 freq -31098 delay 5642
|
||||||
|
phc2sys[90367.624]: eth6 sys offset -3825 s2 freq -34923 delay 5617
|
||||||
|
phc2sys[90368.625]: eth6 sys offset 6 s2 freq -32240 delay 5564
|
||||||
|
phc2sys[90369.625]: eth6 sys offset 1241 s2 freq -31003 delay 5605
|
||||||
|
phc2sys[90370.625]: eth6 sys offset 1131 s2 freq -30741 delay 5600
|
||||||
|
phc2sys[90371.625]: eth6 sys offset 801 s2 freq -30732 delay 5621
|
||||||
|
phc2sys[90372.625]: eth6 sys offset 458 s2 freq -30834 delay 5640
|
||||||
|
phc2sys[90373.626]: eth6 sys offset 186 s2 freq -30969 delay 5598
|
||||||
|
phc2sys[90374.626]: eth6 sys offset 134 s2 freq -30965 delay 5599
|
||||||
|
phc2sys[90375.626]: eth6 sys offset 43 s2 freq -31016 delay 5595
|
||||||
|
phc2sys[90375.681]: eth6 sys offset -32 s2 freq -31078 delay 5541
|
||||||
|
|
||||||
|
This patch fixes the issue by correcting the calculation of the local
|
||||||
|
time stamp value.
|
||||||
|
|
||||||
|
Fixes: 8142da41b61f ("phc2sys: Use reversed sysoff when synchronizing to system clock.")
|
||||||
|
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
|
||||||
|
Reported-by: Cliff Spradlin <cspradlin@google.com>
|
||||||
|
Tested-by: Vladimir Oltean <olteanv@gmail.com>
|
||||||
|
|
||||||
|
diff --git a/phc2sys.c b/phc2sys.c
|
||||||
|
index 28c657a..c0b7b3d 100644
|
||||||
|
--- a/phc2sys.c
|
||||||
|
+++ b/phc2sys.c
|
||||||
|
@@ -770,8 +770,8 @@ static int do_loop(struct node *node, int subscriptions)
|
||||||
|
node->phc_readings,
|
||||||
|
&offset, &ts, &delay) < 0)
|
||||||
|
return -1;
|
||||||
|
- ts += offset;
|
||||||
|
offset = -offset;
|
||||||
|
+ ts += offset;
|
||||||
|
} else {
|
||||||
|
/* use phc */
|
||||||
|
if (!read_phc(node->master->clkid, clock->clkid,
|
||||||
|
46
SOURCES/linuxptp-zerolength.patch
Normal file
46
SOURCES/linuxptp-zerolength.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
commit 6b61ba29c78e26109426429c6d6b354f6e4443cd
|
||||||
|
Author: David Mirabito via Linuxptp-devel <linuxptp-devel@lists.sourceforge.net>
|
||||||
|
Date: Tue Mar 19 13:42:48 2019 +1100
|
||||||
|
|
||||||
|
Avoid fault when receiving zero length packets
|
||||||
|
|
||||||
|
The manpage for recvmsg says -1 will be returned on error, Zero indicates an
|
||||||
|
"orderly shutdown", presumably only in case of stream sockets.
|
||||||
|
Further, UNIX Network Programming, Vol 1 says ".. a return value of 0 from
|
||||||
|
recvfrom is acceptable for a datagram protocol"
|
||||||
|
|
||||||
|
Such packets have been observed in the wild, aimed at PTP's multicast
|
||||||
|
address and port, possibly related to malformed management queries.
|
||||||
|
|
||||||
|
Patch to properly check return from recvmesg and not trigger the fault
|
||||||
|
codepath. Instead, such packets are treated as "Bad Message" the same as
|
||||||
|
non-zero but still too-short UDP payloads.
|
||||||
|
|
||||||
|
Signed-off-by: David Mirabito <davidjm@arista.com>
|
||||||
|
|
||||||
|
diff --git a/port.c b/port.c
|
||||||
|
index ad9554f..9264211 100644
|
||||||
|
--- a/port.c
|
||||||
|
+++ b/port.c
|
||||||
|
@@ -2563,7 +2563,7 @@ static enum fsm_event bc_event(struct port *p, int fd_index)
|
||||||
|
msg->hwts.type = p->timestamping;
|
||||||
|
|
||||||
|
cnt = transport_recv(p->trp, fd, msg);
|
||||||
|
- if (cnt <= 0) {
|
||||||
|
+ if (cnt < 0) {
|
||||||
|
pr_err("port %hu: recv message failed", portnum(p));
|
||||||
|
msg_put(msg);
|
||||||
|
return EV_FAULT_DETECTED;
|
||||||
|
diff --git a/sk.c b/sk.c
|
||||||
|
index 30162eb..93ba77a 100644
|
||||||
|
--- a/sk.c
|
||||||
|
+++ b/sk.c
|
||||||
|
@@ -359,7 +359,7 @@ int sk_receive(int fd, void *buf, int buflen,
|
||||||
|
}
|
||||||
|
|
||||||
|
cnt = recvmsg(fd, &msg, flags);
|
||||||
|
- if (cnt < 1)
|
||||||
|
+ if (cnt < 0)
|
||||||
|
pr_err("recvmsg%sfailed: %m",
|
||||||
|
flags == MSG_ERRQUEUE ? " tx timestamp " : " ");
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Name: linuxptp
|
Name: linuxptp
|
||||||
Version: 2.0
|
Version: 2.0
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
Summary: PTP implementation for Linux
|
Summary: PTP implementation for Linux
|
||||||
|
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
@ -37,6 +37,8 @@ Patch6: linuxptp-addreq.patch
|
|||||||
Patch7: linuxptp-msgput.patch
|
Patch7: linuxptp-msgput.patch
|
||||||
# add hwts_filter option to ptp4l
|
# add hwts_filter option to ptp4l
|
||||||
Patch8: linuxptp-hwtsfilter.patch
|
Patch8: linuxptp-hwtsfilter.patch
|
||||||
|
# fix handling of zero-length messages
|
||||||
|
Patch9: linuxptp-zerolength.patch
|
||||||
|
|
||||||
BuildRequires: kernel-headers > 4.18.0-87
|
BuildRequires: kernel-headers > 4.18.0-87
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
@ -60,6 +62,7 @@ Supporting legacy APIs and other platforms is not a goal.
|
|||||||
%patch6 -p1 -b .addreq
|
%patch6 -p1 -b .addreq
|
||||||
%patch7 -p1 -b .msgput
|
%patch7 -p1 -b .msgput
|
||||||
%patch8 -p1 -b .hwtsfilter
|
%patch8 -p1 -b .hwtsfilter
|
||||||
|
%patch9 -p1 -b .zerolength
|
||||||
mv linuxptp-testsuite-%{testsuite_ver}* testsuite
|
mv linuxptp-testsuite-%{testsuite_ver}* testsuite
|
||||||
mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim
|
mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim
|
||||||
|
|
||||||
@ -119,6 +122,10 @@ PATH=..:$PATH ./run
|
|||||||
%{_mandir}/man8/*.8*
|
%{_mandir}/man8/*.8*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Apr 27 2020 Miroslav Lichvar <mlichvar@redhat.com> 2.0-5
|
||||||
|
- fix sample timestamps when synchronizing PHC to system clock (#1787376)
|
||||||
|
- fix handling of zero-length messages (#1827275)
|
||||||
|
|
||||||
* Thu May 16 2019 Miroslav Lichvar <mlichvar@redhat.com> 2.0-4
|
* Thu May 16 2019 Miroslav Lichvar <mlichvar@redhat.com> 2.0-4
|
||||||
- rebuild with enabled gating (#1680888)
|
- rebuild with enabled gating (#1680888)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user