summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2008-02-17 06:39:16 +0000
committerbrad <brad@openbsd.org>2008-02-17 06:39:16 +0000
commitebdd7d5edfe101c97cec9a18114b28dc9a463c7b (patch)
tree66ccb3e97606d5149dd4a9957576a589e1c2aa3f
parentSimplify the hw revision handling by removing the use of the (diff)
downloadwireguard-openbsd-ebdd7d5edfe101c97cec9a18114b28dc9a463c7b.tar.xz
wireguard-openbsd-ebdd7d5edfe101c97cec9a18114b28dc9a463c7b.zip
- Correct clearing of the IFF_OACTIVE flag by ensuring the flag is
only cleared if there is enough slack space since bge_encap() will return anyway and IFF_OACTIVE will be set again. - Only reset the watchdog timer when all packets have been processed. - Have bge_start() do a fast return if the adapter is not running or the IFF_OACTIVE flag is set. Tested by brad@, chl@, krw@, landry@, sthen@ and Johan Mson Lindman. ok dlg@
-rw-r--r--sys/dev/pci/if_bge.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 978d98d6163..e8d7b6a94c2 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.218 2008/02/02 04:03:33 brad Exp $ */
+/* $OpenBSD: if_bge.c,v 1.219 2008/02/17 06:39:16 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -2596,11 +2596,12 @@ bge_txeof(struct bge_softc *sc)
}
sc->bge_txcnt--;
BGE_INC(sc->bge_tx_saved_considx, BGE_TX_RING_CNT);
- ifp->if_timer = 0;
}
- if (cur_tx != NULL)
+ if (sc->bge_txcnt < BGE_TX_RING_CNT - 16)
ifp->if_flags &= ~IFF_OACTIVE;
+ if (sc->bge_txcnt == 0)
+ ifp->if_timer = 0;
}
int
@@ -2648,8 +2649,7 @@ bge_intr(void *xsc)
/* Re-enable interrupts. */
bge_writembx(sc, BGE_MBX_IRQ0_LO, 0);
- if (ifp->if_flags & IFF_RUNNING && !IFQ_IS_EMPTY(&ifp->if_snd))
- bge_start(ifp);
+ bge_start(ifp);
return (1);
} else
@@ -2950,7 +2950,11 @@ bge_start(struct ifnet *ifp)
sc = ifp->if_softc;
- if (!sc->bge_link || IFQ_IS_EMPTY(&ifp->if_snd))
+ if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ return;
+ if (!sc->bge_link)
+ return;
+ if (IFQ_IS_EMPTY(&ifp->if_snd))
return;
prodidx = sc->bge_tx_prodidx;
@@ -3560,8 +3564,7 @@ bge_power(int why, void *xsc)
ifp = &sc->arpcom.ac_if;
if (ifp->if_flags & IFF_UP) {
bge_init(xsc);
- if (ifp->if_flags & IFF_RUNNING)
- bge_start(ifp);
+ bge_start(ifp);
}
}
}