Netdev List
 help / color / mirror / Atom feed
* [TCP]: Account skb overhead in tcp_fragment
@ 2006-04-20  1:01 Herbert Xu
  2006-04-20  3:26 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2006-04-20  1:01 UTC (permalink / raw)
  To: David S. Miller, netdev

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

Hi Dave:

Since sk_stream_alloc_pskb takes an extra argument that accounts for
paged data all we need to do to account sk_buff overhead correctly
is to use that instead of sk_stream_alloc_skb.

This patch does just that for both tcp_fragment and tso_fragment.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

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: tcp-fragment-charge.patch --]
[-- Type: text/plain, Size: 1062 bytes --]

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 44df1db..fb40d32 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -548,12 +548,10 @@
 		return -ENOMEM;
 
 	/* Get a new skb... force flag on. */
-	buff = sk_stream_alloc_skb(sk, nsize, GFP_ATOMIC);
+	buff = sk_stream_alloc_pskb(sk, nsize, skb->len - len - nsize, GFP_ATOMIC);
 	if (buff == NULL)
 		return -ENOMEM; /* We'll just try again later. */
-
-	buff->truesize = skb->len - len;
-	skb->truesize -= buff->truesize;
+	sk_charge_skb(sk, buff);
 
 	/* Correct the sequence numbers. */
 	TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len;
@@ -1035,12 +1033,10 @@
 	if (skb->len != skb->data_len)
 		return tcp_fragment(sk, skb, len, mss_now);
 
-	buff = sk_stream_alloc_pskb(sk, 0, 0, GFP_ATOMIC);
+	buff = sk_stream_alloc_pskb(sk, 0, nlen, GFP_ATOMIC);
 	if (unlikely(buff == NULL))
 		return -ENOMEM;
-
-	buff->truesize = nlen;
-	skb->truesize -= nlen;
+	sk_charge_skb(sk, buff);
 
 	/* Correct the sequence numbers. */
 	TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len;

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

end of thread, other threads:[~2006-04-20  4:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-20  1:01 [TCP]: Account skb overhead in tcp_fragment Herbert Xu
2006-04-20  3:26 ` Herbert Xu
2006-04-20  4:31   ` 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