On Fri, 2008-07-04 at 14:25 +0200, Ivo van Doorn wrote: > On Friday 04 July 2008, Johannes Berg wrote: > > > > > rt2x00_desc_read(entry_priv->desc, 0, &word0); > > > rt2x00_desc_read(entry_priv->desc, 2, &word2); > > > rt2x00_desc_read(entry_priv->desc, 3, &word3); > > > + rt2x00_desc_read(entry_priv->desc, 4, &word4); > > > > > > if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) > > > rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; > > > @@ -1106,6 +1108,7 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry, > > > * The signal is the PLCP value, and needs to be stripped > > > * of the preamble bit (0x08). > > > */ > > > + rxdesc->timestamp = rt2x00_get_field32(word4, RXD_W4_RX_END_TIME); > > > > You really should extend that, like this it's going to cause trouble as > > soon as it has overflowed 32 bits once. > > Ok, but if I do the get_tsf() callback, to grab the upper 32 bytes of the timestamp, > you will get the same problems during wraparounds, because the upper 32 bytes > can be from _after_ the wrapround while the lower 32 bytes from the descriptor > are still from _before_ the wraparound. You mean bits. But no, it's not a problem, you can safely assume that you call get_tsf() within 2^32 usecs of getting the frame (that's quite a long time after all). Then do something like this: ts = word4 high32 | low32 = get_tsf() if (ts >= low32) // wrapped around while we were not looking high32 -= 1 tsf = high32 | ts johannes
Attachment:
signature.asc
Description: This is a digitally signed message part