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; break;
} }
if (msg_sots_missing(m))
return -ETIME;
err = suffix_post_recv(m, suffix, cnt - pdulen); err = suffix_post_recv(m, suffix, cnt - pdulen);
if (err) if (err)
return 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: case -EBADMSG:
pr_err("port %hu: bad message", portnum(p)); pr_err("port %hu: bad message", portnum(p));
break; break;
case -ETIME:
pr_err("port %hu: received %s without timestamp",
portnum(p), msg_type_string(msg_type(msg)));
break;
case -EPROTO: case -EPROTO:
pr_debug("port %hu: ignoring message", portnum(p)); pr_debug("port %hu: ignoring message", portnum(p));
break; break;
@ -2534,6 +2530,12 @@ enum fsm_event port_event(struct port *p, int fd_index)
msg_put(msg); msg_put(msg);
return EV_NONE; 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)) { if (msg_sots_valid(msg)) {
ts_add(&msg->hwts.ts, -p->rx_timestamp_offset); ts_add(&msg->hwts.ts, -p->rx_timestamp_offset);
clock_check_ts(p->clock, tmv_to_nanoseconds(msg->hwts.ts)); clock_check_ts(p->clock, tmv_to_nanoseconds(msg->hwts.ts));