netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [TG3] Always load TSO firmware
@ 2003-11-17  9:32 Herbert Xu
  2003-11-17 20:38 ` David S. Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2003-11-17  9:32 UTC (permalink / raw)
  To: David S. Miller, Jeff Garzik, netdev

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

Hi:

In 2.5 the TSO firmware is always loaded on capable cards.  This
does not happen in 2.4.  I've received a report from a Broadcom
5705M user that unless the firmware is loaded his card does not
work.

This patch makes it load the TSO firmware even if the kernel
does not support it.

The only catch is that the Broadcom driver doesn't always load
the firmware either and yet it still works under 2.4 for that user.

Despite that this should still be safe as 2.5 always loads the
firmware regardless of whether TSO is going to be used or not.
It also removes another variable between 2.4/2.5 when chasing
down tg3 bugs.

Cheers,
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: tg3.patch --]
[-- Type: text/plain, Size: 1922 bytes --]

Index: kernel-source-2.5/drivers/net/tg3.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/drivers/net/tg3.c,v
retrieving revision 1.2
diff -u -r1.2 tg3.c
--- kernel-source-2.5/drivers/net/tg3.c	12 Nov 2003 10:50:39 -0000	1.2
+++ kernel-source-2.5/drivers/net/tg3.c	17 Nov 2003 08:30:18 -0000
@@ -3857,8 +3857,6 @@
 	return 0;
 }
 
-#if TG3_TSO_SUPPORT != 0
-
 #define TG3_TSO_FW_RELEASE_MAJOR	0x1
 #define TG3_TSO_FW_RELASE_MINOR		0x3
 #define TG3_TSO_FW_RELEASE_FIX		0x0
@@ -4445,8 +4443,6 @@
 	return 0;
 }
 
-#endif /* TG3_TSO_SUPPORT != 0 */
-
 /* tp->lock is held. */
 static void __tg3_set_mac_addr(struct tg3 *tp)
 {
@@ -4644,7 +4640,6 @@
 		tw32(BUFMGR_DMA_DESC_POOL_ADDR, NIC_SRAM_DMA_DESC_POOL_BASE);
 		tw32(BUFMGR_DMA_DESC_POOL_SIZE, NIC_SRAM_DMA_DESC_POOL_SIZE);
 	}
-#if TG3_TSO_SUPPORT != 0
 	else if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
 		int fw_len;
 
@@ -4659,7 +4654,6 @@
 		tw32(BUFMGR_MB_POOL_SIZE,
 		     NIC_SRAM_MBUF_POOL_SIZE5705 - fw_len - 0xa00);
 	}
-#endif
 
 	if (!(tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE)) {
 		tw32(BUFMGR_MB_RDMA_LOW_WATER,
@@ -5005,13 +4999,11 @@
 			return err;
 	}
 
-#if TG3_TSO_SUPPORT != 0
 	if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
 		err = tg3_load_tso_firmware(tp);
 		if (err)
 			return err;
 	}
-#endif
 
 	tp->tx_mode = TX_MODE_ENABLE;
 	tw32(MAC_TX_MODE, tp->tx_mode);
@@ -7649,7 +7641,6 @@
 			DEFAULT_MB_HIGH_WATER_5705;
 	}
 
-#if TG3_TSO_SUPPORT != 0
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 ||
 	    tp->pci_chip_rev_id == CHIPREV_ID_5705_A0 ||
@@ -7666,8 +7657,6 @@
 		dev->features |= NETIF_F_TSO;
 #endif
 
-#endif
-
 	if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 &&
 	    !(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) &&
 	    !(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH)) {

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [TG3] Always load TSO firmware
  2003-11-17  9:32 [TG3] Always load TSO firmware Herbert Xu
@ 2003-11-17 20:38 ` David S. Miller
  2003-11-20  9:56   ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2003-11-17 20:38 UTC (permalink / raw)
  To: Herbert Xu; +Cc: jgarzik, netdev

On Mon, 17 Nov 2003 20:32:25 +1100
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> In 2.5 the TSO firmware is always loaded on capable cards.  This
> does not happen in 2.4.  I've received a report from a Broadcom
> 5705M user that unless the firmware is loaded his card does not
> work.
> 
> This patch makes it load the TSO firmware even if the kernel
> does not support it.
> 
> The only catch is that the Broadcom driver doesn't always load
> the firmware either and yet it still works under 2.4 for that user.
> 
> Despite that this should still be safe as 2.5 always loads the
> firmware regardless of whether TSO is going to be used or not.
> It also removes another variable between 2.4/2.5 when chasing
> down tg3 bugs.

