Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1596520

[PATCH v2 net 8/8] net: bcmgenet: decouple flow control from bcmgenet_tx_reclaim

From Doug Berger <opendmb@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v2 net 8/8] net: bcmgenet: decouple flow control from bcmgenet_tx_reclaim
Date 2017-03-10 02:00 +0100
Message-ID <tjh4t-4qP-17@gated-at.bofh.it> (permalink)
References <tjh4t-4qP-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 20 +++++++++++---------
 1 file 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,
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 	struct device *kdev = &priv->pdev->dev;
 	struct enet_cb *tx_cb_ptr;
-	struct netdev_queue *txq;
 	unsigned int pkts_compl = 0;
 	unsigned int bytes_compl = 0;
 	unsigned int c_index;
@@ -1286,13 +1285,8 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
 	dev->stats.tx_packets += pkts_compl;
 	dev->stats.tx_bytes += bytes_compl;
 
-	txq = netdev_get_tx_queue(dev, ring->queue);
-	netdev_tx_completed_queue(txq, pkts_compl, bytes_compl);
-
-	if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
-		if (netif_tx_queue_stopped(txq))
-			netif_tx_wake_queue(txq);
-	}
+	netdev_tx_completed_queue(netdev_get_tx_queue(dev, ring->queue),
+				  pkts_compl, bytes_compl);
 
 	return pkts_compl;
 }
@@ -1315,8 +1309,16 @@ static int bcmgenet_tx_poll(struct napi_struct *napi, int budget)
 	struct bcmgenet_tx_ring *ring =
 		container_of(napi, struct bcmgenet_tx_ring, napi);
 	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) {
 		napi_complete(napi);
-- 
2.11.1

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 net 0/8] net: bcmgenet: minor bug fixes Doug Berger <opendmb@gmail.com> - 2017-03-10 02:00 +0100
  [PATCH v2 net 6/8] net: bcmgenet: Power up the internal PHY before probing the MII Doug Berger <opendmb@gmail.com> - 2017-03-10 02:00 +0100
    Re: [PATCH v2 net 6/8] net: bcmgenet: Power up the internal PHY  before probing the MII Florian Fainelli <f.fainelli@gmail.com> - 2017-03-10 02:50 +0100
  [PATCH v2 net 8/8] net: bcmgenet: decouple flow control from bcmgenet_tx_reclaim Doug Berger <opendmb@gmail.com> - 2017-03-10 02:00 +0100
    Re: [PATCH v2 net 8/8] net: bcmgenet: decouple flow control from  bcmgenet_tx_reclaim Florian Fainelli <f.fainelli@gmail.com> - 2017-03-10 02:50 +0100
  [PATCH v2 net 5/8] net: bcmgenet: synchronize irq0 status between the isr and task Doug Berger <opendmb@gmail.com> - 2017-03-10 02:00 +0100
  [PATCH v2 net 2/8] net: bcmgenet: correct MIB access of UniMAC RUNT counters Doug Berger <opendmb@gmail.com> - 2017-03-10 02:00 +0100
    Re: [PATCH v2 net 2/8] net: bcmgenet: correct MIB access of UniMAC  RUNT counters Florian Fainelli <f.fainelli@gmail.com> - 2017-03-10 02:50 +0100
  [PATCH v2 net 3/8] net: bcmgenet: reserved phy revisions must be checked first Doug Berger <opendmb@gmail.com> - 2017-03-10 02:10 +0100
  [PATCH v2 net 7/8] net: bcmgenet: add begin/complete ethtool ops Doug Berger <opendmb@gmail.com> - 2017-03-10 02:10 +0100
    Re: [PATCH v2 net 7/8] net: bcmgenet: add begin/complete ethtool ops Florian Fainelli <f.fainelli@gmail.com> - 2017-03-10 02:50 +0100
  [PATCH v2 net 4/8] net: bcmgenet: power down internal phy if open or resume fails Doug Berger <opendmb@gmail.com> - 2017-03-10 02:10 +0100
    Re: [PATCH v2 net 4/8] net: bcmgenet: power down internal phy if open  or resume fails Florian Fainelli <f.fainelli@gmail.com> - 2017-03-10 02:50 +0100
  [PATCH v2 net 1/8] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values Doug Berger <opendmb@gmail.com> - 2017-03-10 02:10 +0100
  Re: [PATCH v2 net 0/8] net: bcmgenet: minor bug fixes Florian Fainelli <f.fainelli@gmail.com> - 2017-03-10 02:50 +0100
  Re: [PATCH v2 net 0/8] net: bcmgenet: minor bug fixes David Miller <davem@davemloft.net> - 2017-03-10 03:40 +0100

csiph-web