netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net-next 4/4] net: bcmgenet: manipulate netdev_queue directly
Date: Thu, 20 Mar 2014 10:53:23 -0700	[thread overview]
Message-ID: <1395338003-17982-5-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1395338003-17982-1-git-send-email-f.fainelli@gmail.com>

Instead of always invoking netdev_get_tx_queue() in bcmgenet_xmit() and
bcmgenet_tx_reclaim(), just get the corresponding netdev_queue pointer
once and for all and manipulate it throughout bcmgenet_xmit() and
bcmgenet_tx_reclaim().

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index cfcb046f4de5..8f87fe001541 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -868,10 +868,12 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev,
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 	int last_tx_cn, last_c_index, num_tx_bds;
 	struct enet_cb *tx_cb_ptr;
+	struct netdev_queue *txq;
 	unsigned int c_index;
 
 	/* Compute how many buffers are transmited since last xmit call */
 	c_index = bcmgenet_tdma_ring_readl(priv, ring->index, TDMA_CONS_INDEX);
+	txq = netdev_get_tx_queue(dev, ring->queue);
 
 	last_c_index = ring->c_index;
 	num_tx_bds = ring->size;
@@ -917,8 +919,8 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev,
 	if (ring->free_bds > (MAX_SKB_FRAGS + 1))
 		ring->int_disable(priv, ring);
 
-	if (__netif_subqueue_stopped(dev, ring->queue))
-		netif_wake_subqueue(dev, ring->queue);
+	if (netif_tx_queue_stopped(txq))
+		netif_tx_wake_queue(txq);
 
 	ring->c_index = c_index;
 }
@@ -1106,6 +1108,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 	struct bcmgenet_tx_ring *ring = NULL;
+	struct netdev_queue *txq;
 	unsigned long flags = 0;
 	int nr_frags, index;
 	u16 dma_desc_flags;
@@ -1127,10 +1130,11 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	nr_frags = skb_shinfo(skb)->nr_frags;
 	ring = &priv->tx_rings[index];
+	txq = netdev_get_tx_queue(dev, ring->queue);
 
 	spin_lock_irqsave(&ring->lock, flags);
 	if (ring->free_bds <= nr_frags + 1) {
-		netif_stop_subqueue(dev, ring->queue);
+		netif_tx_stop_queue(txq);
 		netdev_err(dev, "%s: tx ring %d full when queue %d awake\n",
 				__func__, index, ring->queue);
 		ret = NETDEV_TX_BUSY;
@@ -1177,7 +1181,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
 			ring->prod_index, TDMA_PROD_INDEX);
 
 	if (ring->free_bds <= (MAX_SKB_FRAGS + 1)) {
-		netif_stop_subqueue(dev, ring->queue);
+		netif_tx_stop_queue(txq);
 		ring->int_enable(priv, ring);
 	}
 
-- 
1.8.3.2

  parent reply	other threads:[~2014-03-20 17:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 17:53 [PATCH net-next 0/4] net: bcmgenet: misc fixes Florian Fainelli
2014-03-20 17:53 ` [PATCH net-next 1/4] net: bcmgenet: remove unused spinlock member Florian Fainelli
2014-03-20 17:53 ` [PATCH net-next 2/4] net: bcmgenet: add skb_tx_timestamp call Florian Fainelli
2014-03-20 17:53 ` [PATCH net-next 3/4] net: bcmgenet: remove bogus tx queue checks Florian Fainelli
2014-03-20 17:53 ` Florian Fainelli [this message]
2014-03-20 21:36 ` [PATCH net-next 0/4] net: bcmgenet: misc fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395338003-17982-5-git-send-email-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).