diff options
author | Kenjiro Cho <kjc@cvs.openbsd.org> | 2001-06-27 06:34:54 +0000 |
---|---|---|
committer | Kenjiro Cho <kjc@cvs.openbsd.org> | 2001-06-27 06:34:54 +0000 |
commit | 17cc5dbba19bbbbeb9361149e56ee11dbc22da68 (patch) | |
tree | 8a51ae8b2bde0887aa6650a31196833183a5b94f /sys/dev/pci/if_vr.c | |
parent | 30721c7f5299136d216635afefc517f47511b9f3 (diff) |
ALTQ'ify network drivers.
- use the new queue macros.
- use IFQ_POLL() to peek at the next packet.
- use IFQ_IS_EMPTY() for empty check.
- drivers should always check if (m == NULL) after IFQ_DEQUEUE(),
since it could return NULL even when IFQ_IS_EMPTY() is FALSE
under rate-limiting.
- drivers are supposed to call if_start from tx complete interrupts
(in order to trigger the next dequeue under rate-limiting).
Diffstat (limited to 'sys/dev/pci/if_vr.c')
-rw-r--r-- | sys/dev/pci/if_vr.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index f4d2ead0bd8..1c720aa7748 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.17 2001/06/24 22:38:47 aaron Exp $ */ +/* $OpenBSD: if_vr.c,v 1.18 2001/06/27 06:34:50 kjc Exp $ */ /* * Copyright (c) 1997, 1998 @@ -766,6 +766,7 @@ vr_attach(parent, self, aux) ifp->if_start = vr_start; ifp->if_watchdog = vr_watchdog; ifp->if_baudrate = 10000000; + IFQ_SET_READY(&ifp->if_snd); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); /* @@ -1185,7 +1186,7 @@ vr_intr(arg) /* Re-enable interrupts. */ CSR_WRITE_2(sc, VR_IMR, VR_INTRS); - if (ifp->if_snd.ifq_head != NULL) { + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { vr_start(ifp); } @@ -1291,7 +1292,7 @@ vr_start(ifp) start_tx = sc->vr_cdata.vr_tx_free; while(sc->vr_cdata.vr_tx_free->vr_mbuf == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -1548,7 +1549,7 @@ vr_watchdog(ifp) vr_reset(sc); vr_init(sc); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_IS_EMPTY(&ifp->if_snd)) vr_start(ifp); return; |