rpms/kernel/F-11 tg3-05-assign-flags-to-fixes-in-start_xmit_dma_bug.patch, NONE, 1.1 tg3-06-fix-5906-transmit-hangs.patch, NONE, 1.1 kernel.spec, 1.1826, 1.1827

Chuck Ebbert cebbert at fedoraproject.org
Sun Mar 14 06:40:40 UTC 2010


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24332

Modified Files:
	kernel.spec 
Added Files:
	tg3-05-assign-flags-to-fixes-in-start_xmit_dma_bug.patch 
	tg3-06-fix-5906-transmit-hangs.patch 
Log Message:
Fix regression in tg3 driver (#571638)

tg3-05-assign-flags-to-fixes-in-start_xmit_dma_bug.patch:
 tg3.c |   26 +++++++++++++++++++-------
 tg3.h |    2 ++
 2 files changed, 21 insertions(+), 7 deletions(-)

--- NEW FILE tg3-05-assign-flags-to-fixes-in-start_xmit_dma_bug.patch ---
From: Matt Carlson <mcarlson at broadcom.com>
Date: Mon, 2 Nov 2009 12:33:33 +0000 (+0000)
Subject: tg3: Assign flags to fixes in start_xmit_dma_bug
X-Git-Tag: v2.6.33-rc1~388^2~555
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=0e1406dd404ce55dbe8d68b4b5e2aed7e5c75fdb

tg3: Assign flags to fixes in start_xmit_dma_bug

This patch adds a flag for each bug workaround in
tg3_start_xmit_dma_bug().  This is prep work for the following patch.

Signed-off-by: Matt Carlson <mcarlson at broadcom.com>
Reviewed-by: Michael Chan <mchan at broadcom.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
---

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ba5d3fe..da80825 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5124,7 +5124,8 @@ static int tigon3_dma_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
 		/* Make sure new skb does not cross any 4G boundaries.
 		 * Drop the packet if it does.
 		 */
-		if (ret || tg3_4g_overflow_test(new_addr, new_skb->len)) {
+		if (ret || ((tp->tg3_flags3 & TG3_FLG3_4G_DMA_BNDRY_BUG) &&
+			    tg3_4g_overflow_test(new_addr, new_skb->len))) {
 			if (!ret)
 				skb_dma_unmap(&tp->pdev->dev, new_skb,
 					      DMA_TO_DEVICE);
@@ -5459,9 +5460,15 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
 
 	would_hit_hwbug = 0;
 
-	if (tp->tg3_flags3 & TG3_FLG3_5701_DMA_BUG)
+	if ((tp->tg3_flags3 & TG3_FLG3_4G_DMA_BNDRY_BUG) &&
+	    tg3_4g_overflow_test(mapping, len))
+		would_hit_hwbug = 1;
+
+	if ((tp->tg3_flags3 & TG3_FLG3_40BIT_DMA_LIMIT_BUG) &&
+	    tg3_40bit_overflow_test(tp, mapping, len))
 		would_hit_hwbug = 1;
-	else if (tg3_4g_overflow_test(mapping, len))
+
+	if (tp->tg3_flags3 & TG3_FLG3_5701_DMA_BUG)
 		would_hit_hwbug = 1;
 
 	tg3_set_txd(tnapi, entry, mapping, len, base_flags,
@@ -5482,10 +5489,12 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
 
 			tnapi->tx_buffers[entry].skb = NULL;
 
-			if (tg3_4g_overflow_test(mapping, len))
+			if ((tp->tg3_flags3 & TG3_FLG3_4G_DMA_BNDRY_BUG) &&
+			    tg3_4g_overflow_test(mapping, len))
 				would_hit_hwbug = 1;
 
-			if (tg3_40bit_overflow_test(tp, mapping, len))
+			if ((tp->tg3_flags3 & TG3_FLG3_40BIT_DMA_LIMIT_BUG) &&
+			    tg3_40bit_overflow_test(tp, mapping, len))
 				would_hit_hwbug = 1;
 
 			if (tp->tg3_flags2 & TG3_FLG2_HW_TSO)
@@ -12610,12 +12619,15 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 
 	tp->irq_max = 1;
 
-#ifdef TG3_NAPI
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
 		tp->tg3_flags |= TG3_FLAG_SUPPORT_MSIX;
 		tp->irq_max = TG3_IRQ_MAX_VECS;
 	}
-#endif
+
+	if (!(tp->tg3_flags3 & TG3_FLG3_5755_PLUS)) {
+		tp->tg3_flags3 |= TG3_FLG3_4G_DMA_BNDRY_BUG;
+		tp->tg3_flags3 |= TG3_FLG3_40BIT_DMA_LIMIT_BUG;
+	}
 
 	if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ||
 	     (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) ||
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index bab7940..b603810 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2759,6 +2759,8 @@ struct tg3 {
 #define TG3_FLG3_TOGGLE_10_100_L1PLLPD	0x00008000
 #define TG3_FLG3_PHY_IS_FET		0x00010000
 #define TG3_FLG3_ENABLE_RSS		0x00020000
+#define TG3_FLG3_4G_DMA_BNDRY_BUG	0x00080000
+#define TG3_FLG3_40BIT_DMA_LIMIT_BUG	0x00100000
 
 	struct timer_list		timer;
 	u16				timer_counter;

tg3-06-fix-5906-transmit-hangs.patch:
 tg3.c |   26 +++++++++++++++++++-------
 tg3.h |    1 +
 2 files changed, 20 insertions(+), 7 deletions(-)

--- NEW FILE tg3-06-fix-5906-transmit-hangs.patch ---
From: Matt Carlson <mcarlson at broadcom.com>
Date: Mon, 2 Nov 2009 14:23:27 +0000 (+0000)
Subject: tg3: Fix 5906 transmit hangs
X-Git-Tag: v2.6.33-rc1~388^2~554
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=92c6b8d16a36df3f28b2537bed2a56491fb08f11

tg3: Fix 5906 transmit hangs

The 5906 has trouble with fragments that are less than 8 bytes in size.
This patch works around the problem by pivoting the 5906's transmit
routine to tg3_start_xmit_dma_bug() and introducing a new SHORT_DMA_BUG
flag that enables code to detect and react to the problematic condition.

Signed-off-by: Matt Carlson <mcarlson at broadcom.com>
Signed-off-by: Michael Chan <mchan at broadcom.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
---

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index da80825..a7a582e 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5393,7 +5393,7 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
 	mss = 0;
 	if ((mss = skb_shinfo(skb)->gso_size) != 0) {
 		struct iphdr *iph;
-		int tcp_opt_len, ip_tcp_len, hdr_len;
+		u32 tcp_opt_len, ip_tcp_len, hdr_len;
 
 		if (skb_header_cloned(skb) &&
 		    pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
@@ -5424,8 +5424,10 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
 								 IPPROTO_TCP,
 								 0);
 
-		if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) ||
-		    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) {
+		if (tp->tg3_flags2 & TG3_FLG2_HW_TSO_2)
+			mss |= hdr_len << 9;
+		else if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_1) ||
+			 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
 			if (tcp_opt_len || iph->ihl > 5) {
 				int tsflags;
 
@@ -5460,6 +5462,9 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
 
 	would_hit_hwbug = 0;
 
+	if ((tp->tg3_flags3 & TG3_FLG3_SHORT_DMA_BUG) && len <= 8)
+		would_hit_hwbug = 1;
+
 	if ((tp->tg3_flags3 & TG3_FLG3_4G_DMA_BNDRY_BUG) &&
 	    tg3_4g_overflow_test(mapping, len))
 		would_hit_hwbug = 1;
@@ -5489,6 +5494,10 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
 
 			tnapi->tx_buffers[entry].skb = NULL;
 
+			if ((tp->tg3_flags3 & TG3_FLG3_SHORT_DMA_BUG) &&
+			    len <= 8)
+				would_hit_hwbug = 1;
+
 			if ((tp->tg3_flags3 & TG3_FLG3_4G_DMA_BNDRY_BUG) &&
 			    tg3_4g_overflow_test(mapping, len))
 				would_hit_hwbug = 1;
@@ -12625,8 +12634,12 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 	}
 
 	if (!(tp->tg3_flags3 & TG3_FLG3_5755_PLUS)) {
-		tp->tg3_flags3 |= TG3_FLG3_4G_DMA_BNDRY_BUG;
-		tp->tg3_flags3 |= TG3_FLG3_40BIT_DMA_LIMIT_BUG;
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+			tp->tg3_flags3 |= TG3_FLG3_SHORT_DMA_BUG;
+		else {
+			tp->tg3_flags3 |= TG3_FLG3_4G_DMA_BNDRY_BUG;
+			tp->tg3_flags3 |= TG3_FLG3_40BIT_DMA_LIMIT_BUG;
+		}
 	}
 
 	if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ||
@@ -13987,8 +14000,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 		goto err_out_iounmap;
 	}
 
-	if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) ||
-	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+	if (tp->tg3_flags3 & TG3_FLG3_5755_PLUS)
 		dev->netdev_ops = &tg3_netdev_ops;
 	else
 		dev->netdev_ops = &tg3_netdev_ops_dma_bug;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index b603810..a5568a1 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2761,6 +2761,7 @@ struct tg3 {
 #define TG3_FLG3_ENABLE_RSS		0x00020000
 #define TG3_FLG3_4G_DMA_BNDRY_BUG	0x00080000
 #define TG3_FLG3_40BIT_DMA_LIMIT_BUG	0x00100000
+#define TG3_FLG3_SHORT_DMA_BUG		0x00200000
 
 	struct timer_list		timer;
 	u16				timer_counter;


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1826
retrieving revision 1.1827
diff -u -p -r1.1826 -r1.1827
--- kernel.spec	14 Mar 2010 05:41:07 -0000	1.1826
+++ kernel.spec	14 Mar 2010 06:40:39 -0000	1.1827
@@ -754,6 +754,10 @@ Patch12350: tcp-fix-icmp-rto-war.patch
 
 Patch20031: vgaarb-fix-userspace-ptr-deref.patch
 
+# fix regression caused by dropping these (F12#571638)
+Patch14455: tg3-05-assign-flags-to-fixes-in-start_xmit_dma_bug.patch
+Patch14456: tg3-06-fix-5906-transmit-hangs.patch
+
 #===============================================================================
 %endif
 
@@ -1383,6 +1387,9 @@ ApplyPatch fix-ima-null-ptr-deref.patch
 # rhbz#567530
 ApplyPatch tcp-fix-icmp-rto-war.patch
 
+ApplyPatch tg3-05-assign-flags-to-fixes-in-start_xmit_dma_bug.patch
+ApplyPatch tg3-06-fix-5906-transmit-hangs.patch
+
 # END OF PATCH APPLICATIONS ====================================================
 
 %endif
@@ -2037,7 +2044,10 @@ fi
 # and build.
 
 %changelog
-* Sat Mar 13 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.10-41.rc1
+* Sun Mar 14 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.10-42.rc1
+- Fix regression in tg3 driver (#571638)
+
+* Sat Mar 13 2010 Chuck Ebbert <cebbert at redhat.com>
 - Linux 2.6.32.10-rc1
 - Revert -stable patches that conflict with our F-11 DRM:
   acpi-i915-blacklist-clevo-m5x0n-bad_lid-state.patch



More information about the scm-commits mailing list