Re: [TCP]: Account skb overhead in tcp_fragment

2006-04-19 Thread Herbert Xu
On Thu, Apr 20, 2006 at 11:01:11AM +1000, herbert wrote:
 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.

Here is a better version that does not double-count the paged bits
that get moved across.
 
Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 44df1db..a28ae59 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -533,6 +533,7 @@
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *buff;
int nsize, old_factor;
+   int nlen;
u16 flags;
 
BUG_ON(len  skb-len);
@@ -552,8 +553,10 @@
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);
+   nlen = skb-len - len - nsize;
+   buff-truesize += nlen;
+   skb-truesize -= nlen;
 
/* Correct the sequence numbers. */
TCP_SKB_CB(buff)-seq = TCP_SKB_CB(skb)-seq + len;
@@ -1039,7 +1042,8 @@
if (unlikely(buff == NULL))
return -ENOMEM;
 
-   buff-truesize = nlen;
+   sk_charge_skb(sk, buff);
+   buff-truesize += nlen;
skb-truesize -= nlen;
 
/* Correct the sequence numbers. */


Re: [TCP]: Account skb overhead in tcp_fragment

2006-04-19 Thread David S. Miller
From: Herbert Xu [EMAIL PROTECTED]
Date: Thu, 20 Apr 2006 13:26:02 +1000

 On Thu, Apr 20, 2006 at 11:01:11AM +1000, herbert wrote:
  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.
 
 Here is a better version that does not double-count the paged bits
 that get moved across.
  
 Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Looks good, I'll apply this.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html