From: Greg KH on
2.6.32-stable review patch. If anyone has any objections, please let us know.

------------------

From: Matt Carlson <mcarlson(a)broadcom.com>

This is a resubmit backport of commit 92c6b8d16a36df3f28b2537bed2a56491fb08f11
to kernel version 2.6.32. The gentoo bug report can be found at
https://bugs.gentoo.org/show_bug.cgi?id=301091. Thanks to Matt Carlson for his
assistance and working me to fix a regression caused by the initial patch. The
original description is as follows:

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: Mike Pagano <mpagano(a)gentoo.org>
Signed-off-by: Matt Carlson <mcarlson(a)broadcom.com>
Signed-off-by: Michael Chan <mchan(a)broadcom.com>
Signed-off-by: David S. Miller <davem(a)davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)suse.de>

---
drivers/net/tg3.c | 21 ++++++++++++++++-----
drivers/net/tg3.h | 3 +++
2 files changed, 19 insertions(+), 5 deletions(-)

--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5392,7 +5392,7 @@ static netdev_tx_t tg3_start_xmit_dma_bu
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)) {
@@ -5423,8 +5423,10 @@ static netdev_tx_t tg3_start_xmit_dma_bu
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;

@@ -5459,6 +5461,9 @@ static netdev_tx_t tg3_start_xmit_dma_bu

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_5701_DMA_BUG)
would_hit_hwbug = 1;
else if (tg3_4g_overflow_test(mapping, len))
@@ -5482,6 +5487,10 @@ static netdev_tx_t tg3_start_xmit_dma_bu

tnapi->tx_buffers[entry].skb = NULL;

+ if ((tp->tg3_flags3 & TG3_FLG3_SHORT_DMA_BUG) &&
+ len <= 8)
+ would_hit_hwbug = 1;
+
if (tg3_4g_overflow_test(mapping, len))
would_hit_hwbug = 1;

@@ -12608,6 +12617,9 @@ static int __devinit tg3_get_invariants(
}
}

+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+ tp->tg3_flags3 |= TG3_FLG3_SHORT_DMA_BUG;
+
tp->irq_max = 1;

