Shawn Bohrer
2016-03-31 16:00:57 UTC
From: Shawn Bohrer <***@rgmadvisors.com>
When we send a delay request message check to see if we received a delay
response to the previous delay request. This adds reporting of missing
responses and also reports if the sequence number of a response doesn't
match the request.
Signed-off-by: Shawn Bohrer <***@rgmadvisors.com>
---
port.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/port.c b/port.c
index 3fc262a..b4175f4 100644
--- a/port.c
+++ b/port.c
@@ -1066,8 +1066,11 @@ static int port_delay_request(struct port *p)
goto out;
}
- if (p->delay_req)
+ if (p->delay_req) {
+ pr_warning("port %hu: missed delay_resp for sequenceId: %" PRIu16,
+ portnum(p), ntohs(p->delay_req->header.sequenceId));
msg_put(p->delay_req);
+ }
p->delay_req = msg;
return 0;
@@ -1496,8 +1499,13 @@ static void process_delay_resp(struct port *p, struct ptp_message *m)
return;
if (!pid_eq(&rsp->requestingPortIdentity, &req->hdr.sourcePortIdentity))
return;
- if (rsp->hdr.sequenceId != ntohs(req->hdr.sequenceId))
+ if (rsp->hdr.sequenceId != ntohs(req->hdr.sequenceId)) {
+ pr_warning("port %hu: received delay_request sequenceId: %" PRIu16
+ " does not match delay_resp sequenceId: %" PRIu16,
+ portnum(p),
+ ntohs(req->hdr.sequenceId), rsp->hdr.sequenceId);
return;
+ }
clock_path_delay(p->clock, p->delay_req->hwts.ts, m->ts.pdu,
m->header.correction);
@@ -1509,6 +1517,8 @@ static void process_delay_resp(struct port *p, struct ptp_message *m)
portnum(p), p->logMinDelayReqInterval);
tmtab_init(&p->tmtab, 1 + p->logMinDelayReqInterval);
}
+
+ flush_delay_req(p);
}
static void process_follow_up(struct port *p, struct ptp_message *m)
When we send a delay request message check to see if we received a delay
response to the previous delay request. This adds reporting of missing
responses and also reports if the sequence number of a response doesn't
match the request.
Signed-off-by: Shawn Bohrer <***@rgmadvisors.com>
---
port.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/port.c b/port.c
index 3fc262a..b4175f4 100644
--- a/port.c
+++ b/port.c
@@ -1066,8 +1066,11 @@ static int port_delay_request(struct port *p)
goto out;
}
- if (p->delay_req)
+ if (p->delay_req) {
+ pr_warning("port %hu: missed delay_resp for sequenceId: %" PRIu16,
+ portnum(p), ntohs(p->delay_req->header.sequenceId));
msg_put(p->delay_req);
+ }
p->delay_req = msg;
return 0;
@@ -1496,8 +1499,13 @@ static void process_delay_resp(struct port *p, struct ptp_message *m)
return;
if (!pid_eq(&rsp->requestingPortIdentity, &req->hdr.sourcePortIdentity))
return;
- if (rsp->hdr.sequenceId != ntohs(req->hdr.sequenceId))
+ if (rsp->hdr.sequenceId != ntohs(req->hdr.sequenceId)) {
+ pr_warning("port %hu: received delay_request sequenceId: %" PRIu16
+ " does not match delay_resp sequenceId: %" PRIu16,
+ portnum(p),
+ ntohs(req->hdr.sequenceId), rsp->hdr.sequenceId);
return;
+ }
clock_path_delay(p->clock, p->delay_req->hwts.ts, m->ts.pdu,
m->header.correction);
@@ -1509,6 +1517,8 @@ static void process_delay_resp(struct port *p, struct ptp_message *m)
portnum(p), p->logMinDelayReqInterval);
tmtab_init(&p->tmtab, 1 + p->logMinDelayReqInterval);
}
+
+ flush_delay_req(p);
}
static void process_follow_up(struct port *p, struct ptp_message *m)
--
2.2.1
2.2.1