From ad8a197a0b59ade037f3247e03909dc1cc772306 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 27 Jan 2013 09:51:45 +0100 Subject: [PATCH] Add port logic for the 'capable' flag from 802.1AS. This commit only provides helper functions that will implement the effect of a port being not capable. We let the port be always 'capable' for now, until we actually have added the details of that flag. Signed-off-by: Richard Cochran --- port.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/port.c b/port.c index c249c34..51ef9ec 100644 --- a/port.c +++ b/port.c @@ -312,6 +312,12 @@ static void free_foreign_masters(struct port *p) } } +static int incapable_ignore(struct port *p, struct ptp_message *m) +{ + /* For now, we are always capable. */ + return 0; +} + static int path_trace_append(struct port *p, struct ptp_message *m, struct parent_ds *dad) { @@ -358,6 +364,12 @@ static int path_trace_ignore(struct port *p, struct ptp_message *m) return 0; } +static int port_capable(struct port *p) +{ + /* For now, we are always capable. */ + return 1; +} + static int port_clr_tmo(int fd) { struct itimerspec tmo = { @@ -370,6 +382,9 @@ static int port_ignore(struct port *p, struct ptp_message *m) { struct ClockIdentity c1, c2; + if (incapable_ignore(p, m)) { + return 1; + } if (path_trace_ignore(p, m)) { return 1; } @@ -678,6 +693,9 @@ static int port_tx_announce(struct port *p) struct ptp_message *msg; int cnt, err = 0, pdulen; + if (!port_capable(p)) { + return 0; + } msg = msg_allocate(); if (!msg) return -1; @@ -727,6 +745,9 @@ static int port_tx_sync(struct port *p) int cnt, err = 0, pdulen; int event = p->timestamping == TS_ONESTEP ? TRANS_ONESTEP : TRANS_EVENT; + if (!port_capable(p)) { + return 0; + } msg = msg_allocate(); if (!msg) return -1;