Thread (30 messages) flat view 30 messages, 4 authors, 2021-03-10

Re: [Patch bpf-next v2 2/9] sock: introduce sk_prot->update_proto()

From: Cong Wang <hidden>
Date: 2021-03-03 22:57:34
Also in: bpf

On Wed, Mar 3, 2021 at 1:35 AM Lorenz Bauer [off-list ref] wrote:
On Tue, 2 Mar 2021 at 18:23, Cong Wang [off-list ref] wrote:
quoted
quoted
if the function returned a struct proto * like it does at the moment.
That way we keep sk->sk_prot manipulation confined to the sockmap code
and don't have to copy paste it into every proto.
Well, TCP seems too special to do this, as it could call tcp_update_ulp()
to update the proto.
I had a quick look, tcp_bpf_update_proto is the only caller of tcp_update_ulp,
which in turn is the only caller of icsk_ulp_ops->update, which in turn is only
implemented as tls_update in tls_main.c. Turns out that tls_update
has another one of these calls:

} else {
    /* Pairs with lockless read in sk_clone_lock(). */
    WRITE_ONCE(sk->sk_prot, p);
    sk->sk_write_space = write_space;
}

Maybe it looks familiar? :o) I think it would be a worthwhile change.
Yeah, I am not surprised we can change tcp_update_ulp() too, but
why should I bother kTLS when I do not have to? What you suggest
could at most save us a bit of code size, not a big gain. So, I'd keep
its return value as it is, unless you see any other benefits.

BTW, I will rename it to 'psock_update_sk_prot', please let me know
if you have any better names.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help