dcavalca / rpms / linuxptp

Forked from rpms/linuxptp 2 years ago
Clone
c547f6
commit 1a2dfe9b00b79a59acf905476bbc33c74d5770a3
c547f6
Author: Jacob Keller <jacob.e.keller@intel.com>
c547f6
Date:   Thu Jul 8 12:59:30 2021 -0700
c547f6
c547f6
    Increase the default tx_timestamp_timeout to 10
c547f6
    
c547f6
    The tx_timestamp_timeout configuration defines the number of
c547f6
    milliseconds to wait for a Tx timestamp from the kernel stack. This
c547f6
    delay is necessary as Tx timestamps are captured after a packet is sent
c547f6
    and reported back via the socket error queue.
c547f6
    
c547f6
    The current default is to poll for up to 1 millisecond. In practice, it
c547f6
    turns out that this is not always enough time for hardware and software
c547f6
    to capture the timestamp and report it back. Some hardware designs
c547f6
    require reading timestamps over registers or other slow mechanisms.
c547f6
    
c547f6
    This extra delay results in the timestamp not being sent back to
c547f6
    userspace within the default 1 millisecond polling time. If that occurs
c547f6
    the following can be seen from ptp4l:
c547f6
    
c547f6
      ptp4l[4756.840]: timed out while polling for tx timestamp
c547f6
      ptp4l[4756.840]: increasing tx_timestamp_timeout may correct this issue,
c547f6
                       but it is likely caused by a driver bug
c547f6
      ptp4l[4756.840]: port 1 (p2p1): send sync failed
c547f6
      ptp4l[4756.840]: port 1 (p2p1): MASTER to FAULTY on FAULT_DETECTED
c547f6
                       (FT_UNSPECIFIED)
c547f6
    
c547f6
    This can confuse users because it implies this is a bug, when the
c547f6
    correct solution in many cases is to just increase the timeout to
c547f6
    a slightly higher value.
c547f6
    
c547f6
    Since we know this is a problem for many drivers and hardware designs,
c547f6
    lets increase the default timeout.
c547f6
    
c547f6
    Note that a longer timeout should not affect setups which return the
c547f6
    timestamp quickly. On modern kernels, the poll() call will return once
c547f6
    the timestamp is reported back to the socket error queue. (On old
c547f6
    kernels around the 3.x era the poll will sleep for the full duration
c547f6
    before reporting the timestamp, but this is now quite an old kernel
c547f6
    release).
c547f6
    
c547f6
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
c547f6
c547f6
diff --git a/config.c b/config.c
c547f6
index 760b395..03d981e 100644
c547f6
--- a/config.c
c547f6
+++ b/config.c
c547f6
@@ -324,7 +324,7 @@ struct config_item config_tab[] = {
c547f6
 	GLOB_ITEM_INT("ts2phc.pulsewidth", 500000000, 1000000, 999000000),
c547f6
 	PORT_ITEM_ENU("tsproc_mode", TSPROC_FILTER, tsproc_enu),
c547f6
 	GLOB_ITEM_INT("twoStepFlag", 1, 0, 1),
c547f6
-	GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX),
c547f6
+	GLOB_ITEM_INT("tx_timestamp_timeout", 10, 1, INT_MAX),
c547f6
 	PORT_ITEM_INT("udp_ttl", 1, 1, 255),
c547f6
 	PORT_ITEM_INT("udp6_scope", 0x0E, 0x00, 0x0F),
c547f6
 	GLOB_ITEM_STR("uds_address", "/var/run/ptp4l"),
c547f6
diff --git a/configs/default.cfg b/configs/default.cfg
c547f6
index 64ef3bd..d615610 100644
c547f6
--- a/configs/default.cfg
c547f6
+++ b/configs/default.cfg
c547f6
@@ -51,7 +51,7 @@ hybrid_e2e		0
c547f6
 inhibit_multicast_service	0
c547f6
 net_sync_monitor	0
c547f6
 tc_spanning_tree	0
c547f6
-tx_timestamp_timeout	1
c547f6
+tx_timestamp_timeout	10
c547f6
 unicast_listen		0
c547f6
 unicast_master_table	0
c547f6
 unicast_req_duration	3600
c547f6
diff --git a/ptp4l.8 b/ptp4l.8
c547f6
index fe9e150..7ca3474 100644
c547f6
--- a/ptp4l.8
c547f6
+++ b/ptp4l.8
c547f6
@@ -496,7 +496,7 @@ switches all implement this option together with the BMCA.
c547f6
 .B tx_timestamp_timeout
c547f6
 The number of milliseconds to poll waiting for the tx time stamp from the kernel
c547f6
 when a message has recently been sent.
c547f6
-The default is 1.
c547f6
+The default is 10.
c547f6
 .TP
c547f6
 .B check_fup_sync
c547f6
 Because of packet reordering that can occur in the network, in the