Commit Graph

892 Commits (7c3f9579f0c230ee798644a26d664ebd3efc612f)

Author SHA1 Message Date
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
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 d04deb8ba6 Append the follow up information TLV when enabled.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +02:00
Richard Cochran 226bd355af Convert the follow up info tlv to and from network byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +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 9f72080260 Append the path trace list to announce messages when enabled.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +02:00
Richard Cochran e1c2027266 Keep the path trace list up to date.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +02:00
Richard Cochran 316fb63453 Filter incoming announce messages according to the path trace rule.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:23 +02:00
Richard Cochran f3f62318e2 Enforce a length limit on an incoming path trace list.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:14 +02:00
Richard Cochran edfb5fac84 Add storage fields for the path trace list.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 07:40:21 +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 1d1a6acdc1 raw: return the length of the PTP message on receive.
The upper layer code will be confused by the extra fourteen byte length
of the Ethernet header.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 07:40:21 +02:00
Richard Cochran 6def1b06ad Add a very simple management client.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 22:07:15 +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 ba5c5704e6 Move the protocol version macro to a public header.
This will be needed by the management client program.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:46:03 +02:00
Richard Cochran 353b0a2743 Answer all management requests with 'not supported'
Our management interface is not yet terribly useful,
but at least we are honest about it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:46:03 +02:00
Richard Cochran 21c2fe30c7 Provide a method to send a management error status message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:46:03 +02:00
Richard Cochran f233528ea4 Provide a port method to allocate a management message reply.
This function will be needed for both positive replies and error status
messages.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:42:00 +02:00
Richard Cochran 2d2e38b3ba Adding missing forward declaration.
Including port.h without clock.h produces a compilation error.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-02 07:08:04 +02:00
Richard Cochran 247edc89d3 Filter port management messages by the target port number.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-02 07:08:04 +02:00
Richard Cochran 4f04c4139d Add a functional framework to manage the clock and its ports.
This commit only adds support for forwarding the management messages.
The actual local effects of the management commands still need to be
implemented.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-02 07:08:03 +02:00
Richard Cochran d308df8e27 Convert the management error status TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:24 +02:00
Richard Cochran b654f6c35c Convert the management TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:24 +02:00
Richard Cochran 7f18da0191 Add macros and enums for the various TLV codes.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:24 +02:00
Richard Cochran 4e173932d2 Add hooks for converting TLV values to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:24 +02:00
Richard Cochran 7d32a4bce7 Convert TLV type and length to host byte order on transmit.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:24 +02:00
Richard Cochran f20cf6225a Convert TLV type and length to host byte order on receive.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:23 +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