Hi,

I am experiencing problems with link detection in the e1000e driver using the
3.14 kernel and the latest stable-1.5 master. Once link is down the driver
does not detect link when plugging the cable back in. Link is only detected
again when restarting the EtherCAT master.
This seems to happen only with certain e1000e network cards (e.g. 82574L) and
works fine with some other (e.g. 82573L, I218-LM).

After checking the e1000e code I noticed that there has been a change in the
original driver between kernel 3.8 and 3.10 affecting link detection in the
e1000_watchdog function (the change has been reverted in kernel 3.16).
With these changes a check for adapter->ecdev got lost in the EtherCAT capable
drivers starting with kernel 3.10.

I have created some patches for kernel 3.14 and 3.16 that fix the problem for
me, the 3.14 patches should also work for 3.10 and 3.12.

e1000e-3.16-link-detection.patch adds the missing check for adapter->ecdev.

e1000e-3.14-link-detection-v1.patch adds the missing check for adapter->ecdev.
e1000e-3.14-link-detection-v2.patch adds the missing check for adapter->ecdev
and contains the backport of the reverted change in kernel 3.16, I'm not
completely sure if v1 or v2 is the more "correct" one.


Best regards
  Christoph

# HG changeset patch
# User Christoph Permes <christoph.per...@knapp.com>
# Date 1467796362 -7200
#      Wed Jul 06 11:12:42 2016 +0200
# Branch e1000e-3.16-bugfix
# Node ID fa8f1e6fd2991e288b78d7ed0afa8bc283e71dd3
# Parent  0f4b7d799c4453b10940f7f974fcf9c38f436ebf
Fixed link detection in e1000e driver for 3.16.

diff -r 0f4b7d799c44 -r fa8f1e6fd299 devices/e1000e/netdev-3.16-ethercat.c
--- a/devices/e1000e/netdev-3.16-ethercat.c	Fri May 13 17:43:00 2016 +0200
+++ b/devices/e1000e/netdev-3.16-ethercat.c	Wed Jul 06 11:12:42 2016 +0200
@@ -5201,7 +5201,7 @@
 	 * if there is queued Tx work it cannot be done.  So
 	 * reset the controller to flush the Tx packet buffers.
 	 */
-	if (!netif_carrier_ok(netdev) &&
+	if (!adapter->ecdev && !netif_carrier_ok(netdev) &&
 	    (e1000_desc_unused(tx_ring) + 1 < tx_ring->count))
 		adapter->flags |= FLAG_RESTART_NOW;
 
# HG changeset patch
# User Christoph Permes <christoph.per...@knapp.com>
# Date 1467796628 -7200
#      Wed Jul 06 11:17:08 2016 +0200
# Branch e1000e-3.14-bugfix-v1
# Node ID d20649e3c1a3ae755df0da4824868ea52ac1f924
# Parent  0f4b7d799c4453b10940f7f974fcf9c38f436ebf
Fixed link detection in e1000e driver for 3.14

diff -r 0f4b7d799c44 -r d20649e3c1a3 devices/e1000e/netdev-3.14-ethercat.c
--- a/devices/e1000e/netdev-3.14-ethercat.c	Fri May 13 17:43:00 2016 +0200
+++ b/devices/e1000e/netdev-3.14-ethercat.c	Wed Jul 06 11:17:08 2016 +0200
@@ -5084,7 +5084,8 @@
 			 * (Do the reset outside of interrupt context).
 			 */
 			if ((adapter->flags & FLAG_RX_NEEDS_RESTART) ||
-			    (e1000_desc_unused(tx_ring) + 1 < tx_ring->count))
+			    (!adapter->ecdev &&
+			     (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)))
 				adapter->flags |= FLAG_RESTART_NOW;
 			else
 				pm_schedule_suspend(netdev->dev.parent,
# HG changeset patch
# User Christoph Permes <christoph.per...@knapp.com>
# Date 1467796710 -7200
#      Wed Jul 06 11:18:30 2016 +0200
# Branch e1000e-3.14-bugfix-v2
# Node ID 12377b6939fcf8b6663c195e66c7ccdf7bce13da
# Parent  0f4b7d799c4453b10940f7f974fcf9c38f436ebf
Fixed link detection in e1000e driver for 3.14.

diff -r 0f4b7d799c44 -r 12377b6939fc devices/e1000e/netdev-3.14-ethercat.c
--- a/devices/e1000e/netdev-3.14-ethercat.c	Fri May 13 17:43:00 2016 +0200
+++ b/devices/e1000e/netdev-3.14-ethercat.c	Wed Jul 06 11:18:30 2016 +0200
@@ -5076,15 +5076,11 @@
 							round_jiffies(jiffies + 2 * HZ));
 			}
 
-			/* The link is lost so the controller stops DMA.
-			 * If there is queued Tx work that cannot be done
-			 * or if on an 8000ES2LAN which requires a Rx packet
-			 * buffer work-around on link down event, reset the
-			 * controller to flush the Tx/Rx packet buffers.
-			 * (Do the reset outside of interrupt context).
+			/* 8000ES2LAN requires a Rx packet buffer work-around
+			 * on link down event; reset the controller to flush
+			 * the Rx packet buffer.
 			 */
-			if ((adapter->flags & FLAG_RX_NEEDS_RESTART) ||
-			    (e1000_desc_unused(tx_ring) + 1 < tx_ring->count))
+			if (adapter->flags & FLAG_RX_NEEDS_RESTART)
 				adapter->flags |= FLAG_RESTART_NOW;
 			else
 				pm_schedule_suspend(netdev->dev.parent,
@@ -5107,6 +5103,14 @@
 	adapter->gotc_old = adapter->stats.gotc;
 	spin_unlock(&adapter->stats64_lock);
 
+	/* If the link is lost the controller stops DMA, but
+	 * if there is queued Tx work it cannot be done.  So
+	 * reset the controller to flush the Tx packet buffers.
+	 */
+	if (!adapter->ecdev && !netif_carrier_ok(netdev) &&
+	    (e1000_desc_unused(tx_ring) + 1 < tx_ring->count))
+		adapter->flags |= FLAG_RESTART_NOW;
+
 	if (adapter->flags & FLAG_RESTART_NOW) {
 		schedule_work(&adapter->reset_task);
 		/* return immediately since reset is imminent */
_______________________________________________
etherlab-dev mailing list
etherlab-dev@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-dev

Reply via email to