summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2005-02-24 23:10:49 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2005-02-24 23:10:49 +0000
commita6855348bad768f13ff3e3aeeac33cf0d2d7bd63 (patch)
treea4a2c6dfa1f18b32fc14d33e45716fb37c9a29ea
parent7ae74f768feb542cb28c0333791c95d487d8e42d (diff)
fixes inspired by netbsd and pointed out by jsg@
- make sure the interface is up before continuing in atu_start - use IFQ_DEQUEUE instead of IF_DEQUEUE
-rw-r--r--sys/dev/usb/if_atu.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c
index 7394b031268..5fa75c8c42c 100644
--- a/sys/dev/usb/if_atu.c
+++ b/sys/dev/usb/if_atu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_atu.c,v 1.51 2005/02/17 18:28:05 reyk Exp $ */
+/* $OpenBSD: if_atu.c,v 1.52 2005/02/24 23:10:48 dlg Exp $ */
/*
* Copyright (c) 2003, 2004
* Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved.
@@ -1772,11 +1772,15 @@ atu_start(struct ifnet *ifp)
DPRINTFN(25, ("%s: atu_start: enter\n", USBDEVNAME(sc->atu_dev)));
- s = splnet();
+ if ((ifp->if_flags & (IFF_RUNNING|IFF_UP)) != (IFF_RUNNING|IFF_UP)) {
+ DPRINTFN(30, ("%s: atu_start: not running or up\n",
+ USBDEVNAME(sc->atu_dev)));
+ return;
+ }
+
if (ifp->if_flags & IFF_OACTIVE) {
DPRINTFN(30, ("%s: atu_start: IFF_OACTIVE\n",
USBDEVNAME(sc->atu_dev)));
- splx(s);
return;
}
@@ -1818,7 +1822,7 @@ atu_start(struct ifnet *ifp)
break;
}
- IF_DEQUEUE(&ifp->if_snd, m);
+ IFQ_DEQUEUE(&ifp->if_snd, m);
if (m == NULL) {
DPRINTFN(25, ("%s: nothing to send\n",
USBDEVNAME(sc->atu_dev)));
@@ -2177,6 +2181,9 @@ atu_watchdog(struct ifnet *ifp)
ifp->if_timer = 0;
+ if ((ifp->if_flags & (IFF_RUNNING|IFF_UP)) != (IFF_RUNNING|IFF_UP))
+ return;
+
if (sc->sc_state != ATU_S_OK)
return;