tech-net archive

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

Re: adding new descriptor format to the if_wm driver

Dear all,

Here is an update on the current status of my project, the parts that
are working and the things that I am still to implement:

The list of the currently implemented features is as follows:

I have enabled hardware timestamps in the Intel 82576 driver; timestamps
are saved as mtags associated with the packet; in ip_output (and
ip6_output) we check for the timestamping socket options and pass them
as cmsg data to the app

I have added support for the different timestamping ioctl options in
the 82576 driver.

I have developed a general framework for timestamping in
net/net_tstamp.h, which serves in
making the connection between the driver and the socket output.

I have modified timestamping.c (the Linux timestamping check application)
into a timestamping_rx.c that does not include the tx part (we do not
support yet the snd_err queue);
I have checked that this app gets the timestamps from the driver -
therefore the whole path from driver to user level has been checked
and is working

Here is what is still open and where I have encountered problems:

The Intel 82576 driver needs to be modified in order to use a newer
version of the transmit and receive packet descriptors (the current
ones are legacy descriptors); The new tx descriptors provide a bit for
requesting that the hardware records a timestamp for the current
packet. The new rx descriptor provides a status bit identifying the
packet which was timestamped (from all the packets that arrived during
an interrupt). Redoing the descriptors in the drivers is a bit of an
involved task, so I expect it to take my about two weeks until I have
the whole thing working; Additionally, perhaps one of the driver
maintainers should check my code as well when all is done to make sure
that it does not break any functionality.

The ioctl call for 82576 is called but gets mangled data in the data
pointer; I have to debug to see why the structure is not passed
correctly - I will debug the call stack; meanwhile I ignore the
received structure and set the parameters to default values when the
function is called.

I still have to implement two socket ioctl's that allow for
obtaining the last timestamp for a given socket (these are additional
to the cmsg structures).

For SO_TIMESTAMPING, I have to modify the format of the option from
a single bit (as it is now) to an int with flags.

There is a small inconsistency between the NetBSD socket options and
the Linux socket options. In Linux SO_TIMESTAMP (the option constant)
and the SCM_TIMESTAMP (the cmsg type) are identical, while in the
NetBSD they are not. The timestamping.c code used SO_TIMESTAMP where
it should use SCM_TIMESTAMPING. I have changed this to the correct
version in timestamping_rx.c. In any case, this is a problem that we
should be aware of.

I have not implemented yet the return with cmsg messages for
timestamps of transmitted packets - this was the mechanism with the
error queue that was discussed over the message list.

For Saitoh and other that want to look at the device driver code, I
have just uploaded that code as well.


On Sat, Jul 7, 2012 at 7:06 PM, SAITOH Masanobu <> 
>  Hello, Vlad.
>> To Saitoh, the URL for my code is:
>> The only files that one needs to graft into the kernel source to test the 
>> new descriptors are in sys/dev/pci/if_wm*. If you disable the 
>> WM_TIMESTAMPING flag, the timestamping dependencies are removed and you can 
>> test just the new descriptor code. So far I only have the header definitions 
>> for the descriptors, but I will let you know when I have running code.
>> Regards,
>> Vlad
> Thank you, but I can't see sys/dev/pci/if_wm.c...
> It seems the directory is empty...
> --
> -----------------------------------------------
>                 SAITOH Masanobu (

Home | Main Index | Thread Index | Old Index