Re: obsd 4.6 on Netra X1

Mark Kettenis <[email protected]>
Newsgroups gmane.os.openbsd.sparc
Message-ID <[email protected]>
> Date: Sun, 3 Jan 2010 13:12:04 -0800 (PST)
> From: abs <[email protected]>
> 
> Hello all,
> I am running OpenBSD 4.6 on a Netra X1 as a layer2 firewall.  The problem I
> seem to be experiencing is that every time the NIC gets saturated (100Mb) i
> get the following error on the console twice followed by a kernel panic and
> core dump.
> 
> dc0: watchdog timeout
> 
> As long as I don't max out the network port (i.e 11MBps) everything works as
> expected. Is there a bug or am I doing something wrong?  thank you in
> advance.

Can you try the following diff?  It probably won't fix the watchdog
timeouts, but it should prevent the kernel panic.

Index: dc.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/dc.c,v
retrieving revision 1.113
diff -u -p -r1.113 dc.c
--- dc.c	15 Oct 2009 17:54:54 -0000	1.113
+++ dc.c	12 Dec 2009 00:15:42 -0000
@@ -3062,6 +3062,7 @@ void
 dc_stop(struct dc_softc *sc, int softonly)
 {
 	struct ifnet *ifp;
+	u_int32_t isr;
 	int i;
 
 	ifp = &sc->sc_arpcom.ac_if;
@@ -3073,6 +3074,28 @@ dc_stop(struct dc_softc *sc, int softonl
 
 	if (!softonly) {
 		DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_RX_ON|DC_NETCFG_TX_ON));
+
+		for (i = 0; i < DC_TIMEOUT; i++) {
+			isr = CSR_READ_4(sc, DC_ISR);
+			if ((isr & DC_ISR_TX_IDLE ||
+			    (isr & DC_ISR_TX_STATE) == DC_TXSTATE_RESET) &&
+			    (isr & DC_ISR_RX_STATE) == DC_RXSTATE_STOPPED)
+				break;
+			DELAY(10);
+		}
+
+		if (i == DC_TIMEOUT) {
+			if (!((isr & DC_ISR_TX_IDLE) ||
+			    (isr & DC_ISR_TX_STATE) == DC_TXSTATE_RESET) &&
+			    !DC_IS_ASIX(sc) && !DC_IS_DAVICOM(sc))
+				printf("%s: failed to force tx to idle state\n",
+				    sc->sc_dev.dv_xname);
+			if (!((isr & DC_ISR_RX_STATE) == DC_RXSTATE_STOPPED) &&
+			    !DC_HAS_BROKEN_RXSTATE(sc))
+				printf("%s: failed to force rx to idle state\n",
+				    sc->sc_dev.dv_xname);
+		}
+
 		CSR_WRITE_4(sc, DC_IMR, 0x00000000);
 		CSR_WRITE_4(sc, DC_TXADDR, 0x00000000);
 		CSR_WRITE_4(sc, DC_RXADDR, 0x00000000);
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.