Subject: Re: kern/29126: tcpdump leads to packet loss
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Kimmo Suominen <kim@tac.nyc.ny.us>
List: netbsd-bugs
Date: 02/06/2005 00:16:02
The following reply was made to PR kern/29126; it has been noted by GNATS.

From: Kimmo Suominen <kim@tac.nyc.ny.us>
To: gnats-bugs@netbsd.org
Cc: Christos Zoulas <christos@zoulas.com>,
	Arto Selonen <arto@selonen.org>
Subject: Re: kern/29126: tcpdump leads to packet loss
Date: Sat, 5 Feb 2005 19:15:20 -0500

 And the changes below fix ex for me...
 
 Regards,
 + Kim
 -- 
 Kimmo Suominen
 
 
 Index: elinkxl.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/elinkxl.c,v
 retrieving revision 1.75
 diff -u -r1.75 elinkxl.c
 --- elinkxl.c	30 Oct 2004 18:08:36 -0000	1.75
 +++ elinkxl.c	6 Feb 2005 00:02:41 -0000
 @@ -427,6 +427,7 @@
  	ifp->if_stop = ex_stop;
  	ifp->if_flags =
  	    IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
 +	sc->sc_if_flags = ifp->if_flags;
  	IFQ_SET_READY(&ifp->if_snd);
  
  	/*
 @@ -697,6 +698,7 @@
  	ifp->if_flags |= IFF_RUNNING;
  	ifp->if_flags &= ~IFF_OACTIVE;
  	ex_start(ifp);
 +	sc->sc_if_flags = ifp->if_flags;
  
  	GO_WINDOW(1);
  
 @@ -1382,7 +1384,21 @@
  	case SIOCGIFMEDIA:
  		error = ifmedia_ioctl(ifp, ifr, &sc->ex_mii.mii_media, cmd);
  		break;
 -
 +	case SIOCSIFFLAGS:
 +		/* If the interface is up and running, only modify the receive
 +		 * filter when setting promiscuous or debug mode.  Otherwise
 +		 * fall through to ether_ioctl, which will reset the chip.
 +		 */
 +#define RESETIGN (IFF_CANTCHANGE|IFF_DEBUG)
 +		if (((ifp->if_flags & (IFF_UP|IFF_RUNNING))
 +		    == (IFF_UP|IFF_RUNNING))
 +		    && ((ifp->if_flags & (~RESETIGN))
 +		    == (sc->sc_if_flags & (~RESETIGN)))) {
 +			ex_set_mc(sc);
 +			error = 0;
 +#undef RESETIGN
 +		} else
 +		/* FALLTHROUGH */
  	default:
  		error = ether_ioctl(ifp, cmd, data);
  		if (error == ENETRESET) {
 @@ -1397,6 +1413,7 @@
  		break;
  	}
  
 +	sc->sc_if_flags = ifp->if_flags;
  	splx(s);
  	return (error);
  }
 @@ -1569,6 +1586,7 @@
  		ex_disable(sc);
  
  	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
 +	sc->sc_if_flags = ifp->if_flags;
  	ifp->if_timer = 0;
  }
  
 Index: elinkxlvar.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/elinkxlvar.h,v
 retrieving revision 1.14
 diff -u -r1.14 elinkxlvar.h
 --- elinkxlvar.h	5 Jun 2003 22:11:22 -0000	1.14
 +++ elinkxlvar.h	6 Feb 2005 00:02:41 -0000
 @@ -137,6 +137,8 @@
  
  	bus_dma_segment_t sc_useg, sc_dseg;
  	int sc_urseg, sc_drseg;
 +
 +	short sc_if_flags;
  };
  
  #define ex_waitcmd(sc) \