[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMB2axNCKcGST4SVxXJ+9eqna7u3JZka+qH=pp-dpmW6gM0OaQ@mail.gmail.com>
Date: Fri, 2 May 2025 12:33:21 -0700
From: Amery Hung <ameryhung@...il.com>
To: Martin KaFai Lau <martin.lau@...ux.dev>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, alexei.starovoitov@...il.com,
andrii@...nel.org, daniel@...earbox.net, martin.lau@...nel.org,
xiyou.wangcong@...il.com, kernel-team@...a.com
Subject: Re: [PATCH bpf-next/net v1 2/5] selftests/bpf: Test setting and
creating bpf qdisc as default qdisc
On Fri, May 2, 2025 at 12:27 PM Martin KaFai Lau <martin.lau@...ux.dev> wrote:
>
> On 5/2/25 10:52 AM, Amery Hung wrote:
> >>> +static void test_default_qdisc_attach_to_mq(void)
> >>> +{
> >>> + struct bpf_qdisc_fifo *fifo_skel;
> >>> + char default_qdisc[IFNAMSIZ];
> >>> + struct netns_obj *netns;
> >>> + char tc_qdisc_show[64];
> >>> + struct bpf_link *link;
> >>> + char *str_ret;
> >>> + FILE *tc;
> >>> + int err;
> >>> +
> >>> + fifo_skel = bpf_qdisc_fifo__open_and_load();
> >>> + if (!ASSERT_OK_PTR(fifo_skel, "bpf_qdisc_fifo__open_and_load"))
> >>> + return;
> >>> +
> >>> + link = bpf_map__attach_struct_ops(fifo_skel->maps.fifo);
> >>
> >> fifo_skel->links.fifo = bpf_map__attach_struct_ops(....);
> >>
> >> Then no need to bpf_link__destroy(link). bpf_qdisc_fifo__destroy() should do.
> >>
> >
> > I see. I assume it will also be okay to set autoattach and call
> > bpf_qdisc_fifo__attach()?
>
> Good point. bpf_qdisc_fifo__attach() will be even simpler. I thought the
> autoattach is true by default. Please check.
>
You are right. It is true by default. I will also clean up other qdisc
subtests in this way.
Powered by blists - more mailing lists