[net.wanted.sources] 4.3bsd driver for DELUA

jay@unm-la.UUCP (Jay Plett) (10/16/86)

Can a DELUA be driven (on a Vax 11/750) with the distribution
4.3bsd DEUNA driver?

If not, has anyone a DELUA driver for 4.3bsd?

Many thanks in advance.

	Jay Plett
	UUCP:	{cmcl2,ihnp4}!lanl!unm-la!jay
		{ucbvax,gatech}!unmvax!unm-la!jay
	ARPA:	jxyp@lanl

larry@utecfa.UUCP (10/24/86)

> From: jay@unm-la.UUCP (Jay Plett) Article-I.D.: unm-la.445
> Can a DELUA be driven (on a Vax 11/750) with the distribution
> 4.3bsd DEUNA driver?
> If not, has anyone a DELUA driver for 4.3bsd?
> Many thanks in advance.
> 
> 	Jay Plett
> 	UUCP:	{cmcl2,ihnp4}!lanl!unm-la!jay
> 		{ucbvax,gatech}!unmvax!unm-la!jay
> 	ARPA:	jxyp@lanl

The Delua is identical (according to the manuals) with the DEUNA, and
in fact the 4.3 driver will work with it.  You will have problems however.
The DELUA will hang if you touch the UNIBUS while it is doing its reset,
and that can take 15 seconds!  Donn Seely posted an article on July 15
(3855@utah-cs.UUCP> which I have included below that fixes this problem.
We also had problems with the board hanging after it had been running for
a while.  The symptoms were that it would receive, but not transmit.

We got help from DEC and it appears that the board will hang if you
try and transmit while all the transmit buffers are full?  Well I
don't know, but increaseing NXMT to 4 and installing the fix below
seems to have fixed the problem.

Hope this helps, we are still fairly new DELUA users ourselves and would
hesitate to guarantee this, but it seems to be working for us.

Larry Philps
Engineering Computing Facility
University of Toronto
Usenet:     {linus, ihnp4, allegra, decvax, floyd}!utcsri!utecfa!larry
CSNET:      larry@Toronto
ARPA:       larry%Toronto@CSNet-Relay

-----------------------------------------------------------------------
FIX 1:  Transmitter hangs while system running.
-----------------------------------------------------------------------
*** if_de.c.old	Fri Oct 24 14:42:51 1986
--- if_de.c.new	Fri Oct 24 14:43:41 1986
***************
*** 426,435
  	}
  	if (ds->ds_nxmit != nxmit) {
  		ds->ds_nxmit = nxmit;
  		if (ds->ds_flags & DSF_RUNNING)
  			addr->pclow = PCSR0_INTE|CMD_PDMD;
  	}
  }
  
  /*
   * Command done interrupt.

--- 426,446 -----
  	}
  	if (ds->ds_nxmit != nxmit) {
  		ds->ds_nxmit = nxmit;
  		if (ds->ds_flags & DSF_RUNNING)
  			addr->pclow = PCSR0_INTE|CMD_PDMD;
+ 	} else if (ds->ds_nxmit == NXMT) {
+ 		/*
+ 		 * poke device if we have something to send and 
+ 		 * transmit ring is full. 
+ 		 */
+ 		if (dedebug) { 
+ 			rp = &ds->ds_xrent[0];
+ 			printf("did not xmt: %d, %d, %d, flag0=%x, flag1=%x\n", ds->ds_xindex, ds->ds_nxmit, ds->ds_xfree, rp++->r_flags, rp->r_flags);
+ 		}
+ 		if (ds->ds_flags & DSF_RUNNING)
+ 			addr->pclow = PCSR0_INTE|CMD_PDMD;
  	}
  }
  
  /*
   * Command done interrupt.
-----------------------------------------------------------------------
END OF FIX1
------------------------------------------------------------------------
FIX 2:  Donn Seely's fixes for self-test hanging.
-----------------------------------------------------------------------
From: donn@utah-cs.UUCP
Newsgroups: net.unix-wizards,net.lan,net.bugs.4bsd
Subject: Re: DELUA vs DEUNA under 4.3
Message-ID: <3855@utah-cs.UUCP>
Date: Tue, 15-Jul-86 23:47:13 EDT
Article-I.D.: utah-cs.3855
Posted: Tue Jul 15 23:47:13 1986
References: <501@mplvax.nosc.MIL>
Organization: University of Utah CS Dept

We have 5 VAXen, ranging from 750s to an 8600, running 4.3 BSD using
DELUA network interfaces.  Lou Salkind's DEUNA driver works with the
DELUA, but there are problems (see below).

The first problem, and the one which took us the most time to
understand and 'fix', was that 5 of the 12 DELUA boards shipped to us
were broken.  Of course the first two we tried were in the broken set
and we had a very difficult time trying to figure out what was going
on.  The VMS diagnostic was not very useful, since it failed on all the
boards.  After talking to DEC, we found that it was 'normal' for the
boards to fail one of the tests in the diagnostic (EVDYB test 3), and
the boards which failed on other tests turned out to be precisely the
boards which failed under Unix.  In case someone else runs into this
problem, the symptoms when running under Unix were that the board would
run for a while and then wedge, refusing to interrupt or do anything
else useful.  The threshold varied from board to board -- one would
croak after exchanging only a couple packets, another after a couple
hundred.

The other problem, which is perhaps the problem John McInerney is
seeing, is that the DELUA takes up to 15 seconds to run through
self-test after a bus init.  When 4.3 BSD is booted on systems whose
consoles run at 1200 baud or higher, it's easy to reach the probe
routine for the DEUNA/DELUA before the board has finished self-test.  I
changed the driver to wait up to 15 seconds for self-test to finish;
the changes are presented below.  (I also made changes to print out the
device type in the attach routine and to be more careful about the
interupt enable / command interlock 'feature' -- if a write to csr0
changes the interrupt enable bit, any changes to the command field are
ignored).  The principal changes are in deprobe() and deattach() in
if_de.c:

------------------------------------------------------------------------
*** /tmp/,RCSt1026392	Tue Jul 15 21:28:21 1986
--- if_de.c	Thu Jul 10 21:09:02 1986
***************
*** 123,128 ****
--- 123,144 ----
  	i = 0; derint(i); deintr(i);
  #endif
  
+ 	/*
+ 	 * Make sure self-test is finished before we screw with the board.
+ 	 * Self-test on a DELUA can take 15 seconds (argh).
+ 	 */
+ 	for (i = 0;
+ 	     i < 160 &&
+ 	     (addr->pcsr0 & PCSR0_FATI) == 0 &&
+ 	     (addr->pcsr1 & PCSR1_STMASK) == STAT_RESET;
+ 	     ++i)
+ 		DELAY(100000);
+ 	if ((addr->pcsr0 & PCSR0_FATI) != 0 ||
+ 	    (addr->pcsr1 & PCSR1_STMASK) != STAT_READY)
+ 		return(0);
+ 
+ 	addr->pcsr0 = 0;
+ 	DELAY(100);
  	addr->pcsr0 = PCSR0_RSET;
  	while ((addr->pcsr0 & PCSR0_INTR) == 0)
  		;
