conf: add nocrossts option to hwtimestamp directive
This option disables the use of the PTP_SYS_OFFSET_PRECISE ioctl.
This commit is contained in:
parent
31b6a14444
commit
50f99ec5f4
4 changed files with 12 additions and 2 deletions
4
conf.c
4
conf.c
|
@ -1260,6 +1260,7 @@ 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->nocrossts = 0;
|
||||||
iface->precision = 100.0e-9;
|
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;
|
||||||
|
@ -1279,6 +1280,9 @@ parse_hwtimestamp(char *line)
|
||||||
} else if (!strcasecmp(p, "txcomp")) {
|
} else if (!strcasecmp(p, "txcomp")) {
|
||||||
if (sscanf(line, "%lf%n", &iface->tx_comp, &n) != 1)
|
if (sscanf(line, "%lf%n", &iface->tx_comp, &n) != 1)
|
||||||
break;
|
break;
|
||||||
|
} else if (!strcasecmp(p, "nocrossts")) {
|
||||||
|
n = 0;
|
||||||
|
iface->nocrossts = 1;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
1
conf.h
1
conf.h
|
@ -122,6 +122,7 @@ extern double CNF_GetInitStepThreshold(void);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
int minpoll;
|
int minpoll;
|
||||||
|
int nocrossts;
|
||||||
double precision;
|
double precision;
|
||||||
double tx_comp;
|
double tx_comp;
|
||||||
double rx_comp;
|
double rx_comp;
|
||||||
|
|
|
@ -1836,6 +1836,9 @@ This option specifies the difference in seconds between the reported receive
|
||||||
timestamp and the actual reception time at the physical layer. This value will
|
timestamp and the actual reception time at the physical layer. This value will
|
||||||
be subtracted from receive timestamps obtained from the NIC. The default value
|
be subtracted from receive timestamps obtained from the NIC. The default value
|
||||||
is 0.
|
is 0.
|
||||||
|
*nocrossts*:::
|
||||||
|
Some hardware can precisely cross timestamp the NIC clock with the system
|
||||||
|
clock. This option disables the use of the cross timestamping.
|
||||||
::
|
::
|
||||||
+
|
+
|
||||||
Examples of the directive are:
|
Examples of the directive are:
|
||||||
|
|
|
@ -62,6 +62,7 @@ struct Interface {
|
||||||
int if_index;
|
int if_index;
|
||||||
int phc_fd;
|
int phc_fd;
|
||||||
int phc_mode;
|
int phc_mode;
|
||||||
|
int phc_nocrossts;
|
||||||
/* Link speed in mbit/s */
|
/* Link speed in mbit/s */
|
||||||
int link_speed;
|
int link_speed;
|
||||||
/* Start of UDP data at layer 2 for IPv4 and IPv6 */
|
/* Start of UDP data at layer 2 for IPv4 and IPv6 */
|
||||||
|
@ -165,6 +166,7 @@ add_interface(CNF_HwTsInterface *conf_iface)
|
||||||
iface->if_index = if_index;
|
iface->if_index = if_index;
|
||||||
iface->phc_fd = phc_fd;
|
iface->phc_fd = phc_fd;
|
||||||
iface->phc_mode = 0;
|
iface->phc_mode = 0;
|
||||||
|
iface->phc_nocrossts = conf_iface->nocrossts;
|
||||||
|
|
||||||
/* Start with 1 gbit and no VLANs or IPv4/IPv6 options */
|
/* Start with 1 gbit and no VLANs or IPv4/IPv6 options */
|
||||||
iface->link_speed = 1000;
|
iface->link_speed = 1000;
|
||||||
|
@ -368,8 +370,8 @@ process_hw_timestamp(struct Interface *iface, struct timespec *hw_ts,
|
||||||
int l2_length;
|
int l2_length;
|
||||||
|
|
||||||
if (HCL_NeedsNewSample(iface->clock, &local_ts->ts)) {
|
if (HCL_NeedsNewSample(iface->clock, &local_ts->ts)) {
|
||||||
if (!SYS_Linux_GetPHCSample(iface->phc_fd, 0, iface->precision, &iface->phc_mode,
|
if (!SYS_Linux_GetPHCSample(iface->phc_fd, iface->phc_nocrossts, iface->precision,
|
||||||
&sample_phc_ts, &sample_sys_ts, &err))
|
&iface->phc_mode, &sample_phc_ts, &sample_sys_ts, &err))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LCL_CookTime(&sample_sys_ts, &sample_local_ts, NULL);
|
LCL_CookTime(&sample_sys_ts, &sample_local_ts, NULL);
|
||||||
|
|
Loading…
Reference in a new issue