lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 17 Jul 2018 09:17:35 +1000
From:   Jonathan Maxwell <jmaxwell37@...il.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     David Miller <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Neal Cardwell <ncardwell@...gle.com>,
        David Laight <David.Laight@...lab.com>,
        kuznet <kuznet@....inr.ac.ru>,
        yoshfuji <yoshfuji@...ux-ipv6.org>,
        Netdev <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Jon Maxwell <jmaxwell@...hat.com>
Subject: Re: [net-next, 3/3] tcp: convert icsk_user_timeout from jiffies to msecs

Sorry Eric, my bad. I'll do another version with the indentation fixed and
reformatting of min_t() and resubmit.

On Tue, Jul 17, 2018 at 2:00 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
>
>
> 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@...il.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 !

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