Message ID | 20210213214421.226357-1-xiyou.wangcong@gmail.com |
---|---|
Headers | show |
Series | sock_map: clean up and refactor code for BPF_SK_SKB_VERDICT | expand |
On Sat, 13 Feb 2021 at 21:44, Cong Wang <xiyou.wangcong@gmail.com> wrote: > > From: Cong Wang <cong.wang@bytedance.com> > > As suggested by John, clean up sockmap related Kconfigs: > > Reduce the scope of CONFIG_BPF_STREAM_PARSER down to TCP stream > parser, to reflect its name. > > Make the rest sockmap code simply depend on CONFIG_BPF_SYSCALL. > And leave CONFIG_NET_SOCK_MSG untouched, as it is used by > non-sockmap cases. For the series: Reviewed-by: Lorenz Bauer <lmb@cloudflare.com> Jakub, John: can you please take another look at the assembly in patch 3? -- Lorenz Bauer | Systems Engineer 6th Floor, County Hall/The Riverside Building, SE1 7PB, UK www.cloudflare.com
Cong Wang wrote: > From: Cong Wang <cong.wang@bytedance.com> > > As suggested by John, clean up sockmap related Kconfigs: > > Reduce the scope of CONFIG_BPF_STREAM_PARSER down to TCP stream > parser, to reflect its name. > > Make the rest sockmap code simply depend on CONFIG_BPF_SYSCALL. > And leave CONFIG_NET_SOCK_MSG untouched, as it is used by > non-sockmap cases. > > Cc: John Fastabend <john.fastabend@gmail.com> > Cc: Daniel Borkmann <daniel@iogearbox.net> > Cc: Jakub Sitnicki <jakub@cloudflare.com> > Cc: Lorenz Bauer <lmb@cloudflare.com> > Signed-off-by: Cong Wang <cong.wang@bytedance.com> > --- Thanks for doing this. Acked-by: John Fastabend <john.fastabend@gmail.com>
Cong Wang wrote: > From: Cong Wang <cong.wang@bytedance.com> > > Currently, we compute ->data_end with a compile-time constant > offset of skb. But as Jakub pointed out, we can actually compute > it in eBPF JIT code at run-time, so that we can competely get > rid of ->data_end. This is similar to skb_shinfo(skb) computation > in bpf_convert_shinfo_access(). > > Suggested-by: Jakub Sitnicki <jakub@cloudflare.com> > Cc: John Fastabend <john.fastabend@gmail.com> > Cc: Daniel Borkmann <daniel@iogearbox.net> > Cc: Lorenz Bauer <lmb@cloudflare.com> > Signed-off-by: Cong Wang <cong.wang@bytedance.com> > --- Acked-by: John Fastabend <john.fastabend@gmail.com>
On Sat, Feb 13, 2021 at 10:44 PM CET, Cong Wang wrote: > From: Cong Wang <cong.wang@bytedance.com> > > Currently, we compute ->data_end with a compile-time constant > offset of skb. But as Jakub pointed out, we can actually compute > it in eBPF JIT code at run-time, so that we can competely get > rid of ->data_end. This is similar to skb_shinfo(skb) computation > in bpf_convert_shinfo_access(). > > Suggested-by: Jakub Sitnicki <jakub@cloudflare.com> > Cc: John Fastabend <john.fastabend@gmail.com> > Cc: Daniel Borkmann <daniel@iogearbox.net> > Cc: Lorenz Bauer <lmb@cloudflare.com> > Signed-off-by: Cong Wang <cong.wang@bytedance.com> > --- Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Cong Wang wrote: > From: Cong Wang <cong.wang@bytedance.com> > > These two eBPF programs are tied to BPF_SK_SKB_STREAM_PARSER > and BPF_SK_SKB_STREAM_VERDICT, rename them to reflect the fact > they are only used for TCP. And save the name 'skb_verdict' for > general use later. > > Cc: John Fastabend <john.fastabend@gmail.com> > Cc: Daniel Borkmann <daniel@iogearbox.net> > Cc: Jakub Sitnicki <jakub@cloudflare.com> > Reviewed-by: Lorenz Bauer <lmb@cloudflare.com> > Signed-off-by: Cong Wang <cong.wang@bytedance.com> > --- Acked-by: John Fastabend <john.fastabend@gmail.com>
From: Cong Wang <cong.wang@bytedance.com> This patchset is the first series of patches separated out from the original large patchset, to make reviews easier. This patchset does not add any new feature or change any functionality but merely cleans up the existing sockmap and skmsg code and refactors it, to prepare for the patches followed up. This passed all BPF selftests. The original whole patchset is available on github: https://github.com/congwang/linux/tree/sockmap and this patchset is also available on github: https://github.com/congwang/linux/tree/sockmap1 --- v3: fix a few Kconfig compile errors remove an unused variable add a comment for bpf_convert_data_end_access() v2: split the original patchset compute data_end with bpf_convert_data_end_access() get rid of psock->bpf_running reduce the scope of CONFIG_BPF_STREAM_PARSER do not add CONFIG_BPF_SOCK_MAP Cong Wang (5): bpf: clean up sockmap related Kconfigs skmsg: get rid of struct sk_psock_parser bpf: compute data_end dynamically with JIT code skmsg: use skb ext instead of TCP_SKB_CB sock_map: rename skb_parser and skb_verdict include/linux/bpf.h | 20 +- include/linux/bpf_types.h | 2 - include/linux/skbuff.h | 3 + include/linux/skmsg.h | 85 ++++++-- include/net/tcp.h | 38 +--- include/net/udp.h | 4 +- init/Kconfig | 1 + net/Kconfig | 7 +- net/core/Makefile | 2 +- net/core/filter.c | 48 +++-- net/core/skbuff.c | 7 + net/core/skmsg.c | 194 +++++++++--------- net/core/sock_map.c | 74 +++---- net/ipv4/Makefile | 2 +- net/ipv4/tcp_bpf.c | 2 - .../selftests/bpf/prog_tests/sockmap_listen.c | 8 +- .../selftests/bpf/progs/test_sockmap_listen.c | 4 +- 17 files changed, 269 insertions(+), 232 deletions(-)