Commit Graph

172 Commits (47971bdd50d234305cce95da5a544a4f3b8d0f2f)

Author SHA1 Message Date
Richard Cochran fffb6a53bd config: port: convert 'syncReceiptTimeout' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 35227f2d1f config: port: convert 'announceReceiptTimeout' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 639ce56fa0 config: port: convert 'logMinPdelayReqInterval' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 0578e321fb config: port: convert 'logMinDelayReqInterval' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 769a8d3fa6 config: port: convert 'logSyncInterval' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 8026663c43 config: port: convert 'logAnnounceInterval' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 4c9c447429 config: convert 'ntpshm_segment' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 177a7104d5 config: convert 'pi_integral_norm_max' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 85c358ebe0 config: convert 'pi_integral_exponent' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 7533336234 config: convert 'pi_integral_scale' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran b57840cef9 config: convert 'pi_proportional_norm_max' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran d48c8ce8a5 config: convert 'pi_proportional_exponent' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 94048a2947 config: convert 'pi_proportional_scale' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 07b229907d config: convert 'pi_integral_const' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 25c903b0d2 config: convert 'pi_proportional_const' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran a7db9bad37 config: convert 'verbose' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran f5f77b182c config: convert 'use_syslog' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran caaf72c5ec config: convert 'logging_level' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran e8a2956ce0 config: convert the 'max_frequency' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 4f649b1ec4 config: convert the 'first_step_threshold' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran df578135d3 config: convert the 'step_threshold' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran a4329f7873 config: convert the 'check_fup_sync' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 42dda4d2b7 config: convert 'tx_timestamp_timeout' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 85bbf9d919 config: convert the 'assume_two_step' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran e7dbc068f6 config: introduce a new API for reading configuration settings.
This patch introduces generic code for adding and parsing new options.
The public 'get' methods return option values directly.  Although the
API is easy to use, it does not provide error checking in case the
option does not exist or if there is a type mismatch.

Therefore the code performs a BIST to ensure that the options are
properly populated.  In addition, the code terminates the program in
case of missing options or type mismatches.  This heavy handed
approach is meant to catch errors during development and should never
trigger during normal usage.

As a first element, we include an option for specifying the UDP TTL.

Users are required to call 'config_init', and so this patch add that into
all three programs, ptp4l, phc2sys and pmc.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:19 +02:00
Richard Cochran 1579b7893b clock: store the configuration in the clock data structure.
This will help us to simplify the passing of parameters between the main
program. clock, and ports.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-16 11:20:23 +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
Richard Cochran e5f20ea6df Merge Jiri's Dynamic port allocation series. 2014-09-21 19:40:49 +02:00
Jiri Benc 5e0196d647 Dynamic allocation of interface config entries
Remove the limit of MAX_PORTS ports also when parsing command line
arguments.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2014-09-21 13:15:59 +02:00
Miroslav Lichvar ca637b2067 Move signal handling to util.c.
This will be useful in phc2sys and pmc.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-09-21 12:34:05 +02:00
Miroslav Lichvar 93b7807aad Disable clockcheck and kernel leap with ntpshm servo.
Always disable the clock sanity check when the ntpshm servo is used,
because it doesn't know when or how is the clock adjusted. Disable also
the kernel leap option as the process controlling the clock is
responsible for setting the kernel flag.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-06-22 09:30:31 +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 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
Richard Cochran f36af8e0c3 uds: disable the accidentally enabled announce timer.
Commit e425da2f inadvertently enabled the announce timer on the UDS port,
causing it to continually reopen the socket when in slave mode. This patch
fixes the issue by passing zero in the 'span' field of the new function,
set_tmo_random, which disables the timer again.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reported-by: Rohrer Hansjoerg <hj.rohrer@mobatime.com>
2014-01-08 18:59:20 +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
Richard Cochran bdbda10c73 Introduce the gmCapable flag for use with 802.1AS clocks.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-12-01 20:32:05 +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
Andy Lutomirski f6536fe36a Fix check for timestamping modes
The code was checking the wrong interface's capabilities.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
2013-07-28 14:42: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 4782d669c2 Add a clock variable to hold the value of 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
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
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
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 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 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 fd27f99045 set length of ptp text defaults
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-10 20:05:56 +01:00
Richard Cochran 1ce90fe160 Reduce the arguments to clock_create.
New clock options should go into 'struct default_ds' so that we can avoid
growing clock_create indefinitely.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-02-09 10:45:30 +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 09c2d1a652 adds clock description
Adds struct containing clock description info that will be needed for
USER_DESCRIPTION and CLOCK_DESCRIPTION management messages.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-04 12:22:11 +01:00
Miroslav Lichvar d28f7721de Set program name for print().
The printing facility is used by different programs, allow to set the
program name which prefixes the messages written to stdout.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-02-03 19:08:34 +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
Richard Cochran 39e8ee0642 Add command line options to print the software version.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-10 15:11:51 +01:00
Richard Cochran d60ccc7484 Use the management message memory layout for the defaultDS.
Reforming the data structure in this way will greatly simplify the
implementation of the management message for this data set.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-30 21:52:37 +01:00
Richard Cochran b96e73994b Support one step sync operation.
The Linux kernel supports a hardware time stamping mode that allows
sending a one step sync message. This commit adds support for this mode
by expanding the time stamp type enumeration. In order to enable this
mode, the configuration must specify both hardware time stamping and set
the twoStepFlag to false.

