Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <pulehui@huawei.com>
Link: https://lore.kernel.org/r/20240905081401.1894789-3-pulehui@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Pu Lehui and committed by
Alexei Starovoitov
a48a4388 dc3a8804

+5 -5
+1 -1
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
··· 285 285 dctcp_skel = bpf_dctcp__open(); 286 286 if (!ASSERT_OK_PTR(dctcp_skel, "dctcp_skel")) 287 287 return; 288 - strcpy(dctcp_skel->rodata->fallback, "cubic"); 288 + strcpy(dctcp_skel->rodata->fallback_cc, "cubic"); 289 289 if (!ASSERT_OK(bpf_dctcp__load(dctcp_skel), "bpf_dctcp__load")) 290 290 goto done; 291 291
+4 -4
tools/testing/selftests/bpf/progs/bpf_dctcp.c
··· 26 26 27 27 char _license[] SEC("license") = "GPL"; 28 28 29 - volatile const char fallback[TCP_CA_NAME_MAX]; 29 + volatile const char fallback_cc[TCP_CA_NAME_MAX]; 30 30 const char bpf_dctcp[] = "bpf_dctcp"; 31 31 const char tcp_cdg[] = "cdg"; 32 32 char cc_res[TCP_CA_NAME_MAX]; ··· 71 71 struct bpf_dctcp *ca = inet_csk_ca(sk); 72 72 int *stg; 73 73 74 - if (!(tp->ecn_flags & TCP_ECN_OK) && fallback[0]) { 74 + if (!(tp->ecn_flags & TCP_ECN_OK) && fallback_cc[0]) { 75 75 /* Switch to fallback */ 76 76 if (bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION, 77 - (void *)fallback, sizeof(fallback)) == -EBUSY) 77 + (void *)fallback_cc, sizeof(fallback_cc)) == -EBUSY) 78 78 ebusy_cnt++; 79 79 80 80 /* Switch back to myself and the recurred bpf_dctcp_init() ··· 87 87 88 88 /* Switch back to fallback */ 89 89 if (bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION, 90 - (void *)fallback, sizeof(fallback)) == -EBUSY) 90 + (void *)fallback_cc, sizeof(fallback_cc)) == -EBUSY) 91 91 ebusy_cnt++; 92 92 93 93 /* Expecting -ENOTSUPP for tcp_cdg_res */