Subject: ep0 fix?
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Christos Zoulas <christos@deshaw.com>
List: current-users
Date: 04/22/1994 15:46:01
Hello,

I have been experiencing reproducible hangs with the ep0 driver on a P66
machine.
I can get the machine to hang by just doing:

cat /dev/zero > foo

where foo lives on an nfs partition.

What happens, is that eventually all my mbufs are gone, ping reports
out of buffer space, netstat -m tells me that 100% of my mbufs are in
use, and the only way out if it is:

ifconfig ep0 down && ifconfig ep0 up

After I added some debugging statements, I found that the card was stuck
in IFF_OACTIVE mode. I added the following code [the first part of the
patch] and I have not had a single hang yet (I see the epreset messages
once in a while under heavy network load). I know this is a bad fix, but
I cannot stand having the machine hang on me...

This is not a bad card or a bad machine. I have seen that with a Dell 33L
although less frequently. 

Finally I was looking at the code, and it seems to me that the second 
part of the patch should fix an mbuf leak. Is that correct?
[top gets set to null so the current mbuf does not get free'd]

christos


*** if_ep.c.dist	Tue Apr 19 06:08:11 1994
--- if_ep.c	Fri Apr 22 13:37:08 1994
***************
*** 480,486 ****
  
  	s = splimp();
  	if (sc->ep_ac.ac_if.if_flags & IFF_OACTIVE) {
! 		splx(s);
  		return (0);
  	}
  
--- 480,487 ----
  
  	s = splimp();
  	if (sc->ep_ac.ac_if.if_flags & IFF_OACTIVE) {
! 		printf("%s: reset\n", sc->sc_dev.dv_xname);
! 		epreset(sc);
  		return (0);
  	}
  
***************
*** 811,818 ****
  		sc->mb[sc->next_mb] = 0;
  		if (top == 0) {
  			MGETHDR(top, M_DONTWAIT, MT_DATA);
! 			if (top == 0)
  				goto out;
  		} else {	/* Convert one of our saved mbuf's */
  			sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
  			top->m_data = top->m_pktdat;
--- 812,821 ----
  		sc->mb[sc->next_mb] = 0;
  		if (top == 0) {
  			MGETHDR(top, M_DONTWAIT, MT_DATA);
! 			if (top == 0) {
! 				top = m0;
  				goto out;
+ 			}
  		} else {	/* Convert one of our saved mbuf's */
  			sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
  			top->m_data = top->m_pktdat;

------------------------------------------------------------------------------