All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Kurt Kanzenbach <kurt@linutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Voon Weifeng <weifeng.voon@intel.com>,
	Ong Boon Leong <boon.leong.ong@intel.com>,
	Wong Vee Khee <vee.khee.wong@linux.intel.com>,
	Tan Tee Min <tee.min.tan@intel.com>,
	"Wong, Vee Khee" <vee.khee.wong@intel.com>,
	Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	Benedikt Spranger <b.spranger@linutronix.de>,
	Kurt Kanzenbach <kurt@linutronix.de>
Subject: Re: [PATCH net-next v1] net: stmmac: Caclucate clock domain crossing error only once
Date: Fri, 19 Nov 2021 12:50:21 +0100	[thread overview]
Message-ID: <87mtm0l5z6.ffs@tglx> (raw)
In-Reply-To: <20211119081010.27084-1-kurt@linutronix.de>

Kurt,

On Fri, Nov 19 2021 at 09:10, Kurt Kanzenbach wrote:

> 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.

> 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.

or something to that effect.

> +	/* 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.

Thanks,

        tglx

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Gleixner <tglx@linutronix.de>
To: Kurt Kanzenbach <kurt@linutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Voon Weifeng <weifeng.voon@intel.com>,
	Ong Boon Leong <boon.leong.ong@intel.com>,
	Wong Vee Khee <vee.khee.wong@linux.intel.com>,
	Tan Tee Min <tee.min.tan@intel.com>,
	"Wong, Vee Khee" <vee.khee.wong@intel.com>,
	Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	Benedikt Spranger <b.spranger@linutronix.de>,
	Kurt Kanzenbach <kurt@linutronix.de>
Subject: Re: [PATCH net-next v1] net: stmmac: Caclucate clock domain crossing error only once
Date: Fri, 19 Nov 2021 12:50:21 +0100	[thread overview]
Message-ID: <87mtm0l5z6.ffs@tglx> (raw)
In-Reply-To: <20211119081010.27084-1-kurt@linutronix.de>

Kurt,

On Fri, Nov 19 2021 at 09:10, Kurt Kanzenbach wrote:

> 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.

> 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.

or something to that effect.

> +	/* 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.

Thanks,

        tglx

  reply	other threads:[~2021-11-19 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19  8:10 [PATCH net-next v1] net: stmmac: Caclucate clock domain crossing error only once Kurt Kanzenbach
2021-11-19  8:10 ` Kurt Kanzenbach
2021-11-19 11:50 ` Thomas Gleixner [this message]
2021-11-19 11:50   ` Thomas Gleixner
2021-11-19 12:00   ` Kurt Kanzenbach
2021-11-19 12:00     ` Kurt Kanzenbach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtm0l5z6.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=alexandre.torgue@foss.st.com \
    --cc=b.spranger@linutronix.de \
    --cc=boon.leong.ong@intel.com \
    --cc=davem@davemloft.net \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=tee.min.tan@intel.com \
    --cc=vee.khee.wong@intel.com \
    --cc=vee.khee.wong@linux.intel.com \
    --cc=weifeng.voon@intel.com \
    --cc=xiaoliang.yang_1@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.