Commit Graph

55 Commits (992e29205528414cdd8fd7e8415a3493676f022b)

Author SHA1 Message Date
Richard Cochran d89d26d618 Add a configuration file option to enable the NetSync Monitor protocol.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-08 07:20:42 -08:00
Richard Cochran 99fd084253 Introduce an option to ignore the transport specific field.
Up until now the transportSpecific field has been treated according to
802.1AS, namely as a field that must match exactly on receive.
However, 1588 mandates ignoring this field for some transports, and
there is equipment in the wild that does in fact set the reserved
bits.

This patch adds an option to ignore the field on receive completely.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reported-by: Petr Kulhavy <brain@jikos.cz>
2018-03-06 06:31:04 -08:00
Miroslav Lichvar 4b957cf566 clock: add option to specify initial path delay.
This option allows the clock to be updated before the path delay is
measured in order to speed up the initial correction of the clock, e.g.
in domains using a very long logMinDelayReqInterval.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2018-02-19 09:47:13 -08:00
Miroslav Lichvar 0f6c6972c7 Add options to tag ptp4l and phc2sys log messages.
When running multiple instances of ptp4l or phc2sys, it's difficult to
tell which log message belongs to which instance. Add new options to
ptp4l and phc2sys which can specify a tag for all messages printed to
the standard output or system log, so messages from different instances
can have different tags.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2017-02-05 16:44:48 +01:00
Viliam Lejcik 33e62f9925 ptp4l: Make UTC offset configurable.
Currently UTC offset is defined as a constant - CURRENT_UTC_OFFSET, and if
a leap second is added, that constant is no longer valid. Ptp4l was
updated to read the UTC offset from configuration instead.

Signed-off-by: Viliam Lejcik <viliam.lejcik@kistler.com>
2017-02-05 16:41:58 +01:00
Richard Cochran 4e966536c6 ptp4l: Document the "long" command line options in the man page.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
2016-12-13 20:52:45 +01:00
Jesuiter, Henry (ALC NetworX GmbH) 1e667ff7fb Introduce options to set DSCP values in PTP messages.
In the last years there are several media streaming standards
evolving that are relying on PTP. These standards make requirements
about the DSCP priority of PTP messages. This patch introduces two
new configuration options 'dscp_event' and 'dscp_general' to address
that issue and to be able to set the DSCP priority separately for
PTP event messages and PTP general messages.

Signed-off-by: Henry Jesuiter <henry.jesuiter@alcnetworx.de>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-07-12 15:11:56 +02:00
Richard Cochran 0d61027fd3 Fix the man page regarding the '-p' option.
The -p option for ptp4l, which specifies the PHC device, was added
before the ethtool get_ts_info ioctl had been invented.  Today it does
not "force" the given device as the man page says.  Instead this is a
legacy option only useful when running on older kernels.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-07-03 20:45:41 +02:00
Wolfgang Wallner 6eec5a0d48 Fix typo in manpage of ptp4l
There is one parenthesis too many in the manpage of ptp4l.
2015-11-01 19:46:19 +01:00
Richard Cochran 776f772c36 Merge the hybrid E2E work.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-09-05 21:40:48 +02:00
Miroslav Lichvar d8bfa0fa69 udp6: set hop limit with udp_ttl option.
Use the udp_ttl option to configure both IPv4 and IPv6 transports.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2015-08-31 15:39:41 +02:00
Richard Cochran e85cb68320 Support hybrid E2E using unicast delay requests and responses.
The draft Enterprise Profile [1] specifies a hybrid E2E delay mechanism,
where the delay response message is sent "in kind".  That is, if the
request is unicast, then the response is also unicast.  Apparently this
scheme is already in widespread use in some industries.  Also, it makes
sense, because those messages are of no interest to the other slaves in
the PTP network.

Because of the address work already in place, in turns out that adding
this mode is almost trivial.  This patch introduces an "hybrid_e2e" option
that enabled the new mode.

1. https://datatracker.ietf.org/doc/draft-ietf-tictoc-ptp-enterprise-profile

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-29 11:33:34 +02:00
Richard Cochran 852c288ebe config: convert 'p2p_dst_mac', letting it be a per-port option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran a31f2d0ddf config: convert 'ptp_dst_mac', letting it be a per-port option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran ae09c1c4c0 Add a configuration option to use the "nullf" servo.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-07-24 22:17:09 +02:00
IOhannes m zmölnig 0e1b25176d fixed hyphen/minus signs in groff
in manpages, the '-' denotes a hyphen.
for a proper minus, we need to write '\-'