I'd like to figure out the problem instead of applying this patch.

In fact, the behavior is the biggest clue as to what the problem
might be.  Espcially since in 2.4.x the TSO firmware is not executed
at all by the chip, and therefore should have no bearing on it's
operation.

Whether we load the TSO firmware or not on 5705 determines how big
an onboard buffer area we give to the chip for packet data.  It may
be the case that we are miscalculating these values or not programming
them into the chip correctly.

This is where you should look for the problem.

FWIW all of my 5782 and 5705 PCI boards work perfectly fine with the
current 2.4.x driver.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [TG3] Always load TSO firmware
  2003-11-17 20:38 ` David S. Miller
@ 2003-11-20  9:56   ` Herbert Xu
       [not found]     ` <20031120092530.4dfe9016.davem@redhat.com>
  2003-11-20 17:59     ` Jeff Garzik
  0 siblings, 2 replies; 5+ messages in thread
From: Herbert Xu @ 2003-11-20  9:56 UTC (permalink / raw)
  To: David S. Miller; +Cc: jgarzik, netdev

[-- Attachment #1: Type: text/plain, Size: 868 bytes --]

On Mon, Nov 17, 2003 at 12:38:36PM -0800, David S. Miller wrote:
> 
> Whether we load the TSO firmware or not on 5705 determines how big
> an onboard buffer area we give to the chip for packet data.  It may
> be the case that we are miscalculating these values or not programming
> them into the chip correctly.

OK, I've cross-checked with the Broadcom drivers and the problem seems
to be specific to 5705 A1 which is the chipset in question.

The Broadcom drivers limit the number of rx descriptors to 63 while
tg3.c only limits it to 64.  It has been confirmed that lowering
the limit makes the problem go away.

Here is the patch.

Thanks,
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: q --]
[-- Type: text/plain, Size: 691 bytes --]

--- tg3.c.orig	2003-11-18 21:18:04.000000000 +1100
+++ tg3.c	2003-11-18 21:34:22.000000000 +1100
@@ -6067,8 +6067,8 @@
 	tp->rx_pending = ering->rx_pending;
 
 	if ((tp->tg3_flags2 & TG3_FLG2_MAX_RXPEND_64) &&
-	    tp->rx_pending > 64)
-		tp->rx_pending = 64;
+	    tp->rx_pending > 63)
+		tp->rx_pending = 63;
 	tp->rx_jumbo_pending = ering->rx_jumbo_pending;
 	tp->tx_pending = ering->tx_pending;
 
@@ -7672,7 +7672,7 @@
 	    !(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) &&
 	    !(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH)) {
 		tp->tg3_flags2 |= TG3_FLG2_MAX_RXPEND_64;
-		tp->rx_pending = 64;
+		tp->rx_pending = 63;
 	}
 
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [TG3] Always load TSO firmware
       [not found]     ` <20031120092530.4dfe9016.davem@redhat.com>
@ 2003-11-20 17:41       ` Jeff Garzik
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2003-11-20 17:41 UTC (permalink / raw)
  To: David S. Miller; +Cc: Herbert Xu, netdev

David S. Miller wrote:
> On Thu, 20 Nov 2003 20:56:05 +1100
> Herbert Xu <herbert@gondor.apana.org.au> wrote:
> 
> 
>>OK, I've cross-checked with the Broadcom drivers and the problem seems
>>to be specific to 5705 A1 which is the chipset in question.
>>
>>The Broadcom drivers limit the number of rx descriptors to 63 while
>>tg3.c only limits it to 64.  It has been confirmed that lowering
>>the limit makes the problem go away.
>>
>>Here is the patch.
> 
> 
> Great work.
> 
> Jeff, please push this around.  I think it's serious enough for
> 2.4.23-rcX personally.


Will do, though I first need to check and see if non-power-of-two has 
any implications in the implementation...

	Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [TG3] Always load TSO firmware
  2003-11-20  9:56   ` Herbert Xu
       [not found]     ` <20031120092530.4dfe9016.davem@redhat.com>
@ 2003-11-20 17:59     ` Jeff Garzik
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2003-11-20 17:59 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev

Thanks.

This changes the replenish threshold a bit, but I don't think it will 
adversely affect anything.

Applied to 2.4 and 2.5, and sent upstream.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-11-20 17:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-17  9:32 [TG3] Always load TSO firmware Herbert Xu
2003-11-17 20:38 ` David S. Miller
2003-11-20  9:56   ` Herbert Xu
     [not found]     ` <20031120092530.4dfe9016.davem@redhat.com>
2003-11-20 17:41       ` Jeff Garzik
2003-11-20 17:59     ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).