f078f19339
This API was introduced for 2 reasons: 1. Some hardware can emit PPS signals but not starting from arbitrary absolute times, but rather phase-aligned to the beginning of a second. We _could_ patch ts2phc to always specify a start time of 0.000000000 to PTP_PEROUT_REQUEST, but in practice, we would never know whether that would actually work with all in-tree PHC drivers. So there was a need for a new flag that only specifies the phase of the periodic signal, and not the absolute start time. 2. Some hardware can, rather unfortunately, not distinguish between a rising and a falling extts edge. And, since whatever rises also has to fall before rising again, the strategy in ts2phc is to set a 'large' pulse width (half the period) and ignore the extts event corresponding to the mid-way between one second and another. This is all fine, but currently, ts2phc.pulsewidth is a read-only property in the config file. The kernel is not instructed in any way to use this value, it is simply that must be configured based on prior knowledge of the PHC's implementation. This API changes that. The introduction of a phase adjustment for the master PHC means we have to adjust our approximation of the precise perout timestamp. We put that code into a common function and convert all call sites to call that. We also need to do the same thing for the edge ignoring logic. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> |
||
---|---|---|
configs | ||
.gitignore | ||
CODING_STYLE.org | ||
COPYING | ||
README.org | ||
address.h | ||
as_capable.h | ||
bmc.c | ||
bmc.h | ||
clock.c | ||
clock.h | ||
clockadj.c | ||
clockadj.h | ||
clockcheck.c | ||
clockcheck.h | ||
config.c | ||
config.h | ||
contain.h | ||
ddt.h | ||
designated_fsm.c | ||
designated_fsm.h | ||
dm.h | ||
ds.h | ||
e2e_tc.c | ||
ether.h | ||
fault.c | ||
fault.h | ||
fd.h | ||
filter.c | ||
filter.h | ||
filter_private.h | ||
foreign.h | ||
fsm.c | ||
fsm.h | ||
hash.c | ||
hash.h | ||
hwstamp_ctl.8 | ||
hwstamp_ctl.c | ||
incdefs.sh | ||
interface.c | ||
interface.h | ||
linreg.c | ||
linreg.h | ||
lstab.c | ||
lstab.h | ||
makefile | ||
mave.c | ||
mave.h | ||
missing.h | ||
mmedian.c | ||
mmedian.h | ||
monitor.c | ||
monitor.h | ||
msg.c | ||
msg.h | ||
mtab.h | ||
nmea.c | ||
nmea.h | ||
notification.h | ||
nsm.8 | ||
nsm.c | ||
ntpshm.c | ||
ntpshm.h | ||
nullf.c | ||
nullf.h | ||
p2p_tc.c | ||
pdt.h | ||
phc.c | ||
phc.h | ||
phc2sys.8 | ||
phc2sys.c | ||
phc_ctl.8 | ||
phc_ctl.c | ||
pi.c | ||
pi.h | ||
pmc.8 | ||
pmc.c | ||
pmc_common.c | ||
pmc_common.h | ||
port.c | ||
port.h | ||
port_private.h | ||
port_signaling.c | ||
pqueue.c | ||
pqueue.h | ||
print.c | ||
print.h | ||
ptp4l.8 | ||
ptp4l.c | ||
raw.c | ||
raw.h | ||
rtnl.c | ||
rtnl.h | ||
serial.c | ||
serial.h | ||
servo.c | ||
servo.h | ||
servo_private.h | ||
sk.c | ||
sk.h | ||
sock.c | ||
sock.h | ||
stats.c | ||
stats.h | ||
sysoff.c | ||
sysoff.h | ||
tc.c | ||
tc.h | ||
telecom.c | ||
timemaster.8 | ||
timemaster.c | ||
tlv.c | ||
tlv.h | ||
tmv.h | ||
transport.c | ||
transport.h | ||
transport_private.h | ||
ts2phc.8 | ||
ts2phc.c | ||
ts2phc.h | ||
ts2phc_generic_master.c | ||
ts2phc_generic_master.h | ||
ts2phc_master.c | ||
ts2phc_master.h | ||
ts2phc_master_private.h | ||
ts2phc_nmea_master.c | ||
ts2phc_nmea_master.h | ||
ts2phc_phc_master.c | ||
ts2phc_phc_master.h | ||
ts2phc_slave.c | ||
ts2phc_slave.h | ||
tsproc.c | ||
tsproc.h | ||
udp.c | ||
udp.h | ||
udp6.c | ||
udp6.h | ||
uds.c | ||
uds.h | ||
unicast_client.c | ||
unicast_client.h | ||
unicast_fsm.c | ||
unicast_fsm.h | ||
unicast_service.c | ||
unicast_service.h | ||
util.c | ||
util.h | ||
version.c | ||
version.h | ||
version.sh |
README.org
- Introduction
- License
- Features
- Getting the Code
- System Requirements
- Installation
- Getting Involved
- Thanks
Introduction
This software is an implementation of the Precision Time Protocol (PTP) according to IEEE standard 1588 for Linux. The dual design goals are to provide a robust implementation of the standard and to use the most relevant and modern Application Programming Interfaces (API) offered by the Linux kernel. Supporting legacy APIs and other platforms is not a goal.
License
The software is copyrighted by the authors and is licensed under the GNU General Public License. See the file, COPYING, for details of the license terms.
Features
- Supports hardware and software time stamping via the Linux SO_TIMESTAMPING socket option.
- Supports the Linux PTP Hardware Clock (PHC) subsystem by using the clock_gettime family of calls, including the clock_adjtimex system call.
- Implements Boundary Clock (BC), Ordinary Clock (OC) and Transparent Clock (TC).
- Transport over UDP/IPv4, UDP/IPv6, and raw Ethernet (Layer 2).
- Supports IEEE 802.1AS-2011 in the role of end station.
- Modular design allowing painless addition of new transports and clock servos.
- Implements unicast operation.
-
Supports a number of profiles, including:
- The automotive profile
- The default 1588 profile.
- The enterprise profile.
- The telecom profiles G.8265.1, G.8275.1, and G.8275.2.
- Supports the NetSync Monitor protocol.
- Implements Peer to peer one-step.
- Supports bonded, IPoIB, and vlan interfaces.
Getting the Code
You can download the latest released version at Source Forge.
http://sourceforge.net/projects/linuxptp/files/latest/download
The source code is managed using the git version control system. To get your own copy of the project sources, use the following command.
git clone git://git.code.sf.net/p/linuxptp/code linuxptp
If the git protocol is blocked by your local area network, then you can use the alternative HTTP protocol instead.
git clone http://git.code.sf.net/p/linuxptp/code linuxptp
System Requirements
In order to run this software, you need Linux kernel version 3.0 or newer. Check whether your network interface supports PTP with the following command.
ethtool -T eth0
This command shows whether a MAC supports hardware or software time stamping. The following example output indicates support for hardware time stamping.
Time stamping parameters for eth6: Capabilities: hardware-transmit (SOF_TIMESTAMPING_TX_HARDWARE) software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE) hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE) software-receive (SOF_TIMESTAMPING_RX_SOFTWARE) software-system-clock (SOF_TIMESTAMPING_SOFTWARE) hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE) PTP Hardware Clock: 1 Hardware Transmit Timestamp Modes: off (HWTSTAMP_TX_OFF) on (HWTSTAMP_TX_ON) Hardware Receive Filter Modes: none (HWTSTAMP_FILTER_NONE) all (HWTSTAMP_FILTER_ALL)
The next example shows the case where the MAC only supports software
time stamping. The ptp4l
program requires either the -S
command
line argument or the time_stamping software
configuration option
when using such interfaces.
Time stamping parameters for enp6s0: Capabilities: software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE) software-receive (SOF_TIMESTAMPING_RX_SOFTWARE) software-system-clock (SOF_TIMESTAMPING_SOFTWARE) PTP Hardware Clock: none Hardware Transmit Timestamp Modes: none Hardware Receive Filter Modes: none
Note the software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
capability. If this is lacking, then the MAC cannot be used at
all. However, adding this capability entails adding a single line
of code to the device driver.
Installation
- Just type 'make'
- If you compiled your own kernel (and the headers are not installed into the system path), then you should set the KBUILD_OUTPUT environment variable as in the example, above.
- In order to install the programs and man pages into /usr/local, run the 'make install' target. You can change the installation directories by setttings the variables prefix, sbindir, mandir, and man8dir on the make command line.
Getting Involved
The software development is hosted at Source Forge.
https://sourceforge.net/projects/linuxptp/
Reporting Bugs
Please report any bugs or other issues with the software to the linuxptp-users mailing list.
Development
If you would like to get involved in improving the software, please join the linuxptp-devel mailing list.
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Submitting Patches
- Before submitting patches, please make sure that you are starting your work on the current HEAD of the git repository.
- Please checkout the
CODING_STYLE.org
file for guidelines on how to properly format your code. - Describe your changes. Each patch will be reviewed, and the reviewers need to understand why you did what you did.
-
Sign-Off each commit, so the changes can be properly attributed to you and you explicitely give your agreement for distribution under linuxptp's license. Signing-off is as simple as:
git commit -s
or by adding the following line (replace your real name and email) to your patch:
Signed-off-by: Random J Developer <random@developer.example.org>
-
Finally, send your patches via email to the linuxptp-devel mailing list, where they will be reviewed, and eventually be included in the official code base.
git send-email --to linuxptp-devel@lists.sourceforge.net origin/master
Thanks
Thanks to AudioScience Inc for sponsoring the 8021.AS support.
Thanks to Exablaze for donating an ExaNIC X10
Thanks to Intel Corporation for donating four NICs, the 82574, 82580, 82599, and the i210.
Thanks to Meinberg Funkuhren for donating a LANTIME M1000.
Thanks to Moser Baer for sponsoring the Telecom Profiles and unicast support.
For testing I use an OTMC 100 grandmaster clock donated by OMICRON Lab.