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 <richardcoch...@gmail.com>
---
 port.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/port.c b/port.c
index b2647d3..4e0da1a 100644
--- a/port.c
+++ b/port.c
@@ -1313,7 +1313,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, pdulen;
@@ -1349,6 +1349,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));
@@ -1382,6 +1386,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;
+       }
        err = port_prepare_and_send(p, fup, 0);
        if (err)
                pr_err("port %hu: send follow up failed", portnum(p));
@@ -2321,7 +2329,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));
-- 
2.11.0


------------------------------------------------------------------------------
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

Reply via email to