Commit 10c8fd2f authored by Sieng-Piaw Liew's avatar Sieng-Piaw Liew Committed by Jakub Kicinski

bcm63xx: fix Tx cleanup when NAPI poll budget is zero

NAPI poll() function may be passed a budget value of zero, i.e. during
netpoll, which isn't NAPI context.
Therefore, napi_consume_skb() must be given budget value instead of
!force to truly discern netpoll-like scenarios.

Fixes: c63c615e ("bcm63xx_enet: switch to napi_build_skb() to reuse skbuff_heads")
Signed-off-by: default avatarSieng-Piaw Liew <liew.s.piaw@gmail.com>
Link: https://lore.kernel.org/r/20220708080303.298-1-liew.s.piaw@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b205c1b4
...@@ -423,7 +423,7 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget) ...@@ -423,7 +423,7 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget)
/* /*
* try to or force reclaim of transmitted buffers * try to or force reclaim of transmitted buffers
*/ */
static int bcm_enet_tx_reclaim(struct net_device *dev, int force) static int bcm_enet_tx_reclaim(struct net_device *dev, int force, int budget)
{ {
struct bcm_enet_priv *priv; struct bcm_enet_priv *priv;
unsigned int bytes; unsigned int bytes;
...@@ -468,7 +468,7 @@ static int bcm_enet_tx_reclaim(struct net_device *dev, int force) ...@@ -468,7 +468,7 @@ static int bcm_enet_tx_reclaim(struct net_device *dev, int force)
dev->stats.tx_errors++; dev->stats.tx_errors++;
bytes += skb->len; bytes += skb->len;
napi_consume_skb(skb, !force); napi_consume_skb(skb, budget);
released++; released++;
} }
...@@ -499,7 +499,7 @@ static int bcm_enet_poll(struct napi_struct *napi, int budget) ...@@ -499,7 +499,7 @@ static int bcm_enet_poll(struct napi_struct *napi, int budget)
ENETDMAC_IR, priv->tx_chan); ENETDMAC_IR, priv->tx_chan);
/* reclaim sent skb */ /* reclaim sent skb */
bcm_enet_tx_reclaim(dev, 0); bcm_enet_tx_reclaim(dev, 0, budget);
spin_lock(&priv->rx_lock); spin_lock(&priv->rx_lock);
rx_work_done = bcm_enet_receive_queue(dev, budget); rx_work_done = bcm_enet_receive_queue(dev, budget);
...@@ -1211,7 +1211,7 @@ static int bcm_enet_stop(struct net_device *dev) ...@@ -1211,7 +1211,7 @@ static int bcm_enet_stop(struct net_device *dev)
bcm_enet_disable_mac(priv); bcm_enet_disable_mac(priv);
/* force reclaim of all tx buffers */ /* force reclaim of all tx buffers */
bcm_enet_tx_reclaim(dev, 1); bcm_enet_tx_reclaim(dev, 1, 0);
/* free the rx buffer ring */ /* free the rx buffer ring */
bcm_enet_free_rx_buf_ring(kdev, priv); bcm_enet_free_rx_buf_ring(kdev, priv);
...@@ -2362,7 +2362,7 @@ static int bcm_enetsw_stop(struct net_device *dev) ...@@ -2362,7 +2362,7 @@ static int bcm_enetsw_stop(struct net_device *dev)
bcm_enet_disable_dma(priv, priv->rx_chan); bcm_enet_disable_dma(priv, priv->rx_chan);
/* force reclaim of all tx buffers */ /* force reclaim of all tx buffers */
bcm_enet_tx_reclaim(dev, 1); bcm_enet_tx_reclaim(dev, 1, 0);
/* free the rx buffer ring */ /* free the rx buffer ring */
bcm_enet_free_rx_buf_ring(kdev, priv); bcm_enet_free_rx_buf_ring(kdev, priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment