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>
This patch simplifies some expressions which validate that configuration
variables are within the allowed ranges.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
this patch enables the configuration file to define per-port specific
configuration options via the use of simple INI style syntax with headings for
each port created via [device_name] syntax
[ RC - correct scanning of the port string
- remove '=' from scan format string ]
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch creates a global heading for an INI style configuration file. The
parser allows the default state to be global without the header as well as to
use global. A future patch will enable per-port configuration settings.
-v2
* Forgot a "\n" in the string comparison so that global mode wasn't recognized
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
this patch extracts the pod parser from the scan_line function in order to
simplify the code for future patches
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
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>
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>
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>
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>
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>
Some commercial 802.1AS switches do not feel obliged to set the two step
flag. When we try to synchronize to their apparent one step sync messages,
nothing good happens. This commit adds a global option to work around the
issue.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Some of the time stamping hardware out there only recognizes layer 2
packets, and these do not work without changing the receive filter in
the SIOCSHWTSTAMP request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Add transportSpecific parameter to config file parser
Set transportSpecific field in message headers as using the configuration (default to 0)
[ RC - reduced this patch to just the addition of the field ]
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>