summaryrefslogtreecommitdiff
path: root/sys/dev/usb/if_kue.c
diff options
context:
space:
mode:
authorKenjiro Cho <kjc@cvs.openbsd.org>2001-06-27 06:34:54 +0000
committerKenjiro Cho <kjc@cvs.openbsd.org>2001-06-27 06:34:54 +0000
commit17cc5dbba19bbbbeb9361149e56ee11dbc22da68 (patch)
tree8a51ae8b2bde0887aa6650a31196833183a5b94f /sys/dev/usb/if_kue.c
parent30721c7f5299136d216635afefc517f47511b9f3 (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/usb/if_kue.c')
-rw-r--r--sys/dev/usb/if_kue.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index b2f15b13942..3ee0298c6c7 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_kue.c,v 1.10 2001/05/03 02:20:32 aaron Exp $ */
+/* $OpenBSD: if_kue.c,v 1.11 2001/06/27 06:34:53 kjc Exp $ */
/* $NetBSD: if_kue.c,v 1.40 2001/04/08 02:10:57 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -519,8 +519,9 @@ USB_ATTACH(kue)
ifp->if_start = kue_start;
ifp->if_watchdog = kue_watchdog;
#if defined(__OpenBSD__)
- ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
+ IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
#endif
+ IFQ_SET_READY(&ifp->if_snd);
strncpy(ifp->if_xname, USBDEVNAME(sc->kue_dev), IFNAMSIZ);
/* Attach the interface. */
@@ -850,7 +851,7 @@ kue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
m_freem(c->kue_mbuf);
c->kue_mbuf = NULL;
- if (ifp->if_snd.ifq_head != NULL)
+ if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
kue_start(ifp);
splx(s);
@@ -914,16 +915,17 @@ kue_start(struct ifnet *ifp)
if (ifp->if_flags & IFF_OACTIVE)
return;
- IF_DEQUEUE(&ifp->if_snd, m_head);
+ IFQ_POLL(&ifp->if_snd, m_head);
if (m_head == NULL)
return;
if (kue_send(sc, m_head, 0)) {
- IF_PREPEND(&ifp->if_snd, m_head);
ifp->if_flags |= IFF_OACTIVE;
return;
}
+ IFQ_DEQUEUE(&ifp->if_snd, m_head);
+
#if NBPFILTER > 0
/*
* If there's a BPF listener, bounce a copy of this frame
@@ -1174,7 +1176,7 @@ kue_watchdog(struct ifnet *ifp)
usbd_get_xfer_status(c->kue_xfer, NULL, NULL, NULL, &stat);
kue_txeof(c->kue_xfer, c, stat);
- if (ifp->if_snd.ifq_head != NULL)
+ if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
kue_start(ifp);
splx(s);
}