devices/e1000/e1000_main-2.6.20-ethercat.c
branchstable-1.4
changeset 1684 adf0b6f46ecd
parent 1154 04bcd38cf8dc
child 2050 a3e59f2a8589
--- a/devices/e1000/e1000_main-2.6.20-ethercat.c	Mon Dec 29 13:07:38 2008 +0000
+++ b/devices/e1000/e1000_main-2.6.20-ethercat.c	Mon Dec 29 13:10:53 2008 +0000
@@ -23,6 +23,8 @@
   Linux NICS <linux.nics@intel.com>
   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+  
+  vim: noexpandtab
 
 *******************************************************************************/
 
@@ -557,8 +559,14 @@
 	 * next_to_use != next_to_clean */
 	for (i = 0; i < adapter->num_rx_queues; i++) {
 		struct e1000_rx_ring *ring = &adapter->rx_ring[i];
-		adapter->alloc_rx_buf(adapter, ring,
-		                      E1000_DESC_UNUSED(ring));
+		if (adapter->ecdev) {
+			/* fill rx ring completely! */
+			adapter->alloc_rx_buf(adapter, ring, ring->count);
+		} else {
+            /* this one leaves the last ring element unallocated! */
+			adapter->alloc_rx_buf(adapter, ring,
+					E1000_DESC_UNUSED(ring));
+		}
 	}
 
 	adapter->tx_queue_len = netdev->tx_queue_len;
@@ -2395,7 +2403,14 @@
 		/* No need to loop, because 82542 supports only 1 queue */
 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
 		e1000_configure_rx(adapter);
-		adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
+		if (adapter->ecdev) { 
+			/* fill rx ring completely! */
+			adapter->alloc_rx_buf(adapter, ring, ring->count);
+		} else {
+            /* this one leaves the last ring element unallocated! */
+			adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
+		}
+
 	}
 }
 
@@ -3856,11 +3871,11 @@
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	struct e1000_hw *hw = &adapter->hw;
 	int i;
+
+	if (adapter->ecdev) {
 #ifdef CONFIG_E1000_NAPI
-	int ec_work_done = 0;
-#endif
-
-	if (adapter->ecdev) {
+		int ec_work_done = 0;
+#endif
 		for (i = 0; i < E1000_MAX_INTR; i++)
 #ifdef CONFIG_E1000_NAPI
 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,
@@ -3959,9 +3974,6 @@
 	struct e1000_hw *hw = &adapter->hw;
 	uint32_t rctl, icr = E1000_READ_REG(hw, ICR);
 	int i;
-#ifdef CONFIG_E1000_NAPI
-	int ec_work_done = 0;
-#endif
 	if (unlikely(!icr))
 		return IRQ_NONE;  /* Not our interrupt */
 
@@ -3999,6 +4011,9 @@
 	}
 
 	if (adapter->ecdev) {
+#ifdef CONFIG_E1000_NAPI
+		int ec_work_done = 0;
+#endif
 		for (i = 0; i < E1000_MAX_INTR; i++)
 #ifdef CONFIG_E1000_NAPI
 			if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring,