Commit Graph

709 Commits (6415f56acbb36cd22771e968301c88957685f2e4)

Author SHA1 Message Date
Richard Cochran 81db403af8 Reset announce timer when port is passive.
Whenever a port enters the passive state, it should act like a slaved
port in one respect. Incoming announce messages from the grand master
are supposed to reset the announce timer. This patch fixes the port
logic to properly maintain the passive state.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reported-by: Rohrer Hansjoerg <hj.rohrer@mobatime.com>
2013-07-07 18:55:44 +02:00
Richard Cochran 5be0770dfc pmc: fix coding style by using K&R style functions. 2013-07-07 18:55:44 +02:00
Richard Cochran 93c609eee9 Clean up indented white space.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-07 18:55:44 +02:00
Richard Cochran c9ac677c98 No need to set kernel_leap twice in a row.
This patch removes a redundant initialization of the kernel_leap clock
variable. The field is already set in clock_create a few lines earlier.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-07 18:55:44 +02:00
Richard Cochran 4b21400869 Add another Freescale driver into the support matrix.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-07 18:55:44 +02:00
Geoff Salmon 42b2173a4d Allow received GET management messages to have bodies
You'd probably expect the body of GET messages to be empty, but
interpretation #29 in
http://standards.ieee.org/findstds/interps/1588-2008.html implies
otherwise. With this change, ptp4l will respond to GETs containing
either an empty dataField or a dataField whose length matches the
managementId. If present, the contents of the dataField are ignored.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-06-28 07:38:59 +02:00
Dale P. Smith 6dedf8bc24 Place clock type values in the correct positon
Signed-off-by: Dale P. Smith  <dalepsmith@gmail.com>
2013-06-28 07:37:42 +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
Ken ICHIKAWA 28b8dc9996 Add a new servo option which specifies first step threshold
Current pi servo steps clock without any condition on start.
This patch adds a new servo option "configured_pi_f_offset". The option is similar
to configured_pi_offset but only affects in the first clock update. Therefore,
if this option is set as 0.0, we can prevent clock step on start.
The new servo option can be specified from phc2sys by using -F option.

This feature is usefull when we need to restart phc2sys without system
clock jump. Restarting phc2sys is needed to change its configuration.

changes since v2:
 - manual page fix.
 - also apply max_offset along with max_f_offset in servo step1.
 - add a variable to check if first update is done.

changes since v1:(http://sourceforge.net/mailarchive/message.php?msg_id=31039874)
 - remake as a new servo option.

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
2013-06-21 07:27:11 +02:00
Miroslav Lichvar b796d90e80 Minor documentation improvements.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-06-18 18:56:27 +02:00
Miroslav Lichvar f657e47c26 Add missing state setting in PI servo when date check fails.
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 daca2773de phc2sys: common code exit point for bad usage case
Removed duplicate calls to usage() by providing common exit point for the case.

Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
2013-06-18 17:51:21 +02:00
Richard Cochran f394e1796d uClinux: Add another missing system call wrapper.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-06-14 12:58:57 +02:00
Richard Cochran d6d6a9ba64 Bring the readme file up to date with the equipment donations.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-06-14 12:58:56 +02:00
Richard Cochran e67276a56e trivial: break the very long lines of the get_ functions.
The get_ranged_ and get_arg_ declarations and definitions are just a wee
bit much too long. This patch breaks the overly long lines into two.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-06-14 12:58:56 +02:00
Richard Cochran c14a243b46 Silence grep error during build.
Ever since upgrading to Debian 7.0, building linuxptp results in an
annoying error message. This is due to the fact that the directory
/usr/include/bits is no longer present, but our makefile expects it
to exist. This patch fixes the issue by telling grep not to complain
about missing files.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-06-14 12:04:52 +02:00
Ken ICHIKAWA 0513c3b15b config: Apply more strict input validation to almost all config file options
Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
2013-06-14 11:51:07 +02:00
Ken ICHIKAWA 67c925f459 Don't return bogus clock id
phc_open() can open any device and return clkid even if the device is not phc
for example /dev/kvm and so on.
As a result, phc2sys keeps running with reading bogus clock as below:
 # phc2sys -s /dev/kvm -O 0 -q -m
 phc2sys[687019.699]: failed to read clock: Invalid argument
 phc2sys[687020.699]: failed to read clock: Invalid argument
 phc2sys[687021.699]: failed to read clock: Invalid argument
 phc2sys[687022.699]: failed to read clock: Invalid argument
 ...

This patch fixes that problem.

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
2013-06-06 17:00:25 +02:00
Ken ICHIKAWA 74e703727e ptp4l and phc2sys: Get argument values with strict error checking
Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
2013-06-04 20:16:22 +02:00
Ken ICHIKAWA 42cb449eaa util: Add common procedures to get argument values for ptp4l and phc2sys
Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
2013-06-04 20:16:21 +02:00
Ken ICHIKAWA a92f42de38 config: Apply config value validation to logging_level option
Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
2013-06-04 20:16:21 +02:00
Ken ICHIKAWA 306f83e7b1 Add support for more strict config value validation
This patch adds functions to get int, uint, double value from string
with error checking and range specification.
These functions don't allow overflow and outside of the range values.

In addition, it adds parser_result cases "MALFORMED" and "OUT_OF_RANGE" to make
reason of parse error more clear.

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
2013-06-04 20:16:21 +02:00
Libor Pechacek a29b3bc4f9 phc2sys: Require either -O or -w on command line
The default zero offset can lead to misalignment between system clocks or wrong
time to be broadcast to the domain.  Therefore we require setting offset upon
invocation.

Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
2013-06-03 15:59:01 +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
Delio Brignoli 3f8471ea68 Fix parsing of fault_badpeernet_interval option
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-05-30 15:40:28 +02:00
Miroslav Lichvar 026d422f8f ptp4l: Reset path delay when new master is selected.
When a new master is selected, drop the old path delay and don't
calculate the offset until the delay is measured again with the new
master.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-05-28 16:48:09 +02:00
Jacob Keller 2a89756654 phc2sys: update usage/error reporting
This patch updates phc2sys usage reporting to give a slightly better indication
of why the program was unable to run.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2013-05-16 19:58:23 +02:00
Jacob Keller 73105bc65a phc2sys: update open_clock and deprecate '-i' option
This patch modifies phc2sys to enable the use of interface names in clock_open
rather than having to do that by hand. This enables cleaner use of the -s and -c
options as they can accept interface names. This also enables the user to set
the slave clock by network interface as well.

-v2-
* fix clock_open as it used device instead of phc_device in the final call to phc_open

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2013-05-16 19:58:23 +02:00
Richard Cochran 3ae0ff1f44 phc2sys: Use nanosleep instead of usleep.
[RC: use CLOCK_MONOTONIC as suggested on the list.]

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-05-16 14:49:20 +02:00
Jiri Bohac 7ce1486d22 fix the check for supported timestamping modes
Fix the check for supported timestamping modes. The device needs
to support all the required modes, not just any subset of them.

Signed-off-by: Jiri Bohac <jbohac@suse.cz>
2013-05-16 14:36:19 +02:00
Jiri Bohac 7b02a5e9bd fix misleading pr_err on poll timeout
If poll() times out, don't print a misleading errno, say that a timeout
occured.

Signed-off-by: Jiri Bohac <jbohac@suse.cz>
2013-05-16 14:36:18 +02:00
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