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/ic/if_wi.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/ic/if_wi.c')
-rw-r--r-- | sys/dev/ic/if_wi.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index cc441bd687a..cfdb0f48eb8 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.14 2001/06/25 19:36:13 drahn Exp $ */ +/* $OpenBSD: if_wi.c,v 1.15 2001/06/27 06:34:42 kjc Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -120,7 +120,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.14 2001/06/25 19:36:13 drahn Exp $"; + "$OpenBSD: if_wi.c,v 1.15 2001/06/27 06:34:42 kjc Exp $"; #endif /* lint */ #ifdef foo @@ -197,7 +197,8 @@ wi_attach(sc, print_cis) ifp->if_start = wi_start; ifp->if_watchdog = wi_watchdog; ifp->if_baudrate = 10000000; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_READY(&ifp->if_snd); bzero(sc->wi_node_name, sizeof(sc->wi_node_name)); bcopy(WI_DEFAULT_NODENAME, sc->wi_node_name, @@ -326,7 +327,7 @@ wi_intr(vsc) /* Re-enable interrupts. */ CSR_WRITE_2(sc, WI_INT_EN, WI_INTRS); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_IS_EMPTY(&ifp->if_snd)) wi_start(ifp); return (1); @@ -1340,7 +1341,7 @@ wi_start(ifp) if (ifp->if_flags & IFF_OACTIVE) return; - IF_DEQUEUE(&ifp->if_snd, m0); + IFQ_DEQUEUE(&ifp->if_snd, m0); if (m0 == NULL) return; |