netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [e1000 2.4] hang on ZEROCOPY/TSO when hitting no-Tx-resources condition
@ 2003-10-03  1:22 Feldman, Scott
  2003-10-14 18:15 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Feldman, Scott @ 2003-10-03  1:22 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, Feldman, Scott


* Critical bug fix: under heavy Tx stress using ZEROCOPY or TSO, if we
  run out of Tx descriptors, we don't calculate for the context
  descriptor used as the first of the ZEROCOPY/TSO send, nor do we clean
  up the context descriptor bits in the case where the send isn't going
  to fit and we need to undo the mappings.  This bug was introduced
  with the 5.2.16 patch set which included a workaround for a hang
  on 82544 over PCI-X.  This workaround caused the check for no-Tx-
  resource logic to change, and this bug slipped in.

-------------

diff -Naurp net-drivers-2.4/drivers/net/e1000/e1000_main.c net-drivers-2.4/drivers/net/e1000.mod/e1000_main.c
--- net-drivers-2.4/drivers/net/e1000/e1000_main.c	2003-10-02 18:08:45.000000000 -0700
+++ net-drivers-2.4/drivers/net/e1000.mod/e1000_main.c	2003-10-02 18:12:48.000000000 -0700
@@ -59,7 +59,7 @@
 
 char e1000_driver_name[] = "e1000";
 char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
-char e1000_driver_version[] = "5.2.16-k1";
+char e1000_driver_version[] = "5.2.16-k2";
 char e1000_copyright[] = "Copyright (c) 1999-2003 Intel Corporation.";
 
 /* e1000_pci_tbl - PCI Device ID Table
@@ -1532,6 +1532,7 @@ e1000_tx_map(struct e1000_adapter *adapt
 	unsigned int first)
 {
 	struct e1000_desc_ring *tx_ring = &adapter->tx_ring;
+	struct e1000_tx_desc *tx_desc;
 	struct e1000_buffer *buffer_info;
 	unsigned int len = skb->len, max_per_txd = E1000_MAX_DATA_PER_TXD;
 	unsigned int offset = 0, size, count = 0, i;
@@ -1622,17 +1623,29 @@ e1000_tx_map(struct e1000_adapter *adapt
 		}
 	}
 
-	if(E1000_DESC_UNUSED(&adapter->tx_ring) < count) {
+	if(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2) {
 
 		/* There aren't enough descriptors available to queue up
-		 * this send, so undo the mapping and abort the send. 
-		 * We could have done the check before we mapped the skb,
-		 * but because of all the workarounds (above), it's too
-		 * difficult to predict how many we're going to need.*/
-		i = first;
+		 * this send (need: count + 1 context desc + 1 desc gap
+		 * to keep tail from touching head), so undo the mapping
+		 * and abort the send.  We could have done the check before
+		 * we mapped the skb, but because of all the workarounds
+		 * (above), it's too difficult to predict how many we're
+		 * going to need.*/
+		i = adapter->tx_ring.next_to_use;
+
+		if(i == first) {
+			/* Cleanup after e1000_tx_[csum|tso] scribbling
+			 * on descriptors. */
+			tx_desc = E1000_TX_DESC(*tx_ring, first);
+			tx_desc->buffer_addr = 0;
+			tx_desc->lower.data = 0;
+			tx_desc->upper.data = 0;
+		}
 
 		while(count--) {
 			buffer_info = &tx_ring->buffer_info[i];
+
 			if(buffer_info->dma) {
 				pci_unmap_page(adapter->pdev,
 					       buffer_info->dma,
@@ -1640,9 +1653,12 @@ e1000_tx_map(struct e1000_adapter *adapt
 					       PCI_DMA_TODEVICE);
 				buffer_info->dma = 0;
 			}
+
 			if(++i == tx_ring->count) i = 0;
 		}
 
+		adapter->tx_ring.next_to_use = first;
+
 		return 0;
 	}
 

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

* Re: [e1000 2.4] hang on ZEROCOPY/TSO when hitting no-Tx-resources condition
  2003-10-03  1:22 [e1000 2.4] hang on ZEROCOPY/TSO when hitting no-Tx-resources condition Feldman, Scott
@ 2003-10-14 18:15 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2003-10-14 18:15 UTC (permalink / raw)
  To: Feldman, Scott; +Cc: netdev

applied to 2.4 and 2.5

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

end of thread, other threads:[~2003-10-14 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-03  1:22 [e1000 2.4] hang on ZEROCOPY/TSO when hitting no-Tx-resources condition Feldman, Scott
2003-10-14 18:15 ` Jeff Garzik

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