1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | * 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. #+BEGIN_EXAMPLE git clone git://git.code.sf.net/p/linuxptp/code linuxptp #+END_EXAMPLE If the git protocol is blocked by your local area network, then you can use the alternative HTTP protocol instead. #+BEGIN_EXAMPLE git clone http://git.code.sf.net/p/linuxptp/code linuxptp #+END_EXAMPLE * 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. #+BEGIN_EXAMPLE ethtool -T eth0 #+END_EXAMPLE 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 following two tables list the drivers that support the PHC subsystem and the Linux kernel version when they first appeared. These drivers will create a PHC device for controlling the hardware clock. *** Hardware Timestamping - PHY |---------+-------------------------------+---------| | Driver | Hardware | Version | |---------+-------------------------------+---------| | dp83640 | National Semiconductor PHYTER | 3.0 | |---------+-------------------------------+---------| *** Hardware Timestamping - MAC |------------+--------------------------+---------| | Driver | Hardware | Version | |------------+--------------------------+---------| | bfin_mac | Analog Blackfin | 3.8 | | cpts | Texas Instruments am335x | 3.8 | | e1000e | Intel 82574, 82583 | 3.9 | | fec | Freescale i.mx6 | 3.8 | | gianfar | Freescale eTSEC PowerPC | 3.0 | | igb | Intel 82576, 82580 | 3.5 | | ixgbe | Intel 82599 | 3.5 | | ptp_ixp46x | Intel IXP465 | 3.0 | | ptp_phc | Lapis EG20T PCH | 3.5 | | sfc | Solarflare SFC9000 | 3.7 | |------------+--------------------------+---------| *** Software Timestamping The table below shows the Linux drivers that support software time stamping. In addition, the 'PHY' column indicates whether the Ethernet MAC driver can support a PTP Hardware Clock in an external PHY. The letter 'Y' in this column means that if you design a mother board that combines such a MAC with a PTP capable PHY, then it will work with the Linux PHC subsystem. |--------------+--------------------------+---------+-----| | Driver | Hardware | Version | PHY | |--------------+--------------------------+---------+-----| | bna | Brocade 1010/1020 10Gb | 3.14 | N | | bnx2x | Broadcom Everest | 3.5 | N | | davinci_emac | TI DaVinci, Sitara | 3.1 | Y | | dnet | Dave Ethernet MAC | 3.1 | Y | | e100 | Intel PRO/100 | 3.5 | N | | e1000 | Intel PRO/1000 PCI/PCI-X | 3.5 | N | | e1000e | Intel PRO/1000 PCIe | 3.5 | N | | emaclite | Xilinx Ethernet Lite | 3.1 | Y | | ethoc | OpenCores 10/100 MAC | 3.1 | Y | | fec | Freescale Coldfire | 3.1 | Y | | fec_mpc52xx | Freescale MPC5200 | 3.1 | Y | | forcedeth | NVIDIA nForce | 3.5 | N | | fs_enet | Freescale MPC512x | 3.1 | Y | | ixp4xx_eth | Intel IXP4xx | 3.0 | Y | | lib8390 | Asix AX88796 | 3.1 | Y | | lib8390 | Various 8390 based HW | 3.1 | N | | ll_temac | Xilinx LL TEMAC | 3.1 | Y | | macb | Atmel AT32, AT91 | 3.1 | Y | | mv643xx_eth | Marvell Discovery, Orion | 3.1 | Y | | pxa168_eth | Marvell pxa168 | 3.1 | Y | | r6040 | RDC Ethernet MAC | 3.1 | Y | | r8169 | Realtek 8169/8168/8101 | 3.4 | N | | smsc911x | SMSC LAN911x, LAN921x | 3.1 | Y | | smsc9420 | SMSC LAN9420 PCI | 3.1 | Y | | stmmac | STM Synopsys IP Core | 3.1 | Y | | tg3 | Broadcom Tigon3 PCI | 3.1 | Y | | ucc_geth | Freescale QE Gigabit | 3.1 | Y | | usbnet | USB network devices | 3.2 | Y/N | |--------------+--------------------------+---------+-----| * 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. #+BEGIN_EXAMPLE 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 #+END_EXAMPLE 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. - http://www.audioscience.com Thanks to Intel Corporation for donating four NICs, the 82574, 82580, 82599, and the i210. - http://www.intel.com - http://e1000.sourceforge.net For testing I use an OTMC 100 grandmaster clock donated by OMICRON Lab. - http://www.omicron-lab.com/ptp |