Go to file
Geoff Salmon 8b40f4305b pmc: prefer exact matches for command names
Previously if a command's full name was a prefix of another command
then parse_id would return AMBIGUOUS_ID. This was a problem for the
TIME and various TIME_* messages.
2012-12-31 19:03:49 +01:00
.gitignore Add .gitignore. 2012-11-08 18:17:30 +01:00
COPYING Add the license, a readme, and some header files. 2011-11-01 17:39:14 +01:00
README.org Add the SF download URL into the readme file. 2012-12-21 13:58:03 +01:00
bmc.c Fix the BMC state decision algorithm. 2012-01-07 08:07:56 +01:00
bmc.h Add the best master clock algorithm. 2011-11-04 19:20:23 +01:00
clock.c Distinguish between get and set management requests. 2012-12-04 13:25:50 +01:00
clock.h Use the management message memory layout for the parentDS. 2012-11-30 22:35:26 +01:00
config.c Add asymmetry correction. 2012-12-11 14:36:30 +01:00
config.h Use the management message memory layout for the defaultDS. 2012-11-30 21:52:37 +01:00
contain.h Add a modular clock servo interface with a PI controller. 2011-11-12 12:31:18 +01:00
ddt.h Fix the TLV structure declaration for actual use later. 2012-06-09 20:51:58 +02:00
default.cfg Add asymmetry correction. 2012-12-11 14:36:30 +01:00
dm.h Expose the peer delay flavors in their own header file. 2012-04-05 17:48:59 +02:00
ds.h Add asymmetry correction. 2012-12-11 14:36:30 +01:00
ether.h raw: accept VLAN tagged packets. 2012-08-21 16:22:18 +02:00
fd.h Remove a useless variable from the file descriptor array data type. 2012-03-21 13:55:56 +01:00
foreign.h Implement the PTP clock. 2011-11-12 18:59:13 +01:00
fsm.c Fix the port finite state machine. 2012-01-07 08:07:56 +01:00
fsm.h Fix the port finite state machine. 2012-01-07 08:07:56 +01:00
gPTP.cfg Add asymmetry correction. 2012-12-11 14:36:30 +01:00
hwstamp_ctl.8 Add command line options to print the software version. 2012-12-10 15:11:51 +01:00
hwstamp_ctl.c Add command line options to print the software version. 2012-12-10 15:11:51 +01:00
makefile Add command line options to print the software version. 2012-12-10 15:11:51 +01:00
mave.c Smooth the path delay estimate with a moving average. 2011-11-27 14:24:03 +01:00
mave.h Smooth the path delay estimate with a moving average. 2011-11-27 14:24:03 +01:00
missing.h Use clock_adjtime from glibc if available. 2012-09-06 08:23:21 +02:00
msg.c Provide a method to release the message cache. 2012-08-27 21:09:10 +02:00
msg.h Provide a method to release the message cache. 2012-08-27 21:09:10 +02:00
pdt.h Add the license, a readme, and some header files. 2011-11-01 17:39:14 +01:00
phc.c Clamp maximum adjustment to numerical limit. 2012-05-05 12:49:45 +02:00
phc.h phc: Add a method to query the maximum adjustment. 2011-11-12 18:58:59 +01:00
phc2sys.8 Add command line options to print the software version. 2012-12-10 15:11:51 +01:00
phc2sys.c phc2sys: check that specified interface has a PHC. 2012-12-18 18:52:02 +01:00
pi.c Explicitly set default values for all configurable options. 2012-10-18 19:58:40 +02:00
pi.h ptp4l: add maximum offset to pi servo 2012-09-29 06:24:44 +02:00
pmc.8 Add command line options to print the software version. 2012-12-10 15:11:51 +01:00
pmc.c pmc: prefer exact matches for command names 2012-12-31 19:03:49 +01:00
port.c Add asymmetry correction. 2012-12-11 14:36:30 +01:00
port.h Provide a method to obtain a port's identity. 2012-08-26 14:39:57 +02:00
print.c ptp4l: correct print global set functions 2012-08-21 07:28:14 +02:00
print.h ptp4l: add missing options to config file 2012-08-21 14:30:54 +02:00
ptp4l.8 Update twoStepFlag description in man page. 2012-12-18 18:52:01 +01:00
ptp4l.c Add command line options to print the software version. 2012-12-10 15:11:51 +01:00
raw.c Enumerate the event codes for the transport layer transmission methods. 2012-11-30 11:34:29 +01:00
raw.h Move shared layer 2 global declarations into an appropriate header file. 2012-08-26 14:39:57 +02:00
servo.c ptp4l: modify servo setup to take an enum rather than string 2012-09-29 06:24:43 +02:00
servo.h ptp4l: modify servo setup to take an enum rather than string 2012-09-29 06:24:43 +02:00
servo_private.h Add a modular clock servo interface with a PI controller. 2011-11-12 12:31:18 +01:00
sk.c Support one step sync operation. 2012-11-30 11:34:29 +01:00
sk.h Fixup the Doxygen comment for the sk_ts_info struct. 2012-11-14 20:22:39 +01:00
sysoff.c Add a method to estimate the PHC to system offset using the new ioctl. 2012-11-29 17:43:51 +01:00
sysoff.h Add a method to estimate the PHC to system offset using the new ioctl. 2012-11-29 17:43:51 +01:00
tlv.c Convert the port data set TLV to and from host byte order. 2012-12-02 20:34:44 +01:00
tlv.h Introduce the time status management message. 2012-09-12 17:44:20 +02:00
tmtab.c Add a time out table for delay requests. 2011-11-22 05:40:50 +01:00
tmtab.h Add a time out table for delay requests. 2011-11-22 05:40:50 +01:00
tmv.h Introduce a helper function to convert from tmv to nanoseconds. 2012-09-12 17:30:37 +02:00
transport.c Introduce transport over UNIX domain sockets. 2012-08-25 09:09:10 +02:00
transport.h Support one step sync operation. 2012-11-30 11:34:29 +01:00
transport_private.h Expand the transport layer interface with a peer transmission method. 2012-04-05 17:48:59 +02:00
udp.c udp: work around phyter quirk. 2012-11-30 11:34:29 +01:00
udp.h Add missing release method to the UDPv4 transport. 2012-03-17 17:30:21 +01:00
udp6.c Enumerate the event codes for the transport layer transmission methods. 2012-11-30 11:34:29 +01:00
udp6.h udp6: add an option to set the multicast scope. 2012-11-25 20:30:14 +01:00
uds.c uds: fix bug in file descriptor array opening. 2012-08-27 21:05:34 +02:00
uds.h Introduce transport over UNIX domain sockets. 2012-08-25 09:09:10 +02:00
util.c Make the function to generate a clock identity a global function. 2012-08-05 21:46:03 +02:00
util.h Make the function to generate a clock identity a global function. 2012-08-05 21:46:03 +02:00
version.c Add utility functions to get the software version string. 2012-12-10 15:11:51 +01:00
version.h Add utility functions to get the software version string. 2012-12-10 15:11:51 +01:00
version.sh Version 1.0 2012-12-12 16:52:47 +01:00

