summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2002-03-05 04:12:57 +0000
committeritojun <itojun@NetBSD.org>2002-03-05 04:12:57 +0000
commitac36f7cb2c4f72b86e6d2b681ac6e29f4cfaeab9 (patch)
tree445a5cc94468e541a8b928a5ad54928dc33b1d22 /sys/dev/usb
parent69881cf6b8dc615ac34107b2f982835e042159e3 (diff)
bring in latest ALTQ from kjc. ALTQify some of the drivers.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_upl.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c
index 143d2c8ea6a..fb8409f7efd 100644
--- a/sys/dev/usb/if_upl.c
+++ b/sys/dev/usb/if_upl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_upl.c,v 1.16 2001/11/13 06:24:54 lukem Exp $ */
+/* $NetBSD: if_upl.c,v 1.17 2002/03/05 04:12:59 itojun Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.16 2001/11/13 06:24:54 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.17 2002/03/05 04:12:59 itojun Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@@ -317,6 +317,7 @@ USB_ATTACH(upl)
ifp->if_input = upl_input;
ifp->if_baudrate = 12000000;
ifp->if_dlt = DLT_RAW;
+ IFQ_SET_READY(&ifp->if_snd);
/* Attach the interface. */
if_attach(ifp);
@@ -634,7 +635,7 @@ upl_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
m_freem(c->upl_mbuf);
c->upl_mbuf = NULL;
- if (ifp->if_snd.ifq_head != NULL)
+ if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
upl_start(ifp);
splx(s);
@@ -693,16 +694,17 @@ upl_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 (upl_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
@@ -940,7 +942,7 @@ upl_watchdog(struct ifnet *ifp)
upl_stop(sc);
upl_init(sc);
- if (ifp->if_snd.ifq_head != NULL)
+ if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
upl_start(ifp);
}
@@ -1034,24 +1036,32 @@ Static int
upl_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
struct rtentry *rt0)
{
- int s;
+ int s, len, error;
+ ALTQ_DECL(struct altq_pktattr pktattr;)
DPRINTFN(10,("%s: %s: enter\n",
USBDEVNAME(((struct upl_softc *)ifp->if_softc)->sc_dev),
__FUNCTION__));
+ /*
+ * if the queueing discipline needs packet classification,
+ * do it now.
+ */
+ IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr);
+
+ len = m->m_pkthdr.len;
s = splnet();
/*
* Queue message on interface, and start output if interface
* not yet active.
*/
- if (IF_QFULL(&ifp->if_snd)) {
- IF_DROP(&ifp->if_snd);
+ IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
+ if (error) {
+ /* mbuf is already freed */
splx(s);
- return (ENOBUFS);
+ return (error);
}
- ifp->if_obytes += m->m_pkthdr.len;
- IF_ENQUEUE(&ifp->if_snd, m);
+ ifp->if_obytes += len;
if ((ifp->if_flags & IFF_OACTIVE) == 0)
(*ifp->if_start)(ifp);
splx(s);