diff options
author | Justin T. Gibbs <gibbs@FreeBSD.org> | 1997-09-21 21:33:01 +0000 |
---|---|---|
committer | Justin T. Gibbs <gibbs@FreeBSD.org> | 1997-09-21 21:33:01 +0000 |
commit | b505574de99440d527493928dfd6c834e9c423ae (patch) | |
tree | ec721312e8757d66c67703002dda7cf61db677bc /sys | |
parent | f2f9c18505d7e9a651e21f6c5735260df7ead90e (diff) |
Convert to the new callout interface.
Guard against scheduling more than one callout.
Notes
Notes:
svn path=/head/; revision=29671
Diffstat (limited to 'sys')
-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 4a87f0706968..71799bf54256 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 4825f6eb9e99..99708af18509 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; }; /* |