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:53:01
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:52:17 -0500
And a tlp patch is below...
I've made the patches available over FTP (probably easier than trying
to extract them from GNATS).
ftp://ftp.gw.com/pub/people/kim/netbsd/netbsd-2.99.15-tcpdump-ex.diff
ftp://ftp.gw.com/pub/people/kim/netbsd/netbsd-2.99.15-tcpdump-gsip.diff
ftp://ftp.gw.com/pub/people/kim/netbsd/netbsd-2.99.15-tcpdump-tlp.diff
Regards,
+ Kim
--
Kimmo Suominen
Index: tulip.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/tulip.c,v
retrieving revision 1.131
diff -u -r1.131 tulip.c
--- tulip.c 30 Jan 2005 17:27:38 -0000 1.131
+++ tulip.c 6 Feb 2005 00:32:34 -0000
@@ -497,6 +497,7 @@
strcpy(ifp->if_xname, sc->sc_dev.dv_xname);
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ sc->sc_if_flags = ifp->if_flags;
ifp->if_ioctl = tlp_ioctl;
ifp->if_start = tlp_start;
ifp->if_watchdog = tlp_watchdog;
@@ -1001,7 +1002,22 @@
case SIOCGIFMEDIA:
error = ifmedia_ioctl(ifp, ifr, &sc->sc_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)))) {
+ /* Set up the receive filter. */
+ (*sc->sc_filter_setup)(sc);
+ error = 0;
+#undef RESETIGN
+ } else
+ /* FALLTHROUGH */
default:
error = ether_ioctl(ifp, cmd, data);
if (error == ENETRESET) {
@@ -1021,6 +1037,7 @@
if (TULIP_IS_ENABLED(sc))
tlp_start(ifp);
+ sc->sc_if_flags = ifp->if_flags;
splx(s);
return (error);
}
@@ -1930,6 +1947,7 @@
*/
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
+ sc->sc_if_flags = ifp->if_flags;
out:
if (error) {
@@ -2094,6 +2112,7 @@
* Mark the interface down and cancel the watchdog timer.
*/
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ sc->sc_if_flags = ifp->if_flags;
ifp->if_timer = 0;
/*
Index: tulipvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/tulipvar.h,v
retrieving revision 1.51
diff -u -r1.51 tulipvar.h
--- tulipvar.h 24 Oct 2004 00:35:08 -0000 1.51
+++ tulipvar.h 6 Feb 2005 00:32:35 -0000
@@ -451,6 +451,8 @@
struct tulip_txsq sc_txfreeq; /* free Tx descsofts */
struct tulip_txsq sc_txdirtyq; /* dirty Tx descsofts */
+ short sc_if_flags;
+
int sc_rxptr; /* next ready RX descriptor/descsoft */
#if NRND > 0