From: Cong Wang <xiyou.wangcong@gmail.com>
To: Lorenz Bauer <lmb@cloudflare.com>
Cc: Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
duanxiongchun@bytedance.com,
Dongdong Wang <wangdongdong.6@bytedance.com>,
Jiang Wang <jiang.wang@bytedance.com>,
Cong Wang <cong.wang@bytedance.com>,
John Fastabend <john.fastabend@gmail.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Jakub Sitnicki <jakub@cloudflare.com>
Subject: Re: [Patch bpf-next v2 2/9] sock: introduce sk_prot->update_proto()
Date: Wed, 3 Mar 2021 10:20:48 -0800 [thread overview]
Message-ID: <CAM_iQpWHTvFPifcPL-x64fWqY5k8yP9vu6Bnp8D-HdpUp6vs6g@mail.gmail.com> (raw)
In-Reply-To: <CACAyw99BweMk-82f270=Vb=jDuec0q0N-6E8Rr8enaOGuZEDNQ@mail.gmail.com>
On Wed, Mar 3, 2021 at 1:35 AM Lorenz Bauer <lmb@cloudflare.com> wrote:
>
> On Tue, 2 Mar 2021 at 18:23, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> >
> > > 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.
next prev parent reply other threads:[~2021-03-03 22:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 2:37 [Patch bpf-next v2 0/9] sockmap: introduce BPF_SK_SKB_VERDICT and support UDP Cong Wang
2021-03-02 2:37 ` [Patch bpf-next v2 1/9] sock_map: introduce BPF_SK_SKB_VERDICT Cong Wang
2021-03-02 2:37 ` [Patch bpf-next v2 2/9] sock: introduce sk_prot->update_proto() Cong Wang
2021-03-02 16:22 ` Lorenz Bauer
2021-03-02 18:23 ` Cong Wang
2021-03-03 9:35 ` Lorenz Bauer
2021-03-03 18:20 ` Cong Wang [this message]
2021-03-04 9:30 ` Lorenz Bauer
2021-03-04 23:52 ` Cong Wang
2021-03-06 0:27 ` John Fastabend
2021-03-06 0:57 ` Cong Wang
2021-03-06 1:55 ` John Fastabend
2021-03-09 17:53 ` Cong Wang
2021-03-10 6:33 ` John Fastabend
2021-03-02 2:37 ` [Patch bpf-next v2 3/9] udp: implement ->sendmsg_locked() Cong Wang
2021-03-02 2:37 ` [Patch bpf-next v2 4/9] udp: implement ->read_sock() for sockmap Cong Wang
2021-03-03 6:26 ` Yonghong Song
2021-03-02 2:37 ` [Patch bpf-next v2 5/9] udp: add ->read_sock() and ->sendmsg_locked() to ipv6 Cong Wang
2021-03-02 16:23 ` Lorenz Bauer
2021-03-02 17:59 ` Cong Wang
2021-03-02 2:37 ` [Patch bpf-next v2 6/9] skmsg: extract __tcp_bpf_recvmsg() and tcp_bpf_wait_data() Cong Wang
2021-03-02 2:37 ` [Patch bpf-next v2 7/9] udp: implement udp_bpf_recvmsg() for sockmap Cong Wang
2021-03-02 2:37 ` [Patch bpf-next v2 8/9] sock_map: update sock type checks for UDP Cong Wang
2021-03-03 6:37 ` Yonghong Song
2021-03-03 18:02 ` Cong Wang
2021-03-03 18:50 ` Yonghong Song
2021-03-02 2:37 ` [Patch bpf-next v2 9/9] selftests/bpf: add a test case for udp sockmap Cong Wang
2021-03-02 16:31 ` Lorenz Bauer
2021-03-02 18:05 ` Cong Wang
2021-03-03 10:20 ` Lorenz Bauer
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=CAM_iQpWHTvFPifcPL-x64fWqY5k8yP9vu6Bnp8D-HdpUp6vs6g@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=cong.wang@bytedance.com \
--cc=daniel@iogearbox.net \
--cc=duanxiongchun@bytedance.com \
--cc=jakub@cloudflare.com \
--cc=jiang.wang@bytedance.com \
--cc=john.fastabend@gmail.com \
--cc=lmb@cloudflare.com \
--cc=netdev@vger.kernel.org \
--cc=wangdongdong.6@bytedance.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).