Skip to content

Commit 3c3abbc

Browse files
Ryceancurrygregkh
authored andcommitted
net: bcmgenet: fix leaking free_bds
[ Upstream commit 3f31683 ] 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: f1bacae ("net: bcmgenet: support reclaiming unsent Tx packets") Signed-off-by: Justin Chen <justin.chen@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Tested-by: Nicolai Buchwitz <nb@tipi-net.de> Link: https://patch.msgid.link/20260406175756.134567-3-justin.chen@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e8cc795 commit 3c3abbc

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,7 @@ static unsigned int bcmgenet_tx_reclaim(struct net_device *dev,
19331933
drop = (ring->prod_index - ring->c_index) & DMA_C_INDEX_MASK;
19341934
released += drop;
19351935
ring->prod_index = ring->c_index & DMA_C_INDEX_MASK;
1936+
ring->free_bds += drop;
19361937
while (drop--) {
19371938
cb_ptr = bcmgenet_put_txcb(priv, ring);
19381939
skb = cb_ptr->skb;
@@ -1944,6 +1945,7 @@ static unsigned int bcmgenet_tx_reclaim(struct net_device *dev,
19441945
}
19451946
if (skb)
19461947
dev_consume_skb_any(skb);
1948+
netdev_tx_reset_queue(netdev_get_tx_queue(dev, ring->index));
19471949
bcmgenet_tdma_ring_writel(priv, ring->index,
19481950
ring->prod_index, TDMA_PROD_INDEX);
19491951
wr_ptr = ring->write_ptr * WORDS_PER_BD(priv);

0 commit comments

Comments
 (0)