Commit Graph

1127 Commits (1b7a1e2cda1da59cee9aea38009663cdaf278487)

Author SHA1 Message Date
Miroslav Lichvar 9c83fcb3c9 phc2sys: Change update rate parameter to floating-point.
This allows update intervals longer than 1 second.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-05-10 09:44:59 +02:00
Miroslav Lichvar 3414d99609 phc2sys: Use currentUtcOffset only with PTP timescale.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-05-10 08:16:57 +02:00
Miroslav Lichvar 4a3e5857b1 ptp4l: Allow P, I constants over 1.0.
With sub-second sync intervals, it may be useful to set P and I to
values over 1.0.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-05-10 08:04:38 +02:00
Richard Cochran 776c88a13c Version 1.2
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-04-20 12:12:06 +02:00
Jiri Benc 4004273cd8 phc2sys: enable PPS output from PHC
PPS output from a PHC has to be enabled by PTP_ENABLE_PPS ioctl. Call
the ioctl when both PHC device and PPS device are specified and PPS is
supported by the PHC.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2013-04-19 17:52:25 +02:00
Richard Cochran f0d21dd80f Simplify tests on configuration ranges.
This patch simplifies some expressions which validate that configuration
variables are within the allowed ranges.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-04-12 19:37:09 +02:00
Miroslav Lichvar 5bc98f3130 Replace spaces with tabs in configs.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-11 19:44:07 +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
Miroslav Lichvar 4929d50a3f Let kernel synchronize RTC to system clock.
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>
2013-04-09 07:08:45 +02:00
Miroslav Lichvar 7b162c4821 clockadj: Remove clkid parameter from set_leap function.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-09 07:08:44 +02:00
Miroslav Lichvar 24c4e851fc phc2sys: Add option to set domain number.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-09 07:08:44 +02:00
Miroslav Lichvar d5cf47f7f6 phc2sys: Use phc_open().
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-09 07:08:44 +02:00
Miroslav Lichvar 5835effd2a phc2sys: Don't try PTP_SYS_OFFSET with system clock as source.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-09 07:08:44 +02:00
Miroslav Lichvar e3f57d1579 phc2sys: Read maximum frequency adjustment.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-09 07:08:44 +02:00
Richard Cochran 1f2c9de982 clockadj: remove useless clockid parameter.
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>
2013-04-09 07:06:20 +02:00
Richard Cochran 4a6ef24fef clockadj: make Doxygen comment by using two stars.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-04-09 07:06:19 +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 2ec3829bd4 Apply utc offset correction even when free running.
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>
2013-04-05 20:22:25 +02:00
Miroslav Lichvar fce0aa0a2f Fix compiler warnings with -O2.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-05 09:14:29 +02:00
Miroslav Lichvar f8563452a8 ptp4l: Read system clock maximum frequency adjustment.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-04-05 09:11:17 +02:00
Miroslav Lichvar da347d7a36 ptp4l: Set clock frequency on start.
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>
2013-04-05 08:38:49 +02:00
Richard Cochran 9ee5c1fb8e Let a slaved port update the time properties on every announce message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-04-02 19:28:10 +02:00
Richard Cochran 1c4f99a0c3 Add a clock method to update the time properties data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-04-02 19:25:29 +02:00
Libor Pechacek 0367bb5f1b Distinguish between ignored and malformed packets
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>
2013-03-28 18:48:52 +01:00
Ken ICHIKAWA 5d7e1b0f18 phc2sys: add help messages for -l, -m and -q
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>
2013-03-28 07:10:35 +01:00
Ken ICHIKAWA 8c55817caf Enable LOG_MIN_PDELAY_REQ_INTERVAL management request
Why don't you enable LOG_MIN_PDELAY_REQ_INTERVAL management request?
2013-03-28 07:10:32 +01:00
Jiri Benc fb1b781413 hwstamp_ctl: explain ERANGE error better
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>
2013-03-24 16:12:20 +01: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
Miroslav Lichvar e21af97091 ptp4l: Handle leap seconds.
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>
2013-03-20 19:37:39 +01:00
Miroslav Lichvar 09667479b8 Add missing conversions from tmv_t to nanoseconds.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-03-20 19:37:39 +01:00
Miroslav Lichvar eb93926bc9 phc2sys: Handle leap seconds.
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>
2013-03-20 19:37:39 +01:00
Miroslav Lichvar a29b1a4105 Move clock_adjtime wrapping to clockadj.c.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-03-20 19:37:39 +01:00
Miroslav Lichvar 58b1f3f37d phc2sys: Update sync offset periodically with -w.
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>
2013-03-20 19:37:39 +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 b936d35b6d Add support for multiple fault types
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-20 19:10:22 +01:00
Delio Brignoli 455ebe7d22 Rename set_tmo() to set_tmo_log(), add set_tmo_lin()
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-20 19:10:22 +01:00
Delio Brignoli d374ad6bf7 Explicitly detect and handle changes of the peer's port id by resetting asCapable and the port's nrate
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>
2013-03-20 19:10:09 +01:00
Delio Brignoli 9650cb687d Log changes to asCapable
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-17 18:50:31 +01:00
Delio Brignoli 3cc285c691 Free peer delay responses and followup messages when sending a new peer delay request
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>
2013-03-14 05:17:41 +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
Geoff Salmon 3a028edbc8 pmc: avoid printing invalid data from empty TLVs
Also adds additional null-check to bin2str to avoid crashing on empty
messages.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-03-12 20:26:44 +01:00
Richard Cochran 1ff9d0d0d2 Align the message buffer to eight bytes.
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>
2013-03-07 18:00:01 +01:00
Richard Cochran 48aa6712a9 Add support for the log peer delay interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:27:12 +01:00
Richard Cochran 9b5e37bbf8 Add support for the delay mechanism management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:23:32 +01:00
Richard Cochran d30d397c2b Add support for the version number management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:18:19 +01:00
Richard Cochran 06a65003f4 Add support for the log sync interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:14:05 +01:00
Richard Cochran d2f8bc5e38 Add support for the announce receipt timeout management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:10:51 +01:00
Richard Cochran 555c42e3d0 Add support for the log announce interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:06:36 +01:00
Richard Cochran 2044d045b4 Add support for the timescale management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-03 20:26:00 +01:00