Commit Graph

454 Commits (0367bb5f1bd2ad6f6764928b61bd1b8bb7240ead)

Author SHA1 Message Date
Richard Cochran 8e7a6da80c udp6: remember the interface index.
In order to set the scope id, we will need to know the interface index
before sending, in some cases.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-25 18:01:12 +01:00
Richard Cochran 87313fd05d Initialize the socket address structure to zero.
It is safer and more correct to clear the addresses before use. The IPv6
fields flowinfo and scope_id in particular should not be set to random
values from the stack.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-25 17:45:37 +01:00
Richard Cochran b8b96dd606 Tell about the make install target in the readme file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-25 16:34:21 +01:00
Richard Cochran da2a26a4ca Update the readme for Linux kernel version 3.7.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-25 16:33:08 +01:00
Richard Cochran e6bbbb27e1 Fixup the Doxygen comment for the sk_ts_info struct.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-14 20:22:39 +01:00
Richard Cochran 72fd5b523d Fixup label defined but not used warning
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-14 20:22:25 +01:00
Jacob Keller a1b492aba9 ptp4l: use sk_get_ts_info to check timestamping mode
this patch uses the new sk_get_ts_info data to check whether the selected
timestamping mode is supported on all ports. This check is not run if the port
data isn't valid, so it will only fail if the IOCTL is supported. This allows
for support of old kernels that do not support the IOCTL to still work as expected.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-11-14 20:22:17 +01:00
Jacob Keller 004b62d22b sk: change sk_interface_phc to sk_get_ts_info
this patch changes sk_interface_phc to sk_get_ts_info, by allowing the function
to store all the data returned by Ethtool's get_ts_info IOCTL in a struct. A new
struct "sk_ts_info" contains the same data as well as a field for specifying the
structure as valid (in order to support old kernels without the IOCTL). The
valid field should be set only when the IOCTL successfully populates the fields.

A follow-on patch will add new functionality possible because of these
changes. This patch only updates the programs which use the call to perform the
minimum they already do, using the new interface.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-11-14 20:22:10 +01:00
Miroslav Lichvar 4e81072589 ptp4l: make config parser strict.
- fail on unknown options, bad values and other syntax errors
- fail with more than MAX_PORTS ports
- remove implicit global section
- add error messages

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-08 18:28:33 +01:00
Miroslav Lichvar ff547aeebb ptp4l: ignore empty lines and comments in config.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-08 18:21:26 +01:00
Miroslav Lichvar 1a83619b17 phc2sys: add option to set slave-master time offset.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-08 18:17:31 +01:00
Miroslav Lichvar a373805b6d ptp4l: increase default tx_timestamp_retries to 100.
It seems with some cards the current default of 2 is too small, increase
the number to prevent users from having to investigate the EAGAIN error
messages.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-08 18:17:31 +01:00
Miroslav Lichvar 022f203b11 makefile: add install target.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-08 18:17:30 +01:00
Miroslav Lichvar 23ebe82816 Add .gitignore.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-08 18:17:30 +01:00
Richard Cochran d1c65394c6 Add an acknowledgment in the readme for audioscience.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-01 19:44:13 +01:00
Miroslav Lichvar 3d599e2d5d phc2sys: update help message.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-01 19:35:10 +01:00
Miroslav Lichvar d0714a9fac phc2sys: add selecting clock by name.
This allows synchronization of a PHC to the system clock.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-01 19:35:10 +01:00
Miroslav Lichvar 2f3b9f718f Add man pages.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-01 19:35:09 +01:00
Richard Cochran ebe6a24bd7 Remove useless option selecting layer 2 time stamping.
Now that the code automatically falls back to transport-specific time
stamping, this option is no longer needed.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Jiri Benc <jbenc@redhat.com>
2012-10-29 20:10:02 +01:00
Richard Cochran 870873c7a7 Try two different HWTSTAMP options.
Start with the most general HWTSTAMP option. If that fails, fall back
to the option that best fits the interface's transport.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Jiri Benc <jbenc@redhat.com>
2012-10-29 20:09:54 +01:00
Richard Cochran 8dde0d31b6 Pass transport type to time stamping initialization function.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Jiri Benc <jbenc@redhat.com>
2012-10-29 20:06:00 +01:00
Miroslav Lichvar 7894339cdd Fix errors found by Coverity Static Analysis.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-10-18 19:58:40 +02:00
Miroslav Lichvar e3a9535dff Explicitly set default values for all configurable options.
Make it easier to find out the compiled-in defaults in the code
and set all options in default.cfg.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-10-18 19:58:40 +02:00
Miroslav Lichvar 937f3aec5b Don't try calling SIOCETHTOOL on UDS.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-10-11 20:35:11 +02:00
Richard Cochran c6bb965f3d Remove obsolete links from the readme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-29 11:33:33 +02:00
Richard Cochran 675df82a29 Allow zero as a configured value for pi_offset_const.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-29 10:39:26 +02:00
Jacob Keller a15a0a0221 ptp4l: update the configuration files
this patch updates the default.cfg and gPTP.cfg to show the new defaults

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-09-29 06:24:44 +02:00
Jacob Keller b8160f2760 ptp4l: add maximum offset to pi servo
this patch modifies the pi servo to add a configurable max offset (default
infinity). When ever the detected offset is larger than this value, the clock
will jump and reset the servo state. The value of this feature is for decreasing
time to stabalize when clock is off by a large ammount during late running. This
can occur when the upstream master changes, or when the clock is reset due to
outside forces. The method used to reset clock is simply to reset the pi servo
to the unlocked state.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-09-29 06:24:44 +02:00
Jacob Keller 3464c9cfb4 ptp4l: add servo selection to the configuration file
this patch adds the servo selection to the configuration file

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-09-29 06:24:43 +02:00
Jacob Keller d951ba421f ptp4l: modify clock_create to take servo as argument
this patch modifies the clock_create to take the servo type as an argument

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-09-29 06:24:43 +02:00
Jacob Keller d67892abd7 ptp4l: modify servo setup to take an enum rather than string
passing a string as the servo type seems ugly when there are only a few
choices. This patch modifies the servo_create to take an enum instead.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-09-29 06:24:43 +02:00
Jacob Keller a0fc92957f phc2sys: add sk.o to phc2sys for sk_interface_phc
This patch adds support for sk_interface_phc to lookup the /dev/ptpX device
using ethtool's get_ts_info ioctl

