netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fan Du <fengyuleidian0615@gmail.com>
To: John Heffner <johnwheffner@gmail.com>
Cc: Fan Du <fan.du@intel.com>,
	edumazet@google.com, David Miller <davem@davemloft.net>,
	Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCHv3 net-next 2/4] ipv4: Use binary search to choose tcp PMTU probe_size
Date: Mon, 02 Mar 2015 17:29:50 +0800	[thread overview]
Message-ID: <54F42D8E.2050601@gmail.com> (raw)
In-Reply-To: <CABrhC0=ZPJwPOJFkuuJ+pJgn4CoVhZ2tJcrbce6kytVVtsy=9g@mail.gmail.com>

于 2015年03月01日 07:20, John Heffner 写道:
>> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
>> index a2a796c..c418829 100644
>> --- a/net/ipv4/tcp_output.c
>> +++ b/net/ipv4/tcp_output.c
>> @@ -1837,11 +1837,13 @@ static int tcp_mtu_probe(struct sock *sk)
>>          struct tcp_sock *tp = tcp_sk(sk);
>>          struct inet_connection_sock *icsk = inet_csk(sk);
>>          struct sk_buff *skb, *nskb, *next;
>> +       struct net *net = sock_net(sk);
>>          int len;
>>          int probe_size;
>>          int size_needed;
>>          int copy;
>>          int mss_now;
>> +       int interval;
>>
>>          /* Not currently probing/verifying,
>>           * not in recovery,
>> @@ -1854,11 +1856,17 @@ static int tcp_mtu_probe(struct sock *sk)
>>              tp->rx_opt.num_sacks || tp->rx_opt.dsack)
>>                  return -1;
>>
>> -       /* Very simple search strategy: just double the MSS. */
>> +       /* Use binary search for probe_size bewteen tcp_mss_base,
>> +        * and current mss_clamp. if (search_high - search_low)
>> +        * smaller than a threshold, backoff from probing.
>> +        */
>>          mss_now = tcp_current_mss(sk);
>> -       probe_size = 2 * tp->mss_cache;
>> +       probe_size = (icsk->icsk_mtup.search_high +
>> +                     icsk->icsk_mtup.search_low) >> 1;
>>          size_needed = probe_size + (tp->reordering + 1) * tp->mss_cache;
>> -       if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high)) {
>> +       interval = icsk->icsk_mtup.search_high - icsk->icsk_mtup.search_low;
>> +       if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high) ||
>> +           interval < net->ipv4.sysctl_tcp_probe_threshold) {
>>                  /* TODO: set timer for probe_converge_event */
>>                  return -1;
>>          }
>
> A couple things: the local variable probe_size here is TCP segment
> size, while search_low and search_high are IP datagram sizes.  Use
> tcp_mtu_to_mss to subtract headers.  Also, I think if you set
> sysctl_tcp_probe_threshold <= 0, this will keep probing indefinitely
> at search_low (not useful).  You probably want to test interval <
> max(1, sysctl_tcp_probe_threshold).
Thanks for the comments, will update in next version.
btw, I'm little confused about two points here:

1. Checking if there is enough user data available in write queue with size_needed,
    Is there any special consideration here involving (tp->reordering + 1) * tp->mss_cache ?
    Since the assembly always copies "probe_size" bytes data from the write queue.

    size_needed = probe_size + (tp->reordering + 1) * tp->mss_cache;

2. Traverse write queue to build probing packet with "probe_size" bytes segment,
    when will the final nskb len exceeding probe_size? which trigger the break in line:1971

1971                 if (len >= probe_size)
1972                         break;
1973         }
1974         tcp_init_tso_segs(sk, nskb, nskb->len);


>    -John
>

  reply	other threads:[~2015-03-02  9:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28  3:23 [PATCHv3 net-next 0/4] Improvements for TCP PMTU Fan Du
2015-02-28  3:23 ` [PATCHv3 net-next 1/4] ipv4: Raise tcp PMTU probe mss base size Fan Du
2015-02-28  3:23 ` [PATCHv3 net-next 2/4] ipv4: Use binary search to choose tcp PMTU probe_size Fan Du
2015-02-28 23:20   ` John Heffner
2015-03-02  9:29     ` Fan Du [this message]
2015-02-28  3:23 ` [PATCHv3 net-next 3/4] ipv4: shrink current mss for tcp PMTU blackhole detection Fan Du
2015-02-28 23:39   ` John Heffner
2015-03-02  9:29     ` Fan Du
2015-03-02 20:32       ` John Heffner
2015-03-03  9:18         ` Fan Du
2015-02-28  3:23 ` [PATCHv3 net-next 4/4] ipv4: Create probe timer for tcp PMTU as per RFC4821 Fan Du

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54F42D8E.2050601@gmail.com \
    --to=fengyuleidian0615@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fan.du@intel.com \
    --cc=johnwheffner@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).