[kernel] r19802 - in dists/squeeze/linux-2.6/debian: . patches/features/all/r8169 patches/series

Ben Hutchings benh at alioth.debian.org
Thu Feb 14 04:26:45 UTC 2013


Author: benh
Date: Thu Feb 14 04:26:38 2013
New Revision: 19802

Log:
r8169: Fix bugs that can cause an interface to hang (possible fix for: #617220, #642025)

Added:
   dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0072-r8169-missing-barriers.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0073-r8169-fix-unsigned-int-wraparound-with-TSO.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0074-r8169-remove-the-obsolete-and-incorrect-AMD-workarou.patch
Modified:
   dists/squeeze/linux-2.6/debian/changelog
   dists/squeeze/linux-2.6/debian/patches/series/48

Modified: dists/squeeze/linux-2.6/debian/changelog
==============================================================================
--- dists/squeeze/linux-2.6/debian/changelog	Thu Feb 14 03:55:04 2013	(r19801)
+++ dists/squeeze/linux-2.6/debian/changelog	Thu Feb 14 04:26:38 2013	(r19802)
@@ -5,6 +5,11 @@
   * Revert "time: Avoid making adjustments if we haven't accumulated
     anything" (Closes: #699112, regression in 2.6.32.60)
   * exec: Fix accounting of execv*() memory after vfork() (Closes: #700486)
+  * r8169: Fix bugs that can cause an interface to hang
+    (possible fix for: #617220, #642025)
+    - r8169: missing barriers.
+    - r8169: fix unsigned int wraparound with TSO
+    - r8169: remove the obsolete and incorrect AMD workaround
 
  -- Ben Hutchings <ben at decadent.org.uk>  Sat, 19 Jan 2013 19:57:27 +0000
 

Added: dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0072-r8169-missing-barriers.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0072-r8169-missing-barriers.patch	Thu Feb 14 04:26:38 2013	(r19802)
@@ -0,0 +1,38 @@
+From: Francois Romieu <romieu at fr.zoreil.com>
+Date: Fri, 27 Jan 2012 15:05:38 +0100
+Subject: r8169: missing barriers.
+
+commit 1e874e041fc7c222cbd85b20c4406070be1f687a upstream.
+
+Signed-off-by: Francois Romieu <romieu at fr.zoreil.com>
+Cc: Hayes Wang <hayeswang at realtek.com>
+[bwh: Adjusted filename for squeeze]
+---
+--- a/drivers/net/r8169.c
++++ b/drivers/net/r8169.c
+@@ -5552,7 +5552,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
+ 
+ 	if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) {
+ 		netif_stop_queue(dev);
+-		smp_rmb();
++		smp_mb();
+ 		if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)
+ 			netif_wake_queue(dev);
+ 	}
+@@ -5653,7 +5653,7 @@ static void rtl8169_tx_interrupt(struct net_device *dev,
+ 
+ 	if (tp->dirty_tx != dirty_tx) {
+ 		tp->dirty_tx = dirty_tx;
+-		smp_wmb();
++		smp_mb();
+ 		if (netif_queue_stopped(dev) &&
+ 		    (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) {
+ 			netif_wake_queue(dev);
+@@ -5664,7 +5664,6 @@ static void rtl8169_tx_interrupt(struct net_device *dev,
+ 		 * of start_xmit activity is detected (if it is not detected,
+ 		 * it is slow enough). -- FR
+ 		 */
+-		smp_rmb();
+ 		if (tp->cur_tx != dirty_tx)
+ 			RTL_W8(TxPoll, NPQ);
+ 	}

Added: dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0073-r8169-fix-unsigned-int-wraparound-with-TSO.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0073-r8169-fix-unsigned-int-wraparound-with-TSO.patch	Thu Feb 14 04:26:38 2013	(r19802)
@@ -0,0 +1,72 @@
+From: Julien Ducourthial <jducourt at free.fr>
+Date: Fri, 5 Oct 2012 23:29:20 +0200
+Subject: r8169: fix unsigned int wraparound with TSO
+
+commit 477206a018f902895bfcd069dd820bfe94c187b1 upstream.
+
+The r8169 may get stuck or show bad behaviour after activating TSO :
+the net_device is not stopped when it has no more TX descriptors.
+This problem comes from TX_BUFS_AVAIL which may reach -1 when all
+transmit descriptors are in use. The patch simply tries to keep positive
+values.
+
+Tested with 8111d(onboard) on a D510MO, and with 8111e(onboard) on a
+Zotac 890GXITX.
+
+Signed-off-by: Julien Ducourthial <jducourt at free.fr>
+Acked-by: Francois Romieu <romieu at fr.zoreil.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/r8169.c |   16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
+index f8bfd52..5b94dc9 100644
+--- a/drivers/net/r8169.c
++++ b/drivers/net/r8169.c
+@@ -58,8 +58,12 @@
+ #define R8169_MSG_DEFAULT \
+ 	(NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN)
+ 
+-#define TX_BUFFS_AVAIL(tp) \
+-	(tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1)
++#define TX_SLOTS_AVAIL(tp) \
++	(tp->dirty_tx + NUM_TX_DESC - tp->cur_tx)
++
++/* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */
++#define TX_FRAGS_READY_FOR(tp,nr_frags) \
++	(TX_SLOTS_AVAIL(tp) >= (nr_frags + 1))
+ 
+ /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
+    The RTL chips use a 64 element hash table based on the Ethernet CRC. */
+@@ -4754,7 +4758,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
+ 	u32 opts[2];
+ 	int frags;
+ 
+-	if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) {
++	if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) {
+ 		netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n");
+ 		goto err_stop_0;
+ 	}
+@@ -4792,10 +4796,10 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
+ 
+ 	RTL_W8(TxPoll, NPQ);
+ 
+-	if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) {
++	if (!TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
+ 		netif_stop_queue(dev);
+ 		smp_mb();
+-		if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)
++		if (TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS))
+ 			netif_wake_queue(dev);
+ 	}
+ 
+@@ -4907,7 +4911,7 @@ static void rtl8169_tx_interrupt(struct net_device *dev,
+ 		tp->dirty_tx = dirty_tx;
+ 		smp_mb();
+ 		if (netif_queue_stopped(dev) &&
+-		    (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) {
++		    TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
+ 			netif_wake_queue(dev);
+ 		}
+ 		/*

Added: dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0074-r8169-remove-the-obsolete-and-incorrect-AMD-workarou.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/r8169/0074-r8169-remove-the-obsolete-and-incorrect-AMD-workarou.patch	Thu Feb 14 04:26:38 2013	(r19802)
@@ -0,0 +1,54 @@
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras at iki.fi>
+Date: Mon, 21 Jan 2013 22:30:35 +0000
+Subject: r8169: remove the obsolete and incorrect AMD workaround
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+commit 5d0feaff230c0abfe4a112e6f09f096ed99e0b2d upstream.
+
+This was introduced in commit 6dccd16 "r8169: merge with version
+6.001.00 of Realtek's r8169 driver". I did not find the version
+6.001.00 online, but in 6.002.00 or any later r8169 from Realtek
+this hunk is no longer present.
+
+Also commit 05af214 "r8169: fix Ethernet Hangup for RTL8110SC
+rev d" claims to have fixed this issue otherwise.
+
+The magic compare mask of 0xfffe000 is dubious as it masks
+parts of the Reserved part, and parts of the VLAN tag. But this
+does not make much sense as the VLAN tag parts are perfectly
+valid there. In matter of fact this seems to be triggered with
+any VLAN tagged packet as RxVlanTag bit is matched. I would
+suspect 0xfffe0000 was intended to test reserved part only.
+
+Finally, this hunk is evil as it can cause more packets to be
+handled than what was NAPI quota causing net/core/dev.c:
+net_rx_action(): WARN_ON_ONCE(work > weight) to trigger, and
+mess up the NAPI state causing device to hang.
+
+As result, any system using VLANs and having high receive
+traffic (so that NAPI poll budget limits rtl_rx) would result
+in device hang.
+
+Signed-off-by: Timo Teräs <timo.teras at iki.fi>
+Acked-by: Francois Romieu <romieu at fr.zoreil.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+[bwh: Adjusted context for squeeze]
+---
+--- a/drivers/net/r8169.c
++++ b/drivers/net/r8169.c
+@@ -5029,13 +5029,6 @@ process_pkt:
+ 			dev->stats.rx_bytes += pkt_size;
+ 			dev->stats.rx_packets++;
+ 		}
+-
+-		/* Work around for AMD plateform. */
+-		if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
+-		    (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
+-			desc->opts2 = 0;
+-			cur_rx++;
+-		}
+ 	}
+ 
+ 	count = cur_rx - tp->cur_rx;

Modified: dists/squeeze/linux-2.6/debian/patches/series/48
==============================================================================
--- dists/squeeze/linux-2.6/debian/patches/series/48	Thu Feb 14 03:55:04 2013	(r19801)
+++ dists/squeeze/linux-2.6/debian/patches/series/48	Thu Feb 14 04:26:38 2013	(r19802)
@@ -1,3 +1,6 @@
 + bugfix/s390/s390-time-fix-sched_clock-overflow.patch
 + bugfix/all/revert-time-avoid-making-adjustments-if-we-haven-t.patch
 + debian/exec-Fix-accounting-of-execv-memory-after-vfork.patch
++ features/all/r8169/0072-r8169-missing-barriers.patch
++ features/all/r8169/0073-r8169-fix-unsigned-int-wraparound-with-TSO.patch
++ features/all/r8169/0074-r8169-remove-the-obsolete-and-incorrect-AMD-workarou.patch



More information about the Kernel-svn-changes mailing list