[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+-3saYRN9YUuujYnW8PvmkyUTHmRDX3bUXdbYoGfo=iA@mail.gmail.com>
Date: Thu, 21 Sep 2023 04:16:22 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: David Ahern <dsahern@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Soheil Hassas Yeganeh <soheil@...gle.com>,
Neal Cardwell <ncardwell@...gle.com>, Yuchung Cheng <ycheng@...gle.com>, netdev@...r.kernel.org,
eric.dumazet@...il.com
Subject: Re: [PATCH net-next 3/3] tcp: derive delack_max from rto_min
On Wed, Sep 20, 2023 at 11:57 PM David Ahern <dsahern@...nel.org> wrote:
>
> On 9/20/23 11:29 AM, Eric Dumazet wrote:
> > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> > index 1fc1f879cfd6c28cd655bb8f02eff6624eec2ffc..2d1e4b5ac1ca41ff3db8dc58458d4e922a2c4999 100644
> > --- a/net/ipv4/tcp_output.c
> > +++ b/net/ipv4/tcp_output.c
> > @@ -3977,6 +3977,20 @@ int tcp_connect(struct sock *sk)
> > }
> > EXPORT_SYMBOL(tcp_connect);
> >
> > +u32 tcp_delack_max(const struct sock *sk)
> > +{
> > + const struct dst_entry *dst = __sk_dst_get(sk);
> > + u32 delack_max = inet_csk(sk)->icsk_delack_max;
> > +
> > + if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) {
> > + u32 rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
> > + u32 delack_from_rto_min = max_t(int, 1, rto_min - 1);
>
> `u32` type with max_t type set as `int`
That is because we allow "rto_min 0" in ip route ...
rto_min - 1 is then 0xFFFFFFFF
We could argue that "rto_min 0" would be illegal, but this is orthogonal.
>
> > +
> > + delack_max = min_t(u32, delack_max, delack_from_rto_min);
> > + }
> > + return delack_max;
> > +}
> > +
> > /* Send out a delayed ack, the caller does the policy checking
> > * to see if we should even be here. See tcp_input.c:tcp_ack_snd_check()
> > * for details.
> > @@ -4012,7 +4026,7 @@ void tcp_send_delayed_ack(struct sock *sk)
> > ato = min(ato, max_ato);
> > }
> >
> > - ato = min_t(u32, ato, inet_csk(sk)->icsk_delack_max);
> > + ato = min_t(u32, ato, tcp_delack_max(sk));
>
> and then here ato is an `int`.
> >
> > /* Stay within the limit we were given */
> > timeout = jiffies + ato;
>
Powered by blists - more mailing lists