netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rasesh Mody <rmody@brocade.com>
To: <netdev@vger.kernel.org>
Cc: <huangj@brocade.com>, Rasesh Mody <rmody@brocade.com>,
	Debashis Dutt <ddutt@brocade.com>
Subject: [PATCH 05/10] bna: Fix for TX queue
Date: Thu, 23 Dec 2010 23:45:05 -0800	[thread overview]
Message-ID: <1293176710-21335-6-git-send-email-rmody@brocade.com> (raw)
In-Reply-To: <1293176710-21335-1-git-send-email-rmody@brocade.com>

Change Details:
	- Call netif_wake_queue() if we have freed up sufficient elements
	at the end of completion processing
	- Add netif_queue_stopped counter back to bnad_drv_stats {}
	- Get netif_queue_stopped value from stack
	- Remove BUG_ON() on value returned by pci_unmap_addr()

Signed-off-by: Debashis Dutt <ddutt@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
 drivers/net/bna/bnad.c         |   20 ++++++++++++++++----
 drivers/net/bna/bnad.h         |    7 +++++--
 drivers/net/bna/bnad_ethtool.c |    4 ++++
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
index 5e7a030..f775936 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -109,7 +109,7 @@ static void
 bnad_free_all_txbufs(struct bnad *bnad,
 		 struct bna_tcb *tcb)
 {
-	u16 		unmap_cons;
+	u32 		unmap_cons;
 	struct bnad_unmap_q *unmap_q = tcb->unmap_q;
 	struct bnad_skb_unmap *unmap_array;
 	struct sk_buff 		*skb = NULL;
@@ -244,7 +244,7 @@ bnad_tx_free_tasklet(unsigned long bnad_ptr)
 {
 	struct bnad *bnad = (struct bnad *)bnad_ptr;
 	struct bna_tcb *tcb;
-	u32 		acked;
+	u32 		acked = 0;
 	int			i, j;
 
 	for (i = 0; i < bnad->num_tx; i++) {
@@ -263,6 +263,20 @@ bnad_tx_free_tasklet(unsigned long bnad_ptr)
 				smp_mb__before_clear_bit();
 				clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags);
 			}
+			if (unlikely(!test_bit(BNAD_TXQ_TX_STARTED,
+						&tcb->flags)))
+				continue;
+			if (netif_queue_stopped(bnad->netdev)) {
+				if (acked && netif_carrier_ok(bnad->netdev) &&
+					BNA_QE_FREE_CNT(tcb, tcb->q_depth) >=
+						BNAD_NETIF_WAKE_THRESHOLD) {
+					netif_wake_queue(bnad->netdev);
+					/* TODO */
+					/* Counters for individual TxQs? */
+					BNAD_UPDATE_CTR(bnad,
+						netif_queue_wakeup);
+				}
+			}
 		}
 	}
 }
@@ -334,8 +348,6 @@ bnad_free_all_rxbufs(struct bnad *bnad, struct bna_rcb *rcb)
 		skb = unmap_q->unmap_array[unmap_cons].skb;
 		if (!skb)
 			continue;
-		BUG_ON(!(pci_unmap_addr(
-			&unmap_q->unmap_array[unmap_cons], dma_addr)));
 		unmap_q->unmap_array[unmap_cons].skb = NULL;
 		pci_unmap_single(bnad->pcidev, pci_unmap_addr(&unmap_q->
 					unmap_array[unmap_cons],
diff --git a/drivers/net/bna/bnad.h b/drivers/net/bna/bnad.h
index f59685a..1954dea 100644
--- a/drivers/net/bna/bnad.h
+++ b/drivers/net/bna/bnad.h
@@ -126,6 +126,7 @@ struct bnad_completion {
 struct bnad_drv_stats {
 	u64 		netif_queue_stop;
 	u64		netif_queue_wakeup;
+	u64		netif_queue_stopped;
 	u64		tso4;
 	u64		tso6;
 	u64		tso_err;
@@ -308,8 +309,10 @@ extern void bnad_cleanup_rx(struct bnad *bnad, uint rx_id);
 extern void bnad_dim_timer_start(struct bnad *bnad);
 
 /* Statistics */
-extern void bnad_netdev_qstats_fill(struct bnad *bnad, struct rtnl_link_stats64 *stats);
-extern void bnad_netdev_hwstats_fill(struct bnad *bnad, struct rtnl_link_stats64 *stats);
+extern void bnad_netdev_qstats_fill(struct bnad *bnad,
+		struct rtnl_link_stats64 *stats);
+extern void bnad_netdev_hwstats_fill(struct bnad *bnad,
+		struct rtnl_link_stats64 *stats);
 
 /**
  * MACROS
diff --git a/drivers/net/bna/bnad_ethtool.c b/drivers/net/bna/bnad_ethtool.c
index 3011110..99be5ae 100644
--- a/drivers/net/bna/bnad_ethtool.c
+++ b/drivers/net/bna/bnad_ethtool.c
@@ -68,6 +68,7 @@ static char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = {
 
 	"netif_queue_stop",
 	"netif_queue_wakeup",
+	"netif_queue_stopped",
 	"tso4",
 	"tso6",
 	"tso_err",
@@ -1180,6 +1181,9 @@ bnad_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats,
 
 	bi = sizeof(*net_stats64) / sizeof(u64);
 
+	/* Get netif_queue_stopped from stack */
+	bnad->stats.drv_stats.netif_queue_stopped = netif_queue_stopped(netdev);
+
 	/* Fill driver stats into ethtool buffers */
 	stats64 = (u64 *)&bnad->stats.drv_stats;
 	for (i = 0; i < sizeof(struct bnad_drv_stats) / sizeof(u64); i++)
-- 
1.7.1


  parent reply	other threads:[~2010-12-24  7:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-24  7:45 [PATCH 00/10] bna: Update Brocade BNA Ethernet driver to v2.3.2.3 Rasesh Mody
2010-12-24  7:45 ` [PATCH 01/10] bna: TxRx and datapath fix Rasesh Mody
2010-12-24  7:45 ` [PATCH 02/10] bna: Port enable disable sync and txq priority fix Rasesh Mody
2010-12-24  7:45 ` [PATCH 03/10] bna: Fix ethtool register dump and reordered an API Rasesh Mody
2010-12-24  7:45 ` [PATCH 04/10] bna: Enable pure priority tagged packet reception and rxf uninit cleanup fix Rasesh Mody
2010-12-24  7:45 ` Rasesh Mody [this message]
2010-12-24  7:45 ` [PATCH 06/10] bna: IOC uninit check and misc cleanup Rasesh Mody
2010-12-24  7:45 ` [PATCH 07/10] bna: Removed unused code Rasesh Mody
2010-12-24  7:45 ` [PATCH 08/10] bna: Restore VLAN filter table Rasesh Mody
2010-12-24  7:45 ` [PATCH 09/10] bna: IOC failure auto recovery fix Rasesh Mody
2010-12-24  7:45 ` [PATCH 10/10] bna: Update the driver version to 2.3.2.3 Rasesh Mody
  -- strict thread matches above, loose matches on Subject: below --
2010-12-22  7:23 [PATCH 00/10] bna: Update Brocade BNA Ethernet driver to v2.3.2.3 Rasesh Mody
2010-12-22  7:23 ` [PATCH 05/10] bna: Fix for TX queue Rasesh Mody

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=1293176710-21335-6-git-send-email-rmody@brocade.com \
    --to=rmody@brocade.com \
    --cc=ddutt@brocade.com \
    --cc=huangj@brocade.com \
    --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).