PTP4l(8)
β¨ NAME β¨
okay so bestie, this is the System Manager's Manual page for ptp4l(8) β PTP Boundary/Ordinary/Transparent Clock. π
π¦ SYNOPSIS π¦
ptp4l [ -AEP246HSLmqsv ] [ -f config ] [ -p phc-device ] [ -l print-level ] [ -i interface ] [ long-options ] ...
πΈ DESCRIPTION πΈ
ptp4l is literally an implementation of the Precision Time Protocol (PTP) according to IEEE standard 1588 for Linux. It implements Boundary Clock (BC), Ordinary Clock (OC), and Transparent Clock (TC). no cap.
π OPTIONS π
-Aβ Select the delay mechanism automatically. Start with E2E and switch to P2P when a peer delay request is received. auto magic β¨-Eβ Select the delay request-response (E2E) mechanism. This is the default mechanism. All clocks on single PTP communication path must use the same mechanism. A warning will be printed when a peer delay request is received on port using the E2E mechanism. heads up!-Pβ Select the peer delay (P2P) mechanism. A warning will be printed when a delay request is received on port using the P2P mechanism. another heads up!-2β Select the IEEE 802.3 network transport.-4β Select the UDP IPv4 network transport. This is the default transport. default vibe-6β Select the UDP IPv6 network transport.-Hβ Select the hardware time stamping. All ports specified by the-ioption and in the configuration file must be attached to the same PTP hardware clock (PHC). This is the default time stamping. PHC bestie-Sβ Select the software time stamping.-Lβ Select the legacy hardware time stamping.-f configβ Read configuration from the specified file. No configuration file is read by default. config file? optional, periodt-i interfaceβ Specify a PTP port, it may be used multiple times. At least one port must be specified by this option or in the configuration file. stack 'em up-p phc-deviceβ (This option is deprecated.) Before Linux kernel v3.5 there was no way to discover the PHC device associated with a network interface. This option specifies the PHC device (e.g./dev/ptp0) to be used when running on legacy kernels. π¨ deprecated, bestie π¨-sβ Enable theclientOnlymode.-l print-levelβ Set the maximum syslog level of messages which should be printed or sent to the system logger. The default is6(LOG_INFO). loggy loggy-mβ Print messages to the standard output.-qβ Don't send messages to the system logger.-vβ Prints the software version and exits.-hβ Display a help message.
π LONG OPTIONS π
Each and every configuration file option (see below) may also appear as a "long" style command line argument. For example, the clientOnly option may be set using either of these two forms.
--clientOnly 1 --clientOnly=1
Option values given on the command line override values in the global section of the configuration file. CLI wins, periodt
π CONFIGURATION FILE π
The configuration file is divided into sections. Each section starts with a line containing its name enclosed in brackets and it follows with settings. Each setting is placed on a separate line, it contains the name of the option and the value separated by whitespace characters. Empty lines and lines starting with # are ignored. clean and simple
There are three different section types.
- The global section (indicated as
[global]) sets the program options, clock options and default port options. Other sections are port specific sections and they override the default port options. - Port sections give the name of the configured port (e.g.
[eth0]). Ports specified in the configuration file don't need to be specified by the-ioption. An empty port section can be used to replace the command line option. - Tables for configuring unicast discovery begin with
[unicast_master_table].
See UNICAST DISCOVERY OPTIONS, below. iykyk
π PORT OPTIONS π
active_key_idβ Used in conjunction withsppandsa_filedirectives to specify which key from thesppdefined Security Association should be used for outboundicvcalculations. All Security Associations are read from the file specified bysa_file. Requiressppandsa_filedirectives. Must be in the range of1to2^32-1, inclusive. The default is0(disabled). security stuff, bestieallowedLostResponsesβ The number of missed peer delay responses before theasCapablevariable is reset. The default is3. three strikesannounceReceiptTimeoutβ The number of missed Announce messages before the last Announce messages expires. The default is3. announce meboundary_clock_jbodβ When running as a boundary clock (that is, when more than one network interface is configured),ptp4lperforms a sanity check to make sure that all of the ports share the same hardware clock device. This option allowsptp4lto work as a boundary clock using "just a bunch of devices" that are not synchronized to each other. For this mode, the collection of clocks must be synchronized by an external program, for examplephc2sys(8)in "automatic" mode. The default is0(disabled). JBOD energycmlds.client_addressβ Specifies the source address for the UNIX domain socket that receives peer delay measurement when using the "COMMON_P2P" delay mechanism. The default is/var/run/cmlds_client. socket citycmlds.domainNumberβ Specifies thedomainNumbermessage field for communications with the local Common Mean Link Delay Service, used with the "COMMON_P2P" delay mechanism. The default is0.cmlds.majorSdoIdβ Specifies thetransportSpecificmessage field for communications with the local Common Mean Link Delay Service, used with the "COMMON_P2P" delay mechanism. The default is2.cmlds.portβ Specifies the port number of local Common Mean Link Delay Service from which to accept delay measurements. The range of valid port numbers is one to65535, but the special value zero configures the port number of the port requesting the measurements. The default is0, meaning the requesting port number.cmlds.server_addressβ Specifies the UNIX domain socket address of the local Common Mean Link Delay Service, for use with the "COMMON_P2P" delay mechanism. The default is/var/run/cmlds_server.delayAsymmetryβ The time difference in nanoseconds of the transmit and receive paths. This value should be positive when the server-to-client propagation time is longer and negative when the client-to-server time is longer. The default is0nanoseconds. asymmetry, but make it fashiondelay_filterβ Select the algorithm used to filter the measured delay and peer delay. Possible values aremoving_averageandmoving_median. The default ismoving_median.delay_filter_lengthβ The length of the delay filter in samples. The default is10.delay_mechanismβ Select the delay mechanism. Possible values areAuto,COMMON_P2P,E2E,P2P, andNONE. The default isE2E. mechanism momentdelay_response_timeoutβ The number of delay response messages that may go missing before triggering a synchronization fault. Setting this option to zero will disable the delay response timeout. The default is0or disabled.egressLatencyβ Specifies the difference in nanoseconds between the actual transmission time at the reference plane and the reported transmit time stamp. This value will be added to egress time stamps obtained from the hardware. The default is0.fault_badpeernet_intervalβ The time in seconds between the detection of a peer network misconfiguration and the fault being reset. The port is disabled for the duration of the interval. The value is in seconds and the special key wordASAPwill let the fault be reset immediately. The default is16seconds. peer network dramafault_reset_intervalβ The time in seconds between the detection of a port's fault and the fault being reset. This value is expressed as a power of two. Setting this value to-128or to the special key word "ASAP" will let the fault be reset immediately. The default is4(16seconds). fault reset, but make it ASAPfollow_up_infoβ Include the802.1ASdata in theFollow_Upmessages if enabled. The default is0(disabled).G.8275.portDS.localPriorityβ The Telecom Profiles (ITU-T G.8275.1 and G.8275.2) specify an alternate Best Master Clock Algorithm (BMCA) with a unique data set comparison algorithm. The value of this option is associated with Announce messages arriving on a particular port and is used as a tie breaker wheneverclockClass,clockAccuracy,offsetScaledLogVariance, andpriority2are equal. This option is only used when "dataset_comparison" is set to "G.8275.x". The default value is128.
Warning: the BMCA is guaranteed to produce a spanning tree (that is, a timing network without loops) only when using the default values ofG.8275.defaultDS.localPriorityandG.8275.portDS.localPriority. Careful network engineering is needed when using non-default values. do not play with this unless you know what you're doing, bestie
hybrid_e2eβ Enables the "hybrid" delay mechanism from the draft Enterprise Profile. When enabled, ports in the client state send their delay request messages to the unicast address taken from the server's announce message. Ports in the server state will reply to unicast delay requests using unicast delay responses. This option has no effect if thedelay_mechanismis set toP2P. The default is0(disabled). hybrid eraignore_transport_specificβ By default, incoming messages are dropped if theirtransportSpecificfield does not match the configured value. However, many of the transports specified in the1588standard mandate ignoring this field. Moreover, some equipment is known to set the reserved bits. Configuring this option as1causes this field to be ignored completely on receive. The default is0.ingressLatencyβ Specifies the difference in nanoseconds between the reported receive time stamp and the actual reception time at reference plane. This value will be subtracted from ingress time stamps obtained from the hardware. The default is0.inhibit_delay_reqβ Don't send any delay requests. This will need theasCapableconfig option to be set to'true'. This is useful when running as a designated server who does not need to calculate offset from client. The default is0(disabled). no delay reqs, no problemsinhibit_multicast_serviceβ bestie, some unicast mode profiles are so dramatic and insist that no multicast message ever gets sent. Periodt. Set this and multicast transmission is inhibited. Default is0(multicast enabled). πlogAnnounceIntervalβ the mean time interval between Announce messages. A shorter interval makesptp4lreact faster to changes in the client/server hierarchy (main character reactivity β¨). It should be the same across the whole domain, okay? It's specified as a power of two in seconds. Default is1(2 seconds).logMinDelayReqIntervalβ the minimum permitted mean time interval betweenDelay_Reqmessages. Shorter =ptp4lreacts faster to path delay changes. Specified as a power of two in seconds. Default is0(1 second).logMinPdelayReqIntervalβ the minimum permitted mean time interval betweenPdelay_Reqmessages. Specified as a power of two in seconds. Default is0(1 second).logSyncIntervalβ the mean time interval between Sync messages. A shorter interval may improve accuracy of the local clock π. Specified as a power of two in seconds. Default is0(1 second).masterOnlyβ β οΈ okay so this one is deprecated and will be removed in a future release. Use"serverOnly"instead. We don't use it anymore, bestie.min_neighbor_prop_delayβ lower limit for peer delay, in nanoseconds. If the estimated peer delay is smaller than this value, the port gets marked as not 802.1AS capable. πneighborPropDelayThreshβ upper limit for peer delay, in nanoseconds. If the estimated peer delay is greater than this value, the port gets marked as not 802.1AS capable.network_transportβ picks the network transport, the whole vibe of how messages travel. Possible values areUDPv4,UDPv6andL2. Default isUDPv4.net_sync_monitorβ enables the NetSync Monitor (NSM) protocol π¦. The NSM protocol lets a station measure how well another node is synchronized. The monitor sends a unicast delay request to the node, which replies unconditionally with unicast delay response, sync, and follow up messages. If the monitor is synchronized to the GM, it can use the time stamps in the message to estimate the node's offset. This option requires that the'hybrid_e2e'option be enabled as well. Default is0(disabled).operLogPdelayReqIntervalβ the Pdelay Request messages interval to be used once the clock enters theSERVO_LOCKED_STABLEstate. If the'msg_interval_request'option is set, then the local client port will adopt this rate when the local clock enters the "locked stable" state. Specified as a power of two in seconds, and the default value is0(1 second).operLogSyncIntervalβ the Sync message interval to be requested once the clock enters theSERVO_LOCKED_STABLEstate. If the'msg_interval_request'option is set, then the local client port will request the remote server to switch to the given message rate via a signaling message containing a Message interval request TLV. Specified as a power of two in seconds, and the default value is0(1 second).path_trace_enabledβ enables the mechanism used to trace the route of the Announce messages π§. Default is0(disabled).phc_indexβ specifies the index of the PHC to be used for synchronization with hardware timestamping. This option is useful with virtual clocks running on top of a free-running physical clock (created by writing to/sys/class/ptp/ptp*/n_vclocks). Default is-1, which means the index will be set to the PHC associated with the interface, or the device specified by the-poption.power_profile.2011.grandmasterTimeInaccuracyβ specifies the time inaccuracy of the GM in nanoseconds. Relevant only whenpower_profile.versionis2011. This value may be changed dynamically using thePOWER_PROFILE_SETTINGS_NPmanagement message. Default is-1meaning unknown inaccuracy.power_profile.2011.networkTimeInaccuracyβ specifies the time inaccuracy of the network in nanoseconds. Relevant only whenpower_profile.versionis2011. This value may be changed dynamically using thePOWER_PROFILE_SETTINGS_NPmanagement message. Default is-1meaning unknown inaccuracy.power_profile.2017.totalTimeInaccuracyβ specifies the sum of the GM, network, and local node inaccuracies in nanoseconds. Relevant only whenpower_profile.versionis2017. This value may be changed dynamically using thePOWER_PROFILE_SETTINGS_NPmanagement message. Default is-1meaning unknown inaccuracy.power_profile.grandmasterIDβ specifies an optional, non-zero identification code for the GM. Heads up though: the code is an arbitrary, power profile specific integer, not necessarily related to theclockIdentityin any way. This value may be changed dynamically using thePOWER_PROFILE_SETTINGS_NPmanagement message. Default is0meaning unused.power_profile.versionβ specifies the power profile version to be used. Valid values are"none","2011", or"2017". This value may be changed dynamically using thePOWER_PROFILE_SETTINGS_NPmanagement message. Default is"none".ptp_dst_ipv4β the IPv4 address to which PTP messages should be sent. Relevant only withUDPv4transport. Default is224.0.1.129.p2p_dst_ipv4β the IPv4 address to which peer delay messages should be sent. Relevant only withUDPv4transport. Default is224.0.0.107.ptp_dst_ipv6β the IPv6 address to which PTP messages should be sent. The second byte of the address is substituted withudp6_scope. Relevant only withUDPv6transport. Default isFF0E:0:0:0:0:0:0:181.p2p_dst_ipv6β the IPv6 address to which peer delay messages should be sent. Relevant only withUDPv6transport. Default isFF02:0:0:0:0:0:0:6B.ptp_dst_macβ the MAC address to which PTP messages should be sent. Relevant only withL2transport. Default is01:1B:19:00:00:00.p2p_dst_macβ the MAC address to which peer delay messages should be sent. Relevant only withL2transport. Default is01:80:C2:00:00:0E.serverOnlyβ setting this to one (1) prevents the port from entering the client state. On top of that, the local clock will ignore Announce messages received on this port. The intended use is to support the Telecom Profiles according to ITU-T G.8265.1, G.8275.1, and G.8275.2. Default value is zero or false.sppβ specifies the Security Parameters Pointer of the desired Security Association to be used for Authentication TLV support for a given port π. Any port with an assignedsppwill attach Authentication TLVs to all outbound messages and check for Authentication TLVs on all inbound messages in accordance to the corresponding security association sourced via thesa_filedirective. Outbound Authentication TLVs are generated using the key specified byactive_key_id. Not compatible with one step ports or advertised versions less then PTPv2.1. Requiressa_fileandactive_key_iddirectives. Must be in the range of0to255, inclusive. Default is-1(disabled).syncReceiptTimeoutβ the number of sync/follow up messages that may go missing before triggering a Best Master Clock election π³οΈ. This option is used for running in gPTP mode according to the 802.1AS-2011 standard. Setting this to zero will disable the sync message timeout. Default is0or disabled.transportSpecificβ the transport specific field. Must be in the range0to255. Default is0.tsproc_modeβ selects the time stamp processing mode used to calculate offset and delay. Possible values arefilter,raw,filter_weight,raw_weight. Raw modes perform well when the rate of sync messages (logSyncInterval) is similar to the rate of delay messages (logMinDelayReqIntervalorlogMinPdelayReqInterval). Weighting is useful with larger network jitters (e.g. software time stamping). Default isfilter.udp_ttlβ specifies the Time to live (TTL) value for IPv4 multicast messages and the hop limit for IPv6 multicast messages. Only relevant with the IPv4 and IPv6 UDP transports. Default is1to restrict the messages sent byptp4lto the same subnet.unicast_listenβ when enabled, this option allows the port to grant unicast message contracts. Incoming requests will be granted limited only by the amount of memory available. Default is0(disabled).unicast_master_tableβ when set to a positive integer, this option specifies the table id to be used for unicast discovery. Each table lives in its own section and has a unique, positive numerical ID. Entries in the table are a pair of transport type and protocol address. Default is0(unicast discovery disabled).unicast_req_durationβ the service time in seconds to be requested during unicast discovery. Note that the remote node is free to grant a different duration β it does what it wants, bestie. Default is3600seconds or one hour.
β° PROGRAM AND CLOCK OPTIONS β°
asCapableβ if set to'true', all the checks which can unset theasCapablevariable (as described in Section 10.2.4.1 of 802.1AS) are skipped. If set to'auto',asCapableis initialized to'false'and will be set to'true'after the relevant checks have passed β . Default value is'auto'.assume_two_stepβ treat one-step responses as two-step if enabled. It's used to work around buggy 802.1AS switches π. Default is0(disabled).BMCAβ bestie, this one lets you use static roles for server and client devices instead of running the best master clock algorithm (BMCA) described in the 1588 profile. It's giving "I already know who's who so let's skip the audition" energy, and it speeds up the start time for servers and clients when you know the roles of the devices in advance β¨. When set tonoop, the traditional BMCA algorithm used by 1588 is skipped.masterOnlyandclientOnlywill be used to determine the server or client role for the device. In a bridge,clientOnly(which is a global option) can be set to make all ports assume the client role.masterOnly(which is a per-port config option) can then be used to set individual ports to take on the server role. The default value isptpwhich runs the BMCA related state machines. πcheck_fup_syncβ okay so packet reordering can happen in the network, in the hardware, or in the networking stack, and when it does, a follow up message can appear to arrive in the application before the matching sync message π. This is a normal occurrence, and thesequenceIDmessage field ensures proper matching, so the ptp4l program accepts out of order packets. This option adds an additional check using the software time stamps from the networking stack to verify that the sync message did arrive first. This option is only useful if you do not trust the sequence IDs generated by the server. The default is0(disabled).clientOnlyβ the local clock is a client-only clock if enabled. The default is0(disabled). πclockAccuracyβ theclockAccuracyattribute of the local clock. It is used in the PTP server selection algorithm. The default is0xFE.clockClassβ theclockClassattribute of the local clock. It denotes the traceability of the time distributed by the grandmaster clock. The default is248.clock_class_thresholdβ the maximum clock class value from master, acceptible to subordinate clock beyond which it moves out of lock state. The default value is248.clockIdentityβ theclockIdentityattribute of the local clock. TheclockIdentityis an 8-octet array and should in this configuration be written in textual form, see default. It should be unique since it is used to identify the specific clock. If default is used or if not set at all, theclockIdentitywill be automtically generated. The default is"000000.0000.000000".clock_servoβ the servo which is used to synchronize the local clock. Valid values are"pi"for a PI controller,"linreg"for an adaptive controller using linear regression,"ntpshm"and"refclock_sock"for the NTP SHM and chrony SOCK reference clocks respectively to allow another process to synchronize the local clock, and"nullf"for a servo that always dials frequency offset zero (for use in SyncE nodes). The default is"pi."π¦clock_typeβ specifies the kind of PTP clock. Valid values are"OC"for ordinary clock,"BC"for boundary clock,"P2P_TC"for peer to peer transparent clock, and"E2E_TC"for end to end transparent clock. An multi-port ordinary clock will automatically be configured as a boundary clock. The default is"OC".dataset_comparisonβ specifies the method to be used when comparing data sets during the Best Master Clock Algorithm. The possible values are"ieee1588"and"G.8275.x". The default is"ieee1588".domainNumberβ the domain attribute of the local clock. The default is0.dscp_eventβ defines the Differentiated Services Codepoint (DSCP) to be used for PTP event messages. Must be a value between0and63. There are several media streaming standards out there that require specific values for this option. For example46(EF PHB) in AES67 or48(CS6 PHB) in RAVENNA. The default is0. πdscp_generalβ defines the Differentiated Services Codepoint (DSCP) to be used for PTP general messages. Must be a value between0and63. There are several media streaming standards out there that recommend specific values for this option. For example34(AF41 PHB) in AES67 or46(EF PHB) in RAVENNA. The default is0.first_step_thresholdβ the maximum offset the servo will correct by changing the clock frequency (phase when usingnullfservo) instead of stepping the clock. This is only applied on the first update. It's specified in seconds. When set to0.0, the servo won't step the clock on start. The default is0.00002(20 microseconds). This option used to be calledpi_f_offset_const.free_runningβ don't adjust the local clock if enabled. The default is0(disabled).freq_est_intervalβ the time interval over which is estimated the ratio of the local and peer clock frequencies. It is specified as a power of two in seconds. The default is1(2 seconds).G.8275.defaultDS.localPriorityβ the Telecom Profiles (ITU-T G.8275.1 and G.8275.2) specify an alternate Best Master Clock Algorithm (BMCA) with a unique data set comparison algorithm. The value of this option is associated with the local clock and is used as a tie breaker wheneverclockClass,clockAccuracy,offsetScaledLogVariance, andpriority2are equal. This option is only used when"dataset_comparison"is set to"G.8275.x". The default value is128.
β οΈ Warning: the BMCA is guaranteed to produce a spanning tree (that is, a timing network without loops) only when using the default values ofG.8275.defaultDS.localPriorityandG.8275.portDS.localPriority. Careful network engineering is needed when using non-default values. no cap, this one's serious π
gmCapableβ if this option is enabled, then the local clock is able to become grand master. This is only for use with 802.1AS clocks and has no effect on 1588 clocks. The default is1(enabled). πignore_source_idβ this will disable source port identity checking for Sync and Follow_Up messages. This is useful when the announce messages are disabled in the server and the client does not have any way to know the server's identity. The default is0(disabled).inhibit_announceβ this will disable the timer for announce messages (i.e.FD_MANNO_TIMER) and also the announce message timeout timer (i.e.FD_ANNOUNCE_TIMER). This is used by the Automotive profile as part of switching over to a static BMCA. If this option is enabled,ignore_source_idhas to be enabled in the client because it has no way to identify the server in the Sync and Follow_Up messages. The default is0(disabled).initial_delayβ the initial path delay of the clock in nanoseconds used for synchronization of the clock before the delay is measured using the E2E or P2P delay mechanism. If set to0, the clock will not be updated until the delay is measured. The default is0.interface_rate_tlvβ when the client and server are operating are operating at different interface rate, delay asymmetry caused due to different interface rate needs to be compensated. The server sends its interface rate using interface rate TLV as per G.8275.2 Annex D. The default is0(does not support interface rate tlv).hwts_filterβ select the hardware time stamp filter setting mode. Possible values arenormal,check,full.normalmode set the filters as needed.checkmode only check but do not set.fullmode set the receive filter to mark all packets with hardware time stamp, so all applications can get them. The default isnormal.kernel_leapβ when a leap second is announced, let the kernel apply it by stepping the clock instead of correcting the one-second offset with servo, which would correct the one-second offset slowly by changing the clock frequency (unless thestep_thresholdoption is set to correct such offset by stepping). Relevant only with software time stamping. The default is1(enabled). β¨logging_levelβ the maximum logging level of messages which should be printed. The default is6(LOG_INFO).manufacturerIdentityβ the manufacturer id which should be an OUI owned by the manufacturer. The default is00:00:00.max_frequencyβ the maximum allowed frequency adjustment of the clock in parts per billion (ppb). This is an additional limit to the maximum allowed by the hardware. When set to0, the hardware limit will be used. The default is900000000(90%). This option used to be calledpi_max_frequency.maxStepsRemovedβ when using this option, if the value ofstepsRemovedof an Announce message is greater than or equal to the value ofmaxStepsRemovedthe Announce message is not considered in the operation of the BMCA. The default value is255.message_tagβ the tag which is added to all messages printed to the standard output or system log. If the tag contains the string"{level}", it will be replaced with the log level of the message as a number. The default is an empty string (which cannot be set in the configuration file as the option requires an argument).msg_interval_requestβ this option, when set, will trigger an adjustment to the Sync and peer delay request message intervals when the clock servo transitions into theSERVO_LOCKED_STABLEstate. The Sync interval will be adjusted via the signaling mechanism while the pdelay request interval is simply adjusted locally. The values to use for the new Sync and peer delay request intervals are specified by theoperLogSyncIntervalandoperLogPdelayReqIntervaloptions, respectively. The default value ofmsg_interval_requestis0(disabled).ntpshm_segmentβ the number of the SHM segment used byntpshmservo. The default is0.offsetScaledLogVarianceβ theoffsetScaledLogVarianceattribute of the local clock. It characterizes the stability of the clock. The default is0xFFFF.pi_integral_constβ the integral constant of the PI controller. When set to0.0, the integral constant will be set by the following formula from the current sync interval. The default is0.0. π
ki = min(ki_scale * sync^ki_exponent, ki_norm_max / sync)
pi_integral_exponentβ this is theki_exponentconstant in the formula that sets the integral constant of the PI controller from the sync interval. Default is0.4. β¨pi_integral_norm_maxβ theki_norm_maxconstant in that same formula, still setting the integral constant of the PI controller from the sync interval. Default is0.3.pi_integral_scaleβ theki_scaleconstant in the formula setting the integral constant of the PI controller from the sync interval. When you set it to0.0, the value gets picked from0.3and0.001for hardware and software time stamping respectively. Default is0.0.pi_proportional_constβ the proportional constant of the PI controller. When set to0.0, the proportional constant gets set by this formula from the current sync interval. Default is0.0.
kp = min(kp_scale * sync^kp_exponent, kp_norm_max / sync)
pi_proportional_exponentβ thekp_exponentconstant in the formula that sets the proportional constant of the PI controller from the sync interval. Default is-0.3.pi_proportional_norm_maxβ thekp_norm_maxconstant in the formula that sets the proportional constant of the PI controller from the sync interval. Default is0.7pi_proportional_scaleβ thekp_scaleconstant in the formula that sets the proportional constant of the PI controller from the sync interval. When set to0.0, the value gets picked from0.7and0.1for hardware and software time stamping respectively. Default is0.0.productDescriptionβ the product description string. Allowed values must be of the formmanufacturerName;modelNumber;instanceIdentifierand hold at most 64 utf8 symbols. Default is";;".priority1β the priority1 attribute of the local clock. It's used in the PTP server selection algorithm, and lower values take precedence. Gotta be in the range0to255. Default is128.priority2β the priority2 attribute of the local clock. Also used in the PTP server selection algorithm, also lower values take precedence. Also must be in the range0to255. Default is128.ptp_minor_versionβ this one sets theminorVersionPTPin the common PTP message header. Default is1.refclock_sock_addressβ the address of the UNIX domain socket that therefclock_sockservo uses. Default is/var/run/refclock.ptp.sock.revisionDataβ the revision description string, holding the revisions for node hardware (HW), firmware (FW) and software (SW). Allowed values are of the formHW;FW;SWand hold at most 32 utf8 symbols. Default is an";;".sa_fileβ points at the location of the file holding the Security Associations used for immediate security processing of the Authentication TLV, supporting the optional security mechanism defined in ieee1588-2019 ch 14.16. Peep SECURITY ASSOCIATION OPTIONS for how this file should be formatted.sppandactive_key_idshould be specifed for each port to say which Security Association from the/fBsa_file/fRshould be used. Default is an empty string.sanity_freq_limitβ the max allowed frequency offset between the uncorrected clock and the system monotonic clock, in parts per billion (ppb). It's a sanity check on the synchronized clock: when a bigger offset gets measured, a warning message prints and the servo resets. If the frequency correction set by ptp4l changes unexpectedly between updates of the clock (like, say, because another process is trying to control the clock π), a warning message prints. Set it to0and the sanity check is off. Default is200000000(20%).servo_num_offset_valuesβ how many offset values get considered before transitioning from theSERVO_LOCKEDstate to theSERVO_LOCKED_STABLEstate. The transition happens once the lastservo_num_offset_valuesoffsets are all below theservo_offset_thresholdvalue. Default is10.servo_offset_thresholdβ the offset threshold used for transitioning fromSERVO_LOCKEDtoSERVO_LOCKED_STABLE. The transition happens once the lastservo_num_offset_valuesoffsets are all below the threshold value. Default value ofoffset_thresholdis0(disabled).slave_event_monitorβ the address of a UNIX domain socket for event monitoring. A local monitoring client bound to this address will receiveSLAVE_RX_SYNC_TIMING_DATAandSLAVE_DELAY_TIMING_DATA_NPTLVs. Default is the empty string (disabled).slaveOnlyβ β οΈ this option is deprecated and will be removed in a future release. UseclientOnlyinstead.socket_priorityβ configures theSO_PRIORITYof sockets. This exists for when you want to route ptp4l traffic using Linux qdiscs for traffic shaping. Heads up: it's only available with the IEEE 802.3 transport (the-2option) and gets silently ignored when you're using the UDP IPv4/6 network transports. Must be in the range of0to15, inclusive. Default is0.step_thresholdβ the maximum offset the servo will correct by changing the clock frequency (phase, when using thenullfservo) instead of stepping the clock. When set to0.0, the servo will never step the clock except on start. It's specified in seconds. Default is0.0. Fun fact: this option used to be calledpi_offset_const.step_windowβ when set, this is the number of Sync events after a clock step during which the clock does no frequency or step adjustments at all. It exists for situations where clock stepping can't happen instantaneously, so there's a lag before the timestamps can settle properly and reflect the clock step. Default is0(disabled).summary_intervalβ the time interval in which summary statistics of the clock get printed. Specified as a power of two in seconds. The stats include offset root mean square (RMS), maximum absolute offset, frequency offset mean and standard deviation, and path delay mean and standard deviation. Units are nanoseconds and parts per billion (ppb). If there's only one clock update in the interval, the sample gets printed instead of the statistics. The messages print at theLOG_INFOlevel. Default is0(1 second).tc_spanning_treeβ when running as a Transparent Clock, increment the"stepsRemoved"field of Announce messages that pass through the switch. Turning this on means PTP message loops never form, as long as all the switches implement this option together with the BMCA.timeSourceβ the time source is a single byte code that gives an idea of the kind of local clock in use. The value is purely informational, it has no effect on the outcome of the Best Master Clock algorithm, and it gets advertised when the clock becomes grand master.time_stampingβ the time stamping method to be used. Allowed values arehardware,software,legacy,onestep, andp2p1step. Default ishardware.twoStepFlagβ enables two-step mode for sync messages. One-step mode can only be used with hardware time stamping. Default is1(enabled).tx_timestamp_timeoutβ the number of milliseconds to poll waiting for the tx time stamp from the kernel when a message has recently been sent. Default is10.udp6_scopeβ the desired scope for the IPv6 multicast messages. It gets used as the second byte of the primary address. Only relevant with IPv6 transport. See RFC 4291. Default is0x0Efor the global scope.uds_addressβ the address of the UNIX domain socket for receiving local management messages. Default is/var/run/ptp4l.uds_file_modeβ file mode of the UNIX domain socket used for receiving local management messages. Specify the mode as an octal number, so it should start with a0literal. Default mode is0660.uds_ro_addressβ the address of the second UNIX domain socket for receiving local management messages, which is restricted to GET actions and doesn't forward messages to other ports. You can hand access to this socket to untrusted applications for monitoring purposes. Default is/var/run/ptp4lro.uds_ro_file_modeβ file mode of that second (read-only) UNIX domain socket used for receiving local management messages. Mode should be specified as an octal number, i.e. it should start with a0literal. Default mode is0666.use_syslogβ print messages to the system log if enabled. Default is1(enabled).userDescriptionβ the user description string. Allowed values are of the formname;locationand hold at most 128 utf8 symbols. Default is an empty string.utc_offsetβ the current offset between TAI and UTC. Default is37.verboseβ print messages to the standard output if enabled. Default is0(disabled).write_phase_modeβ enables using the "write phase" feature of a PTP Hardware Clock. If the device supports it, this mode uses the hardware's built in phase offset control instead of frequency offset control. Default value is0(disabled). π«Ά
π UNICAST DISCOVERY OPTIONS π
ok so these live inside a [unicast_master_table] situation, and here's the tea π΅
L2|UDPv4|UDPv6β every single table entry names the transport type and the network address of a potential remote server. And if you list more than one server? Bestie, unicast negotiation gets performed with each of them. Every. Single. One. πlogQueryIntervalβ this one sets how long we wait between unicast negotiation attempts. It's given as a power of two, in seconds. Default is0, which means1second. Yes the default is 0 and yes that means 1 second, that's just how it is, don't fight it π«Άpeer_addressβ this is the unicast address of the peer, for use with the peer-to-peer delay mechanism. If you set it, the port that owns the table will negotiate unicast peer delay responses from the machine at that remote address. If you don't set it, the port just sends multicast peer delay requests instead. your call, queen πtable_idβ every table has to start with a unique, positive table ID. The port claims a given table by sticking that ID in as the value of itsunicast_master_tableoption. matchy matchy, iconic β¨
π SECURITY ASSOCIATION OPTIONS π
these are the keys to the kingdom, literally. lock it down π
sppβ every security association has to begin with a uniquespp. The port claims a given security association by including thesppas the value of itssppoption. Has to be in the range0to255, inclusive. no wiggle room, no exceptions πseqid_windowβ this defines how far the sequence id of an incomingsync/follow_upmessage can advance from the last successfully processedsync/follow_upbefore it gets treated as a replayed message.sync/follow_upseqid tracking resets on port state change and updates on successful processing. Set it to zero and no seqid checking happens at all (living dangerously, respect π). Must be in the range0to32767(0x7FFF), inclusive. Default value is3.allow_mutableβ this allows mutable correction fields when on-path authentication TLV support just isn't possible. > β οΈ This option is NOT recommended, because it leaves the correction field unprotected. The default value is0(disabled). fr fr, leave this one alone unless you have to π©key(format:id type length value) β every security association needs at least one key entry. These entries use the formatid type length value.- Key id: must be in the range
1to2^32-1, inclusive. - Key type: allowed are
SHA256-128,SHA256,AES128,AES256. - Key length: optional verification key length in octets. Used to verify the key value is of the length specified.
- Key value: can be read as ASCII characters with the
ASCII:prefix, as a hexadecimal number with theHEX:prefix, or as a Base64 encoded string with theB64:prefix. If no prefix is included, ASCII is assumed. Key values should be randomly generated if possible. Ciphers (AES) require the key length to match the cipher length (ieAES-128requires a key of 128 bits or 16 bytes). no short kings in the key department π
- Key id: must be in the range
Example
The following is an example of a security associations file:
[security_association]
spp 0
allow_mutable 1
1 SHA256-128 HEX:F8ADC6B8B8E9AA709106BA42481EC9E29607334DE2C3C737A11A12931DB27F8C
2 SHA256 32 HEX:EE91D469B3A8ADC6AC8EB28E21794C706E08FDE48863828A7B0281AFCA81B17D
[security_association]
spp 1
seqid_window 20
1 AES128 HEX:FAF48EBA01E7C5966A76CB787AED4E7B
2 AES256 B64:PKTF9VQz94qPaoAzW4eE3JtFoQ8Ov1OTQSojalWyMbs=
3 SHA256 26 abcdefghijklmnopqrstuvwxyz
β° TIME SCALE USAGE β°
when ptp4l is acting as the domain server, it uses either the PTP or the UTC time scale depending on the time stamping mode. the way that it switches is honestly kind of iconic:
- In software and legacy time stamping modes, it announces Arbitrary time scale mode β which here is effectively UTC.
- In hardware time stamping mode, it announces use of PTP time scale.
and when ptp4l is the domain server and using hardware time stamping? it's up to phc2sys to maintain the correct offset between UTC and PTP times. see phc2sys(8) manual page for more details. teamwork makes the dream work π«Ά
π§΅ KTHREAD PRIORITY π§΅
ok so if you ever see this log:
timed out while polling for tx timestamp increasing
tx_timestamp_timeout or increasing kworker priority may correct
this issue, but a driver bug likely causes it
one possible cause is that the kworker which processes timestamps is being starved. The system admin might try manually increasing the priority of the kworker.
Many device drivers use kworker threads created by the PTP stack. Such kworkers are named:
ptp<decimal number of clock>
The system admin can manually bump the priority of the kworker process using chrt.
Example:
pgrep -f "ptp[0-9]+" | xargs -I {} sudo chrt -f --pid 75 {}
Intel ice driver may create multiple kworkers for one physical NIC and names those processes differently.
Example for Intel E810 card:
pgrep -f ice-ptp | xargs -I {} sudo chrt -f --pid 75 {}
β οΈ Assigning priority needs careful consideration, as assigning too high a priority to any task might make the system unstable. be careful bestie, don't crash the vibe π
π SEE ALSO π
and that's the whole page, you're officially a ptp4l girlie now π this was linuxptp, version from March 2024, and the page you just read is PTP4l(8). go forth and sync, my love πΈβ¨π
π¦ where this page comes from
- arch rolling: linuxptp 4.4-2 Β· GPL-2.0-or-later
- fedora 43: linuxptp 4.4-7.fc43 Β· GPL-2.0-or-later
- nixpkgs unstable: linuxptp 4.4
- opensuse-leap 16.0: linuxptp 4.4-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: linuxptp 4.4-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: linuxptp 4.4-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: linuxptp 4.4-160000.3.1 Β· GPL-2.0-or-later
- ubuntu resolute: linuxptp 4.4-0ubuntu1 Β· GPL-2.0-or-later
- ubuntu stonking: linuxptp 4.4-0ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms