diff --git a/clock.c b/clock.c index 1563ba9..83b700e 100644 --- a/clock.c +++ b/clock.c @@ -76,6 +76,7 @@ struct clock { int nports; /* does not include the UDS port */ int free_running; int freq_est_interval; + int grand_master_capable; /* for 802.1AS only */ int utc_timescale; int leap_set; int kernel_leap; @@ -587,6 +588,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count, c->free_running = dds->free_running; c->freq_est_interval = dds->freq_est_interval; + c->grand_master_capable = dds->grand_master_capable; c->kernel_leap = dds->kernel_leap; c->utc_offset = CURRENT_UTC_OFFSET; c->time_source = dds->time_source; @@ -745,6 +747,11 @@ void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f) sizeof(c->status.lastGmPhaseChange)); } +int clock_gm_capable(struct clock *c) +{ + return c->grand_master_capable; +} + struct ClockIdentity clock_identity(struct clock *c) { return c->dds.clockIdentity; diff --git a/clock.h b/clock.h index bc66dce..52d50b2 100644 --- a/clock.h +++ b/clock.h @@ -100,6 +100,14 @@ UInteger8 clock_domain_number(struct clock *c); */ void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f); +/** + * Obtain the gmCapable flag from a clock's default data set. + * This function is specific to the 802.1AS standard. + * @param c The clock instance. + * @return One if the clock is capable of becoming grand master, zero otherwise. + */ +int clock_gm_capable(struct clock *c); + /** * Obtain a clock's identity from its default data set. * @param c The clock instance. diff --git a/ds.h b/ds.h index 6e2ac61..0cc94b5 100644 --- a/ds.h +++ b/ds.h @@ -53,6 +53,7 @@ struct default_ds { struct defaultDS dds; int free_running; int freq_est_interval; /*log seconds*/ + int grand_master_capable; /*802.1AS only*/ int stats_interval; /*log seconds*/ int kernel_leap; int sanity_freq_limit; diff --git a/ptp4l.c b/ptp4l.c index 5d8749a..e86dd91 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -53,6 +53,7 @@ static struct config cfg_settings = { }, .free_running = 0, .freq_est_interval = 1, + .grand_master_capable = 1, .stats_interval = 0, .kernel_leap = 1, .sanity_freq_limit = 200000000,