Re: mec and resets

Izumi Tsutsui <[email protected]>
Newsgroups gmane.os.netbsd.ports.sgimips
Message-ID <[email protected]>
[email protected] wrote:

> On Wed, Jul 30, 2008 at 01:01:35AM +0200, Jorge Acereda Macia wrote:
> > If you can't reproduce it, I'm available to do any tests.
> 
> FWIW I can reproduce it on both a R5k and a R10k O2.

I can't reproduce it on my R5K O2. (scp ~1GB files works)

Is it on GENERIC32_IP3x or some customized kernel?
On crmfb console, serial console or network ptty?
Could you try the attached (random) patch?
---
Izumi Tsutsui


Index: if_mec.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/mace/if_mec.c,v
retrieving revision 1.20
diff -u -r1.20 if_mec.c
--- if_mec.c	14 May 2008 13:29:28 -0000	1.20
+++ if_mec.c	31 Jul 2008 15:47:28 -0000
@@ -179,7 +179,7 @@
 #define MEC_TXSTAT_UNUSED	0x7fffffffe0000000ULL	/* should be zero */
 #define MEC_TXSTAT_SENT		0x8000000000000000ULL	/* packet sent */
 
-	uint64_t txd_ptr[MEC_NTXPTR];
+	volatile uint64_t txd_ptr[MEC_NTXPTR];
 #define MEC_TXPTR_UNUSED2	0x0000000000000007	/* should be zero */
 #define MEC_TXPTR_DMAADDR	0x00000000fffffff8	/* TX DMA address */
 #define MEC_TXPTR_LEN		0x0000ffff00000000ULL	/* buffer length */
@@ -674,13 +674,17 @@
 	    MEC_MAC_FULL_DUPLEX | MEC_MAC_SPEED_SELECT);
 
 	/* must also set IPG here for duplex stuff ... */
+	/* XXX which value should be used for FDX/HDX? */
 	if ((sc->sc_mii.mii_media_active & IFM_FDX) != 0) {
 		control |= MEC_MAC_FULL_DUPLEX;
+		control |= MEC_MAC_IPG_DEFAULT;
 	} else {
-		/* set IPG */
 		control |= MEC_MAC_IPG_DEFAULT;
 	}
 
+	if (IFM_SUBTYPE(sc->sc_mii.mii_media_active) == IFM_100_TX)
+		control |= MEC_MAC_SPEED_SELECT;
+
 	bus_space_write_8(st, sh, MEC_MAC_CONTROL, control);
 }
 
@@ -1427,8 +1431,6 @@
 	int i;
 	u_int col;
 
-	ifp->if_flags &= ~IFF_OACTIVE;
-
 	DPRINTF(MEC_DEBUG_TXINTR, ("mec_txintr: called\n"));
 
 	for (i = sc->sc_txdirty; sc->sc_txpending != 0;
@@ -1478,6 +1480,8 @@
 	/* cancel the watchdog timer if there are no pending TX packets */
 	if (sc->sc_txpending == 0)
 		ifp->if_timer = 0;
+	else if (sc->sc_txpending < MEC_NTXDESC - 4)
+		ifp->if_flags &= ~IFF_OACTIVE;
 }
 
 static void
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.