From aaa56b03e38dabaf722b9cc38e498da714e1ebe7 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 13 Aug 2019 11:06:57 +0000 Subject: [PATCH] xlat: update BPF_* constants * xlat/bpf_attach_type.in (BPF_CGROUP_GETSOCKOPT, BPF_CGROUP_SETSOCKOPT): New constants introduced by Linux kernel commit v5.3-rc1~140^2~65^2~8^2~8. * xlat/bpf_prog_flags.in (BPF_F_TEST_RND_HI32): New constant introduced by Linux kernel commit v5.3-rc1~140^2~371^2~28^2~12. * xlat/bpf_prog_types.in (BPF_PROG_TYPE_CGROUP_SOCKOPT): New constant introduced by Linux kernel commit v5.3-rc1~140^2~65^2~8^2~8. * NEWS: Mention this. * tests/bpf.c (print_BPF_PROG_LOAD_attr3, print_BPF_PROG_LOAD_attr4, BPF_PROG_LOAD_checks, BPF_PROG_QUERY_checks): Update expected output. * tests/kernel_version.c (print_bpf_attr, main): Likewise. --- NEWS | 3 +++ tests/bpf.c | 17 +++++++++-------- tests/kernel_version.c | 6 +++--- xlat/bpf_attach_type.in | 2 ++ xlat/bpf_prog_flags.in | 1 + xlat/bpf_prog_types.in | 1 + 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index e651c789..ce1087dd 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ Noteworthy changes in release ?.? (????-??-??) ============================================== +* Improvements + * Updated lists of BPF_*, ETH_*, MAP_*, SO_*, V4L2_*, and XDP_* constants. + * Bug fixes * Fixed tests on alpha with Linux kernel headers 5.1+. diff --git a/tests/bpf.c b/tests/bpf.c index 2643f740..5b5df8f1 100644 --- a/tests/bpf.c +++ b/tests/bpf.c @@ -564,7 +564,7 @@ print_BPF_PROG_LOAD_attr3(const struct bpf_attr_check *check, unsigned long addr ", insns=" INSNS_FMT ", license=\"%s\", log_level=2718281828" ", log_size=%u, log_buf=%p" ", kern_version=KERNEL_VERSION(51966, 240, 13)" - ", prog_flags=0x4 /* BPF_F_??? */" + ", prog_flags=0x8 /* BPF_F_??? */" ", prog_name=\"0123456789abcde\"..., prog_ifindex=3203399405", (unsigned int) ARRAY_SIZE(insns), INSNS_ARG, license, log_buf_size, get_log_buf_tail()); @@ -590,7 +590,8 @@ print_BPF_PROG_LOAD_attr4(const struct bpf_attr_check *check, unsigned long addr ", license=\"%s\", log_level=2718281828, log_size=4" ", log_buf=\"log \"..." ", kern_version=KERNEL_VERSION(51966, 240, 13)" - ", prog_flags=BPF_F_STRICT_ALIGNMENT|BPF_F_ANY_ALIGNMENT|0x4" + ", prog_flags=BPF_F_STRICT_ALIGNMENT|BPF_F_ANY_ALIGNMENT" + "|BPF_F_TEST_RND_HI32|0x8" ", prog_name=\"0123456789abcde\"..., prog_ifindex=%s" ", expected_attach_type=BPF_CGROUP_INET6_BIND", (unsigned int) ARRAY_SIZE(insns), INSNS_ARG, @@ -606,7 +607,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = { }, { /* 1 */ .data = { .BPF_PROG_LOAD_data = { - .prog_type = 24, + .prog_type = 25, .insn_cnt = 0xbadc0ded, .insns = 0, .license = 0, @@ -617,7 +618,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = { .prog_flags = 0, } }, .size = offsetofend(struct BPF_PROG_LOAD_struct, prog_flags), - .str = "prog_type=0x18 /* BPF_PROG_TYPE_??? */" + .str = "prog_type=0x19 /* BPF_PROG_TYPE_??? */" ", insn_cnt=3134983661, insns=NULL, license=NULL" ", log_level=42, log_size=3141592653, log_buf=NULL" ", kern_version=KERNEL_VERSION(51966, 240, 13)" @@ -654,7 +655,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = { .log_level = 2718281828U, .log_size = log_buf_size, .kern_version = 0xcafef00d, - .prog_flags = 4, + .prog_flags = 8, .prog_name = "0123456789abcdef", .prog_ifindex = 0xbeeffeed, } }, @@ -669,7 +670,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = { .log_level = 2718281828U, .log_size = 4, .kern_version = 0xcafef00d, - .prog_flags = 7, + .prog_flags = 0xf, .prog_name = "0123456789abcdef", .expected_attach_type = 9, } }, @@ -1052,7 +1053,7 @@ static struct bpf_attr_check BPF_PROG_QUERY_checks[] = { { /* 2 */ .data = { .BPF_PROG_QUERY_data = { .target_fd = 3141592653U, - .attach_type = 21, + .attach_type = 23, .query_flags = 0xfffffffe, .attach_flags = 0xfffffffc, .prog_ids = 0xffffffffffffffffULL, @@ -1060,7 +1061,7 @@ static struct bpf_attr_check BPF_PROG_QUERY_checks[] = { } }, .size = offsetofend(struct BPF_PROG_QUERY_struct, prog_cnt), .str = "query={target_fd=-1153374643" - ", attach_type=0x15 /* BPF_??? */" + ", attach_type=0x17 /* BPF_??? */" ", query_flags=0xfffffffe /* BPF_F_QUERY_??? */" ", attach_flags=0xfffffffc /* BPF_F_??? */" ", prog_ids=" diff --git a/tests/kernel_version.c b/tests/kernel_version.c index 9f55210c..e82095c6 100644 --- a/tests/kernel_version.c +++ b/tests/kernel_version.c @@ -34,9 +34,9 @@ static void print_bpf_attr(void) { #if XLAT_RAW - printf("{prog_type=0x18" + printf("{prog_type=0x19" #else - printf("{prog_type=0x18 /* BPF_PROG_TYPE_??? */" + printf("{prog_type=0x19 /* BPF_PROG_TYPE_??? */" #endif ", insn_cnt=3134983661" ", insns=NULL" @@ -77,7 +77,7 @@ main(void) { long ret; struct BPF_PROG_LOAD_struct prog = { - .prog_type = 24, + .prog_type = 25, .insn_cnt = 0xbadc0ded, .insns = 0, .license = 0, diff --git a/xlat/bpf_attach_type.in b/xlat/bpf_attach_type.in index a753b3c1..60505746 100644 --- a/xlat/bpf_attach_type.in +++ b/xlat/bpf_attach_type.in @@ -20,3 +20,5 @@ BPF_FLOW_DISSECTOR 17 BPF_CGROUP_SYSCTL 18 BPF_CGROUP_UDP4_RECVMSG 19 BPF_CGROUP_UDP6_RECVMSG 20 +BPF_CGROUP_GETSOCKOPT 21 +BPF_CGROUP_SETSOCKOPT 22 diff --git a/xlat/bpf_prog_flags.in b/xlat/bpf_prog_flags.in index e9eb42aa..4637f8c0 100644 --- a/xlat/bpf_prog_flags.in +++ b/xlat/bpf_prog_flags.in @@ -1,2 +1,3 @@ BPF_F_STRICT_ALIGNMENT 1U BPF_F_ANY_ALIGNMENT (1U << 1) +BPF_F_TEST_RND_HI32 (1U << 2) diff --git a/xlat/bpf_prog_types.in b/xlat/bpf_prog_types.in index 452189ff..2d81d82d 100644 --- a/xlat/bpf_prog_types.in +++ b/xlat/bpf_prog_types.in @@ -23,3 +23,4 @@ BPF_PROG_TYPE_SK_REUSEPORT 20 BPF_PROG_TYPE_FLOW_DISSECTOR 21 BPF_PROG_TYPE_CGROUP_SYSCTL 22 BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE 23 +BPF_PROG_TYPE_CGROUP_SOCKOPT 24 -- 2.40.0