tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c- Extension
.c- Size
- 7147 bytes
- Lines
- 298
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.hsk_bypass_prot_mem.skel.hnetwork_helpers.hunistd.h
Detected Declarations
struct test_casefunction tcp_create_socketsfunction udp_create_socketsfunction get_memory_allocatedfunction tcp_get_memory_allocatedfunction udp_get_memory_allocatedfunction check_bypassfunction run_testfunction serial_test_sk_bypass_prot_mem
Annotated Snippet
skel->links.sock_create = bpf_program__attach_cgroup(skel->progs.sock_create, cgroup);
if (!ASSERT_OK_PTR(skel->links.sock_create, "attach_cgroup(sock_create)"))
goto close_netns;
err = check_bypass(test_case, skel, true);
ASSERT_EQ(err, 0, "test_bypass(true by bpf)");
close_netns:
close_netns(nstoken);
remove_netns:
remove_netns("sk_bypass_prot_mem");
close_cgroup:
close(cgroup);
destroy_skel:
sk_bypass_prot_mem__destroy(skel);
}
static struct test_case test_cases[] = {
{
.name = "TCP ",
.family = AF_INET,
.type = SOCK_STREAM,
.create_sockets = tcp_create_sockets,
.get_memory_allocated = tcp_get_memory_allocated,
},
{
.name = "UDP ",
.family = AF_INET,
.type = SOCK_DGRAM,
.create_sockets = udp_create_sockets,
.get_memory_allocated = udp_get_memory_allocated,
},
{
.name = "TCPv6",
.family = AF_INET6,
.type = SOCK_STREAM,
.create_sockets = tcp_create_sockets,
.get_memory_allocated = tcp_get_memory_allocated,
},
{
.name = "UDPv6",
.family = AF_INET6,
.type = SOCK_DGRAM,
.create_sockets = udp_create_sockets,
.get_memory_allocated = udp_get_memory_allocated,
},
};
void serial_test_sk_bypass_prot_mem(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(test_cases); i++) {
if (test__start_subtest(test_cases[i].name))
run_test(&test_cases[i]);
}
}
Annotation
- Immediate include surface: `test_progs.h`, `sk_bypass_prot_mem.skel.h`, `network_helpers.h`, `unistd.h`.
- Detected declarations: `struct test_case`, `function tcp_create_sockets`, `function udp_create_sockets`, `function get_memory_allocated`, `function tcp_get_memory_allocated`, `function udp_get_memory_allocated`, `function check_bypass`, `function run_test`, `function serial_test_sk_bypass_prot_mem`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.