conf: add precision option to hwtimestamp directive

This commit is contained in:
Miroslav Lichvar 2017-01-19 12:40:18 +01:00
parent 98f5d05925
commit 1436d9961f
4 changed files with 10 additions and 2 deletions

6
conf.c
View file

@ -1259,13 +1259,17 @@ parse_hwtimestamp(char *line)
iface = ARR_GetNewElement(hwts_interfaces); iface = ARR_GetNewElement(hwts_interfaces);
iface->name = Strdup(p); iface->name = Strdup(p);
iface->precision = 100.0e-9;
iface->tx_comp = 0.0; iface->tx_comp = 0.0;
iface->rx_comp = 0.0; iface->rx_comp = 0.0;
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, "rxcomp")) { if (!strcasecmp(p, "precision")) {
if (sscanf(line, "%lf%n", &iface->precision, &n) != 1)
break;
} else if (!strcasecmp(p, "rxcomp")) {
if (sscanf(line, "%lf%n", &iface->rx_comp, &n) != 1) if (sscanf(line, "%lf%n", &iface->rx_comp, &n) != 1)
break; break;
} else if (!strcasecmp(p, "txcomp")) { } else if (!strcasecmp(p, "txcomp")) {

1
conf.h
View file

@ -121,6 +121,7 @@ extern double CNF_GetInitStepThreshold(void);
typedef struct { typedef struct {
char *name; char *name;
double precision;
double tx_comp; double tx_comp;
double rx_comp; double rx_comp;
} CNF_HwTsInterface; } CNF_HwTsInterface;

View file

@ -1818,6 +1818,9 @@ on all available interfaces.
+ +
The *hwtimestamp* directive has the following options: The *hwtimestamp* directive has the following options:
+ +
*precision* _precision_:::
This option specifies the assumed precision of reading of the NIC clock. The
default value is 100e-9 (100 nanoseconds).
*txcomp* _compensation_::: *txcomp* _compensation_:::
This option specifies the difference in seconds between the actual transmission This option specifies the difference in seconds between the actual transmission
time at the physical layer and the reported transmit timestamp. This value will time at the physical layer and the reported transmit timestamp. This value will

View file

@ -175,7 +175,7 @@ add_interface(CNF_HwTsInterface *conf_iface)
iface->l2_udp4_ntp_start = 42; iface->l2_udp4_ntp_start = 42;
iface->l2_udp6_ntp_start = 62; iface->l2_udp6_ntp_start = 62;
iface->precision = 100.0e-9; iface->precision = conf_iface->precision;
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;