From: David Laight <David.Laight@ACULAB.COM>
To: 'Eric Dumazet' <edumazet@google.com>
Cc: David Ahern <dsahern@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Soheil Hassas Yeganeh <soheil@google.com>,
Neal Cardwell <ncardwell@google.com>,
Yuchung Cheng <ycheng@google.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>
Subject: RE: [PATCH net-next 3/3] tcp: derive delack_max from rto_min
Date: Fri, 22 Sep 2023 16:51:08 +0000 [thread overview]
Message-ID: <19f0c2696eb4419cad21e20fe6d54bcb@AcuMS.aculab.com> (raw)
In-Reply-To: <CANn89iK_sMY1=OOqJ_XPuumJFBGesw964EJY1JbU9oGRUH1c0g@mail.gmail.com>
From: Eric Dumazet
> Sent: 22 September 2023 11:53
>
> On Fri, Sep 22, 2023 at 11:59 AM David Laight <David.Laight@aculab.com> wrote:
> >
> > From: Eric Dumazet
> > > Sent: 21 September 2023 13:58
> > >
> > > On Thu, Sep 21, 2023 at 2:37 PM David Ahern <dsahern@kernel.org> wrote:
> > > >
> > >
> > > > My comment is solely about mismatch on data types. I am surprised use of
> > > > max_t with mixed data types does not throw a compiler warning.
> > >
> > > This was intentional.
> > >
> > > This is max_t() purpose really.
> >
> > Apart from when it gets used to accidentally mask high bits :-)
> > (Although hat is usually consigned to min_t()).
>
> As explained, this is not an accident, but a conscious decision I made.
>
> >
> > Here
> > u32 delack_from_rto_min = max(rto_min, 2u) - 1;
> > would probably be safer (as in have no casts that might have
> > unwanted side effects).
> >
>
> I find my solution more readable.
It has to be said I didn't really like mine either :-)
A better alternative would be:
max((int)rto_min - 1, 1)
to make it absolutely clear what is going on.
Far too many of the min_t() and max_t() are just used to silence
the over-enthusiastic type checking of min() and max().
So code doing something different might be best making it more obvious.
Does 'ip route' stop very large values for rto_min?
Unsigned values with the top bit set might cause 'interesting' behaviour!
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2023-09-22 16:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-20 17:29 [PATCH net-next 0/3] tcp: add tcp_delack_max() Eric Dumazet
2023-09-20 17:29 ` [PATCH net-next 1/3] net: constify sk_dst_get() and __sk_dst_get() argument Eric Dumazet
2023-09-20 17:29 ` [PATCH net-next 2/3] tcp: constify tcp_rto_min() and tcp_rto_min_us() argument Eric Dumazet
2023-09-20 17:29 ` [PATCH net-next 3/3] tcp: derive delack_max from rto_min Eric Dumazet
2023-09-20 17:34 ` Soheil Hassas Yeganeh
2023-09-20 19:06 ` Neal Cardwell
2023-09-20 21:57 ` David Ahern
2023-09-21 2:16 ` Eric Dumazet
2023-09-21 12:37 ` David Ahern
2023-09-21 12:58 ` Eric Dumazet
2023-09-22 9:59 ` David Laight
2023-09-22 10:53 ` Eric Dumazet
2023-09-22 16:51 ` David Laight [this message]
2023-10-01 12:20 ` [PATCH net-next 0/3] tcp: add tcp_delack_max() patchwork-bot+netdevbpf
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=19f0c2696eb4419cad21e20fe6d54bcb@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=soheil@google.com \
--cc=ycheng@google.com \
/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).