diff options
author | gibbs <gibbs@FreeBSD.org> | 1997-09-21 21:33:01 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 1997-09-21 21:33:01 +0000 |
commit | f01c3975d53f8539b124b8f52f34d8a628d3c97f (patch) | |
tree | c0493d8fc4ad8167aacd54d1b7ee9cca54f00f20 /sys/dev/vx | |
parent | d045f898c6ff35d4005b705d3d1f42fb3c68eaf2 (diff) | |
download | FreeBSD-src-f01c3975d53f8539b124b8f52f34d8a628d3c97f.zip FreeBSD-src-f01c3975d53f8539b124b8f52f34d8a628d3c97f.tar.gz |
Convert to the new callout interface.
Guard against scheduling more than one callout.
Diffstat (limited to 'sys/dev/vx')
-rw-r--r-- | sys/dev/vx/if_vx.c | 18 | ||||
-rw-r--r-- | sys/dev/vx/if_vxreg.h | 2 |
2 files changed, 15 insertions, 5 deletions
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; }; /* |