summaryrefslogtreecommitdiffstats
path: root/sys/dev/isa/if_ex.c
diff options
context:
space:
mode:
authorkjc <kjc@openbsd.org>2001-06-27 06:34:39 +0000
committerkjc <kjc@openbsd.org>2001-06-27 06:34:39 +0000
commit8efdc62ac992003026e0b5684b93073a1ffdc735 (patch)
tree3a95202a04329459b6fc138dd666c98f93f3eba7 /sys/dev/isa/if_ex.c
parentIPFILTER->NPF (diff)
downloadwireguard-openbsd-8efdc62ac992003026e0b5684b93073a1ffdc735.tar.xz
wireguard-openbsd-8efdc62ac992003026e0b5684b93073a1ffdc735.zip
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/isa/if_ex.c')
-rw-r--r--sys/dev/isa/if_ex.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/isa/if_ex.c b/sys/dev/isa/if_ex.c
index 7b12438e32b..b8541856ae1 100644
--- a/sys/dev/isa/if_ex.c
+++ b/sys/dev/isa/if_ex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ex.c,v 1.6 2001/02/20 19:39:40 mickey Exp $ */
+/* $OpenBSD: if_ex.c,v 1.7 2001/06/27 06:34:46 kjc Exp $ */
/*
* Copyright (c) 1997, Donald A. Schmidt
* Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es)
@@ -294,6 +294,7 @@ ex_attach(parent, self, aux)
ifp->if_mtu = ETHERMTU;
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST; /* XXX not done yet.
| IFF_MULTICAST */
+ IFQ_SET_READY(&ifp->if_snd);
/*
* Attach the interface.
@@ -425,8 +426,10 @@ ex_start(ifp)
* Main loop: send outgoing packets to network card until there are no
* more packets left, or the card cannot accept any more yet.
*/
- while (((opkt = ifp->if_snd.ifq_head) != NULL) &&
- !(ifp->if_flags & IFF_OACTIVE)) {
+ while (!(ifp->if_flags & IFF_OACTIVE)) {
+ IFQ_POLL(&ifp->if_snd, opkt);
+ if (opkt == NULL)
+ break;
/*
* Ensure there is enough free transmit buffer space for this
@@ -449,7 +452,7 @@ ex_start(ifp)
avail = -i;
DODEBUG(Sent_Pkts, printf("i=%d, avail=%d\n", i, avail););
if (avail >= len + XMT_HEADER_LEN) {
- IF_DEQUEUE(&ifp->if_snd, opkt);
+ IFQ_DEQUEUE(&ifp->if_snd, opkt);
#ifdef EX_PSA_INTR
/*
@@ -631,7 +634,7 @@ exintr(arg)
* be sent, attempt to send more packets to the network card.
*/
- if (send_pkts && (ifp->if_snd.ifq_head != NULL))
+ if (send_pkts && IFQ_IS_EMPTY(&ifp->if_snd) == 0)
ex_start(ifp);
#ifdef EXDEBUG
exintr_count--;