[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <10ca0a54-18b0-43fd-bf70-c1ab15349e87@linux.dev>
Date: Fri, 11 Apr 2025 13:11:25 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Amery Hung <ameryhung@...il.com>
Cc: Kumar Kartikeya Dwivedi <memxor@...il.com>, 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 03/10] bpf: net_sched: Add basic bpf qdisc
kfuncs
On 4/11/25 1:03 PM, Amery Hung wrote:
>> The same goes for the bpf_kfree_skb(). I was thinking if it is useful at all
>> considering there is already a bpf_qdisc_skb_drop(). I kept it there because it
>> is a little more intuitive in case the .reset/.destroy wanted to do a "skb =
>> bpf_kptr_xchg(&skbn->skb, NULL);" and then explicitly free the
>> bpf_kfree_skb(skb). However, the bpf prog can also directly do the
>> bpf_obj_drop(skbn) and then bpf_kfree_skb() is not needed, right?
>>
>>
>
> My rationale for keeping two skb releasing kfuncs: bpf_kfree_skb() is
> the dtor and since dtor can only have one argument, so
> bpf_qdisc_skb_drop() can not replace it. Since bpf_kfree_skb() is here
> to stay, I allow users to call it directly for convenience. Only
> exposing bpf_qdisc_skb_drop() and calling kfree_skb() in
> bpf_qdisc_skb_drop() when to_free is NULL will also do. I don’t have a
> strong opinion.
>
> Yes, bpf_kfree_skb() will not be needed if doing bpf_obj_drop(skbn).
> bpf_obj_drop() internally will call the dtor of a kptr (i.e., in this
> case, bpf_kfree_skb()) in an allocated object.
Make sense. Lets keep the bpf_kfree_skb() as-is instead of complicating the
bpf_qdisc_skb_drop() with NULL vs non-NULL argument.
Powered by blists - more mailing lists