diff --git a/conf.c b/conf.c index 3df90df..d296da4 100644 --- a/conf.c +++ b/conf.c @@ -1259,6 +1259,7 @@ parse_hwtimestamp(char *line) iface = ARR_GetNewElement(hwts_interfaces); iface->name = Strdup(p); + iface->minpoll = 0; iface->precision = 100.0e-9; iface->tx_comp = 0.0; iface->rx_comp = 0.0; @@ -1266,7 +1267,10 @@ parse_hwtimestamp(char *line) for (p = line; *p; line += n, p = line) { line = CPS_SplitWord(line); - if (!strcasecmp(p, "precision")) { + if (!strcasecmp(p, "minpoll")) { + if (sscanf(line, "%d%n", &iface->minpoll, &n) != 1) + break; + } else if (!strcasecmp(p, "precision")) { if (sscanf(line, "%lf%n", &iface->precision, &n) != 1) break; } else if (!strcasecmp(p, "rxcomp")) { diff --git a/conf.h b/conf.h index c2acc3a..b84d921 100644 --- a/conf.h +++ b/conf.h @@ -121,6 +121,7 @@ extern double CNF_GetInitStepThreshold(void); typedef struct { char *name; + int minpoll; double precision; double tx_comp; double rx_comp; diff --git a/doc/chrony.conf.adoc b/doc/chrony.conf.adoc index 8e6fa96..a0801f0 100644 --- a/doc/chrony.conf.adoc +++ b/doc/chrony.conf.adoc @@ -1818,6 +1818,12 @@ on all available interfaces. + The *hwtimestamp* directive has the following options: + +*minpoll* _poll_::: +This option specifies the minimum interval between readings of the NIC clock. +It's defined as a power of two. It should correspond to the minimum polling +interval of all NTP sources and the minimum expected polling interval of NTP +clients. The default value is 0 (1 second) and the minimum value is -6 (1/64th +of a second). *precision* _precision_::: This option specifies the assumed precision of reading of the NIC clock. The default value is 100e-9 (100 nanoseconds). diff --git a/ntp_io_linux.c b/ntp_io_linux.c index 3a87cad..9a6100c 100644 --- a/ntp_io_linux.c +++ b/ntp_io_linux.c @@ -77,6 +77,9 @@ struct Interface { /* Number of PHC readings per HW clock sample */ #define PHC_READINGS 10 +/* Minimum interval between PHC readings */ +#define MIN_PHC_POLL -6 + /* Maximum acceptable offset between HW and daemon/kernel timestamp */ #define MAX_TS_DELAY 1.0 @@ -179,7 +182,7 @@ add_interface(CNF_HwTsInterface *conf_iface) iface->tx_comp = conf_iface->tx_comp; iface->rx_comp = conf_iface->rx_comp; - iface->clock = HCL_CreateInstance(1.0); + iface->clock = HCL_CreateInstance(UTI_Log2ToDouble(MAX(conf_iface->minpoll, MIN_PHC_POLL))); DEBUG_LOG(LOGF_NtpIOLinux, "Enabled HW timestamping on %s", iface->name);