Commit Graph

155 Commits (852c288ebe1684f947db69ddfd74473135c3edb7)

Author SHA1 Message Date
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
Richard Cochran aeba3afd91 Remove unused macro.
Ever since 0afedd79, the DEFAULT_PHC macro is obsolete.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:23 +02:00
Richard Cochran eed8ed05c8 Add an option to assume two step messaging.
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>
2012-07-28 06:29:15 +02:00
Richard Cochran 4b0f4fda42 Replace hard coded logMinPdelayReqInterval with configuration option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-28 06:29:15 +02:00
Richard Cochran e757b7a9d4 Add a configuration option to support 802.1AS only hardware.
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>
2012-07-28 06:29:15 +02:00
Richard Cochran 7460d2756a Add a configuration option to specify the L2 MAC addresses.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-27 22:41:00 +02:00
Delio Brignoli 9bdf92a7cf Add transmit support for the transportSpecific field
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>
2012-07-27 13:15:56 +02:00
Richard Cochran 3616692203 Remove unneeded newline from pr_info message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-08 10:44:05 +02:00
Jacob Keller 0afedd7993 ptp4l: use ethtool operation to double check PHC
If the new ethtool operation is supported, then use it to verify that the PHC
selected by the user is correct. If the user doesn't specify a PHC and ethtool
is supported then automatically select the PHC device.

If the user specifies a PHC device, and the ethtool operation is suppported,
automatically confirm that the PHC device requested is correct. This check is
performed for all ports, in order to verify that a boundary clock setup is
valid.

The check for PHC device validity is not done in the transport because the
only thing necessary for performing the check is the port name. Handled this
in the port_open code instead.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-05-10 06:53:15 +02:00
Richard Cochran f2aae280b3 Make the PI constants configurable.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-05-03 11:17:34 +02:00
Richard Cochran b35a45d1a4 Add a command line option to select the peer delay mechanism.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
Richard Cochran 59f00b5061 Let each interface use its own transport.
This will allow running a boundary clock that bridges different kinds of
PTP networks.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-01 19:28:13 +02:00
Christian Riesch d5f953fed9 Output an error message when no interface is specified
Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
2012-03-27 19:21:16 +02:00
Richard Cochran 1b78bb0b54 Add a missing doxygen comment to the main program.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-21 13:57:05 +01:00
Richard Cochran 3ff62648fa Make the number of transmit time stamp retries configurable.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-20 20:19:25 +01:00
Richard Cochran da69203517 Rework the configuration file interface.
This change will make it easier to extend the configuration file contents
to include arbitrary new data structures.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-20 20:09:40 +01:00
Richard Cochran 319aae1403 Move some sharable socket code into its own source file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-17 17:30:21 +01:00
Richard Cochran c0ebf12f79 Add command line options to control the logging destination.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-09 10:04:43 +01:00
Richard Cochran 59163df8b1 Make use of the configuration file for the port data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran 1092c4237b Make use of the configuration file for the default data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran 32ee558ef8 Add a command line option to set the message level.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran a736b0c2ff Make the slave only mode a non-default option.
Now that we have the master code in place, there is no longer any need
to restrict ourselves.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran 1de37086ef Rename the main program to something better sounding. 2011-12-13 09:09:08 +01:00