netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brice Goglin <brice@myri.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH 12/16] myri10ge: fix the number of interrupt slots
Date: Fri, 09 May 2008 02:20:47 +0200	[thread overview]
Message-ID: <482398DF.8030901@myri.com> (raw)
In-Reply-To: <482397A3.1050604@myri.com>

Fix a long-standing bug/misunderstanding between the
driver and the firmware.  The size of the interrupt
queue must be set to the number of rx slots (big + small),
and it should never have been a tunable.
Setting it too small results in chaos.

Signed-off-by: Brice Goglin <brice@myri.com>
Signed-off-by: Andrew Gallatin <gallatin@myri.com>
---
 drivers/net/myri10ge/myri10ge.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Index: linux-2.6/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-2.6.orig/drivers/net/myri10ge/myri10ge.c	2008-05-09 00:11:37.000000000 +0200
+++ linux-2.6/drivers/net/myri10ge/myri10ge.c	2008-05-09 00:12:46.000000000 +0200
@@ -253,10 +253,6 @@
 module_param(myri10ge_ecrc_enable, int, S_IRUGO);
 MODULE_PARM_DESC(myri10ge_ecrc_enable, "Enable Extended CRC on PCI-E");
 
-static int myri10ge_max_intr_slots = 1024;
-module_param(myri10ge_max_intr_slots, int, S_IRUGO);
-MODULE_PARM_DESC(myri10ge_max_intr_slots, "Interrupt queue slots");
-
 static int myri10ge_small_bytes = -1;	/* -1 == auto */
 module_param(myri10ge_small_bytes, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(myri10ge_small_bytes, "Threshold of small packets");
@@ -879,7 +875,7 @@
 
 	/* Now exchange information about interrupts  */
 
-	bytes = myri10ge_max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
+	bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
 	memset(mgp->ss.rx_done.entry, 0, bytes);
 	cmd.data0 = (u32) bytes;
 	status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_INTRQ_SIZE, &cmd, 0);
@@ -1217,7 +1213,7 @@
 		rx_packets += rx_ok;
 		rx_bytes += rx_ok * (unsigned long)length;
 		cnt++;
-		idx = cnt & (myri10ge_max_intr_slots - 1);
+		idx = cnt & (mgp->max_intr_slots - 1);
 		work_done++;
 	}
 	rx_done->idx = idx;
@@ -3218,7 +3214,7 @@
 		netdev->dev_addr[i] = mgp->mac_addr[i];
 
 	/* allocate rx done ring */
-	bytes = myri10ge_max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
+	bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
 	mgp->ss.rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes,
 						&mgp->ss.rx_done.bus, GFP_KERNEL);
 	if (mgp->ss.rx_done.entry == NULL)
@@ -3295,7 +3291,7 @@
 	myri10ge_dummy_rdma(mgp, 0);
 
 abort_with_rx_done:
-	bytes = myri10ge_max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
+	bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
 	dma_free_coherent(&pdev->dev, bytes,
 			  mgp->ss.rx_done.entry, mgp->ss.rx_done.bus);
 
@@ -3346,7 +3342,7 @@
 	/* avoid a memory leak */
 	pci_restore_state(pdev);
 
-	bytes = myri10ge_max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
+	bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
 	dma_free_coherent(&pdev->dev, bytes,
 			  mgp->ss.rx_done.entry, mgp->ss.rx_done.bus);
 



  parent reply	other threads:[~2008-05-09  0:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09  0:15 [PATCH 0/16] myri10ge updates Brice Goglin
2008-05-09  0:16 ` [PATCH 01/16] myri10ge: update firmware headers Brice Goglin
2008-05-13  5:15   ` Jeff Garzik
2008-05-09  0:16 ` [PATCH 02/16] myri10ge: fix module parameter descriptions Brice Goglin
2008-05-09  0:17 ` [PATCH 03/16] myri10ge: increase and fix handoff timeout Brice Goglin
2008-05-09  0:17 ` [PATCH 04/16] myri10ge: properly align scratch buffers Brice Goglin
2008-05-09  0:17 ` [PATCH 05/16] myri10ge: don't warn on rx page allocation failure Brice Goglin
2008-05-09  0:18 ` [PATCH 06/16] myri10ge: report FIBER in ethtool for XFP based NIC Brice Goglin
2008-05-09  0:18 ` [PATCH 07/16] myri10ge: add barrier in myri10ge_send_cmd Brice Goglin
2008-05-09  0:19 ` [PATCH 08/16] myri10ge: trivial formatting fix Brice Goglin
2008-05-09  0:19 ` [PATCH 09/16] myri10ge: fix potential infinite loop in enable_ecrc Brice Goglin
2008-05-09  0:20 ` [PATCH 10/16] myri10ge: move data structures into a single slice Brice Goglin
2008-05-09  0:20 ` [PATCH 11/16] myri10ge: cleanup retrieving of firmware capabilities Brice Goglin
2008-05-09  0:20 ` Brice Goglin [this message]
2008-05-09  0:21 ` [PATCH 13/16] myri10ge: add routines for multislices Brice Goglin
2008-05-13  5:47   ` Jeff Garzik
2008-05-13 18:34     ` Brice Goglin
2008-05-13 18:36       ` [PATCH][MAINTAINERS] Add maintainers for myri10ge driver Brice Goglin
2008-05-09  0:21 ` [PATCH 14/16] myri10ge: add multislices support Brice Goglin
2008-05-09  0:22 ` [PATCH 15/16] myri10ge: add Direct Cache Access support Brice Goglin
2008-05-09  0:22 ` [PATCH 16/16] myri10ge: update driver version Brice Goglin

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=482398DF.8030901@myri.com \
    --to=brice@myri.com \
    --cc=jeff@garzik.org \
    --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).