[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABx7vpW8mCNpoCCDwJyWAXM1atSxfbc6O-su3g6BQA-GmzOm4w@mail.gmail.com>
Date: Thu, 10 Apr 2025 16:59:28 -0700
From: Martin KaFai Lau <iamkafai@...il.com>
To: Amery Hung <ameryhung@...il.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, alexei.starovoitov@...il.com,
andrii@...nel.org, daniel@...earbox.net, edumazet@...gle.com, kuba@...nel.org,
xiyou.wangcong@...il.com, jhs@...atatu.com, martin.lau@...nel.org,
jiri@...nulli.us, stfomichev@...il.com, toke@...hat.com, sinquersw@...il.com,
ekarani.silvestre@....ufcg.edu.br, yangpeihao@...u.edu.cn,
yepeilin.cs@...il.com, kernel-team@...a.com
Subject: Re: [PATCH bpf-next v7 08/10] selftests/bpf: Add a basic fifo qdisc test
On Wed, Apr 9, 2025 at 2:49 PM Amery Hung <ameryhung@...il.com> wrote:
> +void test_bpf_qdisc(void)
nit. re-name to "test_ns_bpf_qdisc"....
> +{
> + struct netns_obj *netns;
> +
> + netns = netns_new("bpf_qdisc_ns", true);
... then this can be saved.
> + if (!ASSERT_OK_PTR(netns, "netns_new"))
> + return;
> +
> + if (test__start_subtest("fifo"))
> + test_fifo();
> +
> + netns_free(netns);
> +}
> diff --git a/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h b/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h
> new file mode 100644
> index 000000000000..65a2c561c0bb
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/bpf_qdisc_common.h
> @@ -0,0 +1,31 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifndef _BPF_QDISC_COMMON_H
> +#define _BPF_QDISC_COMMON_H
> +
> +#define NET_XMIT_SUCCESS 0x00
> +#define NET_XMIT_DROP 0x01 /* skb dropped */
> +#define NET_XMIT_CN 0x02 /* congestion notification */
> +
> +#define TC_PRIO_CONTROL 7
> +#define TC_PRIO_MAX 15
> +
> +#define private(name) SEC(".data." #name) __hidden __attribute__((aligned(8)))
> +
> +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;
nit. These kfunc declarations should be no longer needed. vmlinux.h
should already have them. Update pahole if vmlinux.h does not have
them.
The set has been applied. Please consider following up the nits in
selftests. Thanks.
Powered by blists - more mailing lists