[kernel/f13/master] Two networking fixes (skge, r8169) from sgruska

Kyle McMartin kyle at fedoraproject.org
Mon Oct 18 15:04:32 UTC 2010


commit 06186dfdffae788611ef32fc68f7980bd7bcfacb
Author: Kyle McMartin <kyle at mcmartin.ca>
Date:   Mon Oct 18 11:04:18 2010 -0400

    Two networking fixes (skge, r8169) from sgruska

 kernel.spec                     |   11 ++++
 r8169-fix-dma-allocations.patch |  120 +++++++++++++++++++++++++++++++++++++++
 skge-quirk-to-4gb-dma.patch     |   98 +++++++++++++++++++++++++++++++
 3 files changed, 229 insertions(+), 0 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index ac28c2f..0ddaab6 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -828,6 +828,9 @@ Patch12591: linux-2.6-bonding-sysfs-warning.patch
 #twsock rcu warning fix (bz 642905)
 Patch12592: linux-2.6-twsock-rcu-lockdep-warn.patch
 
+Patch13635: r8169-fix-dma-allocations.patch
+Patch13636: skge-quirk-to-4gb-dma.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1565,6 +1568,11 @@ ApplyPatch linux-2.6-bonding-sysfs-warning.patch
 # BZ 642905
 ApplyPatch linux-2.6-twsock-rcu-lockdep-warn.patch
 
+# rhbz#629158
+ApplyPatch r8169-fix-dma-allocations.patch
+# rhbz#447489
+ApplyPatch skge-quirk-to-4gb-dma.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2186,6 +2194,9 @@ fi
 
 
 %changelog
