* skb_clone slower than copying skb data
@ 2004-08-02 14:13 Bertrand Guay-Paquet
0 siblings, 0 replies; only message in thread
From: Bertrand Guay-Paquet @ 2004-08-02 14:13 UTC (permalink / raw)
To: netdev
Hello,
I am writing a patch for the usbnet driver to add support for the
Prolific PL2501 USB host-to-host cable. My question is entirely related
to netdev business however, so please read on.
In order to achieve Win32 interropability, the driver needs to receive
up to 6 ethernet packets wrapped up in a single skb. My current
implementation for reading the contained individual packets is:
(simplified to show relevant parts)
for (each packet in skb except last one) {
length = packet_length();
if (!(skb2 = alloc_skb(length, GFP_ATOMIC)))
return -ENOMEM;
//Copy the data related to the current ethernet packet
memcpy(skb_put(skb2, length), skb->data, length);
//Jump to next ethernet packet
skb_pull(skb, length);
netif_rx(skb2);
}
//Process last packet
netif_rx(skb);
==========
This works very well but uses unnecessary memory for the memcpy. I then
tried: (again simplified to show relevant parts):
for (each packet in skb except last one) {
length = packet_length();
if (!(skb2 = skb_clone(skb, GFP_ATOMIC)))
return -ENOMEM;
//Copy the data related to the current ethernet packet
skb_trim(skb2, length);
//Jump to next ethernet packet
skb_pull(skb, length);
netif_rx(skb2);
}
//Process last packet
netif_rx(skb);
==========
This works as well, but the throughput is cut in half. How can this be
so? Is skb_clone combined with netif_rx supposed to be so slow? I have
searched other uses of skb_clone and have not found any similar to mine
so I do not know if this is normal behaviour or not. I have tried using
skb_clone with 2.4.26 and 2.6.7 with the same results.
Any help would be greatly appreciated!
Bertrand
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-08-02 14:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-02 14:13 skb_clone slower than copying skb data Bertrand Guay-Paquet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).