aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Berger <opendmb@gmail.com>2017-03-09 19:58:50 -0500
committerDavid S. Miller <davem@davemloft.net>2017-03-09 21:39:01 -0500
commit6d22fe14005ce66d1a120495ac16499b944feb95 (patch)
tree1a20612410bf86452ed5136728328f6cc3f02012
parent89316fa34ab8afac8d693f41a5bc268673f1da15 (diff)
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: 1c1008c793fa ("net: bcmgenet: add main driver file") Signed-off-by: Doug Berger <opendmb@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index ec1f3014e410..69015fa50f20 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1234,7 +1234,6 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
1234 struct bcmgenet_priv *priv = netdev_priv(dev); 1234 struct bcmgenet_priv *priv = netdev_priv(dev);
1235 struct device *kdev = &priv->pdev->dev; 1235 struct device *kdev = &priv->pdev->dev;
1236 struct enet_cb *tx_cb_ptr; 1236 struct enet_cb *tx_cb_ptr;
1237 struct netdev_queue *txq;
1238 unsigned int pkts_compl = 0; 1237 unsigned int pkts_compl = 0;
1239 unsigned int bytes_compl = 0; 1238 unsigned int bytes_compl = 0;
1240 unsigned int c_index; 1239 unsigned int c_index;
@@ -1286,13 +1285,8 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
1286 dev->stats.tx_packets += pkts_compl; 1285 dev->stats.tx_packets += pkts_compl;
1287 dev->stats.tx_bytes += bytes_compl; 1286 dev->stats.tx_bytes += bytes_compl;
1288 1287
1289 txq = netdev_get_tx_queue(dev, ring->queue); 1288 netdev_tx_completed_queue(netdev_get_tx_queue(dev, ring->queue),
1290 netdev_tx_completed_queue(txq, pkts_compl, bytes_compl); 1289 pkts_compl, bytes_compl);
1291
1292 if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
1293 if (netif_tx_queue_stopped(txq))
1294 netif_tx_wake_queue(txq);
1295 }
1296 1290
1297 return pkts_compl; 1291 return pkts_compl;
1298} 1292}
@@ -1315,8 +1309,16 @@ static int bcmgenet_tx_poll(struct napi_struct *napi, int budget)
1315 struct bcmgenet_tx_ring *ring = 1309 struct bcmgenet_tx_ring *ring =
1316 container_of(napi, struct bcmgenet_tx_ring, napi); 1310 container_of(napi, struct bcmgenet_tx_ring, napi);
1317 unsigned int work_done = 0; 1311 unsigned int work_done = 0;
1312 struct netdev_queue *txq;
1313 unsigned long flags;
1318 1314
1319 work_done = bcmgenet_tx_reclaim(ring->priv->dev, ring); 1315 spin_lock_irqsave(&ring->lock, flags);
1316 work_done = __bcmgenet_tx_reclaim(ring->priv->dev, ring);
1317 if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
1318 txq = netdev_get_tx_queue(ring->priv->dev, ring->queue);
1319 netif_tx_wake_queue(txq);
1320 }
1321 spin_unlock_irqrestore(&ring->lock, flags);
1320 1322
1321 if (work_done == 0) { 1323 if (work_done == 0) {
1322 napi_complete(napi); 1324 napi_complete(napi);