]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: bcmgenet: fix leaking free_bds
authorJustin Chen <justin.chen@broadcom.com>
Mon, 6 Apr 2026 17:57:55 +0000 (10:57 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 10 Apr 2026 03:19:45 +0000 (20:19 -0700)
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: f1bacae8b655 ("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>
drivers/net/ethernet/broadcom/genet/bcmgenet.c

index 0f6e4baba25b92be1c2bcdc8fce74412c104f653..e89126a0c20eaa91dfca22ee0c7df366b3f40245 100644 (file)
@@ -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);