Signed-off-by: IOhannes m zmölnig <zmoelnig@umlaeute.mur.at>
2015-06-08 14:46:37 +02:00
Miroslav Lichvar 06fcfe123c tsproc: add raw and weighting modes.
Add new time stamp processing modes to return raw delay and offset based
on the raw delay instead of the long-term filtered delay, and to return
also a weight of the sample. The weight is set to the ratio between the
two delays. This gives smaller weight to samples where the sync and/or
delay messages were delayed significantly in the network and possibly
include a large error.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2015-03-27 10:58:04 +01:00
Richard Cochran d70d38ade3 config: add a option to enable a poor man's boundary clock.
This patch adds a configuration option that allows running a boundary clock
using "just a bunch of devices". Normally each port is probed to make sure
they all share the same PTP hardware clock, but this option will allow a
heterogeneous collection of devices, should the user really want it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
2014-12-16 21:33:23 +01:00
Richard Cochran 53a08ec4df config: Introduce options for correcting transmit and receive delays.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2014-12-12 21:44:56 +01:00
Miroslav Lichvar 3760f8b653 Add option to set NTP SHM segment number.
Instead of setting it to the PTP domain number, add a new option to
ptp4l and phc2sys to set it as needed. The default value is 0. This
allows multiple ptp4l/phc2sys instances running in the same domain.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-09-21 12:43:09 +02:00
Miroslav Lichvar 9710fb1a22 Add new servo for NTP SHM reference clock.
This is a simple servo that provides the NTP SHM reference clock. It
doesn't make any clock adjustments and it always returns with the
unlocked state. It writes all samples to the SHM segment and another
process (e.g. chronyd or ntpd) is needed to read the samples and
actually synchronize the clock. The SHM segment number is set to the PTP
domain number to allow multiple SHM reference clocks running at the same
time.

This is mainly useful when other time sources are available on the
system (e.g. NTP, hardware reference clocks, or other PTP domains)
and a fallback to/from PTP is needed.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-06-14 10:49:04 +02:00
Miroslav Lichvar 683218aee6 Print warning message on deprecated ptp4l options.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-03-23 12:39:20 +01:00
Miroslav Lichvar 2b099cfa06 Increase default first step threshold to 20 us.
Most PHC drivers implement stepping (ADJ_SETOFFSET) by reading the
clock, adjusting the value by the offset and writing it back. This is
not perfectly accurate and if the operation is slow (e.g. due to PCIe
latencies), the error can be in microseconds.

Increase the default first step threshold from 100 nanoseconds to 20
microseconds to step only when the initial offset is larger than
the error in the step.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-03-23 12:39:20 +01:00
Miroslav Lichvar a5890cbe98 Add an adaptive servo based on linear regression.
This servo uses linear regression to estimate current time and
frequency error. The number of points used in the regression is
variable (from 4 to 64 in powers of 2) and is selected by a long-term
statistic of the prediction error.

Future improvements could include tracking of sudden frequency changes
(e.g. due to temperature variations), better stability of the error
statistic when a large offset is corrected, options to set the speed of
the adaptation, minimum and maximum number of points, or an option to
prefer frequency accuracy over time accuracy.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-03-14 09:52:40 +01:00
Miroslav Lichvar 31feb00194 Move PI step threshold and max frequency settings to common servo code.
These settings will be useful for all implemented servos, so move them
to the common servo code to avoid duplication. The configuration options
are renamed, but the they can be still set by their old names.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-03-14 09:52:39 +01:00
Delio Brignoli b2bde6f5ec config: Add min_neighbor_prop_delay configuration variable
When peer delay is < min_neighbor_prop_delay the port is flagged
as non 802.1AS capable. min_neighbor_prop_delay defaults to -20ms.

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2014-02-25 14:14:01 +01:00
Miroslav Lichvar 661639420c Clarify units used in clock stepping constants.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-02-11 21:27:52 +01:00
Richard Cochran 101e9dcc0e Add a configuration file option for the 802.1AS gmCapable flag.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-12-18 18:34:33 +01:00
Miroslav Lichvar 85a1bcfa8e Add options to configure delay filter.
Add new options delay_filter and delay_filter_length to select the
filter and its length. They set both the clock delay filter and the port
peer delay filter. The default is now moving median with 10 samples.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-10-30 21:54:07 +01:00
Miroslav Lichvar ed379b4028 Add clock sanity check.
Check the sanity of the synchronized clock by comparing its uncorrected
frequency with the system monotonic clock. When the measured frequency
offset is larger than the value of the sanity_freq_limit option (20% by
default), a warning message will be printed and the servo will be reset.
Setting the option to zero disables the check.

