bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/8] bpf: Allow bpf tcp iter to do bpf_setsockopt
@ 2021-06-25 20:04 Martin KaFai Lau
  2021-06-25 20:04 ` [PATCH bpf-next 1/8] tcp: seq_file: Avoid skipping sk during tcp_seek_last_pos Martin KaFai Lau
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Martin KaFai Lau @ 2021-06-25 20:04 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, Eric Dumazet, kernel-team,
	Neal Cardwell, netdev, Yonghong Song, Yuchung Cheng

This set is to allow bpf tcp iter to call bpf_setsockopt.

With bpf-tcp-cc, new algo rollout happens more often.  Instead of
restarting the applications to pick up the new tcp-cc, this set
allows the bpf tcp iter with the netadmin cap to call
bpf_setsockopt(TCP_CONGESTION).  It is not limited to TCP_CONGESTION
and the bpf tcp iter can call bpf_setsockopt() with other options.
The bpf tcp iter can read into all the fields of a tcp_sock, so
there is a lot of flexibility to select the desired sk to do
setsockopt(), e.g. it can test for TCP_LISTEN only and leave
the established connections untouched, or check the addr/port,
or check the current tcp-cc name, ...etc.

Patch 1-4 are some cleanup and prep work in the tcp and bpf seq_file.

Patch 5 is to have the tcp seq_file iterate on the
port+addr lhash2 instead of the port only listening_hash.

Patch 6 is to have the bpf tcp iter doing batching which
then allows lock_sock.  lock_sock is needed for setsockopt.

Patch 7 allows the bpf tcp iter to call bpf_setsockopt.

Martin KaFai Lau (8):
  tcp: seq_file: Avoid skipping sk during tcp_seek_last_pos
  tcp: seq_file: Refactor net and family matching
  bpf: tcp: seq_file: Remove bpf_seq_afinfo from tcp_iter_state
  tcp: seq_file: Add listening_get_first()
  tcp: seq_file: Replace listening_hash with lhash2
  bpf: tcp: bpf iter batching and lock_sock
  bpf: tcp: Support bpf_setsockopt in bpf tcp iter
  bpf: selftest: Test batching and bpf_setsockopt in bpf tcp iter

 include/linux/bpf.h                           |   7 +
 include/net/inet_hashtables.h                 |   6 +
 include/net/tcp.h                             |   1 -
 kernel/bpf/bpf_iter.c                         |  22 +
 kernel/trace/bpf_trace.c                      |   7 +-
 net/core/filter.c                             |  17 +
 net/ipv4/tcp_ipv4.c                           | 409 ++++++++++++++----
 tools/testing/selftests/bpf/network_helpers.c |  85 +++-
 tools/testing/selftests/bpf/network_helpers.h |   4 +
 .../bpf/prog_tests/bpf_iter_setsockopt.c      | 226 ++++++++++
 .../selftests/bpf/progs/bpf_iter_setsockopt.c |  76 ++++
 .../selftests/bpf/progs/bpf_tracing_net.h     |   4 +
 12 files changed, 767 insertions(+), 97 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_setsockopt.c

-- 
2.30.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-06-29 19:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 20:04 [PATCH bpf-next 0/8] bpf: Allow bpf tcp iter to do bpf_setsockopt Martin KaFai Lau
2021-06-25 20:04 ` [PATCH bpf-next 1/8] tcp: seq_file: Avoid skipping sk during tcp_seek_last_pos Martin KaFai Lau
2021-06-25 20:04 ` [PATCH bpf-next 2/8] tcp: seq_file: Refactor net and family matching Martin KaFai Lau
2021-06-25 20:05 ` [PATCH bpf-next 3/8] bpf: tcp: seq_file: Remove bpf_seq_afinfo from tcp_iter_state Martin KaFai Lau
2021-06-25 20:05 ` [PATCH bpf-next 4/8] tcp: seq_file: Add listening_get_first() Martin KaFai Lau
2021-06-25 20:05 ` [PATCH bpf-next 5/8] tcp: seq_file: Replace listening_hash with lhash2 Martin KaFai Lau
2021-06-25 20:05 ` [PATCH bpf-next 6/8] bpf: tcp: bpf iter batching and lock_sock Martin KaFai Lau
2021-06-29 17:27   ` Yonghong Song
2021-06-29 17:44     ` Martin KaFai Lau
2021-06-29 17:57       ` Yonghong Song
2021-06-29 18:06         ` Martin KaFai Lau
2021-06-29 18:55           ` Yonghong Song
2021-06-25 20:05 ` [PATCH bpf-next 7/8] bpf: tcp: Support bpf_setsockopt in bpf tcp iter Martin KaFai Lau
2021-06-25 20:05 ` [PATCH bpf-next 8/8] bpf: selftest: Test batching and " Martin KaFai Lau
2021-06-29 19:00   ` Yonghong Song
2021-06-29 19:04 ` [PATCH bpf-next 0/8] bpf: Allow bpf tcp iter to do bpf_setsockopt Yonghong Song

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).