README.org

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 new clock_adjtimex system call.
  • Implements Boundary Clock (BC) and Ordinary Clock (OC).
  • 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.

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, and the kernel header files must available at compile time.

In addition, you will also need to have either:

  1. A supported Ethernet MAC device.
  2. A supported PHY device paired with a MAC that allows time stamping in the PHY (indicated by PHY=Y in the table below).

Linux Kernel Support

In order to support PTP, the operating system needs to provide two services: network packet time stamping and clock control. In 2009, Patrick Ohly added a new socket option called SO_TIMESTAMPING for packet time stamping, especially for PTP. This work appeared in Linux version 2.6.30.

In July of 2011, the PTP Hardware Clock (PHC) subsystem was merged into Linux version 3.0. The PHC code provides a driver framework and the user space API for clock control.

Ethtool Support

Starting with version 3.5 of the Linux kernel, you can query the time stamping capabilities of a network interface using the ETHTOOL_GET_TS_INFO ioctl. Using ethtool version 3.4 or later, you can check your system's time stamping support as shown in the following example.

  ethtool -T eth0

If the ethtool ioctl is available, then the ptp4l program will use it in order to discover the proper PHC device.

Driver Support Matrix

The table below shows the Linux drivers that support the new API. The meaning of the column abbreviations is as follows.

  • SOTS: SO_TIMESTAMPING support. This comes in three flavors.

    1. RAW: Supports time stamping using the PHC time values.
    2. SW: Supports software time stamping using the system time.
    3. SYS: Supports time stamping using PHC time values scaled to the system time. This is a legacy mode and its use in new drivers is discouraged.
  • PHC: PTP Hardware Clock support. These drivers will offer a character device that allows direct control of the hardware clock.
  • PHY: Supports time stamping in the PHY. This indicates an Ethernet MAC driver supporting SO_TIMESTAMPING and PHC in the PHY. If you have or build a computer that combines this MAC with a PTP capable PHY, then it will work with the Linux PHC subsystem.
  • VER: Linux kernel version when the PTP API support was added.

