config: add a option to enable a poor man's boundary clock.

This patch adds a configuration option that allows running a boundary clock
using "just a bunch of devices". Normally each port is probed to make sure
they all share the same PTP hardware clock, but this option will allow a
heterogeneous collection of devices, should the user really want it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
master
Richard Cochran 2014-11-01 18:59:13 +01:00
parent 017235f881
commit d70d38ade3
7 changed files with 29 additions and 1 deletions

View File

@ -217,6 +217,12 @@ static enum parser_result parse_port_setting(const char *option,
return r; return r;
iface->delay_filter_length = val; iface->delay_filter_length = val;
} else if (!strcmp(option, "boundary_clock_jbod")) {
r = get_ranged_int(value, &val, 0, 1);
if (r != PARSED_OK)
return r;
iface->boundary_clock_jbod = val;
} else } else
return NOT_PARSED; return NOT_PARSED;
@ -574,6 +580,12 @@ static enum parser_result parse_global_setting(const char *option,
return r; return r;
cfg->dds.delay_filter_length = val; cfg->dds.delay_filter_length = val;
} else if (!strcmp(option, "boundary_clock_jbod")) {
r = get_ranged_int(value, &val, 0, 1);
if (r != PARSED_OK)
return r;
cfg->dds.boundary_clock_jbod = val;
} else } else
return NOT_PARSED; return NOT_PARSED;
@ -762,6 +774,7 @@ void config_init_interface(struct interface *iface, struct config *cfg)
iface->delay_filter = cfg->dds.delay_filter; iface->delay_filter = cfg->dds.delay_filter;
iface->delay_filter_length = cfg->dds.delay_filter_length; iface->delay_filter_length = cfg->dds.delay_filter_length;
iface->boundary_clock_jbod = cfg->dds.boundary_clock_jbod;
} }
void config_destroy(struct config *cfg) void config_destroy(struct config *cfg)

View File

@ -41,6 +41,7 @@ struct interface {
struct sk_ts_info ts_info; struct sk_ts_info ts_info;
enum filter_type delay_filter; enum filter_type delay_filter;
int delay_filter_length; int delay_filter_length;
int boundary_clock_jbod;
}; };
#define CFG_IGNORE_DM (1 << 0) #define CFG_IGNORE_DM (1 << 0)

View File

@ -72,6 +72,7 @@ delay_filter moving_median
delay_filter_length 10 delay_filter_length 10
egressLatency 0 egressLatency 0
ingressLatency 0 ingressLatency 0
boundary_clock_jbod 0
# #
# Clock description # Clock description
# #

1
ds.h
View File

@ -61,6 +61,7 @@ struct default_ds {
struct clock_description clock_desc; struct clock_description clock_desc;
enum filter_type delay_filter; enum filter_type delay_filter;
int delay_filter_length; int delay_filter_length;
int boundary_clock_jbod;
}; };
struct dataset { struct dataset {

View File

@ -71,3 +71,4 @@ delay_filter moving_median
delay_filter_length 10 delay_filter_length 10
egressLatency 0 egressLatency 0
ingressLatency 0 ingressLatency 0
boundary_clock_jbod 0

12
ptp4l.8
View File

@ -1,4 +1,4 @@
.TH PTP4l 8 "October 2013" "linuxptp" .TH PTP4l 8 "December 2014" "linuxptp"
.SH NAME .SH NAME
ptp4l \- PTP Boundary/Ordinary Clock ptp4l \- PTP Boundary/Ordinary Clock
@ -217,6 +217,16 @@ Specifies the difference in nanoseconds between the reported receive
time stamp and the actual reception time at reference plane. This value time stamp and the actual reception time at reference plane. This value
will be subtracted from ingress time stamps obtained from the hardware. will be subtracted from ingress time stamps obtained from the hardware.
The default is 0. The default is 0.
.TP
.B boundary_clock_jbod
When running as a boundary clock (that is, when more than one network
interface is configured), ptp4l performs a sanity check to make sure
that all of the ports share the same hardware clock device. This
option allows ptp4l to work as a boundary clock using "just a bunch of
devices" that are not synchronized to each other. For this mode, the
collection of clocks must be synchronized by an external program, for
example phc2sys(8) in "automatic" mode.
The default is 0 (disabled).
.SH PROGRAM AND CLOCK OPTIONS .SH PROGRAM AND CLOCK OPTIONS

View File

@ -75,6 +75,7 @@ static struct config cfg_settings = {
}, },
.delay_filter = FILTER_MOVING_MEDIAN, .delay_filter = FILTER_MOVING_MEDIAN,
.delay_filter_length = 10, .delay_filter_length = 10,
.boundary_clock_jbod = 0,
}, },
.pod = { .pod = {