File:  [NetBSD Developer Wiki] / wikisrc / projects / project / kernel_udp_timestamping.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Sun Nov 6 01:59:12 2011 UTC (6 years, 5 months ago) by jmmv
Branches: MAIN
CVS tags: HEAD
Move existing project definitions from projects/gsoc_2011/ to
projects/project/ .

The goal for this reorganization is to remove any knowledge of the projects
classification from the file hierarchy: the classification goes into tags,
and projects indexes automatically list projects based on such tags.

Also, the current gsoc_2011 name was wrong anyway, because GSoC 2011 has
already concluded and projects would have had to move to a gsoc_2012 directory

Lastly, yes, "projects/project/*" is slightly redundant.  But I want to keep
the project lists from the projects "database" clearly separated.

This is as proposed in www@.

[[!template id=project

title="Socket option to timestamp UDP packets in the kernel"


[Christos Zoulas](

duration="3 months"

Many applications that use UDP unicast or multicast to receive data, need to store the data together with its reception time, or time the arrival time of packets as precisely as possible. This is required for example in order to be able to replay the data in simulated real-time to be able to do further performance analysis or quality control. Right now the only way to do this is to call [recv(2)]([recvmsg(2)]([recvfrom(2)]( to grab the data, followed by [gettimeofday(2)]([clock_gettime(2)]( This is undesirable because:

* It doubles the number of system calls limiting the effective maximum reception rate.
* The timing of the packet is imprecise because there non-deterministic delay from the time that the packet hit the network adapter till the time userland received it.

Linux provides a socket control message to add timestamp ancillary data to the the socket, which can be controlled by 2 different socket options SO_TIMESTAMP and SO_TIMESTAMPNS, using [setsockopt(2)]( Recently linux added more [SO_TIMESTAMPING_*]( options to provide even more precise timestamps from NIC cards that support them. This project is about implementing those options on NetBSD. Their implementation should be done as close to the code that does reception as possible to minimize timestamp delay. The SO_TIMESTAMP option is already done in the kernel (perhaps only partially): [kern](, [ip](, [raw](, [udp](, [ip6](, [sys]( A good reading would also be [timestamping.c](

This project is to finish implementing SO_TIMESTAMP in the kernel, test it, add SO_TIMESTAMPNS (both very easy, should be a few hours of work), and then design and implement the SO_TIMESTAMPING_* options, get at least one driver working with them and test them.


[[!tag gsoc]]
[[!tag easy]]
[[!tag kernel]]

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb