Re: [PATCH bpf-next 3/3] selftests/bpf: modify bpf_iter_setsockopt to test TCP_BPF_SOCK_OPS_CB_FLAGS

Martin KaFai Lau
2024-08-06T21:42:55Z

On 8/2/24 8:29 AM, Alan Maguire wrote:
> Add support to test bpf_setsockopt(.., TCP_BPF_SOCK_OPS_CB_FLAGS, ...)
> in BPF iterator context; use per-socket storage to store the new
> value and retrieve it in a cgroup/getsockopt program we attach to
> allow us to query TCP_BPF_SOCK_OPS_CB_FLAGS via getsockopt.
>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---
> .../bpf/prog_tests/bpf_iter_setsockopt.c | 83 +++++++++++++------
> .../selftests/bpf/progs/bpf_iter_setsockopt.c | 76 ++++++++++++++---

There are too many code churns to reuse this test to test a new
TCP_BPF_SOCK_OPS_CB_FLAGS sockopt. This is not the right test to reuse. It was
created mainly to test if the tcp batching logic can survive the bpf-iter's
seq_stop.

I don't think it needs a separate bpf_set/getsockopt test specifically for the
bpf iter prog. The test in patch 2 should be enough.

pw-bot: cr