? arch/amd64/conf/DEBUG Index: dev/pci/if_alc.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/if_alc.c,v retrieving revision 1.24 diff -u -p -u -r1.24 if_alc.c --- dev/pci/if_alc.c 21 Dec 2016 11:56:55 -0000 1.24 +++ dev/pci/if_alc.c 28 Jan 2017 18:31:16 -0000 @@ -2035,48 +2035,31 @@ alc_watchdog(struct ifnet *ifp) static int alc_ioctl(struct ifnet *ifp, u_long cmd, void *data) { - struct alc_softc *sc = ifp->if_softc; - struct mii_data *mii = &sc->sc_miibus; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); - error = ether_ioctl(ifp, cmd, data); - switch (cmd) { - case SIOCSIFADDR: - ifp->if_flags |= IFF_UP; - if (!(ifp->if_flags & IFF_RUNNING)) - alc_init(ifp); - break; - - case SIOCSIFFLAGS: - if (ifp->if_flags & IFF_UP) { - if (ifp->if_flags & IFF_RUNNING) - error = ENETRESET; - else - alc_init(ifp); - } else { - if (ifp->if_flags & IFF_RUNNING) - alc_stop(ifp, 0); - } - break; - - case SIOCSIFMEDIA: - case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); - break; - - default: - error = ether_ioctl(ifp, cmd, data); - break; - } - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - alc_iff(sc); - error = 0; - } + switch(cmd) { + case SIOCSIFFLAGS: + if ((error = ifioctl_common(ifp, cmd, data)) != 0) + break; + if (ifp->if_flags & IFF_UP) { + if (!(ifp->if_flags & IFF_RUNNING)) + alc_init(ifp); + } else { + if (ifp->if_flags & IFF_RUNNING) + alc_stop(ifp, 0); + } + error = 0; + break; + + default: + error = ether_ioctl(ifp, cmd, data); + break; + } + + if (error == ENETRESET) + error = 0; splx(s); return (error); Index: net/agr/if_agr.c =================================================================== RCS file: /cvsroot/src/sys/net/agr/if_agr.c,v retrieving revision 1.40 diff -u -p -u -r1.40 if_agr.c --- net/agr/if_agr.c 15 Dec 2016 09:28:06 -0000 1.40 +++ net/agr/if_agr.c 28 Jan 2017 18:31:19 -0000 @@ -341,16 +341,22 @@ agr_vlan_check(struct ifnet *ifp, struct static int agr_clone_create(struct if_clone *ifc, int unit) { + + int error; struct agr_softc *sc; struct ifnet *ifp; sc = agr_alloc_softc(); + error = agrtimer_init(sc); + if (error) { + agr_free_softc(sc); + return error; + } TAILQ_INIT(&sc->sc_ports); mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NET); mutex_init(&sc->sc_entry_mtx, MUTEX_DEFAULT, IPL_NONE); cv_init(&sc->sc_insc_cv, "agrsoftc"); cv_init(&sc->sc_ports_cv, "agrports"); - agrtimer_init(sc); ifp = &sc->sc_if; snprintf(ifp->if_xname, sizeof(ifp->if_xname), "%s%d", ifc->ifc_name, unit); Index: net/agr/if_agrtimer.c =================================================================== RCS file: /cvsroot/src/sys/net/agr/if_agrtimer.c,v retrieving revision 1.6 diff -u -p -u -r1.6 if_agrtimer.c --- net/agr/if_agrtimer.c 8 Feb 2010 17:59:06 -0000 1.6 +++ net/agr/if_agrtimer.c 28 Jan 2017 18:31:19 -0000 @@ -40,14 +40,23 @@ __KERNEL_RCSID(0, "$NetBSD: if_agrtimer. #include static void agrtimer_tick(void *); +static void agrtimer_work(struct work *, void *); static int agrtimer_port_tick(struct agr_port *, void *); -void +int agrtimer_init(struct agr_softc *sc) { + int error; + + error = workqueue_create(&sc->sc_wq, "agrmon", + agrtimer_work, sc, PRI_SOFTNET, IPL_SOFTNET, 0); + if (error) + return error; + callout_init(&sc->sc_callout, 0); callout_setfunc(&sc->sc_callout, agrtimer_tick, sc); + return 0; } void @@ -55,6 +64,7 @@ agrtimer_destroy(struct agr_softc *sc) { callout_destroy(&sc->sc_callout); + workqueue_destroy(sc->sc_wq); } void @@ -74,6 +84,15 @@ agrtimer_stop(struct agr_softc *sc) static void agrtimer_tick(void *arg) { + + struct agr_softc *sc = arg; + workqueue_enqueue(sc->sc_wq, &sc->sc_wk, NULL); +} + +static void +agrtimer_work(struct work *wk, void *arg) +{ + struct agr_softc *sc = arg; const struct agr_iftype_ops *iftop = sc->sc_iftop; @@ -93,6 +112,7 @@ agrtimer_tick(void *arg) static int agrtimer_port_tick(struct agr_port *port, void *arg) { + struct agr_softc *sc = arg; agrport_monitor(port); Index: net/agr/if_agrvar_impl.h =================================================================== RCS file: /cvsroot/src/sys/net/agr/if_agrvar_impl.h,v retrieving revision 1.10 diff -u -p -u -r1.10 if_agrvar_impl.h --- net/agr/if_agrvar_impl.h 26 May 2010 23:46:44 -0000 1.10 +++ net/agr/if_agrvar_impl.h 28 Jan 2017 18:31:19 -0000 @@ -35,6 +35,7 @@ #include #include +#include struct agr_port; struct agr_softc; @@ -112,6 +113,8 @@ struct agr_softc { volatile bool sc_wrports; volatile int sc_rdports; volatile int sc_paused; + struct workqueue *sc_wq; + struct work sc_wk; struct callout sc_callout; int sc_nports; TAILQ_HEAD(, agr_port) sc_ports; @@ -142,7 +145,7 @@ int agr_xmit_frame(struct ifnet *, struc #define AGR_ROUNDROBIN(sc) (((sc)->sc_if.if_flags & IFF_LINK0) != 0) #define AGR_STATIC(sc) (((sc)->sc_if.if_flags & IFF_LINK1) != 0) -void agrtimer_init(struct agr_softc *); +int agrtimer_init(struct agr_softc *); void agrtimer_destroy(struct agr_softc *); void agrtimer_start(struct agr_softc *); void agrtimer_stop(struct agr_softc *);