netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 10/12] forcedeth: tx max work
@ 2007-01-09 18:30 Ayaz Abdulla
  2007-01-19  2:52 ` Jeff Garzik
  0 siblings, 1 reply; 8+ messages in thread
From: Ayaz Abdulla @ 2007-01-09 18:30 UTC (permalink / raw)
  To: Jeff Garzik, Manfred Spraul, Andrew Morton, netdev

[-- Attachment #1: Type: text/plain, Size: 145 bytes --]

This patch adds a limit to how much tx work can be done in each 
iteration of tx processing.

Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>


[-- Attachment #2: patch-tx-loop-limit --]
[-- Type: text/plain, Size: 1456 bytes --]

--- orig/drivers/net/forcedeth.c	2007-01-08 20:34:35.000000000 -0500
+++ new/drivers/net/forcedeth.c	2007-01-08 20:35:22.000000000 -0500
@@ -1859,14 +1859,15 @@
 	}
 }
 
-static void nv_tx_done_optimized(struct net_device *dev)
+static void nv_tx_done_optimized(struct net_device *dev, int limit)
 {
 	struct fe_priv *np = netdev_priv(dev);
 	u32 flags;
 	struct ring_desc_ex* orig_get_tx = np->get_tx.ex;
 
 	while ((np->get_tx.ex != np->put_tx.ex) &&
-	       !((flags = le32_to_cpu(np->get_tx.ex->flaglen)) & NV_TX_VALID)) {
+	       !((flags = le32_to_cpu(np->get_tx.ex->flaglen)) & NV_TX_VALID) &&
+	       (limit-- > 0)) {
 
 		dprintk(KERN_DEBUG "%s: nv_tx_done_optimized: flags 0x%x.\n",
 					dev->name, flags);
@@ -1973,7 +1974,7 @@
 	if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
 		nv_tx_done(dev);
 	else
-		nv_tx_done_optimized(dev);
+		nv_tx_done_optimized(dev, np->tx_ring_size);
 
 	/* 3) if there are dead entries: clear everything */
 	if (np->get_tx_ctx != np->put_tx_ctx) {
@@ -2899,7 +2900,7 @@
 			break;
 
 		spin_lock(&np->lock);
-		nv_tx_done_optimized(dev);
+		nv_tx_done_optimized(dev, TX_WORK_PER_LOOP);
 		spin_unlock(&np->lock);
 
 #ifdef CONFIG_FORCEDETH_NAPI
@@ -3006,7 +3007,7 @@
 			break;
 
 		spin_lock_irqsave(&np->lock, flags);
-		nv_tx_done_optimized(dev);
+		nv_tx_done_optimized(dev, TX_WORK_PER_LOOP);
 		spin_unlock_irqrestore(&np->lock, flags);
 
 		if (unlikely(events & (NVREG_IRQ_TX_ERR))) {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 10/12] forcedeth: tx max work
  2007-01-09 18:30 Ayaz Abdulla
@ 2007-01-19  2:52 ` Jeff Garzik
  2007-01-19 16:27   ` Ayaz Abdulla
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Garzik @ 2007-01-19  2:52 UTC (permalink / raw)
  To: Ayaz Abdulla; +Cc: Manfred Spraul, Andrew Morton, netdev

Ayaz Abdulla wrote:
> This patch adds a limit to how much tx work can be done in each 
> iteration of tx processing.
> 
> Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>

What about the "tail end" of the work, when the limit is reached?

Remember that delaying the completion of TX's too long increases latency.

It seems to me that this patch needs a timer or somesuch, to guarantee 
that TX completions are not delayed too long in the worst case.

	Jeff




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 10/12] forcedeth: tx max work
  2007-01-19  2:52 ` Jeff Garzik
