From 563c52b833b3c5d810b80422d13205fcae1f13dd Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 6 Jan 2019 14:15:56 -0800 Subject: [PATCH] Allow ignoring source port identity in end to end mode. The "inhibit_announce" and "ignore_source_id" options were introduced in order to support the automotive profile. That profile happens to specify using the peer to peer delay mechanism, but there is no reason to restrict them to that mechanism. As it now stands, enabling these two options prevents E2E slaves from synchronizing. This patch fixes the issue by checking the "ignore_source_id" option when accepting E2E delay response messages. Signed-off-by: Richard Cochran --- port.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/port.c b/port.c index 142b970..a52510a 100644 --- a/port.c +++ b/port.c @@ -99,6 +99,17 @@ int clear_fault_asap(struct fault_interval *faint) return 0; } +static int check_source_identity(struct port *p, struct ptp_message *m) +{ + struct PortIdentity master; + + if (p->ignore_source_id) { + return 0; + } + master = clock_parent_identity(p->clock); + return pid_eq(&master, &m->header.sourcePortIdentity) ? 0 : -1; +} + static void extract_address(struct ptp_message *m, struct PortAddress *paddr) { int len = 0; @@ -1825,19 +1836,16 @@ out: void process_delay_resp(struct port *p, struct ptp_message *m) { struct delay_resp_msg *rsp = &m->delay_resp; - struct PortIdentity master; struct ptp_message *req; tmv_t c3, t3, t4, t4c; - master = clock_parent_identity(p->clock); - if (p->state != PS_UNCALIBRATED && p->state != PS_SLAVE) { return; } if (!pid_eq(&rsp->requestingPortIdentity, &p->portIdentity)) { return; } - if (!pid_eq(&master, &m->header.sourcePortIdentity)) { + if (check_source_identity(p, m)) { return; } TAILQ_FOREACH(req, &p->delay_req, list) { @@ -1878,17 +1886,6 @@ void process_delay_resp(struct port *p, struct ptp_message *m) port_set_delay_tmo(p); } -static int check_source_identity(struct port *p, struct ptp_message *m) -{ - struct PortIdentity master; - - if (p->ignore_source_id) { - return 0; - } - master = clock_parent_identity(p->clock); - return pid_eq(&master, &m->header.sourcePortIdentity) ? 0 : -1; -} - void process_follow_up(struct port *p, struct ptp_message *m) { enum syfu_event event;