Commit c371afa5 authored by Davide Ciminaghi's avatar Davide Ciminaghi Committed by Alessandro Rubini

compliance: 11.2 c: take followup cf into account

11.2 c says:

If the twoStepFlag bit of the flagField of the of the Sync message is TRUE,
indicating that a Follow_Up message will be received, then

        <offsetFromMaster> = <syncEventIngressTimestamp> -
       <preciseOriginTimestamp> - <meanPathDelay> -
       correctionField of Sync message -
       correctionField of Follow_Up message.

Before this patch, only the correctionField of the Sync message was
subtracted. We fix things by adding the Follow_Up correctionField to the
Sync correctionField.

Now m_to_s_dly as calculated in pp_servo_got_sync is:

t2 - t1 - sync_cf - follow_up_cf
parent 45f67965
......@@ -252,6 +252,7 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
{
MsgFollowUp follow;
int ret = 0;
TimeInternal cField;
MsgHeader *hdr = &ppi->received_ptp_header;
......@@ -280,6 +281,10 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
ppi->flags &= ~PPI_FLAG_WAITING_FOR_F_UP;
to_TimeInternal(&ppi->t1, &follow.preciseOriginTimestamp);
/* Add correctionField in follow-up to sync correctionField, see 11.2 */
cField_to_TimeInternal(&cField, hdr->correctionfield);
add_TimeInternal(&ppi->cField, &ppi->cField, &cField);
/* Call the extension; it may do it all and ask to return */
if (pp_hooks.handle_followup)
ret = pp_hooks.handle_followup(ppi, &ppi->t1, &ppi->cField);
......
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