From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jon Maxwell <jmaxwell37@gmail.com>, davem@davemloft.net
Cc: edumazet@google.com, ncardwell@google.com,
David.Laight@aculab.com, kuznet@ms2.inr.ac.ru,
yoshfuji@linux-ipv6.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, jmaxwell@redhat.com
Subject: Re: [net-next, 3/3] tcp: convert icsk_user_timeout from jiffies to msecs
Date: Mon, 16 Jul 2018 09:00:09 -0700 [thread overview]
Message-ID: <9a96cc7d-e7bd-5be2-9ce4-e74918773560@gmail.com> (raw)
In-Reply-To: <20180713004919.18608-1-jmaxwell37@gmail.com>
On 07/12/2018 05:49 PM, Jon Maxwell wrote:
> The final patch in this series. Create the tcp_clamp_rto_to_user_timeout()
> helper routine. To calculate the correct rto, so that the TCP_USER_TIMEOUT
> socket option is more accurate. Taking suggestions and feedback into account
> from Eric Dumazet, Neal Cardwell and David Laight. Due to the 1st commit we
> can avoid the msecs_to_jiffies() and jiffies_to_msecs() dance.
>
> Signed-off-by: Jon Maxwell <jmaxwell37@gmail.com>
> ---
> net/ipv4/tcp_timer.c | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
> index 8ab8c9645294..d4d4b30a6bec 100644
> --- a/net/ipv4/tcp_timer.c
> +++ b/net/ipv4/tcp_timer.c
> @@ -36,6 +36,22 @@ u32 tcp_retransmit_stamp(const struct sock *sk)
> return start_ts;
> }
>
> +static u32 tcp_clamp_rto_to_user_timeout(const struct sock *sk)
> +{
> + struct inet_connection_sock *icsk = inet_csk(sk);
> + u32 elapsed, start_ts;
> +
> + start_ts = tcp_retransmit_stamp(sk);
> + if (!icsk->icsk_user_timeout || !start_ts)
> + return icsk->icsk_rto;
> + elapsed = tcp_time_stamp(tcp_sk(sk)) - start_ts;
> + if (elapsed >= icsk->icsk_user_timeout)
> + return 1; /* user timeout has passed; fire ASAP */
> + else
> + return min_t(u32, icsk->icsk_rto, msecs_to_jiffies(icsk->icsk_user_timeout -
> + elapsed));
if (elapsed >= icsk->icsk_user_timeout)
return 1; /* user timeout has passed; fire ASAP */
return min_t(u32, icsk->icsk_rto, msecs_to_jiffies(icsk->icsk_user_timeout - elapsed));
Thanks !
next prev parent reply other threads:[~2018-07-16 16:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 0:49 [net-next, 3/3] tcp: convert icsk_user_timeout from jiffies to msecs Jon Maxwell
2018-07-16 16:00 ` Eric Dumazet [this message]
2018-07-16 23:17 ` Jonathan Maxwell
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=9a96cc7d-e7bd-5be2-9ce4-e74918773560@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=David.Laight@aculab.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jmaxwell37@gmail.com \
--cc=jmaxwell@redhat.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.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).