Skip to contentSkip to conversation

radiotap.mactime appears to be wrong

ath9k-devel Timothy Smith 5 participants 6 messages Feb 16, 2011 – May 30, 2011

lore
Share & tools
lore
#0 lore raw

I'm not sure if this specific to the ath9k drivers, or a general problem across many, but I have seen it here so I'll report it here first. It's actually been the case for quite a while and IIRC the ath5k does this too, but I haven't checked it recently.

radiotap.org defines the mactime field as

"Value in microseconds of the MAC's 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC"

Now I'm looking at a recent sniffer trace I took using an ath9k from compat- wireless-2011-01-30 and I observe a sequence of frames like this:

Data: radiotap.mactime == 23322989
ACK:  radiotap.mactime == 23323032
Data: radiotap.mactime == 23323556

That gives the difference between the ACK timestamp and the preceding data frame as 43 microseconds, and the difference between the data frame and its preceding ACK as 524 microseconds.

This is consistent with radiotap.mactime being the value of the TSF when the LAST bit of the MPDU arrived at the MAC, not the first as both radiotap.org and wireshark's online help say should be the case.

Signature · 4 lines
Tim Smith <[email protected]>


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
#1 lore raw
Quoted 17 lines · Timothy Smith

I'm not sure if this specific to the ath9k drivers, or a general problem across many, but I have seen it here so I'll report it here first. It's actually been the case for quite a while and IIRC the ath5k does this too, but I haven't checked it recently.

radiotap.org defines the mactime field as

"Value in microseconds of the MAC's 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC"

Now I'm looking at a recent sniffer trace I took using an ath9k from compat- wireless-2011-01-30 and I observe a sequence of frames like this:

Data: radiotap.mactime == 23322989.
ACK: ?radiotap.mactime == 23323032
Data: radiotap.mactime == 23323556

Quoted 7 lines

That gives the difference between the ACK timestamp and the preceding data frame as 43 microseconds, and the difference between the data frame and its preceding ACK as 524 microseconds.

This is consistent with radiotap.mactime being the value of the TSF when the LAST bit of the MPDU arrived at the MAC, not the first as both radiotap.org and wireshark's online help say should be the case.

Hi, I understand you are saying we are doing the time stamping wrongly by looking at the last bit instead of the first bit of MPDU. please correct me if I am wrong

Quoted 11 lines

--
Tim Smith <[email protected]>

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
_______________________________________________
ath9k-devel mailing list
ath9k-devel at lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel

#2 lore raw
Quoted 1 line · On Wednesday 16 February 2011 13:11:32 Mohammed Shafi wrote:

On Wed, Feb 16, 2011 at 3:31 PM, Timothy Smith <[email protected]>

Quoted 22 lines · wrote:
Quoted 22 lines

I'm not sure if this specific to the ath9k drivers, or a general problem across many, but I have seen it here so I'll report it here first. It's actually been the case for quite a while and IIRC the ath5k does this too, but I haven't checked it recently.

radiotap.org defines the mactime field as

"Value in microseconds of the MAC's 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC"

Now I'm looking at a recent sniffer trace I took using an ath9k from compat- wireless-2011-01-30 and I observe a sequence of frames like this:

Data: radiotap.mactime == 23322989.
ACK:  radiotap.mactime == 23323032
Data: radiotap.mactime == 23323556

That gives the difference between the ACK timestamp and the preceding data frame as 43 microseconds, and the difference between the data frame and its preceding ACK as 524 microseconds.

Quoted 7 lines
Quoted 3 lines

This is consistent with radiotap.mactime being the value of the TSF when the LAST bit of the MPDU arrived at the MAC, not the first as both radiotap.org and wireshark's online help say should be the case.

Hi, I understand you are saying we are doing the time stamping wrongly by looking at the last bit instead of the first bit of MPDU. please correct me if I am wrong

That's certainly what it looks like. If the timestamp were at the first bit of the MPDU, I would expect the Data=>ACK gap to be bigger (Length of data + SIFS), whereas what we get is much more consistent with (Length of ACK + SIFS
+ AIFSN + rand(CWmin))

Signature · 4 lines
Tim Smith <[email protected]>


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
#3 lore raw
Quoted 29 lines · Timothy Smith
Quoted 1 line · On Wednesday 16 February 2011 13:11:32 Mohammed Shafi wrote:

On Wed, Feb 16, 2011 at 3:31 PM, Timothy Smith <[email protected]>

Quoted 26 lines · wrote:
Quoted 25 lines

I'm not sure if this specific to the ath9k drivers, or a general problem across many, but I have seen it here so I'll report it here first. It's actually been the case for quite a while and IIRC the ath5k does this too, but I haven't checked it recently.

radiotap.org defines the mactime field as

"Value in microseconds of the MAC's 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC"

Now I'm looking at a recent sniffer trace I took using an ath9k from compat- wireless-2011-01-30 and I observe a sequence of frames like this:

Data: radiotap.mactime == 23322989.
ACK: ?radiotap.mactime == 23323032
Data: radiotap.mactime == 23323556

That gives the difference between the ACK timestamp and the preceding data frame as 43 microseconds, and the difference between the data frame and its preceding ACK as 524 microseconds.

This is consistent with radiotap.mactime being the value of the TSF when the LAST bit of the MPDU arrived at the MAC, not the first as both radiotap.org and wireshark's online help say should be the case.

Quoted 9 lines
Quoted 3 lines

Hi, I understand ?you are saying we are doing the time stamping wrongly by looking at the last bit instead of the first bit of MPDU. please correct me if I am wrong

That's certainly what it looks like. If the timestamp were at the first bit of the MPDU, I would expect the Data=>ACK gap to be bigger (Length of data + SIFS), whereas what we get is much more consistent with (Length of ACK + SIFS
+ AIFSN + rand(CWmin))

did not dig deep but saw this comment in ath5k/base.c and they are mentioning hw specific
/*
* always extend the mac timestamp, since this information is
* also needed for proper IBSS merging.
*
* XXX: it might be too late to do it here, since rs_tstamp is
* 15bit only. that means TSF extension has to be done within
* 32768usec (about 32ms). it might be necessary to move this to
* the interrupt handler, like it is done in madwifi. *
* Unfortunately we don't know when the hardware takes the rx
* timestamp (beginning of phy frame, data frame, end of rx?).
* The only thing we know is that it is hardware specific...
* On AR5213 it seems the rx timestamp is at the end of the
* frame, but i'm not sure.
*
* NOTE: mac80211 defines mactime at the beginning of the first
* data symbol. Since we don't have any time references it's
* impossible to comply to that. This affects IBSS merge only
* right now, so it's not too bad...
*/

Quoted 10 lines

--
Tim Smith <[email protected]>

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
_______________________________________________
ath9k-devel mailing list
ath9k-devel at lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel

#4 lore raw
In reply to Timothy Smith
Quoted 4 lines · Timothy Smith

I'm not sure if this specific to the ath9k drivers, or a general problem across many, but I have seen it here so I'll report it here first. It's actually been the case for quite a while and IIRC the ath5k does this too, but I haven't checked it recently.

I'm pretty sure it applies to other drivers, too. At least ath5k is affected since it uses similar mechanism.

Quoted 4 lines

radiotap.org defines the mactime field as

"Value in microseconds of the MAC's 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC"

I had not noticed this specification for the mactime, but yes, this is indeed different moment compared to the one returned by the ath9k (or ath5k) hardware.

Quoted 3 lines

This is consistent with radiotap.mactime being the value of the TSF when the LAST bit of the MPDU arrived at the MAC, not the first as both radiotap.org and wireshark's online help say should be the case.

Yes, the current mactime is returned based on the value provided by the hardware which, for RX, happens to be at the end of the frame (at least for other frames than A-MPDU; I have not checked how exactly the aggregated frames would be handled).

I would prefer to address this in mac80211, though, by allowing the drivers to indicate at which point of the frame the RX timestamp is taken. This would allow the extra calculations to be skipped unless there is need for them (i.e., only do that for IBSS Beacon frames or if there is a monitor interface in use). mac80211 could then adjust the mactime to meet the requirements for various uses (beginning of the timestamp field within Beacon frame for IBSS or beginning of the MPDU for radiotap header) based on the reporting style and transmission rate.

- Jouni

#5 lore raw
Quoted 10 lines · Jouni Malinen <jouni.malinen <at> atheros.com> writes:

I would prefer to address this in mac80211, though, by allowing the drivers to indicate at which point of the frame the RX timestamp is taken. This would allow the extra calculations to be skipped unless there is need for them (i.e., only do that for IBSS Beacon frames or if there is a monitor interface in use). mac80211 could then adjust the mactime to meet the requirements for various uses (beginning of the timestamp field within Beacon frame for IBSS or beginning of the MPDU for radiotap header) based on the reporting style and transmission rate.

- Jouni

Hi,
I faced this problem as well and I have a question.
Considering that we are talking about ICMP packets, is there anyway to capture the MAC Time Stamp at the beginning of the MPDU? If yes, would you please tell me how?
Regards,
Amin