[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <344a6d47-3d4d-ee98-10ef-c710b8538f24@gmail.com>
Date: Tue, 2 Nov 2021 11:50:46 +0200
From: Leonard Crestez <cdleonard@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>,
Francesco Ruggeri <fruggeri@...sta.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Herbert Xu <herbert@...dor.apana.org.au>,
Kuniyuki Iwashima <kuniyu@...zon.co.jp>,
David Ahern <dsahern@...nel.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>,
Yuchung Cheng <ycheng@...gle.com>,
Mat Martineau <mathew.j.martineau@...ux.intel.com>,
Christoph Paasch <cpaasch@...le.com>,
Ivan Delalande <colona@...sta.com>,
Priyaranjan Jha <priyarjha@...gle.com>, netdev@...r.kernel.org,
linux-crypto@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
Dmitry Safonov <0x7f454c46@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Shuah Khan <shuah@...nel.org>
Subject: Re: [PATCH v2 11/25] tcp: authopt: Implement Sequence Number
Extension
On 11/1/21 10:54 PM, Eric Dumazet wrote:
> On 11/1/21 9:34 AM, Leonard Crestez wrote:
>> Add a compute_sne function which finds the value of SNE for a certain
>> SEQ given an already known "recent" SNE/SEQ. This is implemented using
>> the standard tcp before/after macro and will work for SEQ values that
>> are without 2^31 of the SEQ for which we know the SNE.
>
>> }
>> +void __tcp_authopt_update_rcv_sne(struct tcp_sock *tp, struct tcp_authopt_info *info, u32 seq);
>> +static inline void tcp_authopt_update_rcv_sne(struct tcp_sock *tp, u32 seq)
>> +{
>> + struct tcp_authopt_info *info;
>> +
>> + if (static_branch_unlikely(&tcp_authopt_needed)) {
>> + rcu_read_lock();
>> + info = rcu_dereference(tp->authopt_info);
>> + if (info)
>> + __tcp_authopt_update_rcv_sne(tp, info, seq);
>> + rcu_read_unlock();
>> + }
>> +}
>> +void __tcp_authopt_update_snd_sne(struct tcp_sock *tp, struct tcp_authopt_info *info, u32 seq);
>> +static inline void tcp_authopt_update_snd_sne(struct tcp_sock *tp, u32 seq)
>> +{
>> + struct tcp_authopt_info *info;
>> +
>> + if (static_branch_unlikely(&tcp_authopt_needed)) {
>> + rcu_read_lock();
>> + info = rcu_dereference(tp->authopt_info);
>> + if (info)
>> + __tcp_authopt_update_snd_sne(tp, info, seq);
>> + rcu_read_unlock();
>> + }
>> +}
>>
>
> I would think callers of these helpers own socket lock,
> so no rcu_read_lock()/unlock() should be needed.
>
> Perhaps instead
> rcu_dereference_protected(tp->authopt_info, lockdep_sock_is_held(sk));
Yes, all the callers hold the socket lock and replacing rcu_read_lock
doesn't trigger any RCU warnings.
--
Regards,
Leonard
Powered by blists - more mailing lists