bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: chenyuan_fl@163.com, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, Yuan Chen <chenyuan@kylinos.cn>
Subject: Re: [PATCH] selftests: bpf: Add missing symbol declarations to common header
Date: Thu, 31 Jul 2025 20:08:51 -0700	[thread overview]
Message-ID: <49f21df7-5505-4ce4-9bde-4431bf97831e@linux.dev> (raw)
In-Reply-To: <20250801025239.80595-1-chenyuan_fl@163.com>



On 7/31/25 7:52 PM, chenyuan_fl@163.com wrote:
> From: Yuan Chen <chenyuan@kylinos.cn>
>
> Fix implicit function declaration errors in bpf_qdisc_xxx.c by adding
> the required kernel symbol declarations to the shared header file
> bpf_qdisc_common.h. This ensures all qdisc BPF programs can properly
> resolve these kernel functions.
>
> The added declarations include:
> - bpf_qdisc_skb_drop
> - bpf_qdisc_bstats_update
> - bpf_kfree_skb
> - bpf_skb_get_hash
> - bpf_qdisc_watchdog_schedule
>
> Using a common header prevents duplication and ensures consistency
> across different qdisc implementations.

If you have proper and recent vmlinux.h (with recent pahole as well during
kernel build), all the above declarations should be in vmlinux.h.
How did you generate your vmlinux.h? Can you just generate a better one
based on recent kernel/pahole?

>
> Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
> ---
>   tools/testing/selftests/bpf/progs/bpf_qdisc_common.h | 9 +++++++++
>   1 file changed, 9 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..4c896b3e0f65 100644
> --- a/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h
> +++ b/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h
> @@ -14,6 +14,15 @@
>   
>   struct bpf_sk_buff_ptr;
>   
> +extern void bpf_qdisc_skb_drop(struct sk_buff *skb,
> +			       struct bpf_sk_buff_ptr *to_free_list) __ksym;
> +extern void bpf_qdisc_bstats_update(struct Qdisc *sch,
> +				    const struct sk_buff *skb) __ksym;
> +extern void bpf_kfree_skb(struct sk_buff *skb) __ksym;
> +extern u32 bpf_skb_get_hash(struct sk_buff *skb) __ksym;
> +extern void bpf_qdisc_watchdog_schedule(struct Qdisc *sch, u64 expire,
> +					u64 delta_ns) __ksym;
> +
>   static struct qdisc_skb_cb *qdisc_skb_cb(const struct sk_buff *skb)
>   {
>   	return (struct qdisc_skb_cb *)skb->cb;


      reply	other threads:[~2025-08-01  3:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01  2:52 [PATCH] selftests: bpf: Add missing symbol declarations to common header chenyuan_fl
2025-08-01  3:08 ` Yonghong Song [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49f21df7-5505-4ce4-9bde-4431bf97831e@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenyuan@kylinos.cn \
    --cc=chenyuan_fl@163.com \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).