***************
*** 146,151 ****
--- 162,168 ----
  	register struct de_softc *ds = &de_softc[ui->ui_unit];
  	register struct ifnet *ifp = &ds->ds_if;
  	register struct dedevice *addr = (struct dedevice *)ui->ui_addr;
+ 	int csr1;
  
  	ifp->if_unit = ui->ui_unit;
  	ifp->if_name = "de";
***************
*** 153,161 ****
--- 170,193 ----
  	ifp->if_flags = IFF_BROADCAST;
  
  	/*
+ 	 * What kind of a board is this?
+ 	 * The error bits 4-6 in pcsr1 are a device id as long as
+ 	 * the high byte is zero.
+ 	 */
+ 	csr1 = addr->pcsr1;
+ 	if (csr1 & 0xff60)
+ 		printf("de%d: broken\n", ui->ui_unit);
+ 	else if (csr1 & 0x10)
+ 		printf("de%d: delua\n", ui->ui_unit);
+ 	else
+ 		printf("de%d: deuna\n", ui->ui_unit);
+ 
+ 	/*
  	 * Reset the board and temporarily map
  	 * the pcbb buffer onto the Unibus.
  	 */
+ 	addr->pcsr0 = 0;		/* reset INTE */
+ 	DELAY(100);
  	addr->pcsr0 = PCSR0_RSET;
  	(void)dewait(ui, "reset");
  
***************
*** 245,250 ****
--- 277,284 ----
  	incaddr = ds->ds_ubaddr + PCBB_OFFSET;
  	addr->pcsr2 = incaddr & 0xffff;
  	addr->pcsr3 = (incaddr >> 16) & 0x3;
+ 	addr->pclow = 0;	/* reset INTE */
+ 	DELAY(100);
  	addr->pclow = CMD_GETPCBB;
  	(void)dewait(ui, "pcbb");
  
***************
*** 296,303 ****
  	s = splimp();
  	ds->ds_rindex = ds->ds_xindex = ds->ds_xfree = ds->ds_nxmit = 0;
  	ds->ds_if.if_flags |= IFF_RUNNING;
- 	destart(unit);				/* queue output packets */
  	addr->pclow = PCSR0_INTE;		/* avoid interlock */
  	ds->ds_flags |= DSF_RUNNING;		/* need before de_setaddr */
  	if (ds->ds_flags & DSF_SETADDR)
  		de_setaddr(ds->ds_addr, unit);
--- 330,337 ----
  	s = splimp();
  	ds->ds_rindex = ds->ds_xindex = ds->ds_xfree = ds->ds_nxmit = 0;
  	ds->ds_if.if_flags |= IFF_RUNNING;
  	addr->pclow = PCSR0_INTE;		/* avoid interlock */
+ 	destart(unit);				/* queue output packets */
  	ds->ds_flags |= DSF_RUNNING;		/* need before de_setaddr */
  	if (ds->ds_flags & DSF_SETADDR)
  		de_setaddr(ds->ds_addr, unit);
***************
*** 739,744 ****
--- 773,781 ----
  	case SIOCSIFFLAGS:
  		if ((ifp->if_flags & IFF_UP) == 0 &&
  		    ds->ds_flags & DSF_RUNNING) {
+ 			((struct dedevice *)
+ 			   (deinfo[ifp->if_unit]->ui_addr))->pclow = 0;
+ 			DELAY(100);
  			((struct dedevice *)
  			   (deinfo[ifp->if_unit]->ui_addr))->pclow = PCSR0_RSET;
  			ds->ds_flags &= ~(DSF_LOCK | DSF_RUNNING);
------------------------------------------------------------------------

Donn Seeley    University of Utah CS Dept    donn@utah-cs.arpa
40 46' 6"N 111 50' 34"W    (801) 581-5668    decvax!utah-cs!donn
------------------------------------------------------------------------
END OF FIX2
------------------------------------------------------------------------
-- 
Larry Philps
Engineering Computing Facility
University of Toronto
Usenet:     {linus, ihnp4, allegra, decvax, floyd}!utcsri!utecfa!larry
CSNET:      larry@Toronto
ARPA:       larry%Toronto@CSNet-Relay