Discussion:
[Linuxptp-users] Software timestamping
Jan Deinhard
2016-11-06 18:30:48 UTC
Permalink
Hello,

I'm trying to use ptp4l (Version 1.7) on a Raspberry Pi. Unfortunately the
device's network interface does not support hardware timestamping.

$ ethtool -T eth0
Time stamping parameters for eth0:
Capabilities:
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none

I thought I could use software timestamping in this case. Though executing
ptp4l with option -S I see the following output:

$ ./ptp4l -i eth0 -S -m
ptp4l[42.597]: interface 'eth0' does not support requested timestamping mode
failed to create a clock

Obviously my understanding of option -S or software timestamping is wrong.

What is the difference between options -S and -H? What hardware support is
needed for option -S? Is it a driver problem?

Thanks,
Jan
Richard Cochran
2016-11-06 19:31:14 UTC
Permalink
Post by Jan Deinhard
$ ethtool -T eth0
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
You are missing:

software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
Post by Jan Deinhard
What is the difference between options -S and -H?
-S gets the time stamps in software in the Linux networking stack.
Post by Jan Deinhard
What hardware support is needed for option -S?
No special HW support is needed.
Post by Jan Deinhard
Is it a driver problem?
Yes. The receive time stamp is handled by the core networking code,
but the transmit time stamp must be done in the driver. Many, but not
all drivers implement it.

You need to add one line to the transmit path in the driver:

skb_tx_timestamp(skb);

Quoting include/linux/skbuff.h:

* skb_tx_timestamp() - Driver hook for transmit timestamping
*
* Ethernet MAC Drivers should call this function in their hard_xmit()
* function immediately before giving the sk_buff to the MAC hardware.
*
* Specifically, one should make absolutely sure that this function is
* called before TX completion of this packet can trigger. Otherwise
* the packet could potentially already be freed.

HTH,
Richard

Continue reading on narkive:
Loading...