This will allow adding alternative algorithms as defined in PTP profiles.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 port.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/port.c b/port.c
index 34837cc..46db95d 100644
--- a/port.c
+++ b/port.c
@@ -98,6 +98,7 @@ struct port {
        unsigned int multiple_pdr_detected;
        enum port_state (*state_machine)(enum port_state state,
                                         enum fsm_event event, int mdiff);
+       int (*dscmp)(struct dataset *a, struct dataset *b);
        /* portDS */
        struct PortIdentity portIdentity;
        enum port_state     state; /*portState*/
@@ -2069,7 +2070,7 @@ struct foreign_clock *port_compute_best(struct port *p)
 
                if (!p->best)
                        p->best = fc;
-               else if (dscmp(&fc->dataset, &p->best->dataset) > 0)
+               else if (p->dscmp(&fc->dataset, &p->best->dataset) > 0)
                        p->best = fc;
                else
                        fc_clear(fc);
@@ -2598,6 +2599,7 @@ struct port *port_open(int phc_index,
        memset(p, 0, sizeof(*p));
 
        p->state_machine = clock_slave_only(clock) ? ptp_slave_fsm : ptp_fsm;
+       p->dscmp = dscmp;
        p->phc_index = phc_index;
        p->jbod = config_get_int(cfg, interface->name, "boundary_clock_jbod");
        transport = config_get_int(cfg, interface->name, "network_transport");
-- 
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

Reply via email to