On Wed, Dec 31, 2025 at 10:47 AM Sun Jian <[email protected]> wrote:
>
> The qdisc BPF selftests fail to build because qdisc-related kfuncs are
> used without proper declarations, and struct bpf_sk_buff_ptr is only
> introduced in a function prototype scope, triggering -Wvisibility and
> type mismatch errors under -Werror.
>
> Fix the build by:
>   - adding a file-scope forward declaration for struct bpf_sk_buff_ptr
>   - declaring qdisc kfuncs (bpf_qdisc_* and bpf_skb_get_hash/bpf_kfree_skb)
>     as __ksym in the shared header
>   - including required BPF headers in qdisc test progs
>
> Tested: make -C tools/testing/selftests/bpf OUTPUT=/tmp/selftests-bpf \
> /tmp/selftests-bpf/bpf_qdisc_fifo.bpf.o \
> /tmp/selftests-bpf/bpf_qdisc_fq.bpf.o \
> /tmp/selftests-bpf/bpf_qdisc_fail__incompl_ops.bpf.o
>
> Signed-off-by: Sun Jian <[email protected]>
> ---
>  .../selftests/bpf/progs/bpf_qdisc_common.h      | 17 +++++++++++++++++
>  .../bpf/progs/bpf_qdisc_fail__incompl_ops.c     |  4 ++++
>  .../selftests/bpf/progs/bpf_qdisc_fifo.c        |  4 ++++
>  .../testing/selftests/bpf/progs/bpf_qdisc_fq.c  |  1 +
>  4 files changed, 26 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h 
> b/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h
> index 3754f581b328..bed2294c35f9 100644
> --- a/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h
> +++ b/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h
> @@ -3,6 +3,9 @@
>  #ifndef _BPF_QDISC_COMMON_H
>  #define _BPF_QDISC_COMMON_H
>
> +#include <vmlinux.h>
> +#include <bpf/bpf_helpers.h>
> +
>  #define NET_XMIT_SUCCESS        0x00
>  #define NET_XMIT_DROP           0x01    /* skb dropped                  */
>  #define NET_XMIT_CN             0x02    /* congestion notification      */
> @@ -14,6 +17,20 @@
>
>  struct bpf_sk_buff_ptr;
>
> +/* kfunc declarations provided via vmlinux BTF */
> +extern void bpf_qdisc_skb_drop(struct sk_buff *skb,
> +                              struct bpf_sk_buff_ptr *to_free) __ksym;
> +
> +extern void bpf_qdisc_bstats_update(struct Qdisc *sch,
> +                                   const struct sk_buff *skb) __ksym;
> +
> +extern void bpf_qdisc_watchdog_schedule(struct Qdisc *sch,
> +                                       u64 expire, u64 delta_ns) __ksym;
> +
> +extern __u32 bpf_skb_get_hash(struct sk_buff *skb) __ksym;
> +
> +extern void bpf_kfree_skb(struct sk_buff *skb) __ksym;

Stop this spam.
You keep ignoring earlier feedback.

pw-bot: cr

Reply via email to