diff --git a/clock.c b/clock.c index bc2c061..e861b9b 100644 --- a/clock.c +++ b/clock.c @@ -334,6 +334,11 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx, pr_debug("path delay %10lld", c->path_delay); } +int clock_slave_only(struct clock *c) +{ + return c->dds.slaveOnly; +} + void clock_synchronize(struct clock *c, struct timespec ingress_ts, struct timestamp origin_ts, Integer64 correction1, Integer64 correction2) diff --git a/clock.h b/clock.h index 1342143..92b29a5 100644 --- a/clock.h +++ b/clock.h @@ -126,6 +126,13 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx, */ int clock_poll(struct clock *c); +/** + * Obtain the slave-only flag from a clock's default data set. + * @param c The clock instance. + * @return The value of the clock's slave-only flag. + */ +int clock_slave_only(struct clock *c); + /** * Provide a data point to synchronize the clock. * @param c The clock instance to synchronize. diff --git a/linuxptp.c b/linuxptp.c index ecaa31f..a350261 100644 --- a/linuxptp.c +++ b/linuxptp.c @@ -135,6 +135,7 @@ int main(int argc, char *argv[]) phc = NULL; } + ds.slaveOnly = TRUE; // TODO - make this programmable. ds.priority1 = 128; ds.clockQuality.clockClass = 248; ds.clockQuality.clockAccuracy = 0xfe; diff --git a/makefile b/makefile index e163f5b..9c29c50 100644 --- a/makefile +++ b/makefile @@ -32,7 +32,7 @@ DEPEND = $(OBJ:.o=.d) srcdir := $(dir $(lastword $(MAKEFILE_LIST))) VPATH = $(srcdir) -all: $(OBJ) +all: linuxptp linuxptp: $(OBJ) diff --git a/port.c b/port.c index 6aa4d44..c1e2c67 100644 --- a/port.c +++ b/port.c @@ -584,7 +584,8 @@ struct foreign_clock *port_compute_best(struct port *p) void port_dispatch(struct port *p, enum fsm_event event) { - enum port_state next = ptp_fsm(p->state, event); + enum port_state next = clock_slave_only(p->clock) ? + ptp_slave_fsm(p->state, event) : ptp_fsm(p->state, event); if (PS_INITIALIZING == next) { /*