Improved e1000e driver for kernel 3.4. stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Tue, 08 Jan 2013 10:58:46 +0100
branchstable-1.5
changeset 2492 d7b1a62709af
parent 2491 5e9221a78855
child 2493 fcd918d2122f
Improved e1000e driver for kernel 3.4.
devices/e1000e/netdev-3.4-ethercat.c
--- a/devices/e1000e/netdev-3.4-ethercat.c	Mon Jan 07 18:23:27 2013 +0100
+++ b/devices/e1000e/netdev-3.4-ethercat.c	Tue Jan 08 10:58:46 2013 +0100
@@ -1170,7 +1170,9 @@
 
 	tx_ring->next_to_clean = i;
 
-	netdev_completed_queue(netdev, pkts_compl, bytes_compl);
+	if (!adapter->ecdev) {
+		netdev_completed_queue(netdev, pkts_compl, bytes_compl);
+	}
 
 #define TX_WAKE_THRESHOLD 32
 	if (!adapter->ecdev && count && netif_carrier_ok(netdev) &&
@@ -1702,7 +1704,7 @@
 	 * read ICR disables interrupts using IAM
 	 */
 
-	if (!adapter->ecdev && icr & E1000_ICR_LSC) {
+	if (icr & E1000_ICR_LSC) {
 		hw->mac.get_link_status = true;
 		/*
 		 * ICH8 workaround-- Call gig speed drop workaround on cable
@@ -1752,6 +1754,13 @@
 	struct e1000_hw *hw = &adapter->hw;
 	u32 rctl, icr = er32(ICR);
 
+	if (adapter->ecdev) {
+		int ec_work_done = 0;
+		adapter->clean_rx(adapter->rx_ring, &ec_work_done, 100);
+		e1000_clean_tx_irq(adapter->tx_ring);
+		return IRQ_HANDLED;
+	}
+
 	if (!icr || test_bit(__E1000_DOWN, &adapter->state))
 		return IRQ_NONE;  /* Not our interrupt */
 
@@ -1759,7 +1768,7 @@
 	 * IMS will not auto-mask if INT_ASSERTED is not set, and if it is
 	 * not set, then the adapter didn't send an interrupt
 	 */
-	if (!adapter->ecdev && !(icr & E1000_ICR_INT_ASSERTED))
+	if (!(icr & E1000_ICR_INT_ASSERTED))
 		return IRQ_NONE;
 
 	/*
@@ -1796,13 +1805,6 @@
 			mod_timer(&adapter->watchdog_timer, jiffies + 1);
 	}
 
-	if (adapter->ecdev) {
-		int ec_work_done = 0;
-		adapter->clean_rx(adapter->rx_ring, &ec_work_done, 100);
-		e1000_clean_tx_irq(adapter->tx_ring);
-		return IRQ_HANDLED;
-	}
-
 	if (napi_schedule_prep(&adapter->napi)) {
 		adapter->total_tx_bytes = 0;
 		adapter->total_tx_packets = 0;
@@ -2126,8 +2128,9 @@
 {
 	struct net_device *netdev = adapter->netdev;
 
-	if (adapter->ecdev)
+	if (adapter->ecdev) {
 		return;
+	}
 
 	if (adapter->msix_entries) {
 		int vector = 0;
@@ -4061,7 +4064,9 @@
 
 	pm_runtime_get_sync(&pdev->dev);
 
-	napi_disable(&adapter->napi);
+	if (!adapter->ecdev) {
+		napi_disable(&adapter->napi);
+	}
 
 	if (!test_bit(__E1000_DOWN, &adapter->state)) {
 		e1000e_down(adapter);
@@ -6201,9 +6206,9 @@
 	}
 
 #ifdef CONFIG_PCI_MSI
-	e1000_intr_msi(0,netdev);
+	e1000_intr_msi(0, netdev);
 #else
-	e1000_intr(0,netdev);
+	e1000_intr(0, netdev);
 #endif
 }
 
@@ -6571,6 +6576,11 @@
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	bool down = test_bit(__E1000_DOWN, &adapter->state);
 
+	if (adapter->ecdev) {
+		ecdev_close(adapter->ecdev);
+		ecdev_withdraw(adapter->ecdev);
+	}
+
 	/*
 	 * The timers may be rescheduled, so explicitly disable them
 	 * from being rescheduled.
@@ -6593,10 +6603,7 @@
 	if (!down)
 		clear_bit(__E1000_DOWN, &adapter->state);
 
-	if (adapter->ecdev) {
-		ecdev_close(adapter->ecdev);
-		ecdev_withdraw(adapter->ecdev);
-	} else {
+	if (!adapter->ecdev) {
 		unregister_netdev(netdev);
 	}