[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ec91dcac-d2d0-4705-aca1-8cdc1954aa11@linux.dev>
Date: Fri, 2 May 2025 12:27:20 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
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,
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 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.
Powered by blists - more mailing lists