OSDN Git Service

selftests/bpf: Test CGROUP_STORAGE behavior on shared egress + ingress
authorYiFei Zhu <zhuyifei@google.com>
Fri, 24 Jul 2020 04:47:44 +0000 (23:47 -0500)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 26 Jul 2020 03:16:36 +0000 (20:16 -0700)
commit3573f384014f51fd5289df0e8369b63ae7fdc244
tree7ab3c4ef8c26f4f535b390a3f33d9434879d274e
parent7d9c3427894fe70d1347b4820476bf37736d2ff0
selftests/bpf: Test CGROUP_STORAGE behavior on shared egress + ingress

This mirrors the original egress-only test. The cgroup_storage is
now extended to have two packet counters, one for egress and one
for ingress. We also extend to have two egress programs to test
that egress will always share with other egress origrams in the
same cgroup. The behavior of the counters are exactly the same as
the original egress-only test.

The test is split into two, one "isolated" test that when the key
type is struct bpf_cgroup_storage_key, which contains the attach
type, programs of different attach types will see different
storages. The other, "shared" test that when the key type is u64,
programs of different attach types will see the same storage if
they are attached to the same cgroup.

Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/c756f5f1521227b8e6e90a453299dda722d7324d.1595565795.git.zhuyifei@google.com
tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c
tools/testing/selftests/bpf/progs/cg_storage_multi_isolated.c [moved from tools/testing/selftests/bpf/progs/cg_storage_multi_egress_ingress.c with 73% similarity]
tools/testing/selftests/bpf/progs/cg_storage_multi_shared.c [new file with mode: 0644]