[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231207105236.GE50400@kernel.org>
Date: Thu, 7 Dec 2023 10:52:36 +0000
From: Simon Horman <horms@...nel.org>
To: Dmitry Safonov <dima@...sta.com>
Cc: David Ahern <dsahern@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
linux-kernel@...r.kernel.org, Dmitry Safonov <0x7f454c46@...il.com>,
Francesco Ruggeri <fruggeri05@...il.com>,
Salam Noureddine <noureddine@...sta.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v4 6/7] net/tcp: Store SNEs + SEQs on ao_info
On Mon, Dec 04, 2023 at 05:08:20PM +0000, Dmitry Safonov wrote:
> Hi Simon,
>
> On 12/2/23 17:16, Simon Horman wrote:
> > On Wed, Nov 29, 2023 at 04:57:20PM +0000, Dmitry Safonov wrote:
> >> RFC 5925 (6.2):
> >>> TCP-AO emulates a 64-bit sequence number space by inferring when to
> >>> increment the high-order 32-bit portion (the SNE) based on
> >>> transitions in the low-order portion (the TCP sequence number).
> >>
> >> snd_sne and rcv_sne are the upper 4 bytes of extended SEQ number.
> >> Unfortunately, reading two 4-bytes pointers can't be performed
> >> atomically (without synchronization).
> >>
> >> In order to avoid locks on TCP fastpath, let's just double-account for
> >> SEQ changes: snd_una/rcv_nxt will be lower 4 bytes of snd_sne/rcv_sne.
> >>
> >> Fixes: 64382c71a557 ("net/tcp: Add TCP-AO SNE support")
> >> Signed-off-by: Dmitry Safonov <dima@...sta.com>
> >
> > ...
> >
> >> diff --git a/include/net/tcp_ao.h b/include/net/tcp_ao.h
> >> index 647781080613..b8ef25d4b632 100644
> >> --- a/include/net/tcp_ao.h
> >> +++ b/include/net/tcp_ao.h
> >> @@ -121,8 +121,8 @@ struct tcp_ao_info {
> >> * - for time-wait sockets the basis is tw_rcv_nxt/tw_snd_nxt.
> >> * tw_snd_nxt is not expected to change, while tw_rcv_nxt may.
> >> */
> >> - u32 snd_sne;
> >> - u32 rcv_sne;
> >> + u64 snd_sne;
> >> + u64 rcv_sne;
> >> refcount_t refcnt; /* Protects twsk destruction */
> >> struct rcu_head rcu;
> >> };
> >
> > Hi Dmitry,
> >
> > In tcp_ao.c:tcp_ao_connect_init() there is a local
> > variable:
> >
> > struct tcp_ao_info *ao_info;
> >
> > And the following assignment occurs:
> >
> > ao_info->snd_sne = htonl(tp->write_seq);
> >
> > Is this still correct in light of the change of the type of snd_sne?
>
> Thanks for the report.
> Yes, it's correct as lower 4-bytes are initialized as initial SEQ.
> I'll add a cast for it if I'll go with v5 for this patch.
Thanks Dmitry,
I think that would address my concern.
Powered by blists - more mailing lists