@ 2007-01-19 16:27   ` Ayaz Abdulla
  0 siblings, 0 replies; 8+ messages in thread
From: Ayaz Abdulla @ 2007-01-19 16:27 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Manfred Spraul, Andrew Morton, netdev

Jeff Garzik wrote:
> Ayaz Abdulla wrote:
>  > This patch adds a limit to how much tx work can be done in each
>  > iteration of tx processing.
>  >
>  > Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>
> 
> What about the "tail end" of the work, when the limit is reached?
> 
> Remember that delaying the completion of TX's too long increases latency.
> 
> It seems to me that this patch needs a timer or somesuch, to guarantee
> that TX completions are not delayed too long in the worst case.

Yes, you are right.
There is a timer interrupt that fires in throughput mode every 10ms (in 
cpu mode it fires at approx every 130us). I can use that to clean out 
any uncompleted TXs. Let me know if 10ms is not too late for worst case 
tx completion.

> 
>         Jeff
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 10/12] forcedeth: tx max work
       [not found] <45B3F307.8060900@nvidia.com>
@ 2007-01-23  6:09 ` Jeff Garzik
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2007-01-23  6:09 UTC (permalink / raw)
  To: Ayaz Abdulla; +Cc: Manfred Spraul, Andrew Morton, netdev

Ayaz Abdulla wrote:
> This patch adds a limit to how much tx work can be done in each
> iteration of tx processing. If the max limit is reached, remaining tx 
> completions will be handled by timer interrupt.
> 
> Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>

you attached the entire driver, rather than a patch :)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 10/12] forcedeth: tx max work
@ 2007-01-23 17:00 Ayaz Abdulla
  2007-01-23 22:53 ` Jeff Garzik
  2007-01-24  7:17 ` Jeff Garzik
  0 siblings, 2 replies; 8+ messages in thread
From: Ayaz Abdulla @ 2007-01-23 17:00 UTC (permalink / raw)
  To: Jeff Garzik, Manfred Spraul, Andrew Morton, nedev

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

This patch adds a limit to how much tx work can be done in each
iteration of tx processing. If the max limit is reached, remaining tx 
completions will be handled by timer interrupt.

Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>


[-- Attachment #2: patch-tx-loop-limit --]
[-- Type: text/plain, Size: 2157 bytes --]

--- orig/drivers/net/forcedeth.c	2007-01-19 11:13:59.000000000 -0500
+++ new/drivers/net/forcedeth.c	2007-01-21 17:33:02.000000000 -0500
@@ -210,7 +210,7 @@
  * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms
  */
 	NvRegPollingInterval = 0x00c,
-#define NVREG_POLL_DEFAULT_THROUGHPUT	970
+#define NVREG_POLL_DEFAULT_THROUGHPUT	970 /* backup tx cleanup if loop max reached */
 #define NVREG_POLL_DEFAULT_CPU	13
 	NvRegMSIMap0 = 0x020,
 	NvRegMSIMap1 = 0x024,
@@ -1859,14 +1859,15 @@
 	}
 }
 
