Subject: Re: bin/29126: tcpdump leads to packet loss
To: None <gnats-bugs@netbsd.org>
From: john heasley <heas@shrubbery.net>
List: netbsd-bugs
Date: 01/27/2005 11:21:23
Thu, Jan 27, 2005 at 05:49:01PM +0000, Kimmo Suominen:
>  I can also reproduce this with fxp on NetBSD 2.99.12.  As you can see
>  from my previous messages, the problem does not exist with fxp on 1.6B.
>  
>  So, the list of problem NIC's drivers: ex, fxp, gsip, tlp
>  
>  Christos & Manuel:  which drivers are you using that do not exhibit
>  this problem at all?

Most likely any driver that does not handle SIOCSIFFLAGS itself.  ether_ioctl
does:
        case SIOCSIFFLAGS:
                	....
                } else if ((ifp->if_flags & IFF_UP) != 0) {
                        /*
                         * Reset the interface to pick up changes in any other
                         * flags that affect the hardware state.
                         */
                        error = (*ifp->if_init)(ifp);
                }

for most drivers that i've looked at, the first thing the init function
does is stop the chip and reset it.  hme deals with it like this:

        case SIOCSIFFLAGS:
			...
                } else if ((ifp->if_flags & IFF_UP) != 0) {
                        /*
                         * If setting debug or promiscuous mode, do not reset
                         * the chip; for everything else, call hme_init()
                         * which will trigger a reset.
                         */
#define RESETIGN (IFF_CANTCHANGE | IFF_DEBUG)
                        if (ifp->if_flags == sc->sc_if_flags)
                                break;
                        if ((ifp->if_flags & (~RESETIGN))
                            == (sc->sc_if_flags & (~RESETIGN)))
                                hme_setladrf(sc);
                        else
                                hme_init(sc);
#undef RESETIGN
                }