[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1334776707.2472.316.camel@edumazet-glaptop>
Date: Wed, 18 Apr 2012 21:18:27 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Neal Cardwell <ncardwell@...gle.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Tom Herbert <therbert@...gle.com>,
Maciej Żenczykowski <maze@...gle.com>,
Yuchung Cheng <ycheng@...gle.com>
Subject: Re: [PATCH net-next] tcp: avoid expensive pskb_expand_head() calls
On Wed, 2012-04-18 at 14:40 -0400, Neal Cardwell wrote:
>
> > + prev_packets_acked = tcp_skb_pcount(skb);
>
> FWIW, I'd find old_pcount or prev_pcount a little easier to read than
> prev_packets_acked here (I see "oldpcount" is used in tcp_output
> in a similar context).
>
You're right, I'll change this.
> > TCP_SKB_CB(skb)->seq += len;
> > + TCP_SKB_CB(skb)->header.offset_ack = 0;
>
> If the caller decides to trim a prefix of the skb that does not extend
> to snd_una, then setting offset_ack to 0 here will cause us to forget
> that some prefix is ACKed when we should have remembered this.
> However, the API for the function invites the caller to chop off an
> arbitrary amount (and there's no comment to disuade the caller from
> trying this). This seems to risk bugs in the future.
>
> To attempt to make this API safer and simpler for future generations,
> what do you think about calculating the len inside tcp_trim_head(),
> something like:
>
> static int tcp_trim_head(struct sock *sk, struct sk_buff *skb)
> {
> u32 len = tp->snd_una - TCP_SKB_CB(skb)->seq;
> ...
>
> ...
> if (tcp_trim_head(sk, skb))
> ...
>
Very good point, I'll use this suggestion too in v2.
Thanks !
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists