Not a solution to your problem but two points about the usefulness of this proposal since we did similar things some time ago:
1. You will probably have realised that the resolution of the 'ticks' is useless for this measurement - you could use either the fine grain timer or the Pentium instruction cycle counter since you only want differences within a single router. We had to go a lot further since we wanted to time packets to microsecond accuracy across several routers and had to use instrumentation cards to get synchronised measurements across multiple machines.
2. The measurement you propose may well understate the time spent in the router because (assuming you are using Ethernet cards of a conventional nature) there is another 'hidden' queue in the Ethernet device that can only be minimised and not eliminated. The consequence of this is that (for example) EF traffic is not as prioritised as much as it might be because the scheduling decision is made before this hidden queue which can contain 1 to 6 packets. The effect can be seen as a curious 'kink' in the delay curve for EF packets if you can measure sufficiently accurately.
Now for the actual problem:
The data in skb-h.uh is a copy of transport header *not* an address at all.
The actual packet starts at skb->data - what is after this point depends on where you look at the packet in terms of which layer of the IP stack you are looking in. The routines you quote are right down at the bottom so you will have a complete IP packet to deal with. This means you have to access the IP header length in the IP header, add the correct transport header length (i.e. you have to know you are dealing with a UDP packet) and then find the PDU. Oh, and you should of course only fiddle with packets which you know want timestamps - it might be easier to use the IP timestamp option with some mucking about.
From: Benjamin Gaidioz [SMTP:email@example.com]
Sent: Wednesday, May 03, 2000 6:00 PM
Subject: reaching the UDP payload
My machine A is sending packets to my machine B through a LinuxDS-Router
and I want to know how long packets wait in the router.
Packets are UDP packets < 1KB. I want the kernel (2.2.14) to store time
stamps in the UDP payload during the call to dev_queue_xmit (before
q->enqueue) and qdisc_restart (right after hard_start_xmit).
I guess the UDP payload is somewhere in the skb->data, but where? It does
not seem to be eight bytes after the address pointed by skb->h.uh (the UDP
Thanks for your help.