Re: [ath5k-devel] Ath5k Hardware Timestamping of Transmitted Packets

2012-03-19 Thread Qasim Javed
On Mon, Mar 19, 2012 at 10:50 PM, Qasim Javed  wrote:
> Hi Alexander,
>
> As Adrian mentioned, indeed there is a timestamp field in the transmit
> status descriptor which could be used for your purpose. This timestamp
> is basically the last 16-bits of a snapshot of the TSF counter. Since
> you are using a card based on AR5213 chipset, the TX status descriptor
> has 4 32-bit words.
>
> The function used to process the TX status descriptor for your card is then:
>
> ath5khw_proc_4word_tx_status (in desc.c)

This is ath5k_hw_proc_4word_tx_status

>
> You will notice that within this function, the TX timestamp is recorded:

Just a correction, the timestamp is not recorded here, but copied from
the TX status descriptor. It is recorded at the last transmission
attempt when the frame is put on air.

>
> ts->ts_tstamp = AR5K_REG_MS(txstat0, AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP);
>
> where ts is of type "struct ath5k_tx_status".
>
> Having described this, I should mention that I have had mixed
> experience when using this field. Some cards such as (Ubiquiti XR9) do
> not fill the value properly (or there is some bug in the "firmware"
> running on the card), for others such as AR5212 based cards, it works
> fine. From what little I know, in case there are multiple
> retransmissions, the reported TX timestamp is recorded when the frame
> is finally transmitted, that is at the last successful transmission
> attempt.
>
> I hope that helps.
>
> -Qasim
>
>
> On Wed, Mar 14, 2012 at 6:42 PM, Adrian Chadd  wrote:
>>
>> I'd ignore wireshark for now. Look through the TX and TX completion
>> code. There's a timestamp field somewhere that should be populated for
>> all TXed frames.
>>
>> Verify first that the TSF is being written into that timestamp field
>> upon completion, and then verify that it's pushed all the way back up
>> through radiotap.
>>
>>
>> Adrian
>> ___
>> ath5k-devel mailing list
>> ath5k-devel@lists.ath5k.org
>> https://lists.ath5k.org/mailman/listinfo/ath5k-devel
___
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel


Re: [ath5k-devel] Ath5k Hardware Timestamping of Transmitted Packets

2012-03-19 Thread Qasim Javed
Hi Alexander,

As Adrian mentioned, indeed there is a timestamp field in the transmit
status descriptor which could be used for your purpose. This timestamp
is basically the last 16-bits of a snapshot of the TSF counter. Since
you are using a card based on AR5213 chipset, the TX status descriptor
has 4 32-bit words.

The function used to process the TX status descriptor for your card is then:

ath5khw_proc_4word_tx_status (in desc.c)

You will notice that within this function, the TX timestamp is recorded:

ts->ts_tstamp = AR5K_REG_MS(txstat0, AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP);

where ts is of type "struct ath5k_tx_status".

Having described this, I should mention that I have had mixed
experience when using this field. Some cards such as (Ubiquiti XR9) do
not fill the value properly (or there is some bug in the "firmware"
running on the card), for others such as AR5212 based cards, it works
fine. From what little I know, in case there are multiple
retransmissions, the reported TX timestamp is recorded when the frame
is finally transmitted, that is at the last successful transmission
attempt.

I hope that helps.

-Qasim


On Wed, Mar 14, 2012 at 6:42 PM, Adrian Chadd  wrote:
>
> I'd ignore wireshark for now. Look through the TX and TX completion
> code. There's a timestamp field somewhere that should be populated for
> all TXed frames.
>
> Verify first that the TSF is being written into that timestamp field
> upon completion, and then verify that it's pushed all the way back up
> through radiotap.
>
>
> Adrian
> ___
> ath5k-devel mailing list
> ath5k-devel@lists.ath5k.org
> https://lists.ath5k.org/mailman/listinfo/ath5k-devel
___
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel


Re: [ath5k-devel] Ath5k Hardware Timestamping of Transmitted Packets

2012-03-14 Thread Adrian Chadd
I'd ignore wireshark for now. Look through the TX and TX completion
code. There's a timestamp field somewhere that should be populated for
all TXed frames.

Verify first that the TSF is being written into that timestamp field
upon completion, and then verify that it's pushed all the way back up
through radiotap.


Adrian
___
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel


Re: [ath5k-devel] Ath5k Hardware Timestamping of Transmitted Packets

2012-03-14 Thread Alexander Watson
Adrian,

I am currently running a 5413, details attached below which does not appear
to attach timestamps to packets that have been transmitted from the same
interface.

When I run wireshark (or tshark) on the wlan0 interface, I can see
timestamps associated with all received packets. However, when I inject
packets to the interface, I can see the packet payload but there is no
timestamp information associated with packets transmitted from that
interface. On the second (monitor) interface, I can only see the responses
to the packets that I injected from wlan0, no payload or timestamp data for
the injected packets.

I know that the packets were sent correctly, because I can see the response
from the client computer as well as monitor the whole interaction from a
2nd computer that is also running a 5413. Unfortunately, requiring a second
computer will not work for my project. As for why I am unable to see
packets injected from wlan0 on wlan1, it appears that some level of
filtering (perhaps at the ath5k driver level) is preventing me from seeing
the packets injected from wlan0 on wlan1.

Also- to be clear, i am interested in the radiotap mactime (TSF counter),
not the system time field.

Example tshark command:
tshark -i mon0 -R "wlan.fc.type_subtype == 0x1b || wlan.fc.type_subtype ==
0x1c" -T fields -e frame.time -e radiotap.mactime -e radiotap.datarate -e
radiotap.dbm_antsignal -e wlan.channel.freq -e wlan.fc.subtype -e wlan.ta
-e wlan.ra

Wireless card:
00:0e.0 Ethernet controller: Atheros Communications Inc. AR5413 802.11abg
NIC (rev 01)
Subsystem: Device 0777:3009
Flags: bus master, medium devsel, latency 168, IRQ 11
Memory at e008 (32-bit, non-prefetchable) [size=64K]
Capabilities: [44] Power Management version 2
Kernel driver in use: ath5k

Thanks
Alex


On Wed, Mar 14, 2012 at 5:09 PM, Adrian Chadd  wrote:

> Hi!
>
> On 14 March 2012 13:57, Alexander Watson  wrote:
> > Hello,
> >
> > I am working on a project where I need to be able to accurately timestamp
> > both transmitted and received packets from an Atheros NIC. I am aware
> that
> > in its normal mode of operation and that Ath5k only timestamps received
> > packets and beacons.
>
> I believe all AR5212 and later NICs have a TX and RX timestamp in the
> completion descriptor.
> Does it not do what you want?
>
>
>
> Adrian
>
___
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel


Re: [ath5k-devel] Ath5k Hardware Timestamping of Transmitted Packets

2012-03-14 Thread Adrian Chadd
Hi!

On 14 March 2012 13:57, Alexander Watson  wrote:
> Hello,
>
> I am working on a project where I need to be able to accurately timestamp
> both transmitted and received packets from an Atheros NIC. I am aware that
> in its normal mode of operation and that Ath5k only timestamps received
> packets and beacons.

I believe all AR5212 and later NICs have a TX and RX timestamp in the
completion descriptor.
Does it not do what you want?



Adrian
___
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel