netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sky2: 88E803X transmit lockup
@ 2006-10-21  0:06 Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2006-10-21  0:06 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

The reason sky2 driver was locking up on transmit on the Yukon-FE chipset
is that it was misconfiguring the internal RAM buffer so the transmitter
and receiver were sharing the same space. 

The code assumed there was 16K of RAM on Yukon-FE (taken from vendor driver
sk98lin which is even more f*cked up on this). Then it assigned based on that.
The giveaway was that the registers would only hold 9bits so both RX/TX
had 0..1ff for space. It is a wonder it worked at all!

This patch addresses this, and fixes an easily reproducible hang on Transmit.
Only the Yukon-FE chip is Marvell 88E803X (10/100 only) are affected.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

--- sky2.orig/drivers/net/sky2.c	2006-10-20 16:37:56.000000000 -0700
+++ sky2/drivers/net/sky2.c	2006-10-20 16:38:16.000000000 -0700
@@ -699,16 +699,10 @@
 
 }
 
-/* Assign Ram Buffer allocation.
- * start and end are in units of 4k bytes
- * ram registers are in units of 64bit words
- */
-static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
+/* Assign Ram Buffer allocation in units of 64bit (8 bytes) */
+static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 end)
 {
-	u32 start, end;
-
-	start = startk * 4096/8;
-	end = (endk * 4096/8) - 1;
+	pr_debug(PFX "q %d %#x %#x\n", q, start, end);
 
 	sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
 	sky2_write32(hw, RB_ADDR(q, RB_START), start);
@@ -717,7 +711,7 @@
 	sky2_write32(hw, RB_ADDR(q, RB_RP), start);
 
 	if (q == Q_R1 || q == Q_R2) {
-		u32 space = (endk - startk) * 4096/8;
+		u32 space = end - start + 1;
 		u32 tp = space - space/4;
 
 		/* On receive queue's set the thresholds
@@ -1199,19 +1193,16 @@
 
 	sky2_mac_init(hw, port);
 
-	/* Determine available ram buffer space (in 4K blocks).
-	 * Note: not sure about the FE setting below yet
-	 */
-	if (hw->chip_id == CHIP_ID_YUKON_FE)
-		ramsize = 4;
-	else
-		ramsize = sky2_read8(hw, B2_E_0);
+	/* Determine available ram buffer space in qwords.  */
+	ramsize = sky2_read8(hw, B2_E_0) * 4096/8;
 
-	/* Give transmitter one third (rounded up) */
-	rxspace = ramsize - (ramsize + 2) / 3;
+	if (ramsize > 6*1024/8)
+		rxspace = ramsize - (ramsize + 2) / 3;
+	else
+		rxspace = ramsize / 2;
 
-	sky2_ramset(hw, rxqaddr[port], 0, rxspace);
-	sky2_ramset(hw, txqaddr[port], rxspace, ramsize);
+	sky2_ramset(hw, rxqaddr[port], 0, rxspace-1);
+	sky2_ramset(hw, txqaddr[port], rxspace, ramsize-1);
 
 	/* Make sure SyncQ is disabled */
 	sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL),

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

* Re: [PATCH] sky2: 88E803X transmit lockup
@ 2006-10-23 19:20 Daniel J Blueman
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel J Blueman @ 2006-10-23 19:20 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Linux Netdev, Linux Kernel

Stephen Hemminger wrote:
> The reason sky2 driver was locking up on transmit on the Yukon-FE chipset
> is that it was misconfiguring the internal RAM buffer so the transmitter
> and receiver were sharing the same space.
>
> The code assumed there was 16K of RAM on Yukon-FE (taken from vendor driver
> sk98lin which is even more f*cked up on this). Then it assigned based on that.
> The giveaway was that the registers would only hold 9bits so both RX/TX
> had 0..1ff for space. It is a wonder it worked at all!
>
> This patch addresses this, and fixes an easily reproducible hang on Transmit.
> Only the Yukon-FE chip is Marvell 88E803X (10/100 only) are affected.
[snip]

This patch works great - without it, I get only a few minutes of use
from my home dir over NFS4 before the NIC stops transmitting. This is
on a recent Yonah Sony VGN-SZ notebook w/ 88E8036 Marvel Sk-Y2.

Thanks again Stephen!
-- 
Daniel J Blueman

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

end of thread, other threads:[~2006-10-23 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-21  0:06 [PATCH] sky2: 88E803X transmit lockup Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2006-10-23 19:20 Daniel J Blueman

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).