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 <richardcochran@gmail.com>
master
Richard Cochran 2018-03-06 11:00:54 -08:00
parent a412982300
commit 510777deca
2 changed files with 6 additions and 7 deletions

3
msg.c
View File

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

10
port.c
View File

@ -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));