/* * Reset interface. */ void bereset(struct be_softc *sc) { int s; s = splnet(); bestop(sc); if ((sc->sc_arpcom.ac_if.if_flags & IFF_UP) != 0) beinit(sc); splx(s); }
/* * Reset interface. */ void bereset(struct be_softc *sc) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; int s; s = splnet(); behwreset(sc); if ((sc->sc_ethercom.ec_if.if_flags & IFF_UP) != 0) beinit(ifp); splx(s); }
int beioctl(struct ifnet *ifp, u_long cmd, void *data) { struct be_softc *sc = ifp->if_softc; struct ifaddr *ifa = data; struct ifreq *ifr = data; int s, error = 0; s = splnet(); switch (cmd) { case SIOCINITIFADDR: ifp->if_flags |= IFF_UP; beinit(ifp); switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: arp_ifinit(ifp, ifa); break; #endif /* INET */ default: break; } break; case SIOCSIFFLAGS: if ((error = ifioctl_common(ifp, cmd, data)) != 0) break; /* XXX re-use ether_ioctl() */ switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) { case IFF_RUNNING: /* * If interface is marked down and it is running, then * stop it. */ bestop(ifp, 0); ifp->if_flags &= ~IFF_RUNNING; break; case IFF_UP: /* * If interface is marked up and it is stopped, then * start it. */ beinit(ifp); break; default: /* * Reset the interface to pick up changes in any other * flags that affect hardware registers. */ bestop(ifp, 0); beinit(ifp); break; } #ifdef BEDEBUG if (ifp->if_flags & IFF_DEBUG) sc->sc_debug = 1; else sc->sc_debug = 0; #endif break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; default: if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) { /* * Multicast list has changed; set the hardware filter * accordingly. */ if (ifp->if_flags & IFF_RUNNING) error = beinit(ifp); else error = 0; } break; } splx(s); return error; }
int beioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct be_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: beinit(sc); arp_ifinit(&sc->sc_arpcom, ifa); break; #endif /* INET */ default: beinit(sc); break; } break; case SIOCSIFFLAGS: if ((ifp->if_flags & IFF_UP) == 0 && (ifp->if_flags & IFF_RUNNING) != 0) { /* * If interface is marked down and it is running, then * stop it. */ bestop(sc); ifp->if_flags &= ~IFF_RUNNING; } else if ((ifp->if_flags & IFF_UP) != 0 && (ifp->if_flags & IFF_RUNNING) == 0) { /* * If interface is marked up and it is stopped, then * start it. */ beinit(sc); } else { /* * Reset the interface to pick up changes in any other * flags that affect hardware registers. */ bestop(sc); beinit(sc); } #ifdef BEDEBUG if (ifp->if_flags & IFF_DEBUG) sc->sc_debug = 1; else sc->sc_debug = 0; #endif break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } if (error == ENETRESET) { if (ifp->if_flags & IFF_RUNNING) be_mcreset(sc); error = 0; } splx(s); return (error); }