netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: pskb_expand_head instead of skb_copy in skb_checksum_help
@ 2004-08-24 11:05 Herbert Xu
  2004-08-24 18:55 ` David S. Miller
  2004-08-25  0:17 ` David S. Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Herbert Xu @ 2004-08-24 11:05 UTC (permalink / raw)
  To: David S. Miller, jmorris, netdev

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

Hi:

Here is the patch that you wanted to shoot holes at :)

The idea is simple.  None of the callers of skb_checksum are passing it
skb's which are shared.  They may be cloned however.  But the application
checksum is always in the skb header so there is no need to linearise it.

Supposing all these assumptions are correct, then we can avoid the overhead
of skb_copy() and get away with pskb_expand_head().

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 586 bytes --]

===== net/core/dev.c 1.155 vs edited =====
--- 1.155/net/core/dev.c	2004-07-31 07:23:04 +10:00
+++ edited/net/core/dev.c	2004-08-24 20:59:57 +10:00
@@ -1144,16 +1144,10 @@
 		goto out;
 	}
 
-	if (skb_shared(*pskb)  || skb_cloned(*pskb)) {
-		struct sk_buff *newskb = skb_copy(*pskb, GFP_ATOMIC);
-		if (!newskb) {
-			ret = -ENOMEM;
+	if (skb_cloned(*pskb)) {
+		ret = pskb_expand_head(*pskb, 0, 0, GFP_ATOMIC);
+		if (ret)
 			goto out;
-		}
-		if ((*pskb)->sk)
-			skb_set_owner_w(newskb, (*pskb)->sk);
-		kfree_skb(*pskb);
-		*pskb = newskb;
 	}
 
 	if (offset > (int)(*pskb)->len)

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

end of thread, other threads:[~2004-08-25  0:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-24 11:05 RFC: pskb_expand_head instead of skb_copy in skb_checksum_help Herbert Xu
2004-08-24 18:55 ` David S. Miller
2004-08-24 20:53   ` James Morris
2004-08-25  0:17 ` David S. Miller

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