net: gptp_md: Consider different resolutions regarding correction field

From https://www.ieee802.org/1/files/public/docs2007/as-garner-protocol-state-machines-frame-formats-0307.pdf:
  The correctionField is the value of the correction
  measured in nanoseconds and multiplied by 2^16.

Zephyr uses nanoseconds for follow_up_correction_field.
Therefore, the value must be shifted by 2^16.

Signed-off-by: Martin Fletzer <martin.fletzer@kftec.at>
This commit is contained in:
Martin Fletzer 2022-11-17 19:33:54 +01:00 committed by Carles Cufí
commit 144d30eb47

View file

@ -116,7 +116,7 @@ static int gptp_set_md_sync_receive(int port,
sync_ts = &state->rcvd_sync_ptr->timestamp; sync_ts = &state->rcvd_sync_ptr->timestamp;
sync_rcv->follow_up_correction_field = sync_rcv->follow_up_correction_field =
ntohll(fup_hdr->correction_field); (ntohll(fup_hdr->correction_field) >> 16);
memcpy(&sync_rcv->src_port_id, &sync_hdr->port_id, memcpy(&sync_rcv->src_port_id, &sync_hdr->port_id,
sizeof(struct gptp_port_identity)); sizeof(struct gptp_port_identity));
sync_rcv->log_msg_interval = fup_hdr->log_msg_interval; sync_rcv->log_msg_interval = fup_hdr->log_msg_interval;