Skip to content

User space PTP stack for the GNU/Linux operating system.

License

Notifications You must be signed in to change notification settings

JotusKuo/linuxptp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

DriverHardwareSOTSPHCPHYVER
bfin_macAnalog BlackfinRAWYNA3.8
e1000eIntel 82574, 82583RAWYNA3.9
igbIntel 82576, 82580RAWYNA3.5
ixgbeIntel 82599RAWYNA3.5
dp83640Nat Semi PHYTERRAWYNA3.0
gianfarFreescale eTSEC PowerPCRAWYNA3.0
ptp_ixp46xIntel IXP465RAWYNA3.0
ptp_phcLapis EG20T PCHRAWYNA3.5
sfcSolarflare SFC9000RAWYNA3.7

Software Timestamping

DriverHardwareSOTSPHCPHYVER
bnx2xBroadcom EverestSWNN3.5
davinci_emacTI DaVinci, SitaraSWNY3.1
dnetDave Ethernet MACSWNY3.1
e100Intel PRO/100SWNN3.5
e1000Intel PRO/1000 PCI/PCI-XSWNN3.5
e1000eIntel PRO/1000 PCIeSWNN3.5
emacliteXilinx Ethernet LiteSWNY3.1
ethocOpenCores 10/100 MACSWNY3.1
fecFreescale ColdfireSWNY3.1
fec_mpc52xxFreescale MPC5200SWNY3.1
forcedethNVIDIA nForceSWNN3.5
fs_enetFreescale MPC512xSWNY3.1
ixp4xx_ethIntel IXP4xxSWNY3.0
lib8390Asix AX88796SWNY3.1
lib8390Various 8390 based HWSWNN3.1
ll_temacXilinx LL TEMACSWNY3.1
macbAtmel AT32, AT91SWNY3.1
mv643xx_ethMarvell Discovery, OrionSWNY3.1
pxa168_ethMarvell pxa168SWNY3.1
r6040RDC Ethernet MACSWNY3.1
r8169Realtek 8169/8168/8101SWNN3.4
smsc911xSMSC LAN911x, LAN921xSWNY3.1
smsc9420SMSC LAN9420 PCISWNY3.1
stmmacSTM Synopsys IP CoreSWNY3.1
tg3Broadcom Tigon3 PCISWNY3.1
ucc_gethFreescale QE GigabitSWNY3.1
usbnetUSB network devicesSWNY/N3.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.

OptionDescription
CONFIG_PPSRequired
CONFIG_NETWORK_PHY_TIMESTAMPINGTimestamping in PHY devices
PTP_1588_CLOCKPTP 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.

About

User space PTP stack for the GNU/Linux operating system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 90.6%
  • Roff 8.6%
  • Other 0.8%