diff mbox

[RFC,net] tcp: Update pcount after skb_pull() during mtu probing

Message ID 20150605230206.GD2951343@devbig242.prn2.facebook.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Martin KaFai Lau June 5, 2015, 11:02 p.m. UTC
On Fri, Jun 05, 2015 at 02:23:55PM -0700, Eric Dumazet wrote:
> On Fri, 2015-06-05 at 11:02 -0700, Martin KaFai Lau wrote:
> 
> > tcp_trim_head() does not take the mss_now.
> > Is it fine to have mss_now <= tcp_skb_mss(skb)? or we can depend on
> > the tcp_init_tso_segs() in the tcp_write_xmit() to take care of it?
> 
> It should be fine : packets not yet sent have tcp_skb_pcount()==0,
> so that tcp_init_tso_segs() can do the computation at the right time.
hmm.... From tcp_write_xmit(), tcp_init_tso_segs() makes tcp_skb_pcount(skb) > 0
but it may not be sent out immediately (like failing tcp_cwnd_test()).  Later,
this skb is considered for tcp_mtu_probe(), sliced and forgot to update the
pcount, I think.

I am probably missing something.  Hence, I have a side question
in tcp_init_tso_segs(),  should pcount be also recalculated if
(tso_segs == 1 && mss_now < skb->len)?  Like this:

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Dumazet June 5, 2015, 11:45 p.m. UTC | #1
On Fri, 2015-06-05 at 16:02 -0700, Martin KaFai Lau wrote:
> On Fri, Jun 05, 2015 at 02:23:55PM -0700, Eric Dumazet wrote:
> > On Fri, 2015-06-05 at 11:02 -0700, Martin KaFai Lau wrote:
> > 
> > > tcp_trim_head() does not take the mss_now.
> > > Is it fine to have mss_now <= tcp_skb_mss(skb)? or we can depend on
> > > the tcp_init_tso_segs() in the tcp_write_xmit() to take care of it?
> > 
> > It should be fine : packets not yet sent have tcp_skb_pcount()==0,
> > so that tcp_init_tso_segs() can do the computation at the right time.
> hmm.... From tcp_write_xmit(), tcp_init_tso_segs() makes tcp_skb_pcount(skb) > 0
> but it may not be sent out immediately (like failing tcp_cwnd_test()).  Later,
> this skb is considered for tcp_mtu_probe(), sliced and forgot to update the
> pcount, I think.

Then clear pcount at this point, if this is a requirement.

Or else the test on !tso_segs seems quite lazy to me.

> 
> I am probably missing something.  Hence, I have a side question
> in tcp_init_tso_segs(),  should pcount be also recalculated if
> (tso_segs == 1 && mss_now < skb->len)?  Like this:
> 
> diff --git i/net/ipv4/tcp_output.c w/net/ipv4/tcp_output.c
> index a369e8a..15d1c44 100644
> --- i/net/ipv4/tcp_output.c
> +++ w/net/ipv4/tcp_output.c
> @@ -1624,7 +1624,8 @@ static int tcp_init_tso_segs(const struct sock *sk, struct sk_buff *skb,
>  {
>  	int tso_segs = tcp_skb_pcount(skb);
> 
> -	if (!tso_segs || (tso_segs > 1 && tcp_skb_mss(skb) != mss_now)) {
> +	if (!tso_segs || (tso_segs > 1 && tcp_skb_mss(skb) != mss_now) ||
> +	    (tso_segs == 1 && mss_now < skb->len)) {
>  		tcp_set_skb_tso_segs(sk, skb, mss_now);
>  		tso_segs = tcp_skb_pcount(skb);
>  	}


See above. Lets keep fast path as fast as possible ;)





--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git i/net/ipv4/tcp_output.c w/net/ipv4/tcp_output.c
index a369e8a..15d1c44 100644
--- i/net/ipv4/tcp_output.c
+++ w/net/ipv4/tcp_output.c
@@ -1624,7 +1624,8 @@  static int tcp_init_tso_segs(const struct sock *sk, struct sk_buff *skb,
 {
 	int tso_segs = tcp_skb_pcount(skb);

-	if (!tso_segs || (tso_segs > 1 && tcp_skb_mss(skb) != mss_now)) {
+	if (!tso_segs || (tso_segs > 1 && tcp_skb_mss(skb) != mss_now) ||
+	    (tso_segs == 1 && mss_now < skb->len)) {
 		tcp_set_skb_tso_segs(sk, skb, mss_now);
 		tso_segs = tcp_skb_pcount(skb);
 	}