From a6855348bad768f13ff3e3aeeac33cf0d2d7bd63 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Thu, 24 Feb 2005 23:10:49 +0000 Subject: 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 --- sys/dev/usb/if_atu.c | 15 +++++++++++---- 1 file 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 . 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; -- cgit v1.2.3