This will allow adding alternative algorithms as defined in PTP profiles. Signed-off-by: Richard Cochran <richardcoch...@gmail.com> --- clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/clock.c b/clock.c index da15882..7049706 100644 --- a/clock.c +++ b/clock.c @@ -79,6 +79,7 @@ struct clock { clockid_t clkid; struct servo *servo; enum servo_type servo_type; + int (*dscmp)(struct dataset *a, struct dataset *b); struct defaultDS dds; struct dataset default_dataset; struct currentDS cur; @@ -1038,6 +1039,7 @@ struct clock *clock_create(enum clock_type type, struct config *config, } c->servo_state = SERVO_UNLOCKED; c->servo_type = servo; + c->dscmp = dscmp; c->tsproc = tsproc_create(config_get_int(config, NULL, "tsproc_mode"), config_get_int(config, NULL, "delay_filter"), config_get_int(config, NULL, "delay_filter_length")); @@ -1658,7 +1660,7 @@ static void handle_state_decision_event(struct clock *c) fc = port_compute_best(piter); if (!fc) continue; - if (!best || dscmp(&fc->dataset, &best->dataset) > 0) + if (!best || c->dscmp(&fc->dataset, &best->dataset) > 0) best = fc; } -- 2.11.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel