[chrony-dev] disable RX timestamp adjustment patch |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
This adds the "disablerxadjust" config option to hwtimestamp. This
uses RX timestamps at the 1588 point (after SFD/before ethernet
header) instead of the NTP point (after ethernet CRC). At 1G, this
changes the timestamp (and RTT) by 752ns. To be symmetrical, you'd
want this enabled on both the NTP server and client.
It probably doesn't make a difference to things using software
timestamps, 752ns is small compared to interrupt latency/jitter.
Things using hardware timestamps are able to see this difference.
This doesn't make a huge difference, just a lower measured RTT.
Example usage:
hwtimestamp * disablerxadjust
diff --git a/conf.c b/conf.c
index d41f85f..5c43fda 100644
--- a/conf.c
+++ b/conf.c
@@ -1382,6 +1382,7 @@ parse_hwtimestamp(char *line)
iface->precision = 100.0e-9;
iface->tx_comp = 0.0;
iface->rx_comp = 0.0;
+ iface->disable_rx_adjust = 0;
for (p = line; *p; line += n, p = line) {
line = CPS_SplitWord(line);
@@ -1418,6 +1419,9 @@ parse_hwtimestamp(char *line)
} else if (!strcasecmp(p, "nocrossts")) {
n = 0;
iface->nocrossts = 1;
+ } else if (!strcasecmp(p, "disablerxadjust")) {
+ n = 0; // skip 0 chars, no arguments
+ iface->disable_rx_adjust = 1;
} else {
break;
}
diff --git a/conf.h b/conf.h
index 01dc38f..4d35329 100644
--- a/conf.h
+++ b/conf.h
@@ -138,6 +138,7 @@ typedef struct {
double precision;
double tx_comp;
double rx_comp;
+ int disable_rx_adjust;
} CNF_HwTsInterface;
extern int CNF_GetHwTsInterface(unsigned int index, CNF_HwTsInterface **iface);
diff --git a/ntp_io_linux.c b/ntp_io_linux.c
index 634ccb0..18889e8 100644
--- a/ntp_io_linux.c
+++ b/ntp_io_linux.c
@@ -65,6 +65,7 @@ struct Interface {
double tx_comp;
double rx_comp;
HCL_Instance clock;
+ int disable_rx_adjust;
};
/* Number of PHC readings per HW clock sample */
@@ -238,6 +239,7 @@ add_interface(CNF_HwTsInterface *conf_iface)
iface->precision = conf_iface->precision;
iface->tx_comp = conf_iface->tx_comp;
iface->rx_comp = conf_iface->rx_comp;
+ iface->disable_rx_adjust = conf_iface->disable_rx_adjust;
iface->clock = HCL_CreateInstance(conf_iface->min_samples, conf_iface->max_samples,
UTI_Log2ToDouble(MAX(conf_iface->minpoll, MIN_PHC_POLL)));
@@ -577,7 +579,7 @@ process_hw_timestamp(struct Interface *iface, struct timespec *hw_ts,
timestamps. If we don't know the length of the packet at layer 2, we
make an assumption that UDP data start at the same position as in the
last transmitted packet which had a HW TX timestamp. */
- if (rx_ntp_length && iface->link_speed) {
+ if (!iface->disable_rx_adjust && rx_ntp_length && iface->link_speed) {
if (!l2_length)
l2_length = (family == IPADDR_INET4 ? iface->l2_udp4_ntp_start :
iface->l2_udp6_ntp_start) + rx_ntp_length;