Re: [Linuxptp-devel] [PATCH] Use the 802.1AS peer delay computation when transportSpecific is 1

2023-06-22 Thread Richard Cochran
On Tue, Jun 06, 2023 at 02:25:44PM -0400, Dylan Robinson wrote:
> If the transportSpecific value is configured to be 1, compute t3c using
> the 802.1AS math instead of the 1588 math.
> 
> 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
> 
> 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 

Applied.

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH] Use the 802.1AS peer delay computation when transportSpecific is 1

2023-06-07 Thread Dylan Robinson
On Wed, 7 Jun 2023 17:26:08 +0200, Erez wrote:

> Hi,
>
> We tie patches by using the version, so version 2 is named: "[PATCH v2]"
> We use "git format-patch -v2"
> And add "--cover-letter" in case of several commits.
>
> Next time :-)
>
> Erez

Hi Erez,

Understood. Thank you for letting me know. I will be sure to use this
approach moving forward.

Best,

Dylan
___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH] Use the 802.1AS peer delay computation when transportSpecific is 1

2023-06-07 Thread Erez
Hi,

We tie patches by using the version, so version 2 is named: "[PATCH v2]"
We use "git format-patch -v2"
And add "--cover-letter" in case of several commits.

Next time :-)

Erez



On Tue, 6 Jun 2023 at 21:28, Dylan Robinson  wrote:

> If the transportSpecific value is configured to be 1, compute t3c using
> the 802.1AS math instead of the 1588 math.
>
> 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
>
> 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 
> ---
>  msg.h  | 3 +++
>  port.c | 8 +++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/msg.h b/msg.h
> index cbd09e7..484435d 100644
> --- a/msg.h
> +++ b/msg.h
> @@ -37,6 +37,9 @@
>
>  #define MAJOR_VERSION_MASK 0x0f
>
> +/* Values for the transportSpecific field */
> +#define TS_IEEE_8021AS (1<<4)
> +
>  /* Values for the messageType field */
>  #define SYNC  0x0
>  #define DELAY_REQ 0x1
> diff --git a/port.c b/port.c
> index d551bef..a97b6f3 100644
> --- a/port.c
> +++ b/port.c
> @@ -2433,7 +2433,13 @@ 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 if transportSpecific matches 802.1AS
> profile. */
> +   if (p->transportSpecific == TS_IEEE_8021AS) {
> +   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);
> --
> 2.30.2
>
>
>
> ___
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
>
___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


[Linuxptp-devel] [PATCH] Use the 802.1AS peer delay computation when transportSpecific is 1

2023-06-06 Thread Dylan Robinson
If the transportSpecific value is configured to be 1, compute t3c using
the 802.1AS math instead of the 1588 math.

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

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 
---
 msg.h  | 3 +++
 port.c | 8 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/msg.h b/msg.h
index cbd09e7..484435d 100644
--- a/msg.h
+++ b/msg.h
@@ -37,6 +37,9 @@
 
 #define MAJOR_VERSION_MASK 0x0f
 
+/* Values for the transportSpecific field */
+#define TS_IEEE_8021AS (1<<4)
+
 /* Values for the messageType field */
 #define SYNC  0x0
 #define DELAY_REQ 0x1
diff --git a/port.c b/port.c
index d551bef..a97b6f3 100644
--- a/port.c
+++ b/port.c
@@ -2433,7 +2433,13 @@ 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 if transportSpecific matches 802.1AS 
profile. */
+   if (p->transportSpecific == TS_IEEE_8021AS) {
+   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);
-- 
2.30.2



___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel