# Re: \[PATCH net-next v5 2/7\] net: introduce sk\_skb\_reason\_drop function

- From: Jesper Dangaard Brouer \<hawk@kernel.org\>
- Date: 2024-06-18 06:18:19 
- List: netdev
- Page: https://ratatoskr.run/netdev/2024/06/2642536
- Thread: https://ratatoskr.run/netdev/2024/06/2641968/t.md

```text


On 17/06/2024 20.09, Yan Zhai wrote:
> Long used destructors kfree_skb and kfree_skb_reason do not pass
> receiving socket to packet drop tracepoints trace_kfree_skb.
> This makes it hard to track packet drops of a certain netns (container)
> or a socket (user application).
>
> The naming of these destructors are also not consistent with most sk/skb
> operating functions, i.e. functions named "sk_xxx" or "skb_xxx".
> Introduce a new functions sk_skb_reason_drop as drop-in replacement for
> kfree_skb_reason on local receiving path. Callers can now pass receiving
> sockets to the tracepoints.
>
> kfree_skb and kfree_skb_reason are still usable but they are now just
> inline helpers that call sk_skb_reason_drop.
>
> Note it is not feasible to do the same to consume_skb. Packets not
> dropped can flow through multiple receive handlers, and have multiple
> receiving sockets. Leave it untouched for now.
>
> Suggested-by: Eric Dumazet<redacted>
> Signed-off-by: Yan Zhai<redacted>
> ---
> v1->v2: changes function names to be more consistent with common sk/skb
> operations
> ---
>   include/linux/skbuff.h | 10 ++++++++--
>   net/core/skbuff.c      | 22 ++++++++++++----------
>   2 files changed, 20 insertions(+), 12 deletions(-)

Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
```
