[PATCH net v2 0/4] Drop in-flight Tx SKBs on MACB close
From: Théo Lebrun
Date: Tue Apr 28 2026 - 12:58:49 EST
The first patch is here to allow giving a drop reason.
We dissociate consumed packets from dropped ones that way.
Second patch is the main one: it drops unsent packets on close.
MACB driver forgot freeing its SKBs (and associated DMA mappings).
Last two patches are to fix stats reporting on dropped codepaths.
---
Changes in v2:
- Increment tx_dropped stat once per SKB, not once per frame.
- Reset tx_head & tx_tail to avoid keeping stalled cursors.
- Fix SKB dropped reasons throughout by adding the reason as parameter
to macb_tx_unmap(). This is a new patch. Then the drop-all-on-close
fix can use this ability to report we are not consuming SKBs.
- Add increment to stats->tx_dropped on DMA mapping failure and
tx_error_task. Done as separate patches (3 and 4).
- Rebase upon net/main @ 46f74a3f7d57, nothing to report.
- Link to v1: https://patch.msgid.link/20260424-macb-drop-tx-v1-1-b3ecb787d84d@xxxxxxxxxxx
To: Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>
To: Claudiu Beznea <claudiu.beznea@xxxxxxxxx>
To: Andrew Lunn <andrew+netdev@xxxxxxx>
To: "David S. Miller" <davem@xxxxxxxxxxxxx>
To: Eric Dumazet <edumazet@xxxxxxxxxx>
To: Jakub Kicinski <kuba@xxxxxxxxxx>
To: Paolo Abeni <pabeni@xxxxxxxxxx>
To: Haavard Skinnemoen <hskinnemoen@xxxxxxxxx>
To: Jeff Garzik <jeff@xxxxxxxxxx>
Cc: Paolo Valerio <pvalerio@xxxxxxxxxx>
Cc: Conor Dooley <conor@xxxxxxxxxx>
Cc: Nicolai Buchwitz <nb@xxxxxxxxxxx>
Cc: netdev@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: Vladimir Kondratiev <vladimir.kondratiev@xxxxxxxxxxxx>
Cc: Gregory CLEMENT <gregory.clement@xxxxxxxxxxx>
Cc: Benoît Monin <benoit.monin@xxxxxxxxxxx>
Cc: Tawfik Bayouk <tawfik.bayouk@xxxxxxxxxxxx>
Cc: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxx>
Cc: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>
---
Théo Lebrun (4):
net: macb: give reasons for Tx SKB kfree
net: macb: drop in-flight Tx SKBs on close
net: macb: increment stats.tx_dropped on tx error
net: macb: increment stats.tx_dropped on DMA map error
drivers/net/ethernet/cadence/macb_main.c | 57 +++++++++++++++++++++++++++-----
1 file changed, 48 insertions(+), 9 deletions(-)
---
base-commit: e3684df8e778a9988b7f7a84e08daea8019b661e
change-id: 20260423-macb-drop-tx-f9ce72720d05
Best regards,
--
Théo Lebrun <theo.lebrun@xxxxxxxxxxx>