Skip to contentSkip to conversation

spidernet assorted fixes

PATCH Applied Linas Vepstas 5 participants 20 messages May 16, 2007 – May 23, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover spidernet assorted fixes

Jeff,

Please apply & forward upstream the following patch series.

There's a variety of fixes & cleanups in here; the key fix is a rather hard-to-reproduce bug where the hardware runs out of ram, resulting in corruption of some sequencer. The only fix is to reset the card. v-v Unfortunately, this hard-to-repro bug is hit during the fedora-core install process. Ugh.

--linas

#1 lore raw

PATCH 1/10 spidernet: node-aware skbuff allocation

From: Christoph Hellwig <[email protected]>

Spidernet was the driver I original did all the node-aware netdevice allocation for, but after a year it still hasn't hit mainline.

----

 drivers/net/spider_net.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/spider_net.c +2 -1
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -430,7 +430,8 @@ spider_net_prepare_rx_descr(struct spide
 	/* and we need to have it 128 byte aligned, therefore we allocate a
 	 * bit more */
 	/* allocate an skb */
-	descr->skb = dev_alloc_skb(bufsize + SPIDER_NET_RXBUF_ALIGN - 1);
+	descr->skb = netdev_alloc_skb(card->netdev,
+				      bufsize + SPIDER_NET_RXBUF_ALIGN - 1);
 	if (!descr->skb) {
 		if (netif_msg_rx_err(card) && net_ratelimit())
 			pr_err("Not enough memory to allocate rx buffer\n");
Applied
#2 lore raw

Re: [PATCH 1/10] spidernet: node-aware skbuff allocation

Quoted 5 lines · Linas Vepstas

From: Christoph Hellwig <[email protected]>

Spidernet was the driver I original did all the node-aware netdevice allocation for, but after a year it still hasn't hit mainline.

Quoted 7 lines

----

 drivers/net/spider_net.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

applied

#3 lore raw

Re: [PATCH 1/10] spidernet: node-aware skbuff allocation

Quoted 3 lines · Jeff Garzik

Linas Vepstas wrote:

applied

Thanks

--linas

#4 lore raw

PATCH 2/10 spidernet: beautify error messages

In reply to Linas Vepstas

Make error messages print which interface they apply to.

----

 drivers/net/spider_net.c |   10 ++++++----
 drivers/net/spider_net.h |    2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/spider_net.c +6 -4
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -433,7 +433,8 @@ spider_net_prepare_rx_descr(struct spide
 	descr->skb = dev_alloc_skb(bufsize + SPIDER_NET_RXBUF_ALIGN - 1);
 	if (!descr->skb) {
 		if (netif_msg_rx_err(card) && net_ratelimit())
-			pr_err("Not enough memory to allocate rx buffer\n");
+			pr_err("%s: Not enough memory to allocate rx buffer\n",
+			    card->netdev->name);
 		card->spider_stats.alloc_rx_skb_error++;
 		return -ENOMEM;
 	}
@@ -454,7 +455,8 @@ spider_net_prepare_rx_descr(struct spide
 		dev_kfree_skb_any(descr->skb);
 		descr->skb = NULL;
 		if (netif_msg_rx_err(card) && net_ratelimit())
-			pr_err("Could not iommu-map rx buffer\n");
+			pr_err("%s: Could not iommu-map rx buffer\n",
+			      card->netdev->name);
 		card->spider_stats.rx_iommu_map_error++;
 		hwdescr->dmac_cmd_status = SPIDER_NET_DESCR_NOT_IN_USE;
 	} else {
@@ -1454,8 +1456,8 @@ spider_net_handle_error_irq(struct spide
 	case SPIDER_NET_GRFAFLLINT: /* fallthrough */
 	case SPIDER_NET_GRMFLLINT:
 		if (netif_msg_intr(card) && net_ratelimit())
-			pr_err("Spider RX RAM full, incoming packets "
-			       "might be discarded!\n");
+			pr_err("%s: Spider RX RAM full, incoming packets "
+			       "might be discarded!\n", card->netdev->name);
 		spider_net_rx_irq_off(card);
 		netif_rx_schedule(card->netdev);
 		show_error = 0;
drivers/net/spider_net.h +1 -1
Index: linux-2.6.22-rc1/drivers/net/spider_net.h
===================================================================
@@ -25,7 +25,7 @@
 #ifndef _SPIDER_NET_H
 #define _SPIDER_NET_H
 
-#define VERSION "2.0 A"
+#define VERSION "2.0 B"
 
 #include "sungem_phy.h"
 
#5 lore raw

Re: [Cbe-oss-dev] [PATCH 2/10] spidernet: beautify error messages

Quoted 14 lines · Linas Vepstas

Make error messages print which interface they apply to.

----

 drivers/net/spider_net.c |   10 ++++++----
 drivers/net/spider_net.h |    2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================

drivers/net/spider_net.c spider_net_prepare_rx_descr(struct spide · line 437

Quoted 6 lines
drivers/net/spider_net.c +2 -1
@@ -433,7 +433,8 @@ spider_net_prepare_rx_descr(struct spide
 	descr->skb = dev_alloc_skb(bufsize + SPIDER_NET_RXBUF_ALIGN - 1);
 	if (!descr->skb) {
 		if (netif_msg_rx_err(card) && net_ratelimit())
-			pr_err("Not enough memory to allocate rx buffer\n");
+			pr_err("%s: Not enough memory to allocate rx buffer\n",
+			    card->netdev->name);

Isn't that what dev_err() is for?

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#6 lore raw

Re: [Cbe-oss-dev] [PATCH 2/10] spidernet: beautify error messages

Quoted 6 lines · Michael Ellerman

drivers/net/spider_net.c spider_net_prepare_rx_descr(struct spide · line 437

Quoted 3 lines · Linas Vepstas
drivers/net/spider_net.c +2 -1
-			pr_err("Not enough memory to allocate rx buffer\n");
+			pr_err("%s: Not enough memory to allocate rx buffer\n",
+			    card->netdev->name);

Isn't that what dev_err() is for?

Ahh, did not know that. These patches just got pushed upstream, I'll send a separate round to clean this up.

--linas

#7 lore raw

PATCH 3/10 spidernet: move a block of code around

In reply to Linas Vepstas

Put the enable and disable routines next to one-another, as this makes verifying thier symmetry that much easier.

----

 drivers/net/spider_net.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/net/spider_net.c +14 -14
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -505,6 +505,20 @@ spider_net_enable_rxdmac(struct spider_n
 }
 
 /**
+ * spider_net_disable_rxdmac - disables the receive DMA controller
+ * @card: card structure
+ *
+ * spider_net_disable_rxdmac terminates processing on the DMA controller
+ * by turing off the DMA controller, with the force-end flag set.
+ */
+static inline void
+spider_net_disable_rxdmac(struct spider_net_card *card)
+{
+	spider_net_write_reg(card, SPIDER_NET_GDADMACCNTR,
+			     SPIDER_NET_DMA_RX_FEND_VALUE);
+}
+
+/**
  * spider_net_refill_rx_chain - refills descriptors/skbs in the rx chains
  * @card: card structure
  *
@@ -656,20 +670,6 @@ write_hash:
 }
 
 /**
- * spider_net_disable_rxdmac - disables the receive DMA controller
- * @card: card structure
- *
- * spider_net_disable_rxdmac terminates processing on the DMA controller by
- * turing off DMA and issueing a force end
- */
-static void
-spider_net_disable_rxdmac(struct spider_net_card *card)
-{
-	spider_net_write_reg(card, SPIDER_NET_GDADMACCNTR,
-			     SPIDER_NET_DMA_RX_FEND_VALUE);
-}
-
-/**
  * spider_net_prepare_tx_descr - fill tx descriptor with skb data
  * @card: card structure
  * @descr: descriptor structure to fill out
#8 lore raw

PATCH 4/10 spidernet: zero out a pointer.

In reply to Linas Vepstas

Invalidate a pointer as its pci_unmap'ed; this is a bit of paranoia to make sure hardware doesn't continue trying to DMA to it.

----

 drivers/net/spider_net.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/spider_net.c +5 -2
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -1068,6 +1068,7 @@ spider_net_decode_one_descr(struct spide
 	struct spider_net_descr_chain *chain = &card->rx_chain;
 	struct spider_net_descr *descr = chain->tail;
 	struct spider_net_hw_descr *hwdescr = descr->hwdescr;
+	u32 hw_buf_addr;
 	int status;
 
 	status = spider_net_get_descr_status(hwdescr);
@@ -1081,7 +1082,9 @@ spider_net_decode_one_descr(struct spide
 	chain->tail = descr->next;
 
 	/* unmap descriptor */
-	pci_unmap_single(card->pdev, hwdescr->buf_addr,
+	hw_buf_addr = hwdescr->buf_addr;
+	hwdescr->buf_addr = 0x0;
+	pci_unmap_single(card->pdev, hw_buf_addr,
 			SPIDER_NET_MAX_FRAME, PCI_DMA_FROMDEVICE);
 
 	if ( (status == SPIDER_NET_DESCR_RESPONSE_ERROR) ||
@@ -1117,7 +1120,7 @@ spider_net_decode_one_descr(struct spide
 		pr_err("%s: bad status, cmd_status=x%08x\n",
 			       card->netdev->name,
 			       hwdescr->dmac_cmd_status);
-		pr_err("buf_addr=x%08x\n", hwdescr->buf_addr);
+		pr_err("buf_addr=x%08x\n", hw_buf_addr);
 		pr_err("buf_size=x%08x\n", hwdescr->buf_size);
 		pr_err("next_descr_addr=x%08x\n", hwdescr->next_descr_addr);
 		pr_err("result_size=x%08x\n", hwdescr->result_size);
#9 lore raw

Re: [Cbe-oss-dev] [PATCH 4/10] spidernet: zero out a pointer.

Quoted 15 lines · Linas Vepstas

Invalidate a pointer as its pci_unmap'ed; this is a bit of paranoia to make sure hardware doesn't continue trying to DMA to it.

----

 drivers/net/spider_net.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================

drivers/net/spider_net.c spider_net_decode_one_descr(struct spide · line 1086

Quoted 6 lines
drivers/net/spider_net.c +2 -1
@@ -1081,7 +1082,9 @@ spider_net_decode_one_descr(struct spide
 	chain->tail = descr->next;
 
 	/* unmap descriptor */
-	pci_unmap_single(card->pdev, hwdescr->buf_addr,
+	hw_buf_addr = hwdescr->buf_addr;
+	hwdescr->buf_addr = 0x0;

If you're going to be paranoid, shouldn't you do something here to make sure the value's hit the device?

drivers/net/spider_net.c spider_net_decode_one_descr(struct spide · line 1089

Quoted 3 lines
drivers/net/spider_net.c +1 -0
+	pci_unmap_single(card->pdev, hw_buf_addr,
 			SPIDER_NET_MAX_FRAME, PCI_DMA_FROMDEVICE);
 

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#10 lore raw

Re: [Cbe-oss-dev] [PATCH 4/10] spidernet: zero out a pointer.

Quoted 4 lines · Michael Ellerman

drivers/net/spider_net.c spider_net_decode_one_descr(struct spide · line 1086

Quoted 1 line
drivers/net/spider_net.c +1 -0
+	hwdescr->buf_addr = 0x0;

If you're going to be paranoid, shouldn't you do something here to make sure the value's hit the device?

I thought the whole point of paranoia is that its inexplicable.

Here's a delusional reply: I didn't see any point to it.
1) a wmb would add overhead
2) the hardware is supposed to be looking at the status flag, anyway, and not misbehaving.
3) there is a wmb when the descr is actually refilled in such a way as to actually mean something to the hardware.

All that I really acomplished here is a minor trick to aid in debug printing when looking for something bad.

--linas

#11 lore raw

Re: [Cbe-oss-dev] [PATCH 4/10] spidernet: zero out a pointer.

Quoted 7 lines
Quoted 2 lines

If you're going to be paranoid, shouldn't you do something here to make sure the value's hit the device?

I thought the whole point of paranoia is that its inexplicable.

Here's a delusional reply: I didn't see any point to it.
1) a wmb would add overhead

A wmb() doesn't guarantee the write has reached the device.

Quoted 2 lines

2) the hardware is supposed to be looking at the status flag, anyway, and not misbehaving.

But you're paranoid, right? Can't trust that device! :-)

Segher

#12 lore raw

Re: [Cbe-oss-dev] [PATCH 4/10] spidernet: zero out a pointer.

In reply to Linas Vepstas
Quoted 10 lines

Here's a delusional reply: I didn't see any point to it.
1) a wmb would add overhead
2) the hardware is supposed to be looking at the status flag, anyway, and not misbehaving.
3) there is a wmb when the descr is actually refilled in such a way as to actually mean something to the hardware.

All that I really acomplished here is a minor trick to aid in debug printing when looking for something bad.

And the whole thing is moot because 0 is actually a perfectly valid DMA address :-) I suspect spider will end up trying to hit some internal register or it's PCIe or whatever it has mapped at 0 internally and will blow up ... At least on spider, it's not RAM there....

Ben.

#13 lore raw

PATCH 5/10 spidernet: null out skb pointer after its been used.

In reply to Linas Vepstas

If the ethernet interface is brought down while there is still RX traffic in flight, the device shutdown routine can end up trying to double-free an skb, leading to a crash in mm/slab.c Avoid the double-free by nulling out the skb pointer.

----

 drivers/net/spider_net.c |    1 +
 1 file changed, 1 insertion(+)
drivers/net/spider_net.c +1 -0
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -1135,6 +1135,7 @@ spider_net_decode_one_descr(struct spide
 
 	/* Ok, we've got a packet in descr */
 	spider_net_pass_skb_up(descr, card);
+	descr->skb = NULL;
 	hwdescr->dmac_cmd_status = SPIDER_NET_DESCR_NOT_IN_USE;
 	return 1;
 
#14 lore raw

PATCH 6/10 spidernet: Don't terminate the RX ring

In reply to Linas Vepstas

There is no real reason to terminate the RX ring; it doesn't make the operation any smooother, and it does require an extra sync. So don't do it.

----

 drivers/net/spider_net.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/spider_net.c +9 -9
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -461,13 +461,9 @@ spider_net_prepare_rx_descr(struct spide
 		hwdescr->dmac_cmd_status = SPIDER_NET_DESCR_NOT_IN_USE;
 	} else {
 		hwdescr->buf_addr = buf;
-		hwdescr->next_descr_addr = 0;
 		wmb();
 		hwdescr->dmac_cmd_status = SPIDER_NET_DESCR_CARDOWNED |
 					 SPIDER_NET_DMAC_NOINTR_COMPLETE;
-
-		wmb();
-		descr->prev->hwdescr->next_descr_addr = descr->bus_addr;
 	}
 
 	return 0;
@@ -556,12 +552,16 @@ spider_net_refill_rx_chain(struct spider
 static int
 spider_net_alloc_rx_skbs(struct spider_net_card *card)
 {
-	int result;
-	struct spider_net_descr_chain *chain;
+	struct spider_net_descr_chain *chain = &card->rx_chain;
+	struct spider_net_descr *start= chain->tail;
+	struct spider_net_descr *descr = start;
 
-	result = -ENOMEM;
+	/* Link up the hardware chain pointers */
+	do {
+		descr->prev->hwdescr->next_descr_addr = descr->bus_addr;
+		descr = descr->next;
+	} while (descr != start);
 
-	chain = &card->rx_chain;
 	/* Put at least one buffer into the chain. if this fails,
 	 * we've got a problem. If not, spider_net_refill_rx_chain
 	 * will do the rest at the end of this function. */
@@ -578,7 +578,7 @@ spider_net_alloc_rx_skbs(struct spider_n
 
 error:
 	spider_net_free_rx_chain_contents(card);
-	return result;
+	return -ENOMEM;
 }
 
 /**
#15 lore raw

PATCH 7/10 spidernet: enhance the dump routine

In reply to Linas Vepstas

Crazy device problems are hard to debug, when one does not have good trace info. This patch makes a major enhancement to the device dump routine.

----

 drivers/net/spider_net.c |   62 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 54 insertions(+), 8 deletions(-)
drivers/net/spider_net.c +54 -8
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -1023,34 +1023,78 @@ spider_net_pass_skb_up(struct spider_net
 	card->netdev_stats.rx_bytes += skb->len;
 }
 
-#ifdef DEBUG
 static void show_rx_chain(struct spider_net_card *card)
 {
 	struct spider_net_descr_chain *chain = &card->rx_chain;
 	struct spider_net_descr *start= chain->tail;
 	struct spider_net_descr *descr= start;
+	struct spider_net_hw_descr *hwd = start->hwdescr;
+	char *iface = card->netdev->name;
+	u32 curr_desc, next_desc;
 	int status;
 
 	int cnt = 0;
-	int cstat = spider_net_get_descr_status(descr);
-	printk(KERN_INFO "RX chain tail at descr=%ld\n",
-	     (start - card->descr) - card->tx_chain.num_desc);
+	int off = 0;
+	int cstat = hwd->dmac_cmd_status;
+
+	printk(KERN_INFO "%s: Total number of descrs=%d\n",
+		iface, chain->num_desc);
+	printk(KERN_INFO "%s: Chain tail located at descr=%d\n",
+		iface, (int) (start - chain->ring));
+
+	curr_desc = spider_net_read_reg(card, SPIDER_NET_GDACTDPA);
+	next_desc = spider_net_read_reg(card, SPIDER_NET_GDACNEXTDA);
+
 	status = cstat;
 	do
 	{
-		status = spider_net_get_descr_status(descr);
+		hwd = descr->hwdescr;
+		off = descr - chain->ring;
+		if (descr==chain->head)
+			printk(KERN_INFO "%s: chain head is at %d\n", iface, off);
+		if (curr_desc == descr->bus_addr)
+			printk(KERN_INFO "%s: hw curr desc is at %d\n", iface, off);
+		if (next_desc == descr->bus_addr)
+			printk(KERN_INFO "%s: hw next desc is at %d\n", iface, off);
+		if (hwd->next_descr_addr == 0)
+			printk(KERN_INFO "%s: chain is cut at %d\n", iface, off);
+		status = hwd->dmac_cmd_status;
 		if (cstat != status) {
-			printk(KERN_INFO "Have %d descrs with stat=x%08x\n", cnt, cstat);
+			printk(KERN_INFO "%s: Have %d descrs with stat=x%08x\n",
+				iface, cnt, cstat);
 			cstat = status;
 			cnt = 0;
 		}
 		cnt ++;
 		descr = descr->next;
 	} while (descr != start);
-	printk(KERN_INFO "Last %d descrs with stat=x%08x\n", cnt, cstat);
-}
+	printk(KERN_INFO "%s: Last %d descrs with stat=x%08x\n",
+		iface, cnt, cstat);
+
+#ifdef DEBUG
+	/* Now dump the whole ring */
+	descr = start;
+	do
+	{
+		struct spider_net_hw_descr *hwd = descr->hwdescr;
+		status = spider_net_get_descr_status(hwd);
+		cnt = descr - chain->ring;
+		printk(KERN_INFO "Descr %d stat=0x%08x skb=%p\n",
+			cnt, status, descr->skb);
+		printk(KERN_INFO "bus addr=%08x buf addr=%08x sz=%d\n",
+			descr->bus_addr, hwd->buf_addr, hwd->buf_size);
+		printk(KERN_INFO "next=%08x result sz=%d valid sz=%d\n",
+			hwd->next_descr_addr, hwd->result_size, hwd->valid_size);
+		printk(KERN_INFO "dmac=%08x data stat=%08x data err=%08x\n",
+			hwd->dmac_cmd_status, hwd->data_status, hwd->data_error);
+		printk(KERN_INFO "\n");
+
+		descr = descr->next;
+	} while (descr != start);
 #endif
 
+}
+
 /**
  * spider_net_decode_one_descr - processes an RX descriptor
  * @card: card structure
@@ -1140,6 +1184,8 @@ spider_net_decode_one_descr(struct spide
 	return 1;
 
 bad_desc:
+	if (netif_msg_rx_err(card))
+		show_rx_chain(card);
 	dev_kfree_skb_irq(descr->skb);
 	descr->skb = NULL;
 	hwdescr->dmac_cmd_status = SPIDER_NET_DESCR_NOT_IN_USE;
#16 lore raw

PATCH 8/10 spidernet: reset the card when an rxramfull is seen

In reply to Linas Vepstas

Some versions of the spider have a firmware bug, where the RX ring sequencer goes crazy when the RX RAM on the device fills up. Appearently the only viable wrkaround is a soft reset of the card.

----

 drivers/net/spider_net.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/spider_net.c +11 -3
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -1505,11 +1505,17 @@ spider_net_handle_error_irq(struct spide
 	case SPIDER_NET_GRFBFLLINT: /* fallthrough */
 	case SPIDER_NET_GRFAFLLINT: /* fallthrough */
 	case SPIDER_NET_GRMFLLINT:
-		if (netif_msg_intr(card) && net_ratelimit())
-			pr_err("%s: Spider RX RAM full, incoming packets "
-			       "might be discarded!\n", card->netdev->name);
+		if (netif_msg_intr(card) && net_ratelimit()) {
+			pr_err("%s: Spider RX RAM full, reseting device.\n",
+			       card->netdev->name);
+			show_rx_chain(card);
+		}
 		spider_net_rx_irq_off(card);
 		netif_rx_schedule(card->netdev);
+
+		/* If the card is spewing rxramfulls, then reset */
+		atomic_inc(&card->tx_timeout_task_counter);
+		schedule_work(&card->tx_timeout_task);
 		show_error = 0;
 		break;
 
@@ -2086,6 +2092,8 @@ spider_net_workaround_rxramfull(struct s
 {
 	int i, sequencer = 0;
 
+	printk(KERN_INFO "%s: calling rxramfull workaround\n", card->netdev->name);
+
 	/* cancel reset */
 	spider_net_write_reg(card, SPIDER_NET_CKRCTRL,
 			     SPIDER_NET_CKRCTRL_RUN_VALUE);
#17 lore raw

PATCH 9/10 spidernet: service TX later.

In reply to Linas Vepstas

When entering the netdev poll routine, empty out the RX chain first, before cleaning up the TX chain. This should help avoid RX buffer overflows.

----

 drivers/net/spider_net.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/spider_net.c +2 -1
Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
@@ -1212,7 +1212,6 @@ spider_net_poll(struct net_device *netde
 	int packets_to_do, packets_done = 0;
 	int no_more_packets = 0;
 
-	spider_net_cleanup_tx_ring(card);
 	packets_to_do = min(*budget, netdev->quota);
 
 	while (packets_to_do) {
@@ -1231,6 +1230,8 @@ spider_net_poll(struct net_device *netde
 	spider_net_refill_rx_chain(card);
 	spider_net_enable_rxdmac(card);
 
+	spider_net_cleanup_tx_ring(card);
+
 	/* if all packets are in the stack, enable interrupts and return 0 */
 	/* if not, return 1 */
 	if (no_more_packets) {
#18 lore raw

PATCH 10/10 spidernet: increase the NAPI weight

In reply to Linas Vepstas

Another way of minimizing the likelyhood of RX ram from overflowing is to empty out the entire rx ring every chance we get. Change the crazy watchdog timeout from 50 seconds to 3 seconds, while we're here.

----

 drivers/net/spider_net.h |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/spider_net.h +7 -2
Index: linux-2.6.22-rc1/drivers/net/spider_net.h
===================================================================
@@ -56,8 +56,13 @@ extern char spider_net_driver_name[];
 
 #define SPIDER_NET_RX_CSUM_DEFAULT		1
 
-#define SPIDER_NET_WATCHDOG_TIMEOUT		50*HZ
-#define SPIDER_NET_NAPI_WEIGHT			64
+#define SPIDER_NET_WATCHDOG_TIMEOUT		3*HZ
+
+/* We really really want to empty the ring buffer every time,
+ * so as to avoid the RX ram full bug. So set te napi wieght
+ * to the ring size 
+ */
+#define SPIDER_NET_NAPI_WEIGHT			SPIDER_NET_RX_DESCRIPTORS_DEFAULT
 
 #define SPIDER_NET_FIRMWARE_SEQS	6
 #define SPIDER_NET_FIRMWARE_SEQWORDS	1024
#19 lore raw

Re: [Cbe-oss-dev] [PATCH 10/10] spidernet: increase the NAPI weight

Quoted 16 lines · Linas Vepstas

Another way of minimizing the likelyhood of RX ram from overflowing is to empty out the entire rx ring every chance we get. Change the crazy watchdog timeout from 50 seconds to 3 seconds, while we're here.

----

 drivers/net/spider_net.h |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.22-rc1/drivers/net/spider_net.h
===================================================================

drivers/net/spider_net.h extern char spider_net_driver_name[]; · line 62

Quoted 9 lines
drivers/net/spider_net.h +4 -2
@@ -56,8 +56,13 @@ extern char spider_net_driver_name[];
 
 #define SPIDER_NET_RX_CSUM_DEFAULT		1
 
-#define SPIDER_NET_WATCHDOG_TIMEOUT		50*HZ
-#define SPIDER_NET_NAPI_WEIGHT			64
+#define SPIDER_NET_WATCHDOG_TIMEOUT		3*HZ
+
+/* We really really want to empty the ring buffer every time,
+ * so as to avoid the RX ram full bug. So set te napi wieght

Speeeling ...................................... ^^ ^^^^ ^^^^^^

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person