Commit 136a5ddc authored by baujc's avatar baujc

Make timestamp adjusment dependent of the extension

In WR extension, the egress and ingress latencies are already included
in the exchanged deltas (TX/RX). This modification allows for an
extension to remove the egress/ingress latencies from the calculation of
the RX and TX timestamps. This feature is used in the WR extension.
parent 12500686
......@@ -130,6 +130,7 @@ int __send_and_log(struct pp_instance *ppi, int msglen, int chtype,enum pp_msg_f
{
struct pp_msgtype_info *mf = pp_msgtype_info + msg_fmt;
struct pp_time *t = &ppi->last_snt_time;
TimeInterval adjust;
int ret;
ret = ppi->n_ops->send(ppi, ppi->tx_frame, msglen + ppi->tx_offset,msg_fmt);
......@@ -142,7 +143,12 @@ int __send_and_log(struct pp_instance *ppi, int msglen, int chtype,enum pp_msg_f
}
/* The send method updates ppi->last_snt_time with the Tx timestamp. */
/* This timestamp must be corrected with the egressLatency */
pp_time_add_interval(t,ppi->timestampCorrectionPortDS.egressLatency);
if (is_ext_hook_available(ppi,get_egress_latency) ){
adjust= ppi->ext_hooks->get_egress_latency(ppi);
} else {
adjust=ppi->timestampCorrectionPortDS.egressLatency;
}
pp_time_add_interval(t,adjust);
/* FIXME: diagnostics should be looped back in the send method */
pp_diag(ppi, frames, 1, "SENT %02d bytes at %d.%09d.%03d (%s)\n",
......
......@@ -30,8 +30,13 @@ static inline int __recv_and_count(struct pp_instance *ppi, void *buf, int len,
ret = ppi->n_ops->recv(ppi, buf, len, t);
if (ret > 0) {
/* Adjust reception timestamp: ts'= ts - ingressLatency - semistaticLatency*/
TimeInterval adjust=ppi->timestampCorrectionPortDS.ingressLatency;
adjust+=ppi->timestampCorrectionPortDS.semistaticLatency;
TimeInterval adjust;
if (is_ext_hook_available(ppi,get_ingress_latency) ){
adjust= ppi->ext_hooks->get_ingress_latency(ppi);
} else {
adjust=ppi->timestampCorrectionPortDS.ingressLatency;
adjust+=ppi->timestampCorrectionPortDS.semistaticLatency;
}
pp_time_sub_interval(t,adjust);
ppi->ptp_rx_count++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment