]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict
authorPu Lehui <pulehui@huawei.com>
Thu, 5 Sep 2024 08:13:53 +0000 (08:13 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 5 Sep 2024 20:13:39 +0000 (13:13 -0700)
Recently, when compiling bpf selftests on RV64, the following
compilation failure occurred:

progs/bpf_dctcp.c:29:21: error: redefinition of 'fallback' as different kind of symbol
   29 | volatile const char fallback[TCP_CA_NAME_MAX];
      |                     ^
/workspace/tools/testing/selftests/bpf/tools/include/vmlinux.h:86812:15: note: previous definition is here
 86812 | typedef u32 (*fallback)(u32, const unsigned char *, size_t);

The reason is that the `fallback` symbol has been defined in
arch/riscv/lib/crc32.c, which will cause symbol conflicts when vmlinux.h
is included in bpf_dctcp. Let we rename `fallback` string to
`fallback_cc` in bpf_dctcp to fix this compilation failure.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Link: https://lore.kernel.org/r/20240905081401.1894789-3-pulehui@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
tools/testing/selftests/bpf/progs/bpf_dctcp.c

index 1d494b4453f42ff5044ea9276b135aaba3a4d061..409a069758230fd42ad6d010aa3ff6df30e946ad 100644 (file)
@@ -285,7 +285,7 @@ static void test_dctcp_fallback(void)
        dctcp_skel = bpf_dctcp__open();
        if (!ASSERT_OK_PTR(dctcp_skel, "dctcp_skel"))
                return;
-       strcpy(dctcp_skel->rodata->fallback, "cubic");
+       strcpy(dctcp_skel->rodata->fallback_cc, "cubic");
        if (!ASSERT_OK(bpf_dctcp__load(dctcp_skel), "bpf_dctcp__load"))
                goto done;
 
index 02f552e7fd4d01b3d82d85ef18892806cccb9afe..7cd73e75f52a2b1464342dd27e7f9f7811d8542d 100644 (file)
@@ -26,7 +26,7 @@ static bool before(__u32 seq1, __u32 seq2)
 
 char _license[] SEC("license") = "GPL";
 
-volatile const char fallback[TCP_CA_NAME_MAX];
+volatile const char fallback_cc[TCP_CA_NAME_MAX];
 const char bpf_dctcp[] = "bpf_dctcp";
 const char tcp_cdg[] = "cdg";
 char cc_res[TCP_CA_NAME_MAX];
@@ -71,10 +71,10 @@ void BPF_PROG(bpf_dctcp_init, struct sock *sk)
        struct bpf_dctcp *ca = inet_csk_ca(sk);
        int *stg;
 
-       if (!(tp->ecn_flags & TCP_ECN_OK) && fallback[0]) {
+       if (!(tp->ecn_flags & TCP_ECN_OK) && fallback_cc[0]) {
                /* Switch to fallback */
                if (bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION,
-                                  (void *)fallback, sizeof(fallback)) == -EBUSY)
+                                  (void *)fallback_cc, sizeof(fallback_cc)) == -EBUSY)
                        ebusy_cnt++;
 
                /* Switch back to myself and the recurred bpf_dctcp_init()
@@ -87,7 +87,7 @@ void BPF_PROG(bpf_dctcp_init, struct sock *sk)
 
                /* Switch back to fallback */
                if (bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION,
-                                  (void *)fallback, sizeof(fallback)) == -EBUSY)
+                                  (void *)fallback_cc, sizeof(fallback_cc)) == -EBUSY)
                        ebusy_cnt++;
 
                /* Expecting -ENOTSUPP for tcp_cdg_res */