We still do not support the one step peer delay request mechanism since
there is neither kernel nor hardware support for it at this time.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-30 11:34:29 +01:00
Richard Cochran d83cd7283c udp6: add an option to set the multicast scope.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-25 20:30:14 +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
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
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
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
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 81648e81ed Always set the clock class to 255 when slave only mode is configured.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-28 18:47:45 +02:00
Miroslav Lichvar 2040933d74 Configure logging facility sooner.
Error messages from initialization were missing.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-08-27 21:20:08 +02:00
Richard Cochran afbec38d6e Release all resources when quitting the main loop.
This will allow running under valgrind to detect memory leaks
and the like.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 21:11:14 +02:00
Richard Cochran 889c707ba1 Break out of the main loop on Control-C.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 21:07:38 +02:00
Richard Cochran 529206112d Move shared layer 2 global declarations into an appropriate header file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +02:00
Richard Cochran e1f77422ec Move shared PI global variable into the proper module.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +02:00
Richard Cochran 75cdd1fe15 Add an option to dial the frequency estimation interval.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 19:54:46 +02:00
Richard Cochran 20c3dc5ed1 Remove obsolete text from command line usage.
Now the command line options are always global and not per-interface.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 18:26:00 +02:00
Jacob Keller 490c3e22a7 ptp4l: build the interfaces from cmdline after parsing options
this patch causes interfaces to be built after the options have finished
scanning rather than during option parsing. This removes the ability to
specify on the command line separate transport, or dm modes for each port.
Instead this functionality will be added in a follow-on patch via the
configuration file

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 14:30:55 +02:00
Jacob Keller a7db3a1c2b ptp4l: read configuration file immediately after scanning options
This patch moves the call to read the configuration file until just after
the options have finished parsing. This is for future patches that will allow
configuration file to enable ports with specific settings

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 14:30:54 +02:00
Jacob Keller 11a334b93e ptp4l: add override flag in cfg_settings to apply cmdline options
This patch adds a flag field for setting overflag flags so that command line
options override any value in the configuration file. This will be done by
ensuring the flags set whether the config parser accepts the values specified.
This patch also streamlines the handling for the slave only command line
option, as it no longer needs special treatment.

-v2
* Minor change to fix merge with previous patch

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 14:30:54 +02:00
Jacob Keller fcdc675f99 ptp4l: add missing options to config file
This patch adds support to the configuration file for all of the options
specified on the command line.

-v2
* Fix string length to account for null byte
* Add PRINT_LEVEL_MIN/MAX defines

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 14:30:54 +02:00
Jacob Keller 7a69db2379 ptp4l: Allow per-port customized port defaults
this patch allows each port to maintain its own pod structure since it is only
used in ports. This will allow the user to configure any special settings per
port. It takes a copy of the default pod, and a future patch will allow the
configuration file to set per-port specific changes

-v2
* Minor change to fix merge with previous patch

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 14:30:54 +02:00
Jacob Keller 733d4ccf9e ptp4l: new config_create_interface function
this patch adds a support function that creates a new port based on the
current default settings and adds it to the iface list. The function returns
the index into the cfg where the port was created. If a port is attempted to
be created multiple times, future attempts just return the index

-v2
* Move assignment of pointer into array after bounds check

[ RC - fix off by one return code from config_create_interface ]

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 14:30:00 +02:00
Jacob Keller 31865b2589 ptp4l: change interface name into static array
In order to support future settings which allow for the configuration of
per-port data, this patch modifies the interface name to be a static array
instead of a pointer.

-v2
* Minor edit for merge with previous patch

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 07:28:15 +02:00
Jacob Keller 5a0b6c3cd3 ptp4l: move port default values into cfg_settings
move the dm, timestamping, and transport settings into the cfg_settings, and
treat them as defaults for new ports.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 07:28:14 +02:00
Jacob Keller 8250e80581 ptp4l: make ds and pod part of cfg_settings
make ds and pod static inside cfg_settings instead of created via pointers.
Also statically initialize the defaults.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 07:28:14 +02:00
Jacob Keller 08a6a14e6c ptp4l: pull iface into the configure settings
this patch modifies the ptp4l.c and config settings so that the iface list is
inside the cfg_settings structure

-v2
* Moved "struct interface" into config.h

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 07:28:14 +02:00
Jacob Keller 0499513f1e ptp4l: remove timestamping as a per-port configuration option
The current code for the timestamping mode does not allow interfaces to have
separate timestamping modes. This is (probably) due to hardware timestamping
mode being required on all ports to work properly.

This patch removes the timestamping field in the struct iface, and makes it a
clock variable which is really what the mode does anyways. Ports get passed
the timestamping mode but no longer appear as though they are separate.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 07:28:14 +02:00
Jacob Keller 7c501032b2 ptp4l: correct print global set functions
this patch updates the global set functions to allow the user to set the
proper value instead of only being allowed to enable (or disable) a particular
feature. The new patch allows the function to specify exactly what they want
the value to be.

This patch also clarifies what -q and -v do by removing mention of quiet mode
and verbose mode. It is easy for a user to confuse and assume that -q disables
-v when this is not true.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 07:28:14 +02:00
Jacob Keller df5c071599 ptp4l: Change command line options to better match meaning
modify the command line options to make better sense of what each one does.
Ignore previous restriction on disallowing different options on the same
letter with different case.

the purpose of this patch is to simplify the meaning of some very confusing
options (-z for legacy, -r for hardware timestamps, -m for slave)

While there are legacy issues involved with changing options around, it is
important for the user to be able to quickly understand and make fewer
mistakes regarding the various command line options

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 07:28:13 +02:00
Richard Cochran 00b232477d Add a configuration option to control the follow up info TLV.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +02:00
Richard Cochran 269f9873f1 Add a configuration option to control the path trace mechanism.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 07:40:21 +02:00
Richard Cochran 582a8858d7 Make the function to generate a clock identity a global function.
This will allow code reuse in the management client.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:46:03 +02:00
Richard Cochran b2072076bf Place the sk_ globals into their proper source module.
This will allow reusing sk.c in the management client program.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:46:03 +02:00