Signed-off-by: Anders Selhammer <anders.selham...@est.tech> --- clock.c | 7 +++++++ clock.h | 7 +++++++ ds.h | 1 + port.c | 20 +++++++++++++------- port.h | 9 ++++++++- port_private.h | 1 + 6 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/clock.c b/clock.c index 2369247..272c7da 100644 --- a/clock.c +++ b/clock.c @@ -81,6 +81,7 @@ struct clock { struct servo *servo; enum servo_type servo_type; dscmp_type dscmp; + UInteger8 localPriority; struct dataset dataset; struct defaultDS dds; struct currentDS cur; @@ -753,6 +754,11 @@ dscmp_type clock_dscmp(struct clock *c) return c->dscmp; } +UInteger8 clock_local_priority(struct clock *c) +{ + return c->localPriority; +} + UInteger8 clock_class(struct clock *c) { return c->dds.clockQuality.clockClass; @@ -1153,6 +1159,7 @@ struct dataset *clock_dataset(struct clock *c) out->identity = in->clockIdentity; out->quality = in->clockQuality; out->priority2 = in->priority2; + out->localPriority = c->localPriority; out->stepsRemoved = 0; out->sender.clockIdentity = in->clockIdentity; out->sender.portNumber = 0; diff --git a/clock.h b/clock.h index d43ce95..c976155 100644 --- a/clock.h +++ b/clock.h @@ -67,6 +67,13 @@ struct port *clock_best_port(struct clock *c); dscmp_type clock_dscmp(struct clock *c); /** + * Obtain the localPriority attribute from a clock. + * @param c The clock instance. + * @return The value of the clock's localPriority. + */ +UInteger8 clock_local_priority(struct clock *c); + +/** * Obtain the clockClass attribute from a clock. * @param c The clock instance. * @return The value of the clock's class. diff --git a/ds.h b/ds.h index 0e48d05..7d1f4f5 100644 --- a/ds.h +++ b/ds.h @@ -55,6 +55,7 @@ struct dataset { struct ClockIdentity identity; struct ClockQuality quality; UInteger8 priority2; + UInteger8 localPriority; UInteger16 stepsRemoved; struct PortIdentity sender; struct PortIdentity receiver; diff --git a/port.c b/port.c index 593991f..458f77b 100644 --- a/port.c +++ b/port.c @@ -73,13 +73,14 @@ static void announce_to_dataset(struct ptp_message *m, struct port *p, struct dataset *out) { struct announce_msg *a = &m->announce; - out->priority1 = a->grandmasterPriority1; - out->identity = a->grandmasterIdentity; - out->quality = a->grandmasterClockQuality; - out->priority2 = a->grandmasterPriority2; - out->stepsRemoved = a->stepsRemoved; - out->sender = m->header.sourcePortIdentity; - out->receiver = p->portIdentity; + out->priority1 = a->grandmasterPriority1; + out->identity = a->grandmasterIdentity; + out->quality = a->grandmasterClockQuality; + out->priority2 = a->grandmasterPriority2; + out->localPriority = p->localPriority; + out->stepsRemoved = a->stepsRemoved; + out->sender = m->header.sourcePortIdentity; + out->receiver = p->portIdentity; } int clear_fault_asap(struct fault_interval *faint) @@ -2568,6 +2569,11 @@ int port_prepare_and_send(struct port *p, struct ptp_message *msg, return 0; } +UInteger8 port_local_priority(struct port *p) +{ + return p->localPriority; +} + struct PortIdentity port_identity(struct port *p) { return p->portIdentity; diff --git a/port.h b/port.h index d828875..310aa74 100644 --- a/port.h +++ b/port.h @@ -111,8 +111,15 @@ int port_prepare_and_send(struct port *p, struct ptp_message *msg, enum transport_event event); /** + * Obtain the localPriority attribute from a clock. + * @param p A port instance. + * @return The localPriority of 'p'. + */ +UInteger8 port_local_priority(struct port *p); + +/** * Obtain a port's identity. - * @param p A pointer previously obtained via port_open(). + * @param p A port instance. * @return The port identity of 'p'. */ struct PortIdentity port_identity(struct port *p); diff --git a/port_private.h b/port_private.h index f8771c7..50806c2 100644 --- a/port_private.h +++ b/port_private.h @@ -88,6 +88,7 @@ struct port { unsigned int multiple_pdr_detected; enum port_state (*state_machine)(enum port_state state, enum fsm_event event, int mdiff); + UInteger8 localPriority; /* portDS */ struct PortIdentity portIdentity; enum port_state state; /*portState*/ -- 1.8.3.1 ------------------------------------------------------------------------------ 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