From b0d9c9600a02ddf6805cfe9c804d2c8a09ef0d1e Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Thu, 23 Nov 2017 23:13:27 -0800 Subject: [PATCH] port: Introduce unicast sync messages. The port will need to send unicast Sync messages in order to support the NSM protocol. Besides that, we will need this ability anyhow if we ever want to implement unicast operation. Signed-off-by: Richard Cochran --- port.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/port.c b/port.c index 6c26357..17ea1d5 100644 --- a/port.c +++ b/port.c @@ -1333,7 +1333,7 @@ static int port_tx_announce(struct port *p) return err; } -static int port_tx_sync(struct port *p) +static int port_tx_sync(struct port *p, struct address *dst) { struct ptp_message *msg, *fup; int err, event; @@ -1369,6 +1369,10 @@ static int port_tx_sync(struct port *p) if (p->timestamping != TS_ONESTEP) msg->header.flagField[0] |= TWO_STEP; + if (dst) { + msg->address = *dst; + msg->header.flagField[0] |= UNICAST; + } err = port_prepare_and_send(p, msg, event); if (err) { pr_err("port %hu: send sync failed", portnum(p)); @@ -1398,6 +1402,10 @@ static int port_tx_sync(struct port *p) ts_to_timestamp(&msg->hwts.ts, &fup->follow_up.preciseOriginTimestamp); + if (dst) { + fup->address = *dst; + fup->header.flagField[0] |= UNICAST; + } if (p->follow_up_info && follow_up_info_append(p, fup)) { pr_err("port %hu: append fup info failed", portnum(p)); err = -1; @@ -2345,7 +2353,7 @@ enum fsm_event port_event(struct port *p, int fd_index) case FD_SYNC_TX_TIMER: pr_debug("port %hu: master sync timeout", portnum(p)); port_set_sync_tx_tmo(p); - return port_tx_sync(p) ? EV_FAULT_DETECTED : EV_NONE; + return port_tx_sync(p, NULL) ? EV_FAULT_DETECTED : EV_NONE; case FD_RTNL: pr_debug("port %hu: received link status notification", portnum(p));