Reset the STA_UNSYNC flag and maxerror value with every frequency update
to let the kernel synchronize the RTC to the system clock (11 minute mode).
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
The clockid parameter to the function to get the system clock's maximum
adjustment is redundant, so let us just remove it.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch modifies sk_receive in order to use poll() on POLLERR instead of the
tryagain loop as this resolves issues with drivers who do not return timestamps
quickly enough. It also resolves the issue of wasting time repeating every
microsecond. It lets the kernel sleep our application until the data or timeout arrives.
This change also replaces the old tx_timestamp_retries config value with
tx_timestamp_timeout specified in milliseconds (the smallest length of time poll
accepts). This does have the side effect of increasing the minimum delay before
missing a timestamp by up to 1ms, but the poll should return sooner in the
normal case where a packet timestamp was not dropped.
This change vastly improves some devices and cleans the code up by simplifying a
race condition window due to drivers returning tx timestamp on the error queue.
[ RC - removed the unused 'try_again' variable. ]
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
When using software time stamping and a free running clock, the
statistics appear to be off by the TAI offset. This patch fixes the
issue by setting the internal UTC timescale flag in such cases.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Due to a bug in older kernels, frequency reading may silently fail and
return 0. Set the frequency to the read value to make sure the servo
has the actual frequency of the clock.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
When there is a peer speaking PTPv1 in the network we want to silently ignore
the packets instead of flooding system log with error messages. At the same
time we still want to report malformed packets. For that we reuse standard
error numbers and do more fine-grained error reporting in packet processing
routines.
Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
This patch adds help messages for -l, -m and -q options.
Also it swaps -h for -v because ptp4l's help is this order.
Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
ERANGE is used by the kernel to indicate the hardware does not support the
requested time stamping mode. Explain this error to the user.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Add kernel_leap option for ptp4l and -x option for phc2sys to disable
setting of the STA_INS/STA_DEL bit to slowly correct the one-second
offset by servo.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Extend the clock_utc_correct function to handle leap seconds announced
in the time properties data set. With software time stamping, it sets the
STA_INS/STA_DEL bit for the system clock. Clock updates are suspended
in the last second of the day.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Update the currentUtcOffset and leap61/59 values at one minute
interval. When a leap second is detected, set the STA_INS/STA_DEL
bit for the system clock.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Modify the pmc to allow non-blocking operation. Run it on each clock
update to have the sync offset updated from currentUtcOffset with every
other call.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Handle reception of >=3 sequential multiple pdelay responses from
distinct peers as a fault of type FT_BAD_PEER_NETWORK.
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
This patch also changes port_capable() to reset the port's nrate every time asCapable changes
from true to false.
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
If messages are not freed, it is possible (with purposely crafted traffic) to trigger
a peer delay calculation which will use message's data from the previous round.
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
The 'struct ptp_message" includes a 64 bit integer field, ts.pdu.sec,
and this must be aligned to an eight byte boundary for armv5 machines.
Although the compiler puts the field at the right offset, we spoil this
by packing the struct with 20 bytes of head room. This patch fixes the
issue by realigning the message buffer.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Many of the single field management messages have just two bytes, one for
the data value and one for padding. This patch adds a structure that can
be used for all of these management IDs.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>