Index: 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 --- if_agr.c 15 Dec 2016 09:28:06 -0000 1.40 +++ if_agr.c 28 Jan 2017 18:35:38 -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: 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 --- if_agrtimer.c 8 Feb 2010 17:59:06 -0000 1.6 +++ if_agrtimer.c 28 Jan 2017 18:35:38 -0000 @@ -40,14 +40,22 @@ __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 +63,7 @@ agrtimer_destroy(struct agr_softc *sc) { callout_destroy(&sc->sc_callout); + workqueue_destroy(sc->sc_wq); } void @@ -75,6 +84,14 @@ 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; KASSERT(iftop); Index: 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 --- if_agrvar_impl.h 26 May 2010 23:46:44 -0000 1.10 +++ if_agrvar_impl.h 28 Jan 2017 18:35:38 -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 *);