Hardware Timestamping

Driver Hardware SOTS PHC PHY VER
bfin_mac Analog Blackfin RAW Y NA 3.8
igb Intel 82576, 82580 RAW Y NA 3.5
ixgbe Intel 82599 RAW Y NA 3.5
dp83640 Nat Semi PHYTER RAW Y NA 3.0
gianfar Freescale eTSEC PowerPC RAW Y NA 3.0
ptp_ixp46x Intel IXP465 RAW Y NA 3.0
ptp_phc Lapis EG20T PCH RAW Y NA 3.5
sfc Solarflare SFC9000 RAW Y NA 3.7

Software Timestamping

Driver Hardware SOTS PHC PHY VER
bnx2x Broadcom Everest SW N N 3.5
davinci_emac TI DaVinci, Sitara SW N Y 3.1
dnet Dave Ethernet MAC SW N Y 3.1
e100 Intel PRO/100 SW N N 3.5
e1000 Intel PRO/1000 PCI/PCI-X SW N N 3.5
e1000e Intel PRO/1000 PCIe SW N N 3.5
emaclite Xilinx Ethernet Lite SW N Y 3.1
ethoc OpenCores 10/100 MAC SW N Y 3.1
fec Freescale Coldfire SW N Y 3.1
fec_mpc52xx Freescale MPC5200 SW N Y 3.1
forcedeth NVIDIA nForce SW N N 3.5
fs_enet Freescale MPC512x SW N Y 3.1
ixp4xx_eth Intel IXP4xx SW N Y 3.0
lib8390 Asix AX88796 SW N Y 3.1
lib8390 Various 8390 based HW SW N N 3.1
ll_temac Xilinx LL TEMAC SW N Y 3.1
macb Atmel AT32, AT91 SW N Y 3.1
mv643xx_eth Marvell Discovery, Orion SW N Y 3.1
pxa168_eth Marvell pxa168 SW N Y 3.1
r6040 RDC Ethernet MAC SW N Y 3.1
r8169 Realtek 8169/8168/8101 SW N N 3.4
smsc911x SMSC LAN911x, LAN921x SW N Y 3.1
smsc9420 SMSC LAN9420 PCI SW N Y 3.1
stmmac STM Synopsys IP Core SW N Y 3.1
tg3 Broadcom Tigon3 PCI SW N Y 3.1
ucc_geth Freescale QE Gigabit SW N Y 3.1
usbnet USB network devices SW N Y/N 3.2

Installation

Linux kernel

There are many ways of getting a precompiled Linux kernel or compiling your own, so this section is only meant as an example. It is important to have the kernel headers available when compiling the Linux PTP stack.

   export ARCH=x86
   export CROSS_COMPILE=
   export KBUILD_OUTPUT=/home/richard/kernel/ptp_debian
   mkdir -p $KBUILD_OUTPUT
   cp /boot/config-2.6.38-bpo.2-686 $KBUILD_OUTPUT/.config
   make oldnoconfig
   make menuconfig
   time make -j4
   make headers_install

Here is a table of kernel configuration options needed for PTP support. In addtion to these, you should enable the specific Ethernet MAC and PHY drivers for your hardware.

Option Description
CONFIG_PPS Required
CONFIG_NETWORK_PHY_TIMESTAMPING Timestamping in PHY devices
PTP_1588_CLOCK PTP clock support

PTP stack

  1. Just type 'make'
  2. 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.
  3. 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.

https://lists.sourceforge.net/lists/listinfo/linuxptp-users

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

Thanks

Thanks to AudioScience Inc for sponsoring the 8021.AS support.

Thanks to Intel Corporation for donating three NICs, the 82574, 82580, and the 82599.

For testing I use an OTMC 100 grandmaster clock donated by OMICRON Lab.