mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v1] net: gro_cells: add drop reasons to gro_cells_receive()
@ 2026-09-16  9:14 Xuanqiang Luo
  2026-09-16  9:29 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Xuanqiang Luo @ 2026-09-16  9:14 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Sebastian Andrzej Siewior, Dong Chenchen,
	David Ahern, Xuanqiang Luo, Kees Cook, linux-kernel

From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>

gro_cells_receive() reports SKB_DROP_REASON_NOT_SPECIFIED when the device
is down or the GRO cell queue length exceeds max_backlog.

Pass SKB_DROP_REASON_DEV_READY and SKB_DROP_REASON_CPU_BACKLOG to
kfree_skb_reason() for these two cases, respectively.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
---
This patch is based entirely on Eric Dumazet's suggestion in the
discussion below:
https://lore.kernel.org/all/CANn89i+d4ny7K0QV-v+ZY6Kj735tPVrrzd0AzwRqe4vvu5r=aw@mail.gmail.com/

 net/core/gro_cells.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c
index d8c0a28671201..1d64207bf960f 100644
--- a/net/core/gro_cells.c
+++ b/net/core/gro_cells.c
@@ -14,11 +14,13 @@ struct gro_cell {
 int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
+	enum skb_drop_reason reason;
 	bool have_bh_lock = false;
 	struct gro_cell *cell;
 	int res;
 
 	rcu_read_lock();
+	reason = SKB_DROP_REASON_DEV_READY;
 	if (unlikely(!(dev->flags & IFF_UP)))
 		goto drop;
 
@@ -34,9 +36,10 @@ int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
 	cell = this_cpu_ptr(gcells->cells);
 
 	if (skb_queue_len(&cell->napi_skbs) > READ_ONCE(net_hotdata.max_backlog)) {
+		reason = SKB_DROP_REASON_CPU_BACKLOG;
 drop:
 		dev_core_stats_rx_dropped_inc(dev);
-		kfree_skb(skb);
+		kfree_skb_reason(skb, reason);
 		res = NET_RX_DROP;
 		goto unlock;
 	}

base-commit: 87b80c2f6b05cad9f0ff9136709c62a0f59923e3
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v1] net: gro_cells: add drop reasons to gro_cells_receive()
  2026-09-16  9:14 [PATCH net-next v1] net: gro_cells: add drop reasons to gro_cells_receive() Xuanqiang Luo
@ 2026-09-16  9:29 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2026-09-16  9:29 UTC (permalink / raw)
  To: Xuanqiang Luo
  Cc: netdev, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Sebastian Andrzej Siewior, Dong Chenchen,
	David Ahern, Xuanqiang Luo, Kees Cook, linux-kernel

On Wed, Sep 16, 2026 at 2:14 AM Xuanqiang Luo <xuanqiang.luo@linux.dev> wrote:
>
> From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
>
> gro_cells_receive() reports SKB_DROP_REASON_NOT_SPECIFIED when the device
> is down or the GRO cell queue length exceeds max_backlog.
>
> Pass SKB_DROP_REASON_DEV_READY and SKB_DROP_REASON_CPU_BACKLOG to
> kfree_skb_reason() for these two cases, respectively.
>
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>

Reviewed-by: Eric Dumazet <edumazet@google.com>
Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-16  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  9:14 [PATCH net-next v1] net: gro_cells: add drop reasons to gro_cells_receive() Xuanqiang Luo
2026-09-16  9:29 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®