From 510777deca1d0268f8825a3a0fa8d5cbfc51af22 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Tue, 6 Mar 2018 11:00:54 -0800 Subject: [PATCH] msg: Move the check for missing HW time stamps into caller. On the transmit path, the port-level code calls msg_sots_missing() directly, but on receive this check is buried in the message layer. With the coming addition of peer to peer one step, the ingress check will need knowledge of the configured time stamping option. This patch moves the check in order to accommodate the exceptional case. Signed-off-by: Richard Cochran --- msg.c | 3 --- port.c | 10 ++++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/msg.c b/msg.c index 4589374..b7e1053 100644 --- a/msg.c +++ b/msg.c @@ -391,9 +391,6 @@ int msg_post_recv(struct ptp_message *m, int cnt) break; } - if (msg_sots_missing(m)) - return -ETIME; - err = suffix_post_recv(m, suffix, cnt - pdulen); if (err) return err; diff --git a/port.c b/port.c index 3493f63..cf41725 100644 --- a/port.c +++ b/port.c @@ -2523,10 +2523,6 @@ enum fsm_event port_event(struct port *p, int fd_index) case -EBADMSG: pr_err("port %hu: bad message", portnum(p)); break; - case -ETIME: - pr_err("port %hu: received %s without timestamp", - portnum(p), msg_type_string(msg_type(msg))); - break; case -EPROTO: pr_debug("port %hu: ignoring message", portnum(p)); break; @@ -2534,6 +2530,12 @@ enum fsm_event port_event(struct port *p, int fd_index) msg_put(msg); return EV_NONE; } + if (msg_sots_missing(msg)) { + pr_err("port %hu: received %s without timestamp", + portnum(p), msg_type_string(msg_type(msg))); + msg_put(msg); + return EV_NONE; + } if (msg_sots_valid(msg)) { ts_add(&msg->hwts.ts, -p->rx_timestamp_offset); clock_check_ts(p->clock, tmv_to_nanoseconds(msg->hwts.ts));