[PATCH v2 1/6] bpf: update BPF_* constants

Paul Chaignon paul at isovalent.com
Thu Dec 30 10:59:17 UTC 2021


* src/xlat/bpf_map_types.in (BPF_MAP_TYPE_BLOOM_FILTER): New constant
introduced in Linux kernel commit v5.16-rc1~159^2~2^2~20^2~4.
* src/xlat/bpf_attach_types.in (BPF_PERF_EVENT): New constant introduced
in Linux kernel commit v5.15-rc1~157^2~22^2~33^2~12.
* tests/bpf.c (BPF_MAP_CREATE_checks, BPF_PROG_QUERY_checks): Update
checks and their expected output.
* NEWS: Mention this.

Signed-off-by: Paul Chaignon <paul at isovalent.com>
---
 NEWS                        |  1 +
 src/xlat/bpf_attach_type.in |  1 +
 src/xlat/bpf_map_types.in   |  1 +
 tests/bpf.c                 | 10 +++++-----
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index a57c530a5..9ecd8d855 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Noteworthy changes in release ?.?? (????-??-??)
 ===============================================
 
 * Improvements
+  * Updated lists of BPF_* constants.
   * Updated lists of ioctl commands from Linux 5.16.
 
 * Bug fixes
diff --git a/src/xlat/bpf_attach_type.in b/src/xlat/bpf_attach_type.in
index c9419390e..412068698 100644
--- a/src/xlat/bpf_attach_type.in
+++ b/src/xlat/bpf_attach_type.in
@@ -40,3 +40,4 @@ BPF_XDP 37
 BPF_SK_SKB_VERDICT 38
 BPF_SK_REUSEPORT_SELECT 39
 BPF_SK_REUSEPORT_SELECT_OR_MIGRATE 40
+BPF_PERF_EVENT 41
diff --git a/src/xlat/bpf_map_types.in b/src/xlat/bpf_map_types.in
index 7c9b65be4..4717f85f6 100644
--- a/src/xlat/bpf_map_types.in
+++ b/src/xlat/bpf_map_types.in
@@ -29,3 +29,4 @@ BPF_MAP_TYPE_STRUCT_OPS 26
 BPF_MAP_TYPE_RINGBUF 27
 BPF_MAP_TYPE_INODE_STORAGE 28
 BPF_MAP_TYPE_TASK_STORAGE 29
+BPF_MAP_TYPE_BLOOM_FILTER 30
diff --git a/tests/bpf.c b/tests/bpf.c
index 8573f1add..31ed3b742 100644
--- a/tests/bpf.c
+++ b/tests/bpf.c
@@ -262,7 +262,7 @@ init_BPF_MAP_CREATE_attr7(struct bpf_attr_check *check)
 	attr->map_ifindex = ifindex_lo();
 }
 
-static_assert(ARRAY_SIZE(bpf_map_types_xdata) == 30,
+static_assert(ARRAY_SIZE(bpf_map_types_xdata) == 31,
 	      "The map_type for tests 1 and 2 below needs to be updated");
 static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 	{
@@ -295,7 +295,7 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 	},
 	{ /* 2 */
 		.data = { .BPF_MAP_CREATE_data = {
-			.map_type = 30,
+			.map_type = 31,
 			.key_size = 0xface1e55,
 			.value_size = 0xbadc0ded,
 			.max_entries = 0xbeefcafe,
@@ -306,7 +306,7 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 			.map_ifindex = 3141592653,
 		} },
 		.size = offsetofend(struct BPF_MAP_CREATE_struct, map_ifindex),
-		.str = "map_type=0x1e /* BPF_MAP_TYPE_??? */"
+		.str = "map_type=0x1f /* BPF_MAP_TYPE_??? */"
 		       ", key_size=4207812181, value_size=3134983661"
 		       ", max_entries=3203386110"
 		       ", map_flags=0xffffe000 /* BPF_F_??? */"
@@ -1142,7 +1142,7 @@ static struct bpf_attr_check BPF_PROG_QUERY_checks[] = {
 	{ /* 2 */
 		.data = { .BPF_PROG_QUERY_data = {
 			.target_fd = 3141592653U,
-			.attach_type = 41,
+			.attach_type = 42,
 			.query_flags = 0xfffffffe,
 			.attach_flags = 0xfffffff8,
 			.prog_ids = 0xffffffffffffffffULL,
@@ -1150,7 +1150,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=0x29 /* BPF_??? */"
+		       ", attach_type=0x2a /* BPF_??? */"
 		       ", query_flags=0xfffffffe /* BPF_F_QUERY_??? */"
 		       ", attach_flags=0xfffffff8 /* BPF_F_??? */"
 		       ", prog_ids="
-- 
2.25.1



More information about the Strace-devel mailing list