tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c
Extension
.c
Size
6989 bytes
Lines
276
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct test {
	const char *desc;
	void (*run)(struct test_btf_skc_cls_ingress *skel);
};

#define DEF_TEST(name) { #name, test_##name }
static struct test tests[] = {
	DEF_TEST(conn_ipv4),
	DEF_TEST(conn_ipv6),
	DEF_TEST(conn_dual),
	DEF_TEST(syncookie_ipv4),
	DEF_TEST(syncookie_ipv6),
	DEF_TEST(syncookie_dual),
};

void test_btf_skc_cls_ingress(void)
{
	struct test_btf_skc_cls_ingress *skel;
	struct netns_obj *ns;
	int i;

	skel = test_btf_skc_cls_ingress__open_and_load();
	if (!ASSERT_OK_PTR(skel, "test_btf_skc_cls_ingress__open_and_load"))
		return;

	for (i = 0; i < ARRAY_SIZE(tests); i++) {
		if (!test__start_subtest(tests[i].desc))
			continue;

		ns = prepare_netns(skel);
		if (!ns)
			break;

		tests[i].run(skel);

		print_err_line(skel);
		reset_test(skel);
		netns_free(ns);
	}

	test_btf_skc_cls_ingress__destroy(skel);
}

Annotation

Implementation Notes