Skip to contentSkip to conversation

selftests/bpf: Add back removed kfuncs declarations

PATCH In review Xing Guo 2 participants 3 messages Sep 16, 2025 – Sep 17, 2025

Subsystems (3)
lore
Share & tools
lore

Xing Guo

author
#0 lore raw

PATCH 1/1 selftests/bpf: Add back removed kfuncs declarations

These kfuncs are removed in commit 2f9838e25790 ("selftests/bpf: Cleanup bpf qdisc selftests"), but they are still referenced by multiple tests. Otherwise, we will get the following errors.

```
progs/bpf_qdisc_fail__incompl_ops.c:13:2: error: call to undeclared function 'bpf_qdisc_skb_drop'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   13 |         bpf_qdisc_skb_drop(skb, to_free);
      |         ^
1 error generated.
progs/bpf_qdisc_fifo.c:38:3: error: call to undeclared function 'bpf_qdisc_skb_drop'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   38 |                 bpf_qdisc_skb_drop(skb, to_free);
      |                 ^
progs/bpf_qdisc_fq.c:280:11: error: call to undeclared function 'bpf_skb_get_hash'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  280 |                         hash = bpf_skb_get_hash(skb) & q.orphan_mask;
      |                                ^
progs/bpf_qdisc_fq.c:287:11: error: call to undeclared function 'bpf_skb_get_hash'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  287 |                         hash = bpf_skb_get_hash(skb) & q.orphan_mask;
      |                                ^
progs/bpf_qdisc_fq.c:375:3: error: call to undeclared function 'bpf_qdisc_skb_drop'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  375 |                 bpf_qdisc_skb_drop(skb, to_free);
      |                 ^
progs/bpf_qdisc_fifo.c:71:2: error: call to undeclared function 'bpf_qdisc_bstats_update'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   71 |         bpf_qdisc_bstats_update(sch, skb);
      |         ^
progs/bpf_qdisc_fifo.c:106:4: error: call to undeclared function 'bpf_kfree_skb'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  106 |                         bpf_kfree_skb(skb);
      |                         ^
3 errors generated.
progs/bpf_qdisc_fq.c:614:3: error: call to undeclared function 'bpf_qdisc_bstats_update'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  614 |                 bpf_qdisc_bstats_update(sch, skb);
      |                 ^
progs/bpf_qdisc_fq.c:619:3: error: call to undeclared function 'bpf_qdisc_watchdog_schedule'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  619 |                 bpf_qdisc_watchdog_schedule(sch, cb_ctx.expire, q.timer_slack);
      |                 ^
5 errors generated.
```
Fixes 2f9838e25790 ("selftests/bpf: Cleanup bpf qdisc selftests")
---
 tools/testing/selftests/bpf/progs/bpf_qdisc_common.h | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/bpf/progs/bpf_qdisc_common.h +6 -0
index 3754f581b328..7e7f2fe04f22 100644
@@ -14,6 +14,12 @@
 
 struct bpf_sk_buff_ptr;
 
+u32 bpf_skb_get_hash(struct sk_buff *p) __ksym;
+void bpf_kfree_skb(struct sk_buff *p) __ksym;
+void bpf_qdisc_skb_drop(struct sk_buff *p, struct bpf_sk_buff_ptr *to_free) __ksym;
+void bpf_qdisc_watchdog_schedule(struct Qdisc *sch, u64 expire, u64 delta_ns) __ksym;
+void bpf_qdisc_bstats_update(struct Qdisc *sch, const struct sk_buff *skb) __ksym;
+
 static struct qdisc_skb_cb *qdisc_skb_cb(const struct sk_buff *skb)
 {
 	return (struct qdisc_skb_cb *)skb->cb;
Signature · 1 line
2.51.0
#1 lore raw
Quoted 3 lines · Xing Guo

These kfuncs are removed in commit 2f9838e25790 ("selftests/bpf: Cleanup bpf qdisc selftests"), but they are still referenced by multiple tests. Otherwise, we will get the following errors.

They are declared in vmlinux.h which depends on a ~1 year old pahole. There are other selftests also depends on the kfunc declared in vmlinux.h alone. Update your pahole. There is nothing to fix.

pw-bot: cr

author
#2 lore raw
Quoted 9 lines · Martin KaFai Lau
Quoted 3 lines · Xing Guo

These kfuncs are removed in commit 2f9838e25790 ("selftests/bpf: Cleanup bpf qdisc selftests"), but they are still referenced by multiple tests. Otherwise, we will get the following errors.

They are declared in vmlinux.h which depends on a ~1 year old pahole. There are other selftests also depends on the kfunc declared in vmlinux.h alone. Update your pahole. There is nothing to fix.

Ah, silly me. I forgot to enable CONFIG_NET_SCH_BPF in my kernel build. Thanks for the information!