[PATCH net v2 4/4] net: macb: increment stats.tx_dropped on DMA map error

Théo Lebrun
2026-04-28T16:33:38Z

On .ndo_start_xmit() and DMA mapping failure, increment the Tx dropped
statistics counter by one.

Fixes: 89e5785fc8a6 ("[PATCH] Atmel MACB ethernet driver")
Cc: stable@vger.kernel.org
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index ba7cbb10dc2c..353b4bd61aae 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2567,6 +2567,8 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Map socket buffer for DMA transfer */
if (macb_tx_map(bp, queue, skb, hdrlen)) {
dev_kfree_skb_any(skb);
+ queue->stats.tx_dropped++;
+ bp->dev->stats.tx_dropped++;
goto unlock;
}

--
2.54.0