Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 clock.c | 13 +++++++++++++
 clock.h |  8 ++++++++
 2 files changed, 21 insertions(+)

diff --git a/clock.c b/clock.c
index a559cd4..f43cc2a 100644
--- a/clock.c
+++ b/clock.c
@@ -131,6 +131,7 @@ struct clock {
        struct clockcheck *sanity_check;
        struct interface *udsif;
        LIST_HEAD(clock_subscribers_head, clock_subscriber) subscribers;
+       struct monitor *slave_event_monitor;
 };
 
 struct clock the_clock;
@@ -271,6 +272,7 @@ void clock_destroy(struct clock *c)
        LIST_FOREACH_SAFE(p, &c->ports, list, tmp) {
                clock_remove_port(c, p);
        }
+       monitor_destroy(c->slave_event_monitor);
        port_close(c->uds_port);
        free(c->pollfd);
        if (c->clkid != CLOCK_REALTIME) {
@@ -1185,6 +1187,12 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
        }
        clock_fda_changed(c);
 
+       c->slave_event_monitor = monitor_create(config, c->uds_port);
+       if (!c->slave_event_monitor) {
+               pr_err("failed to create slave event monitor");
+               return NULL;
+       }
+
        /* Create the ports. */
        STAILQ_FOREACH(iface, &config->interfaces, list) {
                if (clock_add_port(c, phc_device, phc_index, timestamping, 
iface)) {
@@ -1626,6 +1634,11 @@ void clock_peer_delay(struct clock *c, tmv_t ppd, tmv_t 
req, tmv_t rx,
                stats_add_value(c->stats.delay, tmv_dbl(ppd));
 }
 
+struct monitor *clock_slave_monitor(struct clock *c)
+{
+       return c->slave_event_monitor;
+}
+
 int clock_slave_only(struct clock *c)
 {
        return c->dds.flags & DDS_SLAVE_ONLY;
diff --git a/clock.h b/clock.h
index 1256856..e7daf97 100644
--- a/clock.h
+++ b/clock.h
@@ -23,6 +23,7 @@
 #include "dm.h"
 #include "ds.h"
 #include "config.h"
+#include "monitor.h"
 #include "notification.h"
 #include "servo.h"
 #include "tlv.h"
@@ -267,6 +268,13 @@ struct servo *clock_servo(struct clock *c);
  */
 enum servo_state clock_servo_state(struct clock *c);
 
+/**
+ * Obtain the slave monitor instance from a clock.
+ * @param c The clock instance.
+ * @return  The slave monitor associated with the clock.
+ */
+struct monitor *clock_slave_monitor(struct clock *c);
+
 /**
  * Obtain the slave-only flag from a clock's default data set.
  * @param c  The clock instance.
-- 
2.20.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to