[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090919192549.0735c93a@pundit>
Date: Sat, 19 Sep 2009 19:25:49 +0200
From: Christopher Zimmermann <madroach@...web.de>
To: netdev@...r.kernel.org
Subject: SO_TIMESTAMPING fix and design decisions
Hi,
I'm currently working on the SO_TIMESTAMPING feature which is currently
pretty much broken. The current status is the following:
-tx software timestamps don't work because of a race condition. See
commit cd4d8fdad1f1320.
-rx software timestamps do work. But they are nothing new.
SO_TIMESTAMP[NS] has been available for years.
hardware timestamps only work for the Intel igb driver. I have access to
two test machines with NICs supported by this driver.
-tx hardware timestamps do work. I still have to check what happens when
there is high load of packets requesting timestamping.
-rx hardware timestamps work only for special PTP (Precision Time
Protocol) packets. There exists a HWTSTAMP_FILTER_ALL option to
timestamp all packets, but it doesn't work and it will not work. This is
due to a problem in the hardware design. The Intel hardware is tuned for
PTP (and so is the ioctl interface).
Right now I'm trying to fix the software tx timestamps. I see several
ways to fix it:
-Do skb_get() before calling ops->ndo_start_xmit(). This breaks the
wireless stack, because it is incompatible with pskb_expand_head().
-Do skb_clone() and skb_set_owner_w() before calling
ops->ndo_start_xmit(). If the driver promises to do timestamping
(shtx->in_progress==1), then this clone will be abandoned. -> Software
timestamps only as fallback.
-Do skb_clone() and skb_set_owner_w() before calling
ops->ndo_start_xmit(). Use this to send the software timestamp
regardless of what the driver is doing. This results in software
timestamps being always generated. Not only as fallback. The drawback is
that userspace will eventually have to parse two timestamping messages
(only if requested). This is not a big deal.
I chose the last option since it is easiest to implement without much
interaction with the driver. Patch is attached. Any comments or ideas
for a better implementation are welcome.
Currently the tx timestamp is returned with the whole packet, including
all transport layer headers. I would like to return only the payload,
since this would make the interface easier for userspace. There is
nothing like a "payload" pointer in the sk_buff. How can I solve this?
Add such a pointer?
To fix the hardware rx timestamps my idea is to change the ioctl
interface, so that it allows userspace to fine tune the relevant
hardware registers of the intel controler. This would allow hardware
timestamps to be used in other scenarios than just for PTP.
I don't know any application which already uses this interface right
now. But if there is one it would be easy to fix.
In case there appear some other controlers with timestamping support
they will either need their own custom interface (if they are similarly
limited) or they can just go without the ioctl interface and do hardware
timestamping of all received packages if they are not so limited.
Could this be a way to go or what would you suggest?
Regards,
Christopher Zimmermann
Download attachment "patch" of type "application/octet-stream" (4924 bytes)
Download attachment "signature.asc" of type "application/pgp-signature" (198 bytes)
Powered by blists - more mailing lists