Commit 6d22fe14 authored by Doug Berger's avatar Doug Berger Committed by David S. Miller

net: bcmgenet: decouple flow control from bcmgenet_tx_reclaim

The bcmgenet_tx_reclaim() function is used to reclaim transmit
resources in different places within the driver.  Most of them
should not affect the state of the transmit flow control.

This commit relocates the logic for waking tx queues based on
freed resources to the napi polling function where it is more
appropriate.

Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 89316fa3
...@@ -1234,7 +1234,6 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, ...@@ -1234,7 +1234,6 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
struct bcmgenet_priv *priv = netdev_priv(dev); struct bcmgenet_priv *priv = netdev_priv(dev);
struct device *kdev = &priv->pdev->dev; struct device *kdev = &priv->pdev->dev;
struct enet_cb *tx_cb_ptr; struct enet_cb *tx_cb_ptr;
struct netdev_queue *txq;
unsigned int pkts_compl = 0; unsigned int pkts_compl = 0;
unsigned int bytes_compl = 0; unsigned int bytes_compl = 0;
unsigned int c_index; unsigned int c_index;
...@@ -1286,13 +1285,8 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, ...@@ -1286,13 +1285,8 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
dev->stats.tx_packets += pkts_compl; dev->stats.tx_packets += pkts_compl;
dev->stats.tx_bytes += bytes_compl; dev->stats.tx_bytes += bytes_compl;
txq = netdev_get_tx_queue(dev, ring->queue); netdev_tx_completed_queue(netdev_get_tx_queue(dev, ring->queue),
netdev_tx_completed_queue(txq, pkts_compl, bytes_compl); pkts_compl, bytes_compl);
if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
if (netif_tx_queue_stopped(txq))
netif_tx_wake_queue(txq);
}
return pkts_compl; return pkts_compl;
} }
...@@ -1315,8 +1309,16 @@ static int bcmgenet_tx_poll(struct napi_struct *napi, int budget) ...@@ -1315,8 +1309,16 @@ static int bcmgenet_tx_poll(struct napi_struct *napi, int budget)
struct bcmgenet_tx_ring *ring = struct bcmgenet_tx_ring *ring =
container_of(napi, struct bcmgenet_tx_ring, napi); container_of(napi, struct bcmgenet_tx_ring, napi);
unsigned int work_done = 0; unsigned int work_done = 0;
struct netdev_queue *txq;
unsigned long flags;
work_done = bcmgenet_tx_reclaim(ring->priv->dev, ring); spin_lock_irqsave(&ring->lock, flags);
work_done = __bcmgenet_tx_reclaim(ring->priv->dev, ring);
if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
txq = netdev_get_tx_queue(ring->priv->dev, ring->queue);
netif_tx_wake_queue(txq);
}
spin_unlock_irqrestore(&ring->lock, flags);
if (work_done == 0) { if (work_done == 0) {
napi_complete(napi); napi_complete(napi);
......
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