From 2722485b085175524246d91e014ef9b7d6ea06aa Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Tue, 22 Jul 2003 01:35:09 +0000 Subject: [PATCH] Erm, my previous commit was wrong and sis_tick() was only called each time sis_ioctl() was called, so one had to use ifconfig each time the cable got plugged in to be able to use the connection. Do it a better way now, add a "in_tick" field in the softc structure, call timeout() in sis_tick() and don't call it in sis_init() if in_tick is non-zero. Reported by: Landmark Networks Pointy hat to: cognet --- sys/pci/if_sis.c | 6 +++++- sys/pci/if_sisreg.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c index eb51295f38d..69822de2d82 100644 --- a/sys/pci/if_sis.c +++ b/sys/pci/if_sis.c @@ -1739,6 +1739,7 @@ sis_tick(xsc) sc = xsc; SIS_LOCK(sc); + sc->in_tick = 1; ifp = &sc->arpcom.ac_if; mii = device_get_softc(sc->sis_miibus); @@ -1751,6 +1752,8 @@ sis_tick(xsc) sis_start(ifp); } + sc->sis_stat_ch = timeout(sis_tick, sc, hz); + sc->in_tick = 0; SIS_UNLOCK(sc); return; @@ -2187,7 +2190,8 @@ sis_init(xsc) ifp->if_flags |= IFF_RUNNING; ifp->if_flags &= ~IFF_OACTIVE; - sc->sis_stat_ch = timeout(sis_tick, sc, hz); + if (!sc->in_tick) + sc->sis_stat_ch = timeout(sis_tick, sc, hz); SIS_UNLOCK(sc); diff --git a/sys/pci/if_sisreg.h b/sys/pci/if_sisreg.h index 9fcefd764de..97c48f76473 100644 --- a/sys/pci/if_sisreg.h +++ b/sys/pci/if_sisreg.h @@ -463,6 +463,7 @@ struct sis_softc { #ifdef DEVICE_POLLING int rxcycles; #endif + int in_tick; struct mtx sis_mtx; };