On 6/5/2023 6:56 PM, Dylan Robinson wrote:
> The 1588 defined computation using variable names from this project is:
> D = [(t4 - t1) - (t3 - t2) - c1 - c2]/2
>
> The existing code combines the corrections into a variable t3c which we
> can get the value of by isolating t3, c1 and c2:
> t3c = t3 + c1 + c2
>
> The 802.1AS defined computation is:
> D = [(t4 - t1) - (t3 - t2) + c1 - c2]/2
>
> Again, isolating t3, c1 and c2 for 802.1AS:
> t3c = t3 + c2 - c1
>
> If the ptp profile configured matches 802.1AS, then this patch will
> compute t3c based on the 802.1AS equation instead of the 1588 version.
>
> This has been tested against the MOTU Switch based on the KSZ9567 with
> non-zero correction fields based on the 802.1AS equation as well as MOTU
> audio interfaces that don't utilize the correction fields.
>
> Signed-off-by: Dylan Robinson <dylan_robin...@motu.com>
> ---
> port.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/port.c b/port.c
> index d551bef..72a92e5 100644
> --- a/port.c
> +++ b/port.c
> @@ -2433,7 +2433,16 @@ static void port_peer_delay(struct port *p)
> t3 = timestamp_to_tmv(fup->ts.pdu);
> c2 = correction_to_tmv(fup->header.correction);
> calc:
> - t3c = tmv_add(t3, tmv_add(c1, c2));
> + /* 802.1AS specifies the peer delay computation differently than 1588.
> Do
> + * the 802.1AS computation when transportSpecific is 1 (in top nibble)
> and
> + * the clock domain is 0. If ptp_header.reserved1 (aka minorSdoId)
> becomes
> + * configurable, this should also check that it is 0. */
> + if ((p->transportSpecific == (1 << 4)) &&
Can we do the #define for that instead of (1<<4)?
> + (clock_domain_number(p->clock) == 0)) {
Why we require clock domain to be 0? AFIK the 802.1AS-2020 added support
for multiple domains.
Also the comment talks that the code should check the
ptp_header.reserved1, but the code doesn't follow that.
Thanks,
Maciek
> + t3c = tmv_add(t3, tmv_sub(c2, c1));
> + } else {
> + t3c = tmv_add(t3, tmv_add(c1, c2));
> + }
>
> if (p->follow_up_info)
> port_nrate_calculate(p, t3c, t4);
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel