Thread (3 messages) flat view 3 messages, 2 authors, 2021-11-19

Re: [PATCH net-next v1] net: stmmac: Caclucate clock domain crossing error only once

From: Kurt Kanzenbach <kurt@linutronix.de>
Date: 2021-11-19 12:01:49
Also in: netdev

On Fri Nov 19 2021, Thomas Gleixner wrote:
Kurt,

On Fri, Nov 19 2021 at 09:10, Kurt Kanzenbach wrote:
quoted
The clock domain crossing error (CDC) is calculated at every fetch of Tx or Rx
timestamps. It includes a division. Especially on arm32 based systems it is
expensive. It also saves the two conditionals.
This does not make sense. What you want to say here is:

  It also requires two conditionals in the hotpath.
Yeah, I realized after sending that the last sentence is bogus.
quoted
Therefore, move the calculation to the PTP initialization code and just use the
cached value in the timestamp retrieval functions.
Maybe:

  Add a compensation value cache to struct plat_stmmacenet_data and
  subtract it unconditionally in the RX/TX functions which spares the
  conditionals.

  The value is initialized to 0 and if supported calculated in the PTP
  initialization code.
Sounds better, thanks.
or something to that effect.
quoted
+	/* Calculate the clock domain crossing (CDC) error if necessary */
+	priv->plat->cdc_error_adj = 0;
+	if (priv->plat->has_gmac4 && priv->plat->clk_ptp_rate)
+		priv->plat->cdc_error_adj = (2 * NSEC_PER_SEC) /
+			priv->plat->clk_ptp_rate;
Nit. Just let stick it out. We lifted the 80 char limitation some time ago.
Good to know. Will do.

I'll wait for further comments or test results and will resend next week.

Thanks,
Kurt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help