Linux - KernelThis forum is for all discussion relating to the Linux kernel.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Actually I am developing a module which is transferring the skb after filling it self. But the issue I am facing is, speed is too slow. only 1K pkt per sec. I think that is taking time for allocating memory to skb and freeing it.
I found on googling that we can make it efficient if we use skb pool in our driver module itself. I am kernel newbie, could any one plz tell me, how to implement it or it is not a good idea.
There's absolutely nothing that a CPU could possibly do, to cause a network adapter to only manage 1 kb/sec!
Memory allocation and deallocation (pooling ...) takes microseconds if not nanoseconds to do. Start by measuring the traffic that's taking place between the two machines, perhaps using a hardware monitoring device. The most likely culprit is always the application program that you're using for test purposes. It might not be behaving properly.
But as you say pooling takes microseconds. Speed is 1000 packet per second. In terms of Bytes it is more. M using Jradius Client for testing purpose.
Actually my scenario is :
I have a network driver, it receives pkt from network through hook then put info into KFIFO. another module, in which I have thread functionality for every online cpu. this module takes pkt info from KFIFO and again allocate skb, fill info into that skb with some extra header(RADIUS header) and again send back, then free the skb through kfree_skb(skb). It happens every time when it receives pkt from KFIFO.
This allocation and deallocation of skb every time takes time I think. So You please tell me that if we take a pool, which we will allocate at start of module itself. Then whenever we need any new skb, we will take it from that pool. I think it will take less time.
I don't know weather it is right or wrong, even don't know how to implement it. You please explain me. Should I do it or not. If yes then How??
M really thank full to you. My English is not that much good. Beg me pardon.
As we do in kernel, like "for_each_online_cpu()" I have created a kernel thread. That thread is bounded to available cpu. Thread's function is like, It will pick one packet from KFIFO. that packet is having information about coming IP,mac, etc. It will add these info to new allocated skb and send it using "dev_xmit()".
The allocation of skb is taking time in that thread. That's why I thought, I can use pre-allocated pool of skb. So that I won't be needed to allocate and de-allocate skb every time.
I have implemented it. But the thing is its getting more time, then previous.
As of now my statistics is :-
When allocate an skb - time taken > 400 mostly always greater then 1100.
de-allocation - time > 50-60
In terms of pool :-
dequeue the skb from pool - time taken > 300-400
again enqueue back to pool - time > 450
In between we have to re-initialize the skb that takes - time 300-700
Time is in terms of cpu ticks.
It may be possible that I am not implementing pool in a proper manner.
So, Please tell explain me, whatever I am doing is right or wrong.
Tell me the mechanism of skb pool implementation.