netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
To: Jeroen Hofstee <jhofstee@victronenergy.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	linux-can <linux-can@vger.kernel.org>,
	Wolfgang Grandegger <wg@grandegger.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"open list:NETWORKING DRIVERS" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] can: dev: add software tx timestamps
Date: Sun, 10 Jan 2021 21:32:18 +0900	[thread overview]
Message-ID: <CAMZ6RqKL62wR5KRRJgy8fiEHSKCQvP7CJFdR1=8MPh4_3pMq_A@mail.gmail.com> (raw)
In-Reply-To: <043c3ea1-6bdd-59c0-0269-27b2b5b36cec@victronenergy.com>

Hello Jeroen,

On Sun. 10 Jan 2021 at 20:29, Jeroen Hofstee <jhofstee@victronenergy.com> wrote:
>
> Hello Vincent,
>
> On 1/10/21 11:35 AM, Vincent Mailhol wrote:
> > Call skb_tx_timestamp() within can_put_echo_skb() so that a software
> > tx timestamp gets attached on the skb.
> >
> [..]
> >
> > diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> > index 3486704c8a95..3904e0874543 100644
> > --- a/drivers/net/can/dev.c
> > +++ b/drivers/net/can/dev.c
> > @@ -484,6 +484,8 @@ int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
> >
> >               /* save this skb for tx interrupt echo handling */
> >               priv->echo_skb[idx] = skb;
> > +
> > +             skb_tx_timestamp(skb);
> >       } else {
> >               /* locking problem with netif_stop_queue() ?? */
> >               netdev_err(dev, "%s: BUG! echo_skb %d is occupied!\n", __func__, idx);
>
> Personally, I would put the skb_tx_timestamp, before adding it to the array:
>
>          /* make settings for echo to reduce code in irq context */
>          skb->pkt_type = PACKET_BROADCAST;
>          skb->ip_summed = CHECKSUM_UNNECESSARY;
>          skb->dev = dev;
> +       skb_tx_timestamp(skb);
>
>          /* save this skb for tx interrupt echo handling */
>          priv->echo_skb[idx] = skb;

I agree that it is better like that from an aesthetic point of
view. The reason to put it at the very end was to really to
blindly follow the doc and do the timestamp as late as possible.

>
> I don't think it actually matters though.

Indeed, but will still follow your suggestion though. Putting it
before would just delay the timestamp by a few assembly
instructions: it is negligible enough.


Yours sincerely,
Vincent Mailhol

      reply	other threads:[~2021-01-10 12:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 10:35 [PATCH 0/1] Add software TX timestamps to the CAN devices Vincent Mailhol
2021-01-10 10:35 ` [PATCH 1/1] can: dev: add software tx timestamps Vincent Mailhol
2021-01-10 11:29   ` Jeroen Hofstee
2021-01-10 12:32     ` Vincent MAILHOL [this message]

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='CAMZ6RqKL62wR5KRRJgy8fiEHSKCQvP7CJFdR1=8MPh4_3pMq_A@mail.gmail.com' \
    --to=mailhol.vincent@wanadoo.fr \
    --cc=davem@davemloft.net \
    --cc=jhofstee@victronenergy.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.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).