netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2][RFC] vlan: use pskb_copy() when inserting a vlan tag by hand
@ 2008-07-07 20:56 Lennert Buytenhek
  2008-07-07 21:01 ` Patrick McHardy
  0 siblings, 1 reply; 14+ messages in thread
From: Lennert Buytenhek @ 2008-07-07 20:56 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: Nicolas Pitre, Dale Farnsworth, Ashish Karkare,
	Jesper Dangaard Brouer, netdev

When inserting a vlan tag into an skb by hand (in the case the
target network device hardware does not support inserting a vlan
tag by passing it in via the TX descriptor), making a copy of the
skb to be modified by calling skb_copy() is overkill, since
skb_copy() will needlessly linearize the skb, copying of all of
the fragmented data around, and checksumming the paket in software
even if the hardware is perfectly capable of doing that by itself.

For this case, pskb_copy() does exactly what is needed and no more,
so use that instead.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>

Index: linux-2.6.26-rc9/net/8021q/vlan_dev.c
===================================================================
--- linux-2.6.26-rc9.orig/net/8021q/vlan_dev.c
+++ linux-2.6.26-rc9/net/8021q/vlan_dev.c
@@ -74,7 +74,7 @@ static inline struct sk_buff *vlan_check
 {
 	if (vlan_dev_info(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) {
 		if (skb_shared(skb) || skb_cloned(skb)) {
-			struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
+			struct sk_buff *nskb = pskb_copy(skb, GFP_ATOMIC);
 			kfree_skb(skb);
 			skb = nskb;
 		}

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-07-08 22:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-07 20:56 [PATCH 1/2][RFC] vlan: use pskb_copy() when inserting a vlan tag by hand Lennert Buytenhek
2008-07-07 21:01 ` Patrick McHardy
2008-07-07 21:07   ` Lennert Buytenhek
2008-07-07 21:15     ` Patrick McHardy
2008-07-08 16:24       ` Patrick McHardy
2008-07-08 17:41         ` Patrick McHardy
2008-07-08 18:52         ` Lennert Buytenhek
2008-07-08 18:50           ` Patrick McHardy
2008-07-08 19:33             ` Lennert Buytenhek
2008-07-08 20:15               ` Patrick McHardy
2008-07-08 22:02                 ` David Miller
2008-07-08 22:18                   ` Patrick McHardy
2008-07-08 22:37                     ` David Miller
2008-07-08 22:10             ` Ben Hutchings

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).