Re: [RFC PATCH] can-roundtrip-stats: a tool to benchmark transmission time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26.06.2022 18:54:05, Vincent MAILHOL wrote:
> On Sun. 26 juin 2022 à 18:10, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote:
> > On 26.06.2022 16:53:17, Vincent Mailhol wrote:
> > > This is a simple tool I wrote in the past. It will report the time
> > > need for a packet to travel from:
> > >   * application TX path to kernel TX path
> > >   * kernel TX path to kernel RX path (i.e. kernel round trip)
> > >   * kernel RX path to application RX path
> > >   * application TX path to application RX path (i.e application round
> > >     trip)
> >
> > I'm currently playing around with hardware timestmaps in the mcp251xfd
> > driver and the other day I stumbled over commit 741b91f1b0ea ("can: dev:
> > can_put_echo_skb(): add software tx timestamps") and I was thinking
> > which tool you're using to test this. :)
> >
> > Once the hardware timestamps are running stable, this is exactly the
> > tool I need! Thanks for sharing this.
> 
> Does the mcp251xfd use the host clock to do its hardware timestamp?

It uses an external 40 MHz oscillator, usually each device has it's own.

> (Not sure how SPI hardware works and if they have their own quartz or
> if they share it with the host system). If it is indeed the same clock
> you can have even more precise statistics.

No, the device clock is not shared with the host system and thus drift
apart. But you can synchronize the device's clock against the system
clock with phc2sys of linuxptp. As soon as the code is stable I'll send
the patches around.

[...]

> > > My ultimate goal was to add the TX timestamp feature to candump from
> > > can-utils [3], however, I faced a blocker: the TX timestamps are sent
> > > to the error queue of the sender's socket meaning that a listener
> > > (such as candump) will not see those TX timestamp on his error queue
> > > because this is a different socket as the sender. If anyone knows a
> > > method to access the error queue of another process's socket, let me
> > > know (I guess that you need to be root, but did not find how to do
> > > it).
> >
> > I don't think there's an official way to read the TX timestamps (i.e.
> > error queue) of a socket that's outside of your process.
> 
> What I was thinking is that tools such as tcpdump are able to get TX

Oh, I completely forgot the packet socket and tcpdump....

> packets of ethernet interfaces even if not normally visible (because
> contrary to CAN, there is no default loopback). I was wondering if the
> same could be done with error queues, but as you can guess my research
> did lead anywhere.

What does tcpdump show on a Ethernet if you enable TX timestamps?

> I also guess there is no official support but then,
> I am wondering how hard it would be to hack the error queues to expose
> them to the privileged processes.

Maybe there's general interest of pushing error queue data via packet
socket, too. As this is not a CAN specific issue.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux