aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/vx/if_vx.c
diff options
context:
space:
mode:
authorJustin T. Gibbs <gibbs@FreeBSD.org>1997-09-21 21:33:01 +0000
committerJustin T. Gibbs <gibbs@FreeBSD.org>1997-09-21 21:33:01 +0000
commitb505574de99440d527493928dfd6c834e9c423ae (patch)
treeec721312e8757d66c67703002dda7cf61db677bc /sys/dev/vx/if_vx.c
parentf2f9c18505d7e9a651e21f6c5735260df7ead90e (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/dev/vx/if_vx.c')
-rw-r--r--sys/dev/vx/if_vx.c18
1 files changed, 13 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);
}