PTP4l(8)
Bestie, welcome to ptp4l(8) from the System Manager's Manual โ aka the PTP Boundary/Ordinary/Transparent Clock page. โจ This one is lowkey iconic, so grab a snack. ๐
๐ธ NAME ๐ธ
ptp4l โ PTP Boundary/Ordinary/Transparent Clock ๐
โจ SYNOPSIS โจ
ptp4l [ -AEP246HSLmqsv ] [ -f config ] [ -p phc-device ] [ -l print-level ] [ -i interface ] [ long-options ] ...
๐ฆ DESCRIPTION ๐ฆ
Okay so ptp4l is the Linux implementation of the Precision Time Protocol (PTP) according to IEEE standard 1588. It is literally giving Boundary Clock (BC), Ordinary Clock (OC), and Transparent Clock (TC) energy. ๐ No cap.
๐ OPTIONS ๐
-Aโ Select the delay mechanism automatically. Start with E2E and switch to P2P when a peer delay request is received. ๐-Eโ Select the delay request-response (E2E) mechanism. This is the default mechanism. All clocks on a single PTP communication path must use the same mechanism. A warning will be printed when a peer delay request is received on a port using the E2E mechanism.-Pโ Select the peer delay (P2P) mechanism. A warning will be printed when a delay request is received on a port using the P2P mechanism.-2โ Select the IEEE 802.3 network transport. ๐ฐ๏ธ-4โ Select the UDP IPv4 network transport. This is the default transport.-6โ Select the UDP IPv6 network transport.-Hโ Select 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. โฑ๏ธ-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.-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.-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.-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).-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.
๐ง 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.
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. ๐
๐ PORT OPTIONS ๐
active_key_idโ Used in conjunction withsppandsa_filedirectives to specify which key from thesppdefined Security Association should be used for outbound icv calculations. 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).allowedLostResponsesโ The number of missed peer delay responses before theasCapablevariable is reset. The default is3.announceReceiptTimeoutโ The number of missed Announce messages before the last Announce messages expires. The default is3.boundary_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).cmlds.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.cmlds.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.delay_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.delay_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.rh_estimate_sync_timestampโ This is a RHEL-specific experimental option which can be renamed, removed, or the functionality changed, in a future minor update. Enablesptp4lto provide in two-step sync messages an estimated transmit time stamp instead of zero. The PN transport needs this option to be enabled. The default is0(disabled). ๐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.fault_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).follow_up_infoโ Include the 802.1AS data in the Follow_Up messages 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. โ ๏ธ
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).ignore_transport_specificโ By default, incoming messages are dropped if theirtransportSpecificfield does not match the configured value. However, many of transports specified in the 1588 standard 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โ okay so this one's the gap, in nanoseconds, between the receive time stamp the hardware reports and the actual moment the packet landed at the reference plane ๐ ptp4l subtracts this value from ingress time stamps it gets from the hardware. Default is0.inhibit_delay_reqโ literally just: don't send any delay requests ๐ซ This needs theasCapableconfig option set to'true', iykyk. Super handy when you're running as a designated server who doesn't need to calculate offset from the client. Default is0(disabled).inhibit_multicast_serviceโ some unicast mode profiles are insistent that no multicast messages ever get transmitted ๐ Setting this option inhibits multicast transmission. Default is0(multicast enabled).logAnnounceIntervalโ the mean time interval between Announce messages. Shorter interval = ptp4l reacts faster to changes in the client/server hierarchy, periodt. It should be the same across the whole domain, bestie. Specified as a power of two in seconds. Default is1(2 seconds).logMinDelayReqIntervalโ the minimum permitted mean time interval betweenDelay_Reqmessages. Shorter interval makes ptp4l react faster to changes in the path delay โจ 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 bestie, heads up: this option is deprecated and will be removed in a future release. Use"serverOnly"instead.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 is marked as not 802.1AS capable.network_transportโ picks the network transport ๐ Possible values areUDPv4,UDPv6,L2(Ethernet), andPN(PROFINET). ThePNtransport is experimental in RHEL and it can be removed or changed in a future minor update โ so don't get too attached. 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'msg_interval_request'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 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. Only relevant whenpower_profile.versionis2011. This value may be changed dynamically using thePOWER_PROFILE_SETTINGS_NPmanagement message. Default is-1, meaning unknown inaccuracy ๐power_profile.2011.networkTimeInaccuracyโ specifies the time inaccuracy of the network, in nanoseconds. Only relevant whenpower_profile.versionis2011. This value may be changed dynamically using thePOWER_PROFILE_SETTINGS_NPmanagement message. Default is-1, meaning unknown inaccuracy.power_profile.2017.totalTimeInaccuracyโ specifies the sum of the GM, network, and local node inaccuracies, in nanoseconds. Only relevant whenpower_profile.versionis2017. This value may be changed dynamically using thePOWER_PROFILE_SETTINGS_NPmanagement message. Default is-1, meaning unknown inaccuracy ๐power_profile.grandmasterIDโ specifies an optional, non-zero identification code for the GM. Note that 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 is0, meaning 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. Only relevant with UDPv4 transport. Default is224.0.1.129๐ฌp2p_dst_ipv4โ the IPv4 address to which peer delay messages should be sent. Only relevant with UDPv4 transport. 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๐ Only relevant with UDPv6 transport. Default isFF0E:0:0:0:0:0:0:181.p2p_dst_ipv6โ the IPv6 address to which peer delay messages should be sent. Only relevant with UDPv6 transport. Default isFF02:0:0:0:0:0:0:6B.ptp_dst_macโ the MAC address to which PTP messages should be sent. Only relevant with L2 transport. Default is01:1B:19:00:00:00๐ธp2p_dst_macโ the MAC address to which peer delay messages should be sent. Only relevant with L2 transport. Default is01:80:C2:00:00:0E.serverOnlyโ setting this option 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 ๐ซ This option's intended use is to support the Telecom Profiles according to ITU-TG.8265.1,G.8275.1, andG.8275.2. The 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 the802.1AS-2011standard. Setting this option 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.rh_subdomainUUIDโ โ ๏ธ this is a RHEL-specific experimental option which can be renamed, removed, or the functionality changed, in a future minor update.
It specifies the UUID of the PTCP subdomain used with the PN transport. Default is 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 (which indicates an unknown subdomain).
udp_ttlโ specifies the Time to live (TTL) value for IPv4 multicast messages and the hop limit for IPv6 multicast messages. This option is only relevant with the IPv4 and IPv6 UDP transports. Default is1to restrict the messages sent by ptp4l to the same subnet ๐unicast_listenโ when enabled, this option allows the port to grant unicast message contracts โจ Incoming requests for 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).
okay so last port-option baddie before we slide into clock business:
unicast_req_durationโ this is the service time in seconds that gets requested during unicast discovery. Quick note, bestie: the remote node can totally grant a different duration, so donโt act surprised ๐ . The default is 3600 seconds, aka one hour โฐ.
โจ PROGRAM AND CLOCK OPTIONS โจ
These are the main-character knobs for how ptp4l thinks about itself, its clock, and the whole timing vibe ๐ฐ๏ธโจ
asCapableโ if set to'true', all the checks that can unset theasCapablevariable (as described in Section 10.2.4.1 of 802.1AS) get skipped. If set to'auto',asCapablestarts as'false'and flips to'true'after the relevant checks pass. Default is'auto'๐.assume_two_stepโ treat one-step responses as two-step if this is enabled. Itโs the workaround for buggy 802.1AS switches, no cap ๐ญ. Default is 0 (disabled).BMCAโ this option enables static roles for server and client devices instead of running the best master clock algorithm (BMCA) described in the 1588 profile. Itโs giving speed-up energy for servers and clients when you already know the roles in advance ๐ฅ. When set tonoop, the traditional BMCA algorithm used by 1588 is skipped.masterOnlyandclientOnlyare then used to determine the server or client role for the device. In a bridge,clientOnly(which is a global option) can be set so 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. Default is'ptp', which runs the BMCA-related state machines ๐.check_fup_syncโ because packet reordering can happen in the network, in the hardware, or in the networking stack, a follow-up message can appear to arrive in the application before the matching sync message. This is a normal occurrence, and thesequenceIDmessage field makes sure matching still works, soptp4laccepts out-of-order packets ๐ซถ. This option adds an extra check using the software time stamps from the networking stack to verify that the sync message did arrive first. Itโs only useful if you do not trust the sequence IDs generated by the server. Default is 0 (disabled).clientOnlyโ the local clock is a client-only clock if enabled. Default is 0 (disabled) ๐ธ.clockAccuracyโ theclockAccuracyattribute of the local clock. Itโs used in the PTP server selection algorithm. Default is0xFEโญ.clockClassโ theclockClassattribute of the local clock. It denotes the traceability of the time distributed by the grandmaster clock. Default is248๐.clock_class_thresholdโ the maximum clock class value from master thatโs acceptable to a subordinate clock, beyond which it moves out of lock state. Default value is248๐ฆ.clockIdentityโ theclockIdentityattribute of the local clock. Itโs an 8-octet array and should be written in textual form in this configuration, see the default. It should be unique since itโs used to identify the specific clock ๐. Ifdefaultis used or if itโs not set at all, theclockIdentitywill be automatically generated. Default is"000000.0000.000000"โจ.clock_servoโ the servo 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) ๐ . 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. A multi-port ordinary clock will automatically be configured as a boundary clock. Default is"OC"๐.dataset_comparisonโ specifies the method used when comparing data sets during the Best Master Clock Algorithm. Possible values are"ieee1588"and"G.8275.x". Default is"ieee1588"๐.domainNumberโ the domain attribute of the local clock. Default is0๐.dscp_eventโ defines the Differentiated Services Codepoint (DSCP) to be used for PTP event messages. Must be a value between 0 and 63. 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. Default is0๐.dscp_generalโ defines the Differentiated Services Codepoint (DSCP) to be used for PTP general messages. Must be a value between 0 and 63. 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. 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. Default is0.00002(20 microseconds) โฑ๏ธ. This option used to be calledpi_f_offset_const.free_runningโ donโt adjust the local clock if enabled. Default is 0 (disabled) ๐ฆ.freq_est_intervalโ the time interval over which the ratio of the local and peer clock frequencies is estimated. Itโs specified as a power of two in seconds. 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". 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 โ ๏ธ.
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. Default is1(enabled) ๐.ignore_source_idโ this disables source port identity checking for Sync and Follow_Up messages. Itโs useful when announce messages are disabled in the server and the client doesnโt have any way to know the serverโs identity. Default is 0 (disabled) ๐.inhibit_announceโ this disables the timer for announce messages (i.e.FD_MANNO_TIMER) and also the announce message timeout timer (i.e.FD_ANNOUNCE_TIMER). Itโs 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. Default is 0 (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. Default is0โณ.interface_rate_tlvโ when the client and server are operating at different interface rates, delay asymmetry caused by the different interface rate needs to be compensated. The server sends its interface rate using the interface rate TLV as per G.8275.2 Annex D. Default is 0 (does not support interface rate tlv) ๐ก.hwts_filterโ select the hardware time stamp filter setting mode. Possible values arenormal,check, andfull.normalmode sets the filters as needed.checkmode only checks but does not set.fullmode sets the receive filter to mark all packets with hardware time stamp, so all applications can get them. 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. Default is1(enabled) โฐ.logging_levelโ the maximum logging level of messages that should be printed. Default is6(LOG_INFO) ๐.manufacturerIdentityโ the manufacturer id, which should be an OUI owned by the manufacturer. 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. 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 ofmaxStepsRemoved, the Announce message is not considered in the operation of the BMCA. Default value is255๐.message_tagโ the tag 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 ๐. Default is an empty string (which cannot be set in the configuration file as the option requires an argument).msg_interval_requestโ bestie, when you turn this on it triggers an adjustment to the Sync and peer delay request message intervals the moment the clock servo transitions into theSERVO_LOCKED_STABLEstate โจ. The Sync interval gets adjusted via the signaling mechanism, while the pdelay request interval is simply adjusted locally (no cap, that's just how it works). The new values come from theoperLogSyncIntervalandoperLogPdelayReqIntervaloptions respectively. Default is0(disabled) ๐ntpshm_segmentโ the number of the SHM segment used by thentpshmservo. Default is0๐ซถoffsetScaledLogVarianceโ theoffsetScaledLogVarianceattribute of the local clock. It characterizes the stability of the clock. Default is0xFFFF๐pi_integral_constโ the integral constant of the PI controller ๐ง. When set to0.0, the integral constant gets set by this formula from the current sync interval. Default is0.0.
ki = min(ki_scale * sync^ki_exponent, ki_norm_max / sync)
pi_integral_exponentโ theki_exponentconstant in the formula used to set 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 used to set the integral constant of the PI controller from the sync interval. Default is0.3๐ธpi_integral_scaleโ theki_scaleconstant in the formula used to set the integral constant of the PI controller from the sync interval. When set to0.0, the value will be selected from0.3and0.001for the 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 will be 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 used to set 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 used to set the proportional constant of the PI controller from the sync interval. Default is0.7๐pi_proportional_scaleโ thekp_scaleconstant in the formula used to set the proportional constant of the PI controller from the sync interval. When set to0.0, the value will be selected from0.7and0.1for the hardware and software time stamping respectively ๐. Default is0.0.productDescriptionโ the product description string ๐ท๏ธ. Allowed values must be of the formmanufacturerName;modelNumber;instanceIdentifierand contain at most 64 utf8 symbols. Default is";;".priority1โ thepriority1attribute of the local clock. It's used in the PTP server selection algorithm, and lower values take precedence ๐. Must be in the range0to255. Default is128.priority2โ thepriority2attribute of the local clock. Also used in the PTP server selection algorithm, lower values take precedence. Must be in the range0to255. Default is128๐ptp_minor_versionโ this option sets theminorVersionPTPin the common PTP message header. The default (specific to the installed linuxptp package) is0, but settingsa_fileforces the version to1โ ๏ธrefclock_sock_addressโ the address of the UNIX domain socket to be used by therefclock_sockservo. Default is/var/run/refclock.ptp.sock๐revisionDataโ the revision description string which contains the revisions for node hardware (HW), firmware (FW), and software (SW) ๐ง. Allowed values are of the formHW;FW;SWand contain at most 32 utf8 symbols. The default is an";;".sa_fileโ specifies the location of the file containing Security Associations used for immediate security processing of the Authentication TLV in support of the optional security mechanism defined in ieee1588-2019 ch 14.16 ๐. See SECURITY ASSOCIATION OPTIONS for info on how this file should be formatted.sppandactive_key_idshould be specified for each port to indicate which Security Association from thesa_fileshould be used. Default is an empty string.sanity_freq_limitโ the maximum allowed frequency offset between uncorrected clock and the system monotonic clock, in parts per billion (ppb) ๐ค. This is used as a sanity check of the synchronized clock. When a larger offset is measured, a warning message will be printed and the servo will be reset. If the frequency correction set byptp4lchanges unexpectedly between updates of the clock (e.g. due to another process trying to control the clock), a warning message will be printed. When set to0, the sanity check is disabled. Default is200000000(20%).servo_num_offset_valuesโ the number of offset values considered in order to transition from theSERVO_LOCKEDto theSERVO_LOCKED_STABLEstate ๐ฆ. The transition occurs once the lastservo_num_offset_valuesoffsets are all below theservo_offset_thresholdvalue. Default value is10.servo_offset_thresholdโ the offset threshold used in order to transition from theSERVO_LOCKEDto theSERVO_LOCKED_STABLEstate โจ. The transition occurs once the lastservo_num_offset_valuesoffsets are all below the threshold value. The default value ofoffset_thresholdis0(disabled).slave_event_monitorโ specifies 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, bestie.socket_priorityโ configure theSO_PRIORITYof sockets ๐ง. This is to support cases where a user wants to routeptp4ltraffic using Linux qdiscs for the purpose of traffic shaping. This option is only available with the IEEE 802.3 transport (the-2option) and is silently ignored when 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 usingnullfservo) 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. This option used to be calledpi_offset_const.step_windowโ when set, indicates the number of Sync events after a clock step that the clock will not do any frequency or step adjustments ๐. This is used in situations where clock stepping is unable to happen instantaneously so there is a lag before the timestamps can settle properly to reflect the clock step. Default is0(disabled).summary_intervalโ the time interval in which summary statistics of the clock are printed ๐. It's specified as a power of two in seconds. The statistics include offset root mean square (RMS), maximum absolute offset, frequency offset mean and standard deviation, and path delay mean and standard deviation. The units are nanoseconds and parts per billion (ppb). If there is only one clock update in the interval, the sample will be printed instead of the statistics. The messages are printed 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 ๐ณ. Enabling this option ensures that PTP message loops never form, provided the switches all 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, having no effect on the outcome of the Best Master Clock algorithm, and is advertised when the clock becomes grand master.time_stampingโ the time stamping method to be used. The allowed values arehardware,software,legacy,onestep, andp2p1step. Default ishardwareโกtwoStepFlagโ enable two-step mode for sync messages. One-step mode can be used only 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โ specifies the desired scope for the IPv6 multicast messages ๐. This will be used as the second byte of the primary address. This option is only relevant with IPv6 transport. See RFC 4291. Default is0x0Efor the global scope.uds_addressโ specifies 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 ๐. The mode should be specified as an octal number, i.e. it should start with a0literal. The default mode is0660.uds_ro_addressโ specifies the address of the second UNIX domain socket for receiving local management messages, which is restricted toGETactions and does not forward messages to other ports ๐. Access to this socket can be given to untrusted applications for monitoring purposes. Default is/var/run/ptp4lro.uds_ro_file_modeโ file mode of the second (read-only) UNIX domain socket used for receiving local management messages. The mode should be specified as an octal number, i.e. it should start with a0literal. The default mode is0666๐use_syslogโ print messages to the system log if enabled. Default is1(enabled) ๐userDescriptionโ okay so this is the user description string ๐ allowed values look likename;locationand it can hold at most 128 utf8 symbols. default is an empty string (iykyk, nothing there).utc_offsetโ the current offset between TAI and UTC โฐ default is37. no cap, that's the number.verboseโ prints messages to the standard output if enabled ๐ฌ default is0(disabled, so it's quiet bestie).write_phase_modeโ this one unlocks 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 ๐
L2|UDPv4|UDPv6โ every table entry specifies the transport type and the network address of a potential remote server ๐ if you list multiple servers, then unicast negotiation gets performed with each of them. slay, multitasking.logQueryIntervalโ this configures the time to wait between unicast negotiation attempts โณ it's specified as a power of two in seconds. default is0(which means 1 second, cute).peer_addressโ specifies the unicast address of the peer for use with the peer to peer delay mechanism ๐ฆ if you set it, the port owning the table will negotiate unicast peer delay responses from the machine at that given remote address; otherwise the port just sends multicast peer delay requests.table_idโ each table must begin with a unique, positive table ID ๐ข the port that claims a given table does so by including the ID as the value of itsunicast_master_tableoption. periodt.
๐ SECURITY ASSOCIATION OPTIONS ๐
sppโ each security association must begin with a uniquespp๐ the port claims a given security association by including thesppas the value of itssppoption. must be in the range of0to255, inclusive.seqid_windowโ this defines how far the sequence id of an incoming sync/follow_up message can advance from the last successfully processed sync/follow_up before it gets considered a replayed message ๐ sync/follow_up seqid tracking is reset on port state change and updated upon successful processing. when set to zero, no seqid checking happens at all. must be in the range of0to32767(0x7FFF) inclusive. default value is3.allow_mutableโ this allows for mutable correction fields if on path authentication tlv support isn't possible ๐ this option is NOT recommended โ it leaves the correction field unprotected. default value is0(disabled).key(format:id type length value) โ each security association must have at least one key entry, bestie, like at minimum one ๐๏ธ these entries should use the formatid type length value:- Key id: must be in the range of
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 the"HEX:"prefix, or as a Base64 encoded string with the"B64:"prefix. if no prefix is included, ASCII is assumed. key values should be randomally generated if possible. ciphers (AES) require the key length to match the cipher length (ie AES-128 requires key of 128 bits or 16 bytes).
- Key id: must be in the range of
๐ซ 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 acts as the domain server, it either uses the PTP or the UTC time scale depending on the time stamping mode ๐ in software and legacy time stamping modes it announces Arbitrary time scale mode, which is effectively UTC here. in hardware time stamping mode it announces use of PTP time scale. two whole vibes, one program.
when ptp4l is the domain server 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.
๐งต KTHREAD PRIORITY ๐งต
so in the case of the following 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 {}
the 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, bestie โ assigning too high a priority to any task might make the system unstable. like fr fr, be careful with this one ๐
๐ SEE ALSO ๐
and that's the whole page, you ate that ๐๐ linuxptp โ dated March 2024 โจ go be iconic with your clocks, bestie ๐๐ซถ๐
๐ฆ where this page comes from
- centos-stream 9: linuxptp 4.4-6.el9 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms