Commit 3f316830 authored by Justin Chen's avatar Justin Chen Committed by Jakub Kicinski
Browse files

net: bcmgenet: fix leaking free_bds



While reclaiming the tx queue we fast forward the write pointer to
drop any data in flight. These dropped frames are not added back
to the pool of free bds. We also need to tell the netdev that we
are dropping said data.

Fixes: f1bacae8 ("net: bcmgenet: support reclaiming unsent Tx packets")
Signed-off-by: default avatarJustin Chen <justin.chen@broadcom.com>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: default avatarNicolai Buchwitz <nb@tipi-net.de>
Tested-by: default avatarNicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20260406175756.134567-3-justin.chen@broadcom.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 57f3f53d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1985,6 +1985,7 @@ static unsigned int bcmgenet_tx_reclaim(struct net_device *dev,
		drop = (ring->prod_index - ring->c_index) & DMA_C_INDEX_MASK;
		released += drop;
		ring->prod_index = ring->c_index & DMA_C_INDEX_MASK;
		ring->free_bds += drop;
		while (drop--) {
			cb_ptr = bcmgenet_put_txcb(priv, ring);
			skb = cb_ptr->skb;
@@ -1996,6 +1997,7 @@ static unsigned int bcmgenet_tx_reclaim(struct net_device *dev,
		}
		if (skb)
			dev_consume_skb_any(skb);
		netdev_tx_reset_queue(netdev_get_tx_queue(dev, ring->index));
		bcmgenet_tdma_ring_writel(priv, ring->index,
					  ring->prod_index, TDMA_PROD_INDEX);
		wr_ptr = ring->write_ptr * WORDS_PER_BD(priv);