+* Mon Oct 18 2010 Kyle McMartin <kyle at redhat.com>
+- Two networking fixes (skge, r8169) from sgruska. (rhbz#447489,629158)
+
 * Thu Oct 14 2010 Neil Horman <nhorman at redhat.com>
 - Fix rcu warning in twsock_net (bz 642905)
 
diff --git a/r8169-fix-dma-allocations.patch b/r8169-fix-dma-allocations.patch
new file mode 100644
index 0000000..e4aa160
--- /dev/null
+++ b/r8169-fix-dma-allocations.patch
@@ -0,0 +1,120 @@
+From sgruszka at redhat.com Mon Oct 18 05:10:00 2010
+Return-Path: sgruszka at redhat.com
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail03.corp.redhat.com with LMTP; Mon, 18 Oct 2010 05:10:00 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 5E48E928A4;
+	Mon, 18 Oct 2010 05:10:00 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id q3QJQ+TOP+bt; Mon, 18 Oct 2010 05:10:00 -0400 (EDT)
+Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 423CC91A7C;
+	Mon, 18 Oct 2010 05:10:00 -0400 (EDT)
+Received: from localhost (dhcp-1-246.brq.redhat.com [10.34.1.246])
+	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o9I99x6b006228;
+	Mon, 18 Oct 2010 05:09:59 -0400
+From: Stanislaw Gruszka <sgruszka at redhat.com>
+To: stable at kernel.org
+Cc: Kyle McMartin <kmcmartin at redhat.com>,
+        Stanislaw Gruszka <sgruszka at redhat.com>,
+        "David S. Miller" <davem at davemloft.net>
+Subject: [PATCH -stable 2.6.34+] r8169: allocate with GFP_KERNEL flag when able to sleep
+Date: Mon, 18 Oct 2010 11:12:22 +0200
+Message-Id: <1287393142-2566-1-git-send-email-sgruszka at redhat.com>
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
+
+Upstream aeb19f6052b5e5c8a24aa444fbff73b84341beac commit.
+
+We have fedora bug report where driver fail to initialize after
+suspend/resume because of memory allocation errors:
+https://bugzilla.redhat.com/show_bug.cgi?id=629158
+
+To fix use GFP_KERNEL allocation where possible.
+
+Patch should fix any allocation errors with calltrace like that:
+
+NetworkManager: page allocation failure. order:3, mode:0x4020
+Pid: 1427, comm: NetworkManager Not tainted 2.6.31.12-rhapsody.fc12-121 #1
+Call Trace:
+ [<ffffffff810c876f>] __alloc_pages_nodemask+0x57a/0x5bb
+ [<ffffffff810f415d>] alloc_pages_node+0x48/0x4a
+ [<ffffffff810f4189>] kmalloc_large_node+0x2a/0x67
+ [<ffffffff810f5f1c>] __kmalloc_node_track_caller+0x31/0x11b
+ [<ffffffff8136f4fe>] ? __netdev_alloc_skb+0x34/0x50
+ [<ffffffff8136e8b8>] __alloc_skb+0x80/0x170
+ [<ffffffff8136f4fe>] __netdev_alloc_skb+0x34/0x50
+ [<ffffffffa011c5e0>] rtl8169_rx_fill+0xa8/0x154 [r8169]
+ [<ffffffffa011e5c5>] rtl8169_init_ring+0x71/0x9f [r8169]
+ [<ffffffffa011edbe>] rtl8169_open+0x7f/0x199 [r8169]
+
+Tested-by: Neal Becker <ndbecker2 at gmail.com>
+Signed-off-by: Stanislaw Gruszka <sgruszka at redhat.com>
+Acked-by: Eric Dumazet <eric.dumazet at gmail.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/r8169.c |   12 ++++++------
+ 1 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
+index a0da4a1..a68ec8f 100644
+--- a/drivers/net/r8169.c
++++ b/drivers/net/r8169.c
+@@ -4000,7 +4000,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
+ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
+ 					    struct net_device *dev,
+ 					    struct RxDesc *desc, int rx_buf_sz,
+-					    unsigned int align)
++					    unsigned int align, gfp_t gfp)
+ {
+ 	struct sk_buff *skb;
+ 	dma_addr_t mapping;
+@@ -4008,7 +4008,7 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
+ 
+ 	pad = align ? align : NET_IP_ALIGN;
+ 
+-	skb = netdev_alloc_skb(dev, rx_buf_sz + pad);
++	skb = __netdev_alloc_skb(dev, rx_buf_sz + pad, gfp);
+ 	if (!skb)
+ 		goto err_out;
+ 
+@@ -4039,7 +4039,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp)
+ }
+ 
+ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
+-			   u32 start, u32 end)
++			   u32 start, u32 end, gfp_t gfp)
+ {
+ 	u32 cur;
+ 
+@@ -4054,7 +4054,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
+ 
+ 		skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev,
+ 					   tp->RxDescArray + i,
+-					   tp->rx_buf_sz, tp->align);
++					   tp->rx_buf_sz, tp->align, gfp);
+ 		if (!skb)
+ 			break;
+ 
+@@ -4082,7 +4082,7 @@ static int rtl8169_init_ring(struct net_device *dev)
+ 	memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info));
+ 	memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *));
+ 
+-	if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC)
++	if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, GFP_KERNEL) != NUM_RX_DESC)
+ 		goto err_out;
+ 
+ 	rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1);
+@@ -4583,7 +4583,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
+ 	count = cur_rx - tp->cur_rx;
+ 	tp->cur_rx = cur_rx;
+ 
+-	delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx);
++	delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, GFP_ATOMIC);
+ 	if (!delta && count)
+ 		netif_info(tp, intr, dev, "no Rx buffer allocated\n");
+ 	tp->dirty_rx += delta;
+-- 
+1.7.1
+
diff --git a/skge-quirk-to-4gb-dma.patch b/skge-quirk-to-4gb-dma.patch
new file mode 100644
index 0000000..ffa0fff
--- /dev/null
+++ b/skge-quirk-to-4gb-dma.patch
@@ -0,0 +1,98 @@
+From sgruszka at redhat.com Mon Oct 18 05:19:21 2010
+Return-Path: sgruszka at redhat.com
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail03.corp.redhat.com with LMTP; Mon, 18 Oct 2010 05:19:21 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id A11F69E559;
+	Mon, 18 Oct 2010 05:19:21 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id IhyIgD7E4aj3; Mon, 18 Oct 2010 05:19:21 -0400 (EDT)
+Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 9007B9E55E;
+	Mon, 18 Oct 2010 05:19:21 -0400 (EDT)
+Received: from localhost (dhcp-1-246.brq.redhat.com [10.34.1.246])
+	by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o9I9JKsF025385;
+	Mon, 18 Oct 2010 05:19:21 -0400
+From: Stanislaw Gruszka <sgruszka at redhat.com>
+To: stable at kernel.org
+Cc: Kyle McMartin <kmcmartin at redhat.com>,
+        Stanislaw Gruszka <sgruszka at redhat.com>,
+        "David S. Miller" <davem at davemloft.net>
+Subject: [PATCH -stable 2.6.34+] skge: add quirk to limit DMA
+Date: Mon, 18 Oct 2010 11:21:54 +0200
+Message-Id: <1287393714-3720-1-git-send-email-sgruszka at redhat.com>
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21
+
+Upstream 392bd0cb000d4aac9e88e4f50823db85e7220688 commit.
+
+Skge devices installed on some Gigabyte motherboards are not able to
+perform 64 dma correctly due to board PCI implementation, so limit
+DMA to 32bit if such boards are detected.
+
+Bug was reported here:
+https://bugzilla.redhat.com/show_bug.cgi?id=447489
+
+Signed-off-by: Stanislaw Gruszka <sgruszka at redhat.com>
+Tested-by: Luya Tshimbalanga <luya at fedoraproject.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/skge.c |   18 +++++++++++++++++-
+ 1 files changed, 17 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/net/skge.c b/drivers/net/skge.c
+index 40e5c46..465ae7e 100644
+--- a/drivers/net/skge.c
++++ b/drivers/net/skge.c
+@@ -43,6 +43,7 @@
+ #include <linux/seq_file.h>
+ #include <linux/mii.h>
+ #include <linux/slab.h>
++#include <linux/dmi.h>
+ #include <asm/irq.h>
+ 
+ #include "skge.h"
+@@ -3868,6 +3869,8 @@ static void __devinit skge_show_addr(struct net_device *dev)
+ 	netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr);
+ }
+ 
++static int only_32bit_dma;
++
+ static int __devinit skge_probe(struct pci_dev *pdev,
+ 				const struct pci_device_id *ent)
+ {
+@@ -3889,7 +3892,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
+ 
+ 	pci_set_master(pdev);
+ 
+-	if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
++	if (!only_32bit_dma && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
+ 		using_dac = 1;
+ 		err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+ 	} else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) {
+@@ -4147,8 +4150,21 @@ static struct pci_driver skge_driver = {
+ 	.shutdown =	skge_shutdown,
+ };
+ 
++static struct dmi_system_id skge_32bit_dma_boards[] = {
++	{
++		.ident = "Gigabyte nForce boards",
++		.matches = {
++			DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"),
++			DMI_MATCH(DMI_BOARD_NAME, "nForce"),
++		},
++	},
++	{}
++};
++
+ static int __init skge_init_module(void)
+ {
++	if (dmi_check_system(skge_32bit_dma_boards))
++		only_32bit_dma = 1;
+ 	skge_debug_init();
+ 	return pci_register_driver(&skge_driver);
+ }
+-- 
+1.7.1
+


More information about the scm-commits mailing list