Skip to content

RFC hardware time stamping + igb example implementation

Patrick Ohly netdev 1 version In review

Get series with b4
b4 am 1226414697.17450.852.camel@ecld0pohly

Versions newest first

  1. v1 RFC Latest13 patches 34 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13put_cmsg_compat + SO_TIMESTAMP[NS]: use same name for value as callernet/compat.c+2 -21 reply
2/13extended semantic of sk_buff::tstamp: lowest bit marks hardware time stampsinclude/linux/netdevice.h include/linux/skbuff.h net/core/skbuff.c+118 -25 replies
3/13user space API for time stamping of incoming and outgoing packetsDocumentation/networking/timestamping.txt Documentation/networking/timestamping/timestamping.c include/asm-x86/socket.h +10 more+861 -551 reply
4/13net: implement generic SOF_TIMESTAMPING_TX_* supportDocumentation/networking/timestamping.txt include/linux/netdevice.h include/linux/skbuff.h +4 more+188 -32 replies
5/13ip: support for TX timestamps on UDP and RAW socketsinclude/net/ip.h net/can/raw.c net/ipv4/icmp.c +3 more+18 -01 reply
6/13workaround: detect time stamp when command flags are expectednet/core/skbuff.c+7 -01 reply
7/13net: add SIOCSHWTSTAMP - hardware time stamping of packetsDocumentation/networking/timestamping.txt Documentation/networking/timestamping/timestamping.c fs/compat_ioctl.c +2 more+56 -30 replies
8/13igb: stub support for SIOCSHWTSTAMPdrivers/net/igb/igb_main.c+32 -00 replies
9/13clocksource: allow usage independent of timekeeping.cinclude/linux/clocksource.h+118 -11 reply
10/13igb: infrastructure for hardware time stampingdrivers/net/igb/e1000_regs.h drivers/net/igb/igb.h drivers/net/igb/igb_main.c+136 -00 replies
11/13time sync: generic infrastructure to map between time stamps generated by a clock source and system timeinclude/linux/clocksync.h kernel/time/Makefile kernel/time/clocksync.c+250 -16 replies
12/13igb: use clocksync to implement hardware time stampingdrivers/net/igb/e1000_82575.h drivers/net/igb/e1000_defines.h drivers/net/igb/e1000_regs.h +2 more+275 -80 replies
13/13skbuff: optionally store hardware time stamps in new fielddrivers/net/igb/igb_main.c include/linux/skbuff.h net/Kconfig +1 more+71 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 00/13] hardware time stamping + igb example implementation

Hello all!

This patch series is related to Octavian's proposals a while ago ("net:
support for TX timestamps", "net: support for hardware timestamps"). It mostly implements the revised plan discussed recently ("hardware time stamps + existing time stamp usage").

As part of that discussion there was no consensus on storing hardware time stamps in sk_buff. One suggested solution for avoiding a new field was based on storing a transformed hardware time stamp in the existing field (thus keeping the existing code happy) and then transforming back to the original hardware time base if needed.

This patch series follows that approach, but the utility code which is used to transform from hardware time to system time doesn't implement the necessary inverse transformation. This means that although access to the original, raw hardware time stamp is part of the API, the corresponding value is never actually reported by the existing code. If this value is required, then the final patch shows how a separate hardware time stamp field solves the problem with a lot less hassle.

If the extra field is considered acceptable unconditionally, then the #ifdefs become redundant and the code much cleaner. I would prefer this solution, but I don't know what the performance impact of a larger sk_buff really is.

This patch series is currently based on v2.6.27. If it is considered for inclusion, then I'd make sure that PTPd indeed works with this patch (currently it has only been tested with the included example program) and resubmit the patch based on the latest netdev branch. This is my first contribution to the Linux kernel; it hasn't been discussed inside Intel either. So please give it the treatment that a newbie patch
deserves: thorough, but not too harsh critisism ;-) Thanks!

I'm sure there will be things to correct. To spare you the trouble of searching for them, here are some I already know of:
* there's currently no locking of the newly added fields in the igb private data structure; I don't quite understand how locking currently works in the igb driver (or net_device in general)
* because of the missing locking I also haven't fully implemented the part which matches TX time stamps with the right outgoing packet and the "time stamp all packets" mode
* as noted in the patch, the assumption that skb->sk is still valid after net_device->hard_start_xmit is not always true (this was what I mentioned earlier on this list, without actually understanding what was happening at that time)
* in combination with IP_MULTICAST_LOOP packets which already carry a time stamp reach dev_start_hard_xmit(), which conflicts with the use of the time stamp field to carry time stamping requests

Any tips regarding them are very much appreciated.

Signature · 6 lines
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.