> Date: Wed, 21 Sep 2016 21:42:36 +1000 > From: Jonathan Gray <j...@jsg.id.au> > > On Wed, Sep 21, 2016 at 01:22:04PM +0200, Mark Kettenis wrote: > > Here is the promised diff that makes fec(4) call mii_tick() like all > > our other ethernet drivers that use mii do. > > > > Does this fix your problem Philip? > > Isn't this missing a call to timeout_add_sec() outside of > fec_tick()?
Right. Updated diff (for real now). Index: sys/arch/armv7/imx/if_fec.c =================================================================== RCS file: /cvs/src/sys/arch/armv7/imx/if_fec.c,v retrieving revision 1.17 diff -u -p -r1.17 if_fec.c --- sys/arch/armv7/imx/if_fec.c 21 Sep 2016 10:28:47 -0000 1.17 +++ sys/arch/armv7/imx/if_fec.c 21 Sep 2016 12:16:28 -0000 @@ -231,6 +231,7 @@ struct fec_softc { struct fec_buffer *rx_buffer_base; int cur_tx; int cur_rx; + struct timeout sc_tick; }; struct fec_softc *fec_sc; @@ -249,6 +250,7 @@ void fec_iff(struct fec_softc *); struct mbuf * fec_newbuf(void); int fec_intr(void *); void fec_recv(struct fec_softc *); +void fec_tick(void *); int fec_miibus_readreg(struct device *, int, int); void fec_miibus_writereg(struct device *, int, int, int); void fec_miibus_statchg(struct device *); @@ -430,6 +432,8 @@ fec_attach(struct device *parent, struct ether_ifattach(ifp); splx(s); + timeout_set(&sc->sc_tick, fec_tick, sc); + fec_sc = sc; return; @@ -672,6 +676,8 @@ fec_init(struct fec_softc *sc) /* program promiscuous mode and multicast filters */ fec_iff(sc); + timeout_add_sec(&sc->sc_tick, 1); + /* Indicate we are up and running. */ ifp->if_flags |= IFF_RUNNING; ifq_clr_oactive(&ifp->if_snd); @@ -694,6 +700,8 @@ fec_stop(struct fec_softc *sc) ifp->if_timer = 0; ifq_clr_oactive(&ifp->if_snd); + timeout_del(&sc->sc_tick); + /* reset the controller */ HSET4(sc, ENET_ECR, ENET_ECR_RESET); while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); @@ -966,6 +974,19 @@ done: HWRITE4(sc, ENET_RDAR, ENET_RDAR_RDAR); if_input(ifp, &ml); +} + +void +fec_tick(void *arg) +{ + struct fec_softc *sc = arg; + int s; + + s = splnet(); + mii_tick(&sc->sc_mii); + splx(s); + + timeout_add_sec(&sc->sc_tick, 1); } /*