diff options
author | Sieng-Piaw Liew <liew.s.piaw@gmail.com> | 2022-07-08 16:16:08 +0800 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2023-03-04 19:28:16 +0100 |
commit | a6a54135ef7dca13a3f042afe83a99ce0218622c (patch) | |
tree | 5c7f4e6af1b7ddec579d4123391a454ee52b9e65 /target | |
parent | cbc1fcf0e4e21cf331cbd92dd7802b8f40c31107 (diff) | |
download | upstream-a6a54135ef7dca13a3f042afe83a99ce0218622c.tar.gz upstream-a6a54135ef7dca13a3f042afe83a99ce0218622c.tar.bz2 upstream-a6a54135ef7dca13a3f042afe83a99ce0218622c.zip |
bmips: 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.
https://lore.kernel.org/netdev/20220707141056.2644-1-liew.s.piaw@gmail.com/t/#m470f5c20225e76fb08c44d6cfa2f1b739ffaaea4
Signed-off-by: Sieng-Piaw Liew <liew.s.piaw@gmail.com>
[improve code format]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c index b3dc53c20f..c655ae8d27 100644 --- a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c +++ b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c @@ -442,7 +442,8 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget) /* * try to or force reclaim of transmitted buffers */ -static int bcm6368_enetsw_tx_reclaim(struct net_device *dev, int force) +static int bcm6368_enetsw_tx_reclaim(struct net_device *dev, int force, + int budget) { struct bcm6368_enetsw *priv = netdev_priv(dev); unsigned int bytes = 0; @@ -483,7 +484,7 @@ static int bcm6368_enetsw_tx_reclaim(struct net_device *dev, int force) dev->stats.tx_errors++; bytes += skb->len; - napi_consume_skb(skb, !force); + napi_consume_skb(skb, budget); released++; } @@ -511,7 +512,7 @@ static int bcm6368_enetsw_poll(struct napi_struct *napi, int budget) DMAC_IR_REG, priv->tx_chan); /* reclaim sent skb */ - bcm6368_enetsw_tx_reclaim(dev, 0); + bcm6368_enetsw_tx_reclaim(dev, 0, budget); spin_lock(&priv->rx_lock); rx_work_done = bcm6368_enetsw_receive_queue(dev, budget); @@ -855,7 +856,7 @@ static int bcm6368_enetsw_stop(struct net_device *dev) bcm6368_enetsw_disable_dma(priv, priv->rx_chan); /* force reclaim of all tx buffers */ - bcm6368_enetsw_tx_reclaim(dev, 1); + bcm6368_enetsw_tx_reclaim(dev, 1, 0); /* free the rx buffer ring */ for (i = 0; i < priv->rx_ring_size; i++) { |