Networking Forums

Networking Forums > Computer Networking > Linux Networking > best strategy to allocate buffer to replicate TCP packets

Reply
Thread Tools Display Modes

best strategy to allocate buffer to replicate TCP packets

 
 
will_u_tellmemore
Guest
Posts: n/a

 
      12-20-2006, 08:51 AM
Hi All,

As part of project fault-tolerant TCP , I am implementing a kernel
module which will intercept all inbound /outbound packets for the
connection to be monitored . I use netfilter module to insert my hooks
and get those packets.(I use PRE_ROUTING and POST_ROUTING hooks).

Now correct me if i go wrong in any of my next statements.

My hook will be called in interrupt context, so i can not block
from that , so i put those packets in a work-queue which i create at
module initialization. Before putting that hook there, i copy data from
sk_buff structure and the payload also. I am using kmalloc with
GFP_ATOMIC flag. Is this right way to allocate memory to replicate this
data ??

My concerns :

1: There must be limitation to how much kmalloc can give with
GFP_ATOMIC . I wont require more than skb buffer ever but this
allocated memory will be freed only when my worker thread send that
data to another server over a TCP socket.

Will there be case when i will have allocated lots of memory in this
way ?? I guess no ,as my worker thread should execute quite often than
not if there are pending data to be sent.

2: Also there seems to be skb_clone , which can also be used. This may
be faster method as it uses some cache i guess. But i have not
investigated into this much.

3: Or computing some max limit for pending packets at any time and
allocating memory for them in the module initialization and instead of
freeing it using same again and again. This way if i get it in the
start , i will be always safe. but this method doesn't look very
attractive as computing max limit may be very difficult and if i try to
be conservative , the value can be very high in other word useless.

So what are your suggestion about this allocation and how exactly it
should be done for performance issues.

Thanks ,
Rohit






What i was bit confused about is :

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading packets into a buffer lancer6238@yahoo.com Linux Networking 4 03-28-2011 04:23 PM
DHCP Does Not allocate IP Adam Simmonds (SimAda00) Windows Networking 1 11-07-2006 10:21 PM
Child domains don't replicate with each other? Jan Dye Windows Networking 3 10-13-2005 12:24 AM
How to set Max UDP Receive Buffer Size and Max UDP Transmit Buffer Size under Windows 2000 and Windows 2003 ? msnews.microsoft.com Windows Networking 0 09-14-2005 07:20 PM
Replicate over VPN Harry Piedra Windows Networking 3 09-01-2005 12:28 AM



1 2 3 4 5 6 7 8 9 10 11