ntp: add options to set minsamples/maxsamples of hwclock
This commit is contained in:
parent
c0717a27f6
commit
afff06c88c
4 changed files with 19 additions and 3 deletions
10
conf.c
10
conf.c
|
@ -1291,6 +1291,8 @@ parse_hwtimestamp(char *line)
|
||||||
iface = ARR_GetNewElement(hwts_interfaces);
|
iface = ARR_GetNewElement(hwts_interfaces);
|
||||||
iface->name = Strdup(p);
|
iface->name = Strdup(p);
|
||||||
iface->minpoll = 0;
|
iface->minpoll = 0;
|
||||||
|
iface->min_samples = 2;
|
||||||
|
iface->max_samples = 16;
|
||||||
iface->nocrossts = 0;
|
iface->nocrossts = 0;
|
||||||
iface->rxfilter = CNF_HWTS_RXFILTER_ANY;
|
iface->rxfilter = CNF_HWTS_RXFILTER_ANY;
|
||||||
iface->precision = 100.0e-9;
|
iface->precision = 100.0e-9;
|
||||||
|
@ -1300,9 +1302,15 @@ parse_hwtimestamp(char *line)
|
||||||
for (p = line; *p; line += n, p = line) {
|
for (p = line; *p; line += n, p = line) {
|
||||||
line = CPS_SplitWord(line);
|
line = CPS_SplitWord(line);
|
||||||
|
|
||||||
if (!strcasecmp(p, "minpoll")) {
|
if (!strcasecmp(p, "maxsamples")) {
|
||||||
|
if (sscanf(line, "%d%n", &iface->max_samples, &n) != 1)
|
||||||
|
break;
|
||||||
|
} else if (!strcasecmp(p, "minpoll")) {
|
||||||
if (sscanf(line, "%d%n", &iface->minpoll, &n) != 1)
|
if (sscanf(line, "%d%n", &iface->minpoll, &n) != 1)
|
||||||
break;
|
break;
|
||||||
|
} else if (!strcasecmp(p, "minsamples")) {
|
||||||
|
if (sscanf(line, "%d%n", &iface->min_samples, &n) != 1)
|
||||||
|
break;
|
||||||
} else if (!strcasecmp(p, "precision")) {
|
} else if (!strcasecmp(p, "precision")) {
|
||||||
if (sscanf(line, "%lf%n", &iface->precision, &n) != 1)
|
if (sscanf(line, "%lf%n", &iface->precision, &n) != 1)
|
||||||
break;
|
break;
|
||||||
|
|
2
conf.h
2
conf.h
|
@ -128,6 +128,8 @@ typedef enum {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
int minpoll;
|
int minpoll;
|
||||||
|
int min_samples;
|
||||||
|
int max_samples;
|
||||||
int nocrossts;
|
int nocrossts;
|
||||||
CNF_HwTs_RxFilter rxfilter;
|
CNF_HwTs_RxFilter rxfilter;
|
||||||
double precision;
|
double precision;
|
||||||
|
|
|
@ -1945,6 +1945,12 @@ 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
|
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
|
clients. The default value is 0 (1 second) and the minimum value is -6 (1/64th
|
||||||
of a second).
|
of a second).
|
||||||
|
*minsamples* _samples_:::
|
||||||
|
This option specifies the minimum number of readings kept for tracking of the
|
||||||
|
NIC clock. The default value is 2.
|
||||||
|
*maxsamples* _samples_:::
|
||||||
|
This option specifies the maximum number of readings kept for tracking of the
|
||||||
|
NIC clock. The default value is 16.
|
||||||
*precision* _precision_:::
|
*precision* _precision_:::
|
||||||
This option specifies the assumed precision of reading of the NIC clock. The
|
This option specifies the assumed precision of reading of the NIC clock. The
|
||||||
default value is 100e-9 (100 nanoseconds).
|
default value is 100e-9 (100 nanoseconds).
|
||||||
|
|
|
@ -236,8 +236,8 @@ add_interface(CNF_HwTsInterface *conf_iface)
|
||||||
iface->tx_comp = conf_iface->tx_comp;
|
iface->tx_comp = conf_iface->tx_comp;
|
||||||
iface->rx_comp = conf_iface->rx_comp;
|
iface->rx_comp = conf_iface->rx_comp;
|
||||||
|
|
||||||
iface->clock = HCL_CreateInstance(0, 16, UTI_Log2ToDouble(MAX(conf_iface->minpoll,
|
iface->clock = HCL_CreateInstance(conf_iface->min_samples, conf_iface->max_samples,
|
||||||
MIN_PHC_POLL)));
|
UTI_Log2ToDouble(MAX(conf_iface->minpoll, MIN_PHC_POLL)));
|
||||||
|
|
||||||
LOG(LOGS_INFO, "Enabled HW timestamping %son %s",
|
LOG(LOGS_INFO, "Enabled HW timestamping %son %s",
|
||||||
ts_config.rx_filter == HWTSTAMP_FILTER_NONE ? "(TX only) " : "", iface->name);
|
ts_config.rx_filter == HWTSTAMP_FILTER_NONE ? "(TX only) " : "", iface->name);
|
||||||
|
|
Loading…
Reference in a new issue