OSDN Git Service

selftests/bpf: Fix test_xdp_adjust_tail_grow2 on s390x
authorIlya Leoshkevich <iii@linux.ibm.com>
Sat, 28 Jan 2023 00:06:35 +0000 (01:06 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 28 Jan 2023 20:30:09 +0000 (12:30 -0800)
s390x cache line size is 256 bytes, so skb_shared_info must be aligned
on a much larger boundary than for x86.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/r/20230128000650.1516334-17-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_grow.c

index 39973ea..f09505f 100644 (file)
@@ -76,10 +76,15 @@ static void test_xdp_adjust_tail_grow2(void)
 {
        const char *file = "./test_xdp_adjust_tail_grow.bpf.o";
        char buf[4096]; /* avoid segfault: large buf to hold grow results */
-       int tailroom = 320; /* SKB_DATA_ALIGN(sizeof(struct skb_shared_info))*/;
        struct bpf_object *obj;
        int err, cnt, i;
        int max_grow, prog_fd;
+       /* SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) */
+#if defined(__s390x__)
+       int tailroom = 512;
+#else
+       int tailroom = 320;
+#endif
 
        LIBBPF_OPTS(bpf_test_run_opts, tattr,
                .repeat         = 1,
index 53b64c9..297c260 100644 (file)
@@ -9,6 +9,12 @@ int _xdp_adjust_tail_grow(struct xdp_md *xdp)
        void *data = (void *)(long)xdp->data;
        int data_len = bpf_xdp_get_buff_len(xdp);
        int offset = 0;
+       /* SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) */
+#if defined(__TARGET_ARCH_s390)
+       int tailroom = 512;
+#else
+       int tailroom = 320;
+#endif
 
        /* Data length determine test case */
 
@@ -20,7 +26,7 @@ int _xdp_adjust_tail_grow(struct xdp_md *xdp)
                offset = 128;
        } else if (data_len == 128) {
                /* Max tail grow 3520 */
-               offset = 4096 - 256 - 320 - data_len;
+               offset = 4096 - 256 - tailroom - data_len;
        } else if (data_len == 9000) {
                offset = 10;
        } else if (data_len == 9001) {