Subject: LANCE bug (in the chip!)
To: None <port-sun3@NetBSD.ORG>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 04/18/1995 18:30:46
Hi folks,

If you are seeing unexpected core dumps on your 3/50 or 3/60
using NFS mounted file systems, would you please try out this
patch and let me know if your system has the LANCE Rev. C bug?
None of my machines appear to suffer from this.

Thanks,
Gordon

diff -rc sun3.orig/dev/if_le.c sun3/dev/if_le.c
*** sun3.orig/dev/if_le.c	Sun Apr 16 06:06:53 1995
--- sun3/dev/if_le.c	Mon Apr 17 18:52:32 1995
***************
*** 51,56 ****
--- 51,59 ----
  #include <machine/autoconf.h>
  #include <machine/cpu.h>
  
+ /* XXX - Yes, we DO have to deal with this bug. */
+ #define	LANCE_REVC_BUG 1
+ 
  /* #define	LEDEBUG	1 */
  
  #include "if_lereg.h"
***************
*** 661,666 ****
--- 664,692 ----
  	len -= 4;
  	if (len <= 0)
  		return;
+ 
+ #ifdef	LANCE_REVC_BUG
+ 	/*
+ 	 * Check for unreported packet errors.  Rev C of the LANCE chip
+ 	 * has a bug which can cause "random" bytes to be prepended to
+ 	 * the start of the packet.  The work-around is to make sure that
+ 	 * the Ethernet destination address in the packet matches our
+ 	 * address (or the broadcast address).
+ 	 */
+ 	{
+ 		register short *pp, *ea;
+ 		pp = (short *) buf;
+ 		ea = (short *) &sc->sc_enaddr;
+ 		if (((pp[0] != ea[0]) || (pp[1] != ea[1]) || (pp[2] != ea[2])) &&
+ 			((pp[0] != -1)    || (pp[1] != -1)    || (pp[2] != -1)   ))
+ 		{
+ 			sc->sc_if.if_ierrors++;
+ 			printf("%s: LANCE Rev C Extra Byte(s) bug; Packet punted\n",
+ 				   sc->sc_dev.dv_xname);
+ 			return;
+ 		}
+ 	}
+ #endif	/* LANCE_REVC_BUG */
  
  	/* Pull packet off interface. */
  	ifp = &sc->sc_if;