Time stamping TCP packets at the device driver level
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Time stamping TCP packets at the device driver level
I'm currently doing some latency timings on some code I've written.
I'm trying to determine the time taken from receipt of a packet by the network device driver until the packet is handled by my code.
To do this, I am going to send a stream of known TCP messages to the machine. I will then modify the device driver to add a time-stamp to the data section of all incoming TCP messages. This can then be compared with with the system time when the packet is received by my application.
I have found the location in the device driver where it allocates incoming packets to the sk_buff structure, but I have two problems to overcome before I can implement my proposed solution.
1) When is the transport protocol of an incoming packet determined?
2) How can I determine the transport protocol of an sk_buff structure?
1. If I read stuff right, right after the dev driver yanks the data into the buffer it calls netif_rx* which timestamps it and places it in the queue.
2. Dunno. 0, 1, 2, and netfilter doc stuff is what I'm looking at.
Can I see this time stamp from the application layer? For example, I'll have an open socket, which will trigger a select statement, which I'll then go to read from.
At that point, how do I get hold of the timestamp put in earlier?
Thanks for your help, this is the first time I've had to look at the Linux low-level networking - and at first it can be slightly daunting!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.