Subject: Re: le0 on 3100: missing buffers
To: None <benco@ucsee.EECS.Berkeley.EDU, port-pmax@NetBSD.ORG>
From: Arne H. Juul <arnej@pvv.unit.no>
List: port-pmax
Date: 12/06/1995 09:46:46
 > I can use the Ethernet fine if I don't send too many packets at once--
 > like a telnet session. If I do an ftp or NFS, however, I get:
 > /netbsd: missing buffer, no_td = 2, last_td = 3
 > (with different numbers, of course).

Tell me about it - I've been struggling with that lance driver since
the middle of October, trying to understand what it did, and what
the differences between it and the old one was.  My 3100 has been
useless for `real work' (that is, NetBSD compiling etc) because of this.

Now, however, after spending the night on it (again), I finally have
a solution to the problem.  Only thing is, I don't particularly like
my "solution", which looks like this:

--- sys/arch/pmax/pmax/machdep.c	Sat Oct 14 03:17:51 1995
+++ sys/arch/pmax/pmax/machdep.c.ahj	Wed Dec  6 08:09:06 1995
@@ -399,12 +399,21 @@
 		 */
 		pmax_hardware_intr = kn01_intr;
 		tc_enable_interrupt = kn01_enable_intr; /*XXX*/
+#if 0
 		Mach_splbio = Mach_spl0;
 		Mach_splnet = Mach_spl1;
 		Mach_spltty = Mach_spl2;
 		Mach_splimp = Mach_spl2;
 		Mach_splclock = Mach_spl3;
 		Mach_splstatclock = Mach_spl3;
+#else
+		Mach_splbio = splhigh;
+		Mach_splnet = splhigh;
+		Mach_spltty = splhigh;
+		Mach_splimp = splhigh;
+		Mach_splclock = splhigh;
+		Mach_splstatclock = splhigh;
+#endif
 		Mach_clock_addr = (volatile struct chiptime *)
 			MACH_PHYS_TO_UNCACHED(KN01_SYS_CLOCK);
 		strcpy(cpu_model, "3100");


However, this has fixed not only my everlasting problem with the
if_le driver, it has fixed the intermittent 'multiple free' panic
I've been getting as well.  It seems that the ethernet driver routines,
when called from the interrupt routine, can munge the mbuf lists
(since the various routines manipulating them only run at splimp()
and therefore are unprotected).  The original 'lost buffer' problem
happens because lestart() is called both from the high-level network
routines and the interrupt handler at the same time.

What I don't understand is the architecture.  I thought network
things (like this) was supposed to run at splnet(), but evidently
this is not the case.  I hope someone with a better knowledge of
the "NetBSD way" can enlighten us here, now that the problem is
(hopefully!) pinpointed.

 > This doesn't happen when I boot up
 > in BSD 4.4. After I get sufficiatently many of these in a row, the
 > system hangs.

What's the structure in BSD 4.4 for this?  (And when is the 4.4 version
of the daemon book coming, so I can read up on things like this a bit,
does anybody know?)

  -  Arne H. J.

[Sorry if this message isn't quite coherent, it's 09:45 after all...]