This is useful to detect when the clock is broken or adjusted by another
program.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-10-27 08:24:01 +01:00
Richard Cochran 9fe2ffd2ef Introduce a configuration file option for the server's UDS address.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-10-08 20:11:20 +02:00
Richard Cochran b7ebfab0cc Add a configuration file option for the extra sync-fup check.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-08-29 11:23:48 +02:00
Richard Cochran c6e046e2a2 Add a configuration file option for the sync receive timeout.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-08-26 18:30:54 +02:00
Miroslav Lichvar c7c675852e Adjust constants of PI servo according to sync interval.
Instead of using fixed constants, set them by the following formula from
the current sync to allow good performance of the servo even when the
sync interval changes in runtime and to avoid instability.

kp = min(kp_scale * sync^kp_exponent, kp_norm_max / sync)
ki = min(ki_scale * sync^ki_exponent, ki_norm_max / sync)

The scale, exponent and norm_max constants are configurable. The
defaults are chosen so there is no change to the previous default
constants of the servo with one second sync interval. The automatic
adjustment can be disabled by setting the pi_proportional_const and
pi_integral_const options to a non-zero value, but stability of the
servo is always enforced.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-07-14 21:37:53 +02:00
Richard Cochran f89e203209 Add a configuration option for the time source.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-07 18:55:45 +02:00
Ken ICHIKAWA fa41be7e6e ptp4l: add support for using configured_pi_f_offset servo option
This patch adds support for using the configured_pi_f_offset servo option to ptp4l.
If "pi_f_offset_const 0.0" is specified in the config file, stepping on the first
update is prevented. If any other positive value is specified, stepping on the
first update occurs when the offset is larger than the specified value.

change since v1
 - add the new option to default.cfg and gPTP.cfg

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
2013-06-25 07:16:24 +02:00
Miroslav Lichvar b796d90e80 Minor documentation improvements.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-06-18 18:56:27 +02:00
Libor Pechacek 0bf412d24b Reordered options in manual page synopsis
Options without parameters are now grouped together at the beginning of line
for better legibility.

Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
Cc: Miroslav Lichvar <mlichvar@redhat.com>
2013-06-18 17:51:21 +02:00
Libor Pechacek 6e4734316f Document PTP time scale usage and provide examples
Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
2013-06-03 15:59:01 +02:00
Miroslav Lichvar 3012cf0540 Add option to set maximum frequency adjustment.
The option sets an additional limit to the hardware limit. It's disabled
if set to zero. The default is 900000000 ppb.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-11 19:44:07 +02:00
Jacob Keller 76e10e95fb ptp4l: Use poll() instead of a try-again loop
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>
2013-04-05 20:43:33 +02:00
Richard Cochran bd28acffb3 Merge branch 'mlichvar_leap'
Fixed up trivial conflict in the makefile.

Conflicts:
	makefile
2013-03-20 19:51:46 +01:00
Miroslav Lichvar 4e24248a71 Add options to not apply leap seconds in kernel.
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>
2013-03-20 19:37:40 +01:00
Delio Brignoli 789a5c8e37 Add support for FT_BAD_PEER_NETWORK
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>
2013-03-20 19:10:22 +01:00
Delio Brignoli 4626487ff3 Implement neighborPropDelayThresh check in port_capable()
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-14 05:17:38 +01:00
Miroslav Lichvar 3136e3e46c Add summary statistics.
Add new options to ptp4l and phc2sys to print summary statistics of the
clock instead of the individual samples.

[ RC - Fix () function prototype with (void).
     - Use unsigned for sample counter.
     - Fix over-zealous line breaks. ]

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-02-09 10:09:25 +01:00
Geoff Salmon 1e77af6d21 config clock description
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-04 12:22:11 +01:00
Delio Brignoli da594e78d9 Make the fault reset interval a per-port configuration parameter.
A timeout of 15 seconds is not always acceptable, make it configurable.

By popular consensus, instead of using a linear number of seconds, use
the 2^N format for the time interval, just like the other intervals in
the PTP data sets. In addition to numeric values, let the configuration
file support 'ASAP' to have the fault reset immediately.

[RC - moved the handling of special case tmo=0 and added a break out
      of the fd event loop in case the fds have been closed.
    - changed the linear seconds option to log second instead.
    - changed the commit message to reflect the final version. ]

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-02-03 17:53:33 +01:00
Miroslav Lichvar b5ec128574 Update twoStepFlag description in man page. 2012-12-18 18:52:01 +01:00
Richard Cochran b810153ed5 Add asymmetry correction.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jacob Keller <Jacob.e.keller@intel.com>
2012-12-11 14:36:30 +01:00