tech-net archive

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

Re: hardware timestamping of packets

On Wed, Jun 20, 2012 at 02:47:03PM -0700, Vlad Balan wrote:
> Finally, it appears that none of the cards currently available is
> capable of obtaining hardware timestamps for all packets and returning
> them in the packet descriptors. Line capture cards built on FPGAs have
> this capability, however my understanding is that they use different
> interfaces to the host (possibly userspace), making them unsuitable
> for testing the hardware timestamping kernel feature.

There are several WLAN adapters that provide a microsecond timestamp,
corresponding to the 802.11 Time Synchronization Function (TSF), in
the descriptors.  Sometimes the timestamp in the descriptor is 64 bits
wide, but sometimes the timestamp in the descriptor is less than 16
bits wide.  Thus you may have 65 milliseconds or less to convert the
descriptor's timestamp to an unambiguous timestamp for your application.
That may involve reading a couple of TSF registers, timebase conversion
(TSF -> uptime), etc.

I found that I could rely on the Rx timestamps on an Atheros WLAN
adapter to help me resolve the distance from one Atheros WLAN adapter to
another to within 10 or 20 feet by sending a carefully-crafted train of
packets from one adapter to the other, recording and averaging the time
interval between the train of link-layer acknowledgements.  I reckon
that I couldn't have done that if it wasn't a quality timestamp.

I think that converting TSF timestamps to civil time may be a bit tricky
in the details.

It has always seemed to me that the Linux API for packet timestamps
is inadequate.  I'm concerned that following the Linux API will
divert your thought and development from the most productive path.  I
suggest creating an original userland API for packet timestamping that
incorporates the advice that you receive here.  Emulating the Linux API
should not be difficult.


David Young    Urbana, IL    (217) 721-9981

Home | Main Index | Thread Index | Old Index