netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] myri10ge - Write the firmware in 256-bytes chunks
       [not found] <44CB6BAC.10400@myri.com>
@ 2006-07-30  4:14 ` Brice Goglin
  2006-08-03 21:31   ` Jeff Garzik
  2006-07-30  4:14 ` [PATCH 2/2] myri10ge - Fix spurious invokations of the watchdog reset handler Brice Goglin
  1 sibling, 1 reply; 3+ messages in thread
From: Brice Goglin @ 2006-07-30  4:14 UTC (permalink / raw)
  To: Jeff Garzik, netdev

When writing the firmware to the NIC, the FIFO is 256-bytes long,
so we use 256-bytes chunks and a read to wait until the previous
write is done.

Signed-off-by: Brice Goglin <brice@myri.com>
---
 drivers/net/myri10ge/myri10ge.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Index: linux-mm/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-mm.orig/drivers/net/myri10ge/myri10ge.c	2006-07-27 06:49:18.000000000 -0400
+++ linux-mm/drivers/net/myri10ge/myri10ge.c	2006-07-29 10:02:39.000000000 -0400
@@ -448,6 +448,7 @@
 	struct mcp_gen_header *hdr;
 	size_t hdr_offset;
 	int status;
+	unsigned i;
 
 	if ((status = request_firmware(&fw, mgp->fw_name, dev)) < 0) {
 		dev_err(dev, "Unable to load %s firmware image via hotplug\n",
@@ -479,18 +480,12 @@
 		goto abort_with_fw;
 
 	crc = crc32(~0, fw->data, fw->size);
-	if (mgp->tx.boundary == 2048) {
-		/* Avoid PCI burst on chipset with unaligned completions. */
-		int i;
-		__iomem u32 *ptr = (__iomem u32 *) (mgp->sram +
-						    MYRI10GE_FW_OFFSET);
-		for (i = 0; i < fw->size / 4; i++) {
-			__raw_writel(((u32 *) fw->data)[i], ptr + i);
-			wmb();
-		}
-	} else {
-		myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET, fw->data,
-				  fw->size);
+	for (i = 0; i < fw->size; i += 256) {
+		myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET + i,
+				  fw->data + i,
+				  min(256U, (unsigned)(fw->size - i)));
+		mb();
+		readb(mgp->sram);
 	}
 	/* corruption checking is good for parity recovery and buggy chipset */
 	memcpy_fromio(fw->data, mgp->sram + MYRI10GE_FW_OFFSET, fw->size);



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

* [PATCH 2/2] myri10ge - Fix spurious invokations of the watchdog reset handler
       [not found] <44CB6BAC.10400@myri.com>
  2006-07-30  4:14 ` [PATCH 1/2] myri10ge - Write the firmware in 256-bytes chunks Brice Goglin
@ 2006-07-30  4:14 ` Brice Goglin
  1 sibling, 0 replies; 3+ messages in thread
From: Brice Goglin @ 2006-07-30  4:14 UTC (permalink / raw)
  To: Jeff Garzik, netdev

Fix spurious invocations of the watchdog reset handler.

Signed-off-by: Brice Goglin <brice@myri.com>
---
 drivers/net/myri10ge/myri10ge.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: linux-mm/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-mm.orig/drivers/net/myri10ge/myri10ge.c	2006-07-27 06:49:19.000000000 -0400
+++ linux-mm/drivers/net/myri10ge/myri10ge.c	2006-07-27 15:34:02.000000000 -0400
@@ -177,6 +177,7 @@
 	struct work_struct watchdog_work;
 	struct timer_list watchdog_timer;
 	int watchdog_tx_done;
+	int watchdog_tx_req;
 	int watchdog_resets;
 	int tx_linearized;
 	int pause;
@@ -2536,7 +2537,8 @@
 
 	mgp = (struct myri10ge_priv *)arg;
 	if (mgp->tx.req != mgp->tx.done &&
-	    mgp->tx.done == mgp->watchdog_tx_done)
+	    mgp->tx.done == mgp->watchdog_tx_done &&
+	    mgp->watchdog_tx_req != mgp->watchdog_tx_done)
 		/* nic seems like it might be stuck.. */
 		schedule_work(&mgp->watchdog_work);
 	else
@@ -2545,6 +2547,7 @@
 			  jiffies + myri10ge_watchdog_timeout * HZ);
 
 	mgp->watchdog_tx_done = mgp->tx.done;
+	mgp->watchdog_tx_req = mgp->tx.req;
 }
 
 static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)



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

* Re: [PATCH 1/2] myri10ge - Write the firmware in 256-bytes chunks
  2006-07-30  4:14 ` [PATCH 1/2] myri10ge - Write the firmware in 256-bytes chunks Brice Goglin
@ 2006-08-03 21:31   ` Jeff Garzik
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2006-08-03 21:31 UTC (permalink / raw)
  To: Brice Goglin; +Cc: netdev

applied 1-2


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

end of thread, other threads:[~2006-08-03 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <44CB6BAC.10400@myri.com>
2006-07-30  4:14 ` [PATCH 1/2] myri10ge - Write the firmware in 256-bytes chunks Brice Goglin
2006-08-03 21:31   ` Jeff Garzik
2006-07-30  4:14 ` [PATCH 2/2] myri10ge - Fix spurious invokations of the watchdog reset handler Brice Goglin

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