Skip to content

Commit

Permalink
config: add a option to enable a poor man's boundary clock.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jiri Benc <[email protected]>
  • Loading branch information
richardcochran committed Dec 16, 2014
1 parent 017235f commit d70d38a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 1 deletion.
13 changes: 13 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ static enum parser_result parse_port_setting(const char *option,
return r;
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
return NOT_PARSED;

Expand Down Expand Up @@ -574,6 +580,12 @@ static enum parser_result parse_global_setting(const char *option,
return r;
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
return NOT_PARSED;

Expand Down Expand Up @@ -762,6 +774,7 @@ void config_init_interface(struct interface *iface, struct config *cfg)

iface->delay_filter = cfg->dds.delay_filter;
iface->delay_filter_length = cfg->dds.delay_filter_length;
iface->boundary_clock_jbod = cfg->dds.boundary_clock_jbod;
}

void config_destroy(struct config *cfg)
Expand Down
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct interface {
struct sk_ts_info ts_info;
enum filter_type delay_filter;
int delay_filter_length;
int boundary_clock_jbod;
};

#define CFG_IGNORE_DM (1 << 0)
Expand Down
1 change: 1 addition & 0 deletions default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ delay_filter moving_median
delay_filter_length 10
egressLatency 0
ingressLatency 0
boundary_clock_jbod 0
#
# Clock description
#
Expand Down
1 change: 1 addition & 0 deletions ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct default_ds {
struct clock_description clock_desc;
enum filter_type delay_filter;
int delay_filter_length;
int boundary_clock_jbod;
};

struct dataset {
Expand Down
1 change: 1 addition & 0 deletions gPTP.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ delay_filter moving_median
delay_filter_length 10
egressLatency 0
ingressLatency 0
boundary_clock_jbod 0
12 changes: 11 additions & 1 deletion ptp4l.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH PTP4l 8 "October 2013" "linuxptp"
.TH PTP4l 8 "December 2014" "linuxptp"
.SH NAME
ptp4l \- PTP Boundary/Ordinary Clock

Expand Down Expand Up @@ -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
will be subtracted from ingress time stamps obtained from the hardware.
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

Expand Down
1 change: 1 addition & 0 deletions ptp4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ static struct config cfg_settings = {
},
.delay_filter = FILTER_MOVING_MEDIAN,
.delay_filter_length = 10,
.boundary_clock_jbod = 0,
},

.pod = {
Expand Down

0 comments on commit d70d38a

Please sign in to comment.