I have been working with the i350-T4 ethernet card to test a packet capturing library. I would like this library to be able to deliver a hardware timestamp for each incoming frame. In the datasheet for the i350 controller, one can see that this feature should be supported (p44, table I-4).
I tried to read out the values of these timestamps (I am working with a Linux kernel 3.2.9 - vanilla). To this end, I activated the hardware timestamping on the NIC, issuing an ioctl(SIOCSHWTSTAMP) call and filling the rx_filter field of the hwtstamp_config stucture with the value HWTSTAMP_FILTER_ALL. I then activated the socket option TIMESTAMPING, or-ing all possible values for the timesource. I should get the values of the timestamps for each frame from the control message header I receive by calling recvmsg() on my socket. In this header, I am supposed to receive the raw hardware timestamp (without correction in regards to the system clock), the corrected hardware timestamp (in the realm of the system clock) and the system timestamp (given higher up in the network stack). For a good 2/3rd of the packets, I receive only the system timestamp, the others being set to 0.
Does the i350 controller really produce a hardware timestamp for each incoming frames? If yes, is there another way to read out the values of these timestamps? Are there other options to activate HW timestamping/return these values?
The following is a general response intended to serve future users looking for information on implementing IEEE 1588. You are obviously through the initial research portion of the process, so you can safely just to Step 2 below.
A quick introduction to IEEE 1588 can be obtained in this post to the Wired Ethernet blog.
IEEE 1588 software support is, at the time of this writing, implemented in our out-of-tree drivers hosted on SourceForge in the e1000 project. Upstream patches have been submitted and the community is processing them, but support for this feature is not yet included in any of the distros.
Our guidance for those who want to experiment with timestamping is the following:
Download the latest driver at SourceForge and examine the timestamping implementation within. Make sure your hardware supports IEEE 1588 or your testing won't get far.
For development assistance, post to the e1000-devel mailing list which is also available under the 'Mailing Lists' tab on the SourceForge project page.