Skip to content

Commit a48a438

Browse files
Pu LehuiAlexei Starovoitov
authored andcommitted
selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent dc3a880 commit a48a438

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static void test_dctcp_fallback(void)
285285
dctcp_skel = bpf_dctcp__open();
286286
if (!ASSERT_OK_PTR(dctcp_skel, "dctcp_skel"))
287287
return;
288-
strcpy(dctcp_skel->rodata->fallback, "cubic");
288+
strcpy(dctcp_skel->rodata->fallback_cc, "cubic");
289289
if (!ASSERT_OK(bpf_dctcp__load(dctcp_skel), "bpf_dctcp__load"))
290290
goto done;
291291

tools/testing/selftests/bpf/progs/bpf_dctcp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static bool before(__u32 seq1, __u32 seq2)
2626

2727
char _license[] SEC("license") = "GPL";
2828

29-
volatile const char fallback[TCP_CA_NAME_MAX];
29+
volatile const char fallback_cc[TCP_CA_NAME_MAX];
3030
const char bpf_dctcp[] = "bpf_dctcp";
3131
const char tcp_cdg[] = "cdg";
3232
char cc_res[TCP_CA_NAME_MAX];
@@ -71,10 +71,10 @@ void BPF_PROG(bpf_dctcp_init, struct sock *sk)
7171
struct bpf_dctcp *ca = inet_csk_ca(sk);
7272
int *stg;
7373

74-
if (!(tp->ecn_flags & TCP_ECN_OK) && fallback[0]) {
74+
if (!(tp->ecn_flags & TCP_ECN_OK) && fallback_cc[0]) {
7575
/* Switch to fallback */
7676
if (bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION,
77-
(void *)fallback, sizeof(fallback)) == -EBUSY)
77+
(void *)fallback_cc, sizeof(fallback_cc)) == -EBUSY)
7878
ebusy_cnt++;
7979

8080
/* Switch back to myself and the recurred bpf_dctcp_init()
@@ -87,7 +87,7 @@ void BPF_PROG(bpf_dctcp_init, struct sock *sk)
8787

8888
/* Switch back to fallback */
8989
if (bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION,
90-
(void *)fallback, sizeof(fallback)) == -EBUSY)
90+
(void *)fallback_cc, sizeof(fallback_cc)) == -EBUSY)
9191
ebusy_cnt++;
9292

9393
/* Expecting -ENOTSUPP for tcp_cdg_res */

0 commit comments

Comments
 (0)