#ifdef TG3_NAPI
@@ -13975,8 +13987,7 @@ static int __devinit tg3_init_one(struct
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;
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2759,6 +2759,9 @@ 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
+#define TG3_FLG3_SHORT_DMA_BUG 0x00200000

struct timer_list timer;
u16 timer_counter;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Chuck Ebbert on
On Tue, 30 Mar 2010 15:54:45 -0700
Greg KH <gregkh(a)suse.de> wrote:

> 2.6.32-stable review patch. If anyone has any objections, please let
> us know.
>
> ------------------
>
> From: Matt Carlson <mcarlson(a)broadcom.com>
>
> This is a resubmit backport of commit
> 92c6b8d16a36df3f28b2537bed2a56491fb08f11 to kernel version 2.6.32.
> The gentoo bug report can be found at
> https://bugs.gentoo.org/show_bug.cgi?id=301091. Thanks to Matt
> Carlson for his assistance and working me to fix a regression caused
> by the initial patch. The original description is as follows:
>

I think these two patches should be used instead, as they fix the
bug without needing backports and keep the driver closer to upstream:

0e1406dd404ce55dbe8d68b4b5e2aed7e5c75fdb
"tg3: Assign flags to fixes in start_xmit_dma_bug"

92c6b8d16a36df3f28b2537bed2a56491fb08f11
"tg3: Fix 5906 transmit hangs"
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Greg KH on
On Tue, Mar 30, 2010 at 09:15:22PM -0400, Chuck Ebbert wrote:
> On Tue, 30 Mar 2010 15:54:45 -0700
> Greg KH <gregkh(a)suse.de> wrote:
>
> > 2.6.32-stable review patch. If anyone has any objections, please let
> > us know.
> >
> > ------------------
> >
> > From: Matt Carlson <mcarlson(a)broadcom.com>
> >
> > This is a resubmit backport of commit
> > 92c6b8d16a36df3f28b2537bed2a56491fb08f11 to kernel version 2.6.32.
> > The gentoo bug report can be found at
> > https://bugs.gentoo.org/show_bug.cgi?id=301091. Thanks to Matt
> > Carlson for his assistance and working me to fix a regression caused
> > by the initial patch. The original description is as follows:
> >
>
> I think these two patches should be used instead, as they fix the
> bug without needing backports and keep the driver closer to upstream:
>
> 0e1406dd404ce55dbe8d68b4b5e2aed7e5c75fdb
> "tg3: Assign flags to fixes in start_xmit_dma_bug"
>
> 92c6b8d16a36df3f28b2537bed2a56491fb08f11
> "tg3: Fix 5906 transmit hangs"

I don't know, I'll defer to Matt here, this patch has gone in and out of
the stable queue for a while now as he and some users have tested and
had problems lots of times...

Matt?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Matt Carlson on
On Wed, Mar 31, 2010 at 01:39:26PM -0700, Greg KH wrote:
> On Tue, Mar 30, 2010 at 09:15:22PM -0400, Chuck Ebbert wrote:
> > On Tue, 30 Mar 2010 15:54:45 -0700
> > Greg KH <gregkh(a)suse.de> wrote:
> >
> > > 2.6.32-stable review patch. If anyone has any objections, please let
> > > us know.
> > >
> > > ------------------
> > >
> > > From: Matt Carlson <mcarlson(a)broadcom.com>
> > >
> > > This is a resubmit backport of commit
> > > 92c6b8d16a36df3f28b2537bed2a56491fb08f11 to kernel version 2.6.32.
> > > The gentoo bug report can be found at
> > > https://bugs.gentoo.org/show_bug.cgi?id=301091. Thanks to Matt
> > > Carlson for his assistance and working me to fix a regression caused
> > > by the initial patch. The original description is as follows:
> > >
> >
> > I think these two patches should be used instead, as they fix the
> > bug without needing backports and keep the driver closer to upstream:
> >
> > 0e1406dd404ce55dbe8d68b4b5e2aed7e5c75fdb
> > "tg3: Assign flags to fixes in start_xmit_dma_bug"
> >
> > 92c6b8d16a36df3f28b2537bed2a56491fb08f11
> > "tg3: Fix 5906 transmit hangs"
>
> I don't know, I'll defer to Matt here, this patch has gone in and out of
> the stable queue for a while now as he and some users have tested and
> had problems lots of times...
>
> Matt?

I'm O.K. with either path. I supported Mike's patch because it was
minimal. (All the bugs should be shaken out by now.) If that isn't a
goal, then I guess I'd rather rubber stamp my own implementation.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Greg KH on
On Wed, Mar 31, 2010 at 02:23:09PM -0700, Matt Carlson wrote:
> On Wed, Mar 31, 2010 at 01:39:26PM -0700, Greg KH wrote:
> > On Tue, Mar 30, 2010 at 09:15:22PM -0400, Chuck Ebbert wrote:
> > > On Tue, 30 Mar 2010 15:54:45 -0700
> > > Greg KH <gregkh(a)suse.de> wrote:
> > >
> > > > 2.6.32-stable review patch. If anyone has any objections, please let
> > > > us know.
> > > >
> > > > ------------------
> > > >
> > > > From: Matt Carlson <mcarlson(a)broadcom.com>
> > > >
> > > > This is a resubmit backport of commit
> > > > 92c6b8d16a36df3f28b2537bed2a56491fb08f11 to kernel version 2.6.32.
> > > > The gentoo bug report can be found at
> > > > https://bugs.gentoo.org/show_bug.cgi?id=301091. Thanks to Matt
> > > > Carlson for his assistance and working me to fix a regression caused
> > > > by the initial patch. The original description is as follows:
> > > >
> > >
> > > I think these two patches should be used instead, as they fix the
> > > bug without needing backports and keep the driver closer to upstream:
> > >
> > > 0e1406dd404ce55dbe8d68b4b5e2aed7e5c75fdb
> > > "tg3: Assign flags to fixes in start_xmit_dma_bug"
> > >
> > > 92c6b8d16a36df3f28b2537bed2a56491fb08f11
> > > "tg3: Fix 5906 transmit hangs"
> >
> > I don't know, I'll defer to Matt here, this patch has gone in and out of
> > the stable queue for a while now as he and some users have tested and
> > had problems lots of times...
> >
> > Matt?
>
> I'm O.K. with either path. I supported Mike's patch because it was
> minimal. (All the bugs should be shaken out by now.) If that isn't a
> goal, then I guess I'd rather rubber stamp my own implementation.

I'll live with what we have now as we know it's been tested, and it is
less work for me at the moment :)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/