From: John Fastabend <john.fastabend@gmail.com>
To: Lorenz Bauer <lmb@cloudflare.com>,
john.fastabend@gmail.com, Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jakub Sitnicki <jakub@cloudflare.com>,
Lorenz Bauer <lmb@cloudflare.com>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Alexei Starovoitov <ast@kernel.org>
Cc: kernel-team@cloudflare.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: RE: [PATCH bpf-next v3 03/12] bpf: tcp: move assertions into tcp_bpf_get_proto
Date: Fri, 06 Mar 2020 07:25:32 -0800 [thread overview]
Message-ID: <5e626b6c364eb_17502acca07205b427@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <20200304101318.5225-4-lmb@cloudflare.com>
Lorenz Bauer wrote:
> We need to ensure that sk->sk_prot uses certain callbacks, so that
> code that directly calls e.g. tcp_sendmsg in certain corner cases
> works. To avoid spurious asserts, we must to do this only if
> sk_psock_update_proto has not yet been called. The same invariants
> apply for tcp_bpf_check_v6_needs_rebuild, so move the call as well.
>
> Doing so allows us to merge tcp_bpf_init and tcp_bpf_reinit.
>
> Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Small nit if you update it just carry the acks through.
Acked-by: John Fastabend <john.fastabend@gmail.com>
> skb_verdict = READ_ONCE(progs->skb_verdict);
> @@ -191,18 +191,14 @@ static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs,
> ret = -ENOMEM;
> goto out_progs;
> }
> - sk_psock_is_new = true;
> }
>
> if (msg_parser)
> psock_set_prog(&psock->progs.msg_parser, msg_parser);
> - if (sk_psock_is_new) {
> - ret = tcp_bpf_init(sk);
> - if (ret < 0)
> - goto out_drop;
> - } else {
> - tcp_bpf_reinit(sk);
> - }
> +
> + ret = tcp_bpf_init(sk);
> + if (ret < 0)
> + goto out_drop;
>
> write_lock_bh(&sk->sk_callback_lock);
> if (skb_progs && !psock->parser.enabled) {
> @@ -239,12 +235,9 @@ static int sock_map_link_no_progs(struct bpf_map *map, struct sock *sk)
> if (IS_ERR(psock))
> return PTR_ERR(psock);
>
> - if (psock) {
> - tcp_bpf_reinit(sk);
> - return 0;
> - }
> + if (!psock)
> + psock = sk_psock_init(sk, map->numa_node);
>
> - psock = sk_psock_init(sk, map->numa_node);
> if (!psock)
> return -ENOMEM;
also small nit this reads,
if (!psock)
psock = ...
if (!psock)
return -ENOMEM
how about,
if (!psock) {
psock = ...
if (!psock) return -ENOMEM;
}
next prev parent reply other threads:[~2020-03-06 15:25 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-04 10:13 [PATCH bpf-next v3 00/12] bpf: sockmap, sockhash: support storing UDP sockets Lorenz Bauer
2020-03-04 10:13 ` [PATCH bpf-next v3 01/12] bpf: sockmap: only check ULP for TCP sockets Lorenz Bauer
2020-03-05 12:00 ` Jakub Sitnicki
2020-03-06 14:56 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 02/12] skmsg: update saved hooks only once Lorenz Bauer
2020-03-05 12:03 ` Jakub Sitnicki
2020-03-06 15:00 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 03/12] bpf: tcp: move assertions into tcp_bpf_get_proto Lorenz Bauer
2020-03-05 12:10 ` Jakub Sitnicki
2020-03-06 15:25 ` John Fastabend [this message]
2020-03-04 10:13 ` [PATCH bpf-next v3 04/12] bpf: tcp: guard declarations with CONFIG_NET_SOCK_MSG Lorenz Bauer
2020-03-05 12:14 ` Jakub Sitnicki
2020-03-04 10:13 ` [PATCH bpf-next v3 05/12] bpf: sockmap: move generic sockmap hooks from BPF TCP Lorenz Bauer
2020-03-05 12:32 ` Jakub Sitnicki
2020-03-06 15:28 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 06/12] bpf: sockmap: simplify sock_map_init_proto Lorenz Bauer
2020-03-05 12:39 ` Jakub Sitnicki
2020-03-06 15:29 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 07/12] bpf: add sockmap hooks for UDP sockets Lorenz Bauer
2020-03-06 15:44 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 08/12] bpf: sockmap: add UDP support Lorenz Bauer
2020-03-06 15:31 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 09/12] selftests: bpf: don't listen() on UDP sockets Lorenz Bauer
2020-03-05 12:53 ` Jakub Sitnicki
2020-03-06 15:36 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 10/12] selftests: bpf: add tests for UDP sockets in sockmap Lorenz Bauer
2020-03-06 15:38 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 11/12] selftests: bpf: enable UDP sockmap reuseport tests Lorenz Bauer
2020-03-05 12:56 ` Jakub Sitnicki
2020-03-06 15:39 ` John Fastabend
2020-03-04 10:13 ` [PATCH bpf-next v3 12/12] bpf, doc: update maintainers for L7 BPF Lorenz Bauer
2020-03-05 12:58 ` Jakub Sitnicki
2020-03-05 12:59 ` [PATCH bpf-next v3 00/12] bpf: sockmap, sockhash: support storing UDP sockets Jakub Sitnicki
2020-03-06 15:45 ` John Fastabend
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=5e626b6c364eb_17502acca07205b427@john-XPS-13-9370.notmuch \
--to=john.fastabend@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jakub@cloudflare.com \
--cc=kernel-team@cloudflare.com \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=lmb@cloudflare.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/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).