-v2-
* set ethdev to null initially
* rebased on top of phc2sys changes

-v3-
* fixed typo regarding slash

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-09-28 06:55:14 +02:00
Richard Cochran eb09fe01d7 phc2sys: refactor and rationalize the output messages.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-26 08:42:19 +02:00
Richard Cochran c890a4b935 phc2sys: disentangle the PPS loop from the read_phc loop.
The main loop has become a bit messy, mixing two completely disjunct code
paths. This patch separates the two use cases for the sake of clarity.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-25 20:09:58 +02:00
Richard Cochran 99d7c128a1 phc2sys: remove useless option.
The 'rdelay' option has been obsoleted by the newer read_phc() logic.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-25 20:09:58 +02:00
Richard Cochran 0ff2d47d61 phc2sys: remove unused variable.
The 'src' parameter to the do_servo() function is never used, so
remove it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-25 19:39:50 +02:00
Richard Cochran 8f00d29265 Discover and utilize the initial clock frequency adjustment.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-22 11:30:50 +02:00
Richard Cochran 671358b21d Warn if a slave only node is selected by the bmc.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-22 11:30:50 +02:00
Richard Cochran 6ce135eaac Merge branch 'as2' 2012-09-20 12:59:27 +02:00
Miroslav Lichvar ce6533fd75 phc2sys: fix operation without -s option.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-09-20 09:55:27 +02:00
Delio Brignoli 1e6a169431 Do not expect or open a /dev/ptpX device when in free_running mode
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2012-09-15 10:59:49 +02:00
Richard Cochran 6c54c31dca Introduce the time status management message.
This non-portable, implementation specific message is designed to inform
external programs about the relationship between the local clock and the
remote master clock.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:44:20 +02:00
Richard Cochran f3b0ca69d3 trivial: fix a spelling error in a comment.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:30:37 +02:00
Richard Cochran 4e09ff8585 Introduce a helper function to convert from tmv to nanoseconds.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:30:37 +02:00
Richard Cochran d4e761138e bugfix: use a sensible test to detect a new master.
The code to detect a new master used pointer equality using a stale
pointer within the clock instance. Instead, the clock needs to remember
the identity of the foreign master in order to correctly detect a
change of master.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:30:36 +02:00
Miroslav Lichvar 9edd319f11 Use clock_adjtime from glibc if available.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-09-06 08:23:21 +02:00
Richard Cochran 7a50ead1d0 bugfix: correct wrong type for the cumulativeScaledRateOffset field.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-04 09:21:02 +02:00
Richard Cochran 8f5bd0edda Guard against divide by zero.
If a buggy driver or hardware delivers bogus time stamps, then we might
crash with a divide by zero exception.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-04 08:16:53 +02:00
Richard Cochran 35170cf6e4 Introduce a macro for the constant 2^41.
We are going to need this more than once for working with the
cumulativeScaledRateOffset fields.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-04 07:37:10 +02:00
Richard Cochran 8cc3433b8b Add an implementation specific management code.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:28 +02:00