From f01c3975d53f8539b124b8f52f34d8a628d3c97f Mon Sep 17 00:00:00 2001 From: gibbs Date: Sun, 21 Sep 1997 21:33:01 +0000 Subject: Convert to the new callout interface. Guard against scheduling more than one callout. --- sys/dev/vx/if_vx.c | 18 +++++++++++++----- sys/dev/vx/if_vxreg.h | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c index 4a87f07..71799bf 100644 --- a/sys/dev/vx/if_vx.c +++ b/sys/dev/vx/if_vx.c @@ -160,6 +160,7 @@ vxalloc(unit) return NULL; } bzero(sc, sizeof(struct vx_softc)); + callout_handle_init(&sc->ch); vx_softc[unit] = sc; sc->unit = unit; @@ -827,8 +828,10 @@ vxget(sc, totlen) return 0; } else { /* If the queue is no longer full, refill. */ - if (sc->last_mb == sc->next_mb) - timeout(vxmbuffill, sc, 1); + if (sc->last_mb == sc->next_mb && sc->buffill_pending == 0) { + sc->ch = timeout(vxmbuffill, sc, 1); + sc->buffill_pending = 1; + } /* Convert one of our saved mbuf's. */ sc->next_mb = (sc->next_mb + 1) % MAX_MBS; m->m_data = m->m_pktdat; @@ -1056,8 +1059,12 @@ vxmbuffill(sp) } while (i != sc->next_mb); sc->last_mb = i; /* If the queue was not filled, try again. */ - if (sc->last_mb != sc->next_mb) - timeout(vxmbuffill, sc, 1); + if (sc->last_mb != sc->next_mb) { + sc->ch = timeout(vxmbuffill, sc, 1); + sc->buffill_pending = 1; + } else { + sc->buffill_pending = 0; + } splx(s); } @@ -1075,7 +1082,8 @@ vxmbufempty(sc) } } sc->last_mb = sc->next_mb = 0; - untimeout(vxmbuffill, sc); + if (sc->buffill_pending != 0) + untimeout(vxmbuffill, sc, sc->ch); splx(s); } diff --git a/sys/dev/vx/if_vxreg.h b/sys/dev/vx/if_vxreg.h index 4825f6e..99708af 100644 --- a/sys/dev/vx/if_vxreg.h +++ b/sys/dev/vx/if_vxreg.h @@ -61,6 +61,8 @@ struct vx_softc { short tx_start_thresh; /* Current TX_start_thresh. */ int tx_succ_ok; /* # packets sent in sequence */ /* w/o underrun */ + struct callout_handle ch; /* Callout handle for timeouts */ + int buffill_pending; }; /* -- cgit v1.1