Skip to content

Commit cdeebb3

Browse files
committed
chore: Don't use bpf_core_enum_value_exists for detecting bpf_loop
We already have a more reliable `FEATURE_BPF_LOOP` check for that.
1 parent 7a0226f commit cdeebb3

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

crates/bpf-builder/include/loop.bpf.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@
1616
// function seems to cause issues.
1717
#ifdef FEATURE_BPF_LOOP
1818
#define LOOP(max_iterations, max_unroll, callback_fn, ctx) \
19-
if (bpf_core_enum_value_exists(enum bpf_func_id, BPF_FUNC_loop)) { \
20-
bpf_loop(max_iterations, callback_fn, ctx, 0); \
21-
} else { \
22-
_Pragma("unroll") for (int i = 0; i < max_unroll; i++) { \
23-
if (callback_fn(i, ctx) == LOOP_STOP) \
24-
break; \
25-
} \
26-
}
19+
bpf_loop(max_iterations, callback_fn, ctx, 0);
2720
#else
2821
// On kernel <= 5.13 taking the address of a function results in a verifier
2922
// error, even if inside a dead-code elimination branch.

0 commit comments

Comments
 (0)