Commit Graph

1115 Commits (d663a483c40939bad58301c256d86da1f3da6cc0)

Author SHA1 Message Date
Miroslav Lichvar d663a483c4 Fix building with new kernel headers.
net_tstamp.h in recent kernel versions requires time.h for clockid_t.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2019-01-06 19:56:25 -08:00
Anders Selhammer 1a4f6a26ce msg: Added const flag in msg_type
Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2019-01-06 19:47:51 -08:00
Dimitrios Katsaros a5da8c4b71 Added support for opening POSIX clock devices
I have reduced the requirements for the -p option to accept
any type of device. With this it should be possible to use
ptp4l to syncronize any clock device that implements the kernel
POSIX clock interface.

[ RC - Initialize struct timex. ]

Signed-off-by: Dimitrios Katsaros <patcherwork@gmail.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2019-01-06 19:41:45 -08:00
Vedang Patel d1ce07d5cb port: Fix for inhibit_announce.
When inhibit_announce is set, ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES event is
still sent once every state change. Avoid this by explicitly sending
EV_NONE instead.

[ RC - Simplify and keep all of the timer's state maintenance. ]

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2019-01-06 17:35:37 -08:00
Richard Cochran 563c52b833 Allow ignoring source port identity in end to end mode.
The "inhibit_announce" and "ignore_source_id" options were introduced
in order to support the automotive profile.  That profile happens to
specify using the peer to peer delay mechanism, but there is no reason
to restrict them to that mechanism.  As it now stands, enabling these
two options prevents E2E slaves from synchronizing.  This patch fixes
the issue by checking the "ignore_source_id" option when accepting E2E
delay response messages.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2019-01-06 17:34:31 -08:00
Cliff Spradlin via Linuxptp-devel e27cc2d8a8 Include missing headers.
Signed-off-by: Cliff Spradlin <cspradlin@google.com>
Change-Id: If0fd08df74e1cf108978266cd77768df4b49fb1f
2018-11-01 20:17:50 -07:00
Cliff Spradlin via Linuxptp-devel 2c3a501fc3 Use llabs() instead of fabs() for integers.
Change-Id: I64cf1d4e1728c31ced40aff865d66b5b4356560f
Signed-off-by: Cliff Spradlin <cspradlin@google.com>
2018-11-01 20:17:50 -07:00
Anders Selhammer 80b1d25dfd sk: Added address family as inargument in sk_set_priority
Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-11-01 20:17:50 -07:00
Anders Selhammer d88b4ff229 util: Added IPv6 support in help funtions addreq and str2addr
Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-11-01 20:17:50 -07:00
Anders Selhammer 8f2f9bbcab port: correction of port name used port_open
Correction of fault introduced in "Add BMCA config option."

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
Reviewed-by: Vedang Patel <vedang.patel@intel.com>
2018-11-01 20:07:55 -07:00
Vedang Patel 4d251d8358 Add example configuration for Automotive Profile.
This commit adds example for configuring master and slave devices that
support features from the Automotive Profile.

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
2018-10-04 19:38:19 -07:00
Vedang Patel d58b1080bc Add ignore_source_id config option.
This config option will skip the source port identity verification in
the Sync and Follow_up messages. This option is needed when the announce
messages are disabled because the slave cannot know the identity of
master without announce messages.

This is required by Automotive Profile as part of skipping the Best
Master Clock Algorithm (BMCA).

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
2018-10-04 19:38:19 -07:00
Vedang Patel 1cbeec80cd Add inhibit_announce config option.
This option will accomplish 2 things. On the master, it will stop the
announce messages being sent (by disabling FD_MANNO_TIMER timer). On
slave, it will not configure announce message timeouts (by disabling
FD_ANNOUNCE_TIMEOUT timer).

This config option is needed for the Automotive profile as part of
skipping the Best Master Clock Algorithm (BMCA).

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
2018-10-04 19:38:19 -07:00
Vedang Patel 83be05256b Add BMCA config option.
This adds config option to specify static roles for master and slave
in the Best Master Clock Algorithm. This is the case for Automotive
Profile where networks are mostly static and role for each device is
known in advance.

masterOnly and slaveOnly will be used to determine the roles for the
devices. Since masterOnly is a per-port config and slaveOnly is a global
config option, role assignment will be slightly odd in case of bridges.
If slaveOnly is set to 1, all the ports will be in slave roles except
for the ones where masterOnly is set to 1. These ports will assume the
master role.

Two new FSMs which will be used for master and slave roles for this
config option have also been added.

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
2018-10-04 19:38:19 -07:00
Vedang Patel 3f764aec6a port: Add configurable option to set asCapable.
If set to 'true', this unconditionally sets the asCapable variable. The
usual checks will be applied to asCapable if it is set to 'auto'. The
default value is 'auto'.

This config option is needed by the Automotive Profile. The master will
be able to send out Sync Message as soon as the daemon is started.

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
2018-10-04 19:38:19 -07:00
Vedang Patel 386fc3ed89 clock: Add NULL check for best clock in clock_update_slave()
This scenario will only be encountered when the clock transitions to the
slave state without knowing who the master is.

This will result in a segfault for BMCA with designated master and slave
states (to be added in upcoming patches).

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
2018-10-04 19:38:19 -07:00
Vedang Patel 4910055bd7 port: Add condition to check fc.
If foreign clock is NULL, both the clocks are obviously not equal. So,
return 0 in that case.

The above condition (fc == NULL) is not currently encountered. It will
be encoutered in the next few patches which implement static roles for
master and slave.

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
2018-10-04 19:38:19 -07:00
Miroslav Lichvar 78a720f2b3 timemaster: Allow ptp4l-specific sections in [ptp4l.conf].
Remove > from beginning of lines specified in the *.conf sections in
order to allow a ptp4l-specific section (e.g. [unicast_master_table]) to
be included there.

After inserting the lines to the generated ptp4l.conf, switch back to
the [global] section.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2018-09-30 18:54:31 -07:00
Miroslav Lichvar 241d8a064e unicast: Process timeouts equal to current time.
Don't postpone processing of a timeout if it is equal to the current
time. This prevents an infinite loop with a simulated clock.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2018-09-30 18:54:31 -07:00
Ethel Nilsson 2b00608278 snmp4lptp: added snmp4lptp.8
Signed-off-by: Ethel Nilsson <ethel.nilsson@est.tech>
2018-09-30 18:52:56 -07:00
Anders Selhammer 57b98c216a Add possibility to set clockIdentity
Currently the clockIdentity is generated from the mac address of the first
interface/port in config file. This patch add the possibility to set it in
config file.
The reason is if the stack is restarted with a different set of ports, it
may be circumstances when clockIdentity needs to be equal as before
restart even if the port setup is different.

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-09-30 18:45:52 -07:00
Anders Selhammer 1173e774dd Introduce the maxStepsRemoved attribute
Add attribute maxStepsRemoved which is included in IEEE1588-2017 (v2.1)
It is an optional attribute which can decide if an Announce message is
considered in the operation of the BMCA or not.

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-09-30 18:39:39 -07:00
Erez Geva 399907db7f config: Add hardware time stamp filter setting mode
Add global option for the hardware time stamp setting.
The function could:
Normally set the filters as the PTP daemon require.
Check that the filters are proper but do not change them.
Full, set the RX filter to all and the TX filter as the PTP daemon require.

[ RC: added missing extern keyword and fixed indentation. ]

Signed-off-by: Erez Geva <erez.geva.ext@siemens.com>
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2018-09-30 18:38:00 -07:00
Anders Selhammer 1d0832b2f5 snmp4lptp: Added function for data collection from ptp4l program.
General function to use for sending signals for data collection
from ptp4l program.

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-09-07 09:45:40 -07:00
Anders Selhammer 68dcd10673 snmp4lptp: Added communication to ptp4l via the UDS port.
UDS transport is configured using pmc_common functions.

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-09-07 09:44:52 -07:00
Anders Selhammer b2f2c9e02d snmp4lptp: Add snmp sub agent for linuxptp
The sub agent use net-snmp library and AgentX protocol for the
communication towards the snmp master agent.
snmpd.c should only include general setup needed for handling snmp.
Supported MIBs should be implemented in separate files.
Makefile will include snmpd if libsnmp is available during compilation.
configs/snmpd.conf should be placed in /etc/snmp/

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-09-07 09:44:52 -07:00
Richard Cochran 059269d0cc Version 2.0
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-08-12 14:08:43 -07:00
Miroslav Lichvar 47971bdd50 port: Fix memory leaks.
In port_management_fill_response() the TLV descriptor leaked when
not responding.

In port_open() the port would leak with the unsupported management clock
type.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2018-08-12 13:33:06 -07:00
Miroslav Lichvar d08bee2771 Fix -Wformat-overflow warnings.
Two warnings were observed with gcc-8.1.1.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2018-08-12 13:29:39 -07:00
Richard Cochran a2740768b6 Apply ingress and egress latency corrections in P2P one step mode.
When using peer to peer one step mode, the normal time stamp handling
of peer delay request messages is bypassed.  The hardware subtracts
the ingress time stamp from the correction field and then adds the
egress time into the correction of the response.  The configured
latency values are never applied since the hardware has no knowledge
of them.  This patch adds in the correction values in this special
case.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-08-05 21:15:59 -07:00
Christoph Seifert da06ea5a3a config: logAnnounceInterval for 802.1AS
The default initial value for logAnnounceInterval should be 0 (once per second).
See chapter 10.6.2.2 of IEEE 802.1AS standard.

Signed-off-by: Christoph Seifert <christoph.seifert@posteo.me>
2018-08-02 09:25:58 -07:00
Michael Walle 57c2b46604 msg: inline net2host64() and host2net64()
These functions are just wrappers. Make it possible for the compiler to
optimize the calls when compiled with optimization.

Signed-off-by: Michael Walle <michael@walle.cc>
2018-07-21 16:28:07 -07:00
Michael Walle 8f484e8312 msg: Drop msg->tlv_count.
The field is redundant with the length tlv_list. Replace it with a
function msg_tlv_count() instead. This iterates over the tlv_list. The
computational overhead should be small, because the lists are very short
and the tlv_count is only used in management paths (yet).

Signed-off-by: Michael Walle <michael@walle.cc>
2018-07-21 16:28:07 -07:00
Michael Walle 427f1b3981 msg: Make msg_pre_send() and msg_post_recv() symmetrical
Since commit 7fe69e7ba0 management
messages are dropped in some cases because the tlv_count isn't 1.
Further analysis shows that this is the case when the message is
forwarded in clock_forward_mgmt_msg(). This is because msg_post_recv()
will append TLVs and - in the forwarding case - there is already one TLV
in the list, which results in tlv_count being 2 and thus dropped in
subsequent code.

msg_post_recv() is intended to be the cleanup code for msg_pre_send()
which is called earlier. Therefore, make msg_post_recv() and
msg_pre_send() symmetrical and cleanup the tlv_list and tlv_count.

Signed-off-by: Michael Walle <michael@walle.cc>
2018-07-21 16:28:07 -07:00
Andriy Kohut f977a653e0 pmc_common: Recycle message if allocation of tlv_extra failed
Change-Id: I4ed12f1cddcb85e8f55552ce8980a9d5f3f7d800
Signed-off-by: Andriy Kohut <andriyk@mellanox.com>
2018-07-19 10:31:06 -07:00
Anders Selhammer f32553b70a pdt: Added check if already defined
TRUE and FALSE is also defined in net-snmp library. Without this check,
compilation and includes must be made in a certain order.

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-07-05 23:54:26 -07:00
Anders Selhammer d85c592993 pmc: Move new common funtionality into pmc_common
Code from pmc.c will be reused by new snmpd.c in later commit.

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-07-05 23:17:32 -07:00
Michael Walle 763a7ecdb2 clock: Fix memleak in clock_management_fill_response()
If the message is ignored, the tlv_extra isn't freed. Fix this.

Signed-off-by: Michael Walle <michael@walle.cc>
2018-07-02 22:23:13 -07:00
Richard Cochran 6ba73d18b1 telecom: Add example configuration files.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:08 -07:00
Richard Cochran 0cb7abf703 Add example configuration files for unicast operation.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:08 -07:00
Richard Cochran 8144fa7546 Document the unicast configuration options.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:07 -07:00
Richard Cochran b1ce06206f port: Introduce an option to disable mutlicast service.
Some profiles forbid multicast altogther.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:07 -07:00
Richard Cochran b9b18268cd port: Hook into the unicast service logic.
Now that all the pieces are in place, hook the port logic into the
unicast service code.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:07 -07:00
Richard Cochran 63598688b7 Introduce unicast service.
This patch adds new code that handles unicast service contracts,
sending messages according the negotiated schedule.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:07 -07:00
Richard Cochran dfa9e65785 fd: Introduce a unicast service timer.
This patch adds a new timer to be used by the server side unicast
negotiation logic.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:06 -07:00
Richard Cochran a076fd1ce9 Introduce a priority queue implementation.
This will be needed to keep track of multiple different deadlines
using a single timer.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:06 -07:00
Richard Cochran f71caedc57 port: Hook into the unicast client logic.
Now that all the pieces are in place, hook the port logic into the unicast
client code.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:06 -07:00
Richard Cochran c2ab96fd40 port: Add a method for processing received signaling messages.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:06 -07:00
Richard Cochran e8e2be017a Support unicast peer to peer delay mechanism.
There are two aspects.  First, on the receive path, we reply to
unicast peer delay requests in kind.  That is, if the peer sends a
unicast delay request, then reply with unicast, too, since this is
obviously what the peer expects.

Second, if configured, we transmit peer delay requests to the
specified unicast peer address.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:06 -07:00
Richard Cochran faf0e0a025 Introduce unicast client logic.
This patch adds new code that runs the state machine and handles the
TLVs for requesting unicast service from a remote master.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-07-01 22:10:06 -07:00