-static void nv_tx_done_optimized(struct net_device *dev)
+static void nv_tx_done_optimized(struct net_device *dev, int limit)
 {
 	struct fe_priv *np = netdev_priv(dev);
 	u32 flags;
 	struct ring_desc_ex* orig_get_tx = np->get_tx.ex;
 
 	while ((np->get_tx.ex != np->put_tx.ex) &&
-	       !((flags = le32_to_cpu(np->get_tx.ex->flaglen)) & NV_TX_VALID)) {
+	       !((flags = le32_to_cpu(np->get_tx.ex->flaglen)) & NV_TX_VALID) &&
+	       (limit-- > 0)) {
 
 		dprintk(KERN_DEBUG "%s: nv_tx_done_optimized: flags 0x%x.\n",
 					dev->name, flags);
@@ -1973,7 +1974,7 @@
 	if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
 		nv_tx_done(dev);
 	else
-		nv_tx_done_optimized(dev);
+		nv_tx_done_optimized(dev, np->tx_ring_size);
 
 	/* 3) if there are dead entries: clear everything */
 	if (np->get_tx_ctx != np->put_tx_ctx) {
@@ -2899,7 +2900,7 @@
 			break;
 
 		spin_lock(&np->lock);
-		nv_tx_done_optimized(dev);
+		nv_tx_done_optimized(dev, TX_WORK_PER_LOOP);
 		spin_unlock(&np->lock);
 
 #ifdef CONFIG_FORCEDETH_NAPI
@@ -3006,7 +3007,7 @@
 			break;
 
 		spin_lock_irqsave(&np->lock, flags);
-		nv_tx_done_optimized(dev);
+		nv_tx_done_optimized(dev, TX_WORK_PER_LOOP);
 		spin_unlock_irqrestore(&np->lock, flags);
 
 		if (unlikely(events & (NVREG_IRQ_TX_ERR))) {
@@ -3163,6 +3164,11 @@
 		if (!(events & np->irqmask))
 			break;
 
+		/* check tx in case we reached max loop limit in tx isr */
+		spin_lock_irqsave(&np->lock, flags);
+		nv_tx_done_optimized(dev, TX_WORK_PER_LOOP);
+		spin_unlock_irqrestore(&np->lock, flags);
+
 		if (events & NVREG_IRQ_LINK) {
 			spin_lock_irqsave(&np->lock, flags);
 			nv_link_irq(dev);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 10/12] forcedeth: tx max work
  2007-01-23 17:00 [PATCH 10/12] forcedeth: tx max work Ayaz Abdulla
@ 2007-01-23 22:53 ` Jeff Garzik
  2007-01-23 23:06   ` Jeff Garzik
  2007-01-24  7:17 ` Jeff Garzik
  1 sibling, 1 reply; 8+ messages in thread
From: Jeff Garzik @ 2007-01-23 22:53 UTC (permalink / raw)
  To: Ayaz Abdulla; +Cc: Manfred Spraul, Andrew Morton, nedev

Ayaz Abdulla wrote:
> This patch adds a limit to how much tx work can be done in each
> iteration of tx processing. If the max limit is reached, remaining tx 
> completions will be handled by timer interrupt.
> 
> Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>

Thanks, will apply soon.

Please resend patches 11 & 12 too.  Whereever I stop applying patches, 
in a patch series, the remaining patches are dropped.

I either apply a patch immediately, or delete it.

	Jeff



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 10/12] forcedeth: tx max work
  2007-01-23 22:53 ` Jeff Garzik
@ 2007-01-23 23:06   ` Jeff Garzik
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2007-01-23 23:06 UTC (permalink / raw)
  To: Ayaz Abdulla; +Cc: Manfred Spraul, Andrew Morton, nedev

Jeff Garzik wrote:
> Please resend patches 11 & 12 too.  Whereever I stop applying patches, 
> in a patch series, the remaining patches are dropped.

Received patches 11 & 12.  Maybe my email system was just slow.  If so, 
sorry for the noise.

	Jeff



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 10/12] forcedeth: tx max work
  2007-01-23 17:00 [PATCH 10/12] forcedeth: tx max work Ayaz Abdulla
  2007-01-23 22:53 ` Jeff Garzik
@ 2007-01-24  7:17 ` Jeff Garzik
  1 sibling, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2007-01-24  7:17 UTC (permalink / raw)
  To: Ayaz Abdulla; +Cc: Manfred Spraul, Andrew Morton, nedev

Ayaz Abdulla wrote:
> This patch adds a limit to how much tx work can be done in each
> iteration of tx processing. If the max limit is reached, remaining tx 
> completions will be handled by timer interrupt.
> 
> Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>

applied 10-12



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-01-24  7:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-23 17:00 [PATCH 10/12] forcedeth: tx max work Ayaz Abdulla
2007-01-23 22:53 ` Jeff Garzik
2007-01-23 23:06   ` Jeff Garzik
2007-01-24  7:17 ` Jeff Garzik
     [not found] <45B3F307.8060900@nvidia.com>
2007-01-23  6:09 ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2007-01-09 18:30 Ayaz Abdulla
2007-01-19  2:52 ` Jeff Garzik
2007-01-19 16:27   ` Ayaz Abdulla

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).