Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jul 2008
Duplicating skb without using skb_copy
I have a network driver in its final stages of development that needs some optimization. Its purpose is to accept data from the user, slap on some custom headers, and then transmit it out two different interfaces.
The bulk of the data, from payload to LLC/SNAP encapsulation is all the same. The only difference between the two packets is the layer 2 information.
|---- Layer 2 ----| |---- SNAP / LLC ----| |---- Other headers / data ----|
The way the xmit( ) function works right now is that it takes the original incoming skb, allocates appropriate headroom for it, and then slaps on the custom headers. Snippets of the rest, in pseudocode, is as follows:
if interface 2 is up and running
clone the original skbcopy appropriate layer 2 information for the new skbdev_queue_xmit the new skb}
if interface 1 is up and running
copy appropriate layer 2 information for original skbdev_queue_xmit the original skb}
//kfree_skb( ) of original and copy both handled by kernel post transmission
In this implementation it works just fine. However, I would like to avoid the costly overhead of skb_copy because the packet data is almost the exact same between the two skbs. I have contemplated using skb_clone, but since I still need to modify the data, this will not work. Is it possible to do this without skb_copy()'ing the packet? Or is it possible to fragment the data (e.g., the layer 2 information is in one part of memory, the data in another) and then have the kernel linearize it? Is that even possible?
Thanks for any help