From: Richard Cochran <richardcochran@gmail.com>
To: Yangbo Lu <yangbo.lu@nxp.com>
Cc: netdev@vger.kernel.org, madalin.bucur@nxp.com,
Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/10] dpaa_eth: add support for hardware timestamping
Date: Mon, 4 Jun 2018 06:49:20 -0700 [thread overview]
Message-ID: <20180604134920.ezhe6jz5ntpnqyzj@localhost> (raw)
In-Reply-To: <20180604070837.19265-10-yangbo.lu@nxp.com>
On Mon, Jun 04, 2018 at 03:08:36PM +0800, Yangbo Lu wrote:
> +if FSL_DPAA_ETH
> +config FSL_DPAA_ETH_TS
> + bool "DPAA hardware timestamping support"
> + select PTP_1588_CLOCK_QORIQ
> + default n
> + help
> + Enable DPAA hardware timestamping support.
> + This option is useful for applications to get
> + hardware time stamps on the Ethernet packets
> + using the SO_TIMESTAMPING API.
> +endif
You should drop this #ifdef. In general, if a MAC supports time
stamping and PHC, then the driver support should simply be compiled
in.
[ When time stamping incurs a large run time performance penalty to
non-PTP users, then it might make sense to have a Kconfig option to
disable it, but that doesn't appear to be the case here. ]
> @@ -1615,6 +1635,24 @@ static int dpaa_eth_refill_bpools(struct dpaa_priv *priv)
> skbh = (struct sk_buff **)phys_to_virt(addr);
> skb = *skbh;
>
> +#ifdef CONFIG_FSL_DPAA_ETH_TS
> + if (priv->tx_tstamp &&
> + skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) {
This condition fits on one line easily.
> + struct skb_shared_hwtstamps shhwtstamps;
> + u64 ns;
Local variables belong at the top of the function.
> + memset(&shhwtstamps, 0, sizeof(shhwtstamps));
> +
> + if (!dpaa_get_tstamp_ns(priv->net_dev, &ns,
> + priv->mac_dev->port[TX],
> + (void *)skbh)) {
> + shhwtstamps.hwtstamp = ns_to_ktime(ns);
> + skb_tstamp_tx(skb, &shhwtstamps);
> + } else {
> + dev_warn(dev, "dpaa_get_tstamp_ns failed!\n");
> + }
> + }
> +#endif
> if (unlikely(qm_fd_get_format(fd) == qm_fd_sg)) {
> nr_frags = skb_shinfo(skb)->nr_frags;
> dma_unmap_single(dev, addr, qm_fd_get_offset(fd) +
> @@ -2086,6 +2124,14 @@ static int dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
> if (unlikely(err < 0))
> goto skb_to_fd_failed;
>
> +#ifdef CONFIG_FSL_DPAA_ETH_TS
> + if (priv->tx_tstamp &&
> + skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) {
One line please.
> + fd.cmd |= FM_FD_CMD_UPD;
> + skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
> + }
> +#endif
> +
> if (likely(dpaa_xmit(priv, percpu_stats, queue_mapping, &fd) == 0))
> return NETDEV_TX_OK;
>
Thanks,
Richard
next prev parent reply other threads:[~2018-06-04 13:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 7:08 [PATCH 00/10] Support DPAA PTP clock and timestamping Yangbo Lu
2018-06-04 7:08 ` [PATCH 01/10] fsl/fman: share the event interrupt Yangbo Lu
2018-06-04 7:08 ` [PATCH 02/10] ptp: support DPAA FMan 1588 timer in ptp_qoriq Yangbo Lu
2018-06-04 7:08 ` [PATCH 03/10] dt-binding: ptp_qoriq: add DPAA FMan support Yangbo Lu
2018-06-04 7:08 ` [PATCH 04/10] powerpc/mpc85xx: move ptp timer out of fman in dts Yangbo Lu
2018-06-04 7:08 ` [PATCH 05/10] arm64: dts: fsl: move ptp timer out of fman Yangbo Lu
2018-06-04 7:08 ` [PATCH 06/10] fsl/fman: add set_tstamp interface Yangbo Lu
2018-06-04 7:08 ` [PATCH 07/10] fsl/fman_port: support getting timestamp field Yangbo Lu
2018-06-04 7:08 ` [PATCH 08/10] fsl/fman: define frame description command UPD Yangbo Lu
2018-06-04 7:08 ` [PATCH 09/10] dpaa_eth: add support for hardware timestamping Yangbo Lu
2018-06-04 13:49 ` Richard Cochran [this message]
2018-06-05 3:35 ` Y.b. Lu
2018-06-05 13:57 ` Richard Cochran
2018-06-06 11:48 ` Y.b. Lu
2018-06-04 7:08 ` [PATCH 10/10] dpaa_eth: add the get_ts_info interface for ethtool Yangbo Lu
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=20180604134920.ezhe6jz5ntpnqyzj@localhost \
--to=richardcochran@gmail.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=shawnguo@kernel.org \
--cc=yangbo.lu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).