Commit Graph

271 Commits (c890a4b9356c7abeed78d03e43ddabeea1b6b031)

Author SHA1 Message Date
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 2b819b6b76 uds: fix bug in file descriptor array opening.
By not touching the event descriptor, uds is leaving the value as zero,
resulting in polling on stdin.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 21:05:34 +02:00
Richard Cochran 3936316468 Correct the TAI-UTC offset when it is reasonable to do so.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 18:57:43 +02:00
Richard Cochran 1bfb6fd217 Warn if the master's time properties are suspicious.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 20:36:43 +02:00
Richard Cochran d377229ab4 Update the hard coded TAI-UTC offset.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 18:48:54 +02:00
Richard Cochran ce745572b4 Use zero for the UDS port number.
Using 0xffff looks dumb in the log and in the pmc output.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 15:09:15 +02:00
Richard Cochran 420d48ce02 Use the ingress port identity for clock management replies.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +02:00
Richard Cochran 9da511d6f6 Provide a method to obtain a port's identity.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +02:00
Richard Cochran b9c4fbc11d Clean up the tlv and pmc include directives.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +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 8f6d2549b1 pmc: look for POLLHUP in order to work with piped input and redirection.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +02:00
Richard Cochran 9b2a6d543c pmc: add command line options to control messaging.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +02:00
Richard Cochran 9fc5f31c8b pmc: provide a reasonable default path when using UDS.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-25 15:53:58 +02:00
Richard Cochran dac6372091 pmc: optionally use the UDS transport.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-25 11:43:35 +02:00
Richard Cochran a25c5484d1 Create one special UDS port per clock.
This port is handled a bit differently than the others. Its only purpose
is to accept management messages from the local machine.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-25 11:43:35 +02:00
Richard Cochran 18cac67b33 Introduce transport over UNIX domain sockets.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-25 09:09:10 +02:00
Richard Cochran 97df9b66b2 pmc: show the fields of the current data set responses.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 16:41:45 +02:00
Richard Cochran 8c0393321e Respond to the current data set management query.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 07:36:33 +02:00
Richard Cochran 7da00ec089 Convert the current data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 07:36:33 +02:00
Richard Cochran 92c6c9149d Maintain the current data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 07:36:33 +02:00
Richard Cochran b2e8555ffd pmc: support getting the current data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 07:36:33 +02:00
Richard Cochran 4240203655 pmc: make the interactive output a bit clearer.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 07:36:32 +02:00
Richard Cochran f9953c6ef3 Drop stale delay requests after the clock jumps in time.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 05:05:11 +02:00
Richard Cochran ba4727ccaf Throw an error if SIOCETHTOOL returns a bad PHC index.
If the kernel supports the ioctl, but the driver does not (like igb in
kernel version 3.5), then ptp4l will incorrectly choose the system clock.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 05:05:11 +02:00
Richard Cochran cd8996ecb9 Estimate the local/master frequency ratio when free running.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 20:10:35 +02:00
Richard Cochran 83bd97be80 Let a slaved port report the sync interval.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 20:10:35 +02:00
Richard Cochran 83be79df13 Provide a method to report the sync interval to the clock.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 20:10:35 +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 1bb4ef4e34 Add an option to configure a free running local clock.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 18:26:00 +02:00
Richard Cochran 07b016cd44 Restore reading of the configuration file on stdin.
This feature is was dropped by accident in commit e1d3dc56.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 18:26:00 +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
Richard Cochran e4c3fb2432 Free the clock's servo and moving average on destroy.
The destroy method is supposed to undo everything that the create does.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 16:22:18 +02:00
Richard Cochran 08bee20be2 raw: accept VLAN tagged packets.
The power profile requires using VLAN priority tagged packets. The tags
may or may not reach the application. This commit adds code to handle the
tags in the case that they do appear.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 16:22:18 +02:00
Jacob Keller 86123d28e7 ptp4l: update the configuration files with the new defaults and sections
Update the configuration files for gPTP and default so that they show more of
the options as well as use suitable defaults for each style.

-v2
* Add [global] to gPTP.cfg

[ RC - also add logging_level, verbose, and use_syslog
     - use time_stamping, not timestamping ]

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 14:32:16 +02:00
Jacob Keller 06756e29d2 ptp4l: per-port configure settings
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>
2012-08-21 14:30:55 +02:00
Jacob Keller e1d3dc560b ptp4l: create [global] INI style config header
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>
2012-08-21 14:30:55 +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 6157db9ac4 ptp4l: add pod parser to separate logic from scan_line
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>
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 64dcf257e3 ptp4l: pass struct interface directly instead of passing it's sub arguments
the port_open function takes a large number of command options, a few of which
are actually all values of struct interface. This patch modifies the port_open
call to take a struct interface value instead of all the other values. This
simplifies the overall work necessary and allows for adding new port
configuration values by appending them to the struct interface

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