[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <348a6ba6-9c0e-6c62-6750-7944961b0487@huawei.com>
Date: Thu, 23 Feb 2023 17:19:44 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Eric Dumazet <edumazet@...gle.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <eric.dumazet@...il.com>
Subject: Re: [PATCH v2 net] net: fix __dev_kfree_skb_any() vs drop monitor
On 2023/2/23 16:38, Eric Dumazet wrote:
> dev_kfree_skb() is aliased to consume_skb().
>
> When a driver is dropping a packet by calling dev_kfree_skb_any()
> we should propagate the drop reason instead of pretending
> the packet was consumed.
>
> Note: Now we have enum skb_drop_reason we could remove
> enum skb_free_reason (for linux-6.4)
LGTM.
Reviewed-by: Yunsheng Lin <linyunsheng@...wei.com>
>
> v2: added an unlikely(), suggested by Yunsheng Lin.
>
> Fixes: e6247027e517 ("net: introduce dev_consume_skb_any()")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Yunsheng Lin <linyunsheng@...wei.com>
> ---
> net/core/dev.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 18dc8d75ead9795163ace74e8e86fe35cb9b7552..253584777101f2e6af3fc30107516f1e1197f8d3 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3134,8 +3134,10 @@ void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason)
> {
> if (in_hardirq() || irqs_disabled())
> __dev_kfree_skb_irq(skb, reason);
> + else if (unlikely(reason == SKB_REASON_DROPPED))
> + kfree_skb(skb);
> else
> - dev_kfree_skb(skb);
> + consume_skb(skb);
> }
> EXPORT_SYMBOL(__dev_kfree_skb_any);
>
>
Powered by blists - more mailing lists