summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2011-07-05 05:25:09 +0000
committerbluhm <bluhm@openbsd.org>2011-07-05 05:25:09 +0000
commit1682d237d688a0ffd8f707f991ef53c5a51e9a66 (patch)
treeb9eee055e6b67a48ac602812b07c0a2df50ef000
parentAdd so_idletv to netstat -vP pcb-address output. (diff)
downloadwireguard-openbsd-1682d237d688a0ffd8f707f991ef53c5a51e9a66.tar.xz
wireguard-openbsd-1682d237d688a0ffd8f707f991ef53c5a51e9a66.zip
When the kernel runs out of mbuf clusters, the hme receive ring may
become empty. In that case, the hme driver could not recover as the ring was only filled after receiving data. Check and potentially fill an empty receive ring every second in hme_tick(). ok kettenis@
-rw-r--r--sys/dev/ic/hme.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c
index 5bea4e1002e..d4bd60608b3 100644
--- a/sys/dev/ic/hme.c
+++ b/sys/dev/ic/hme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hme.c,v 1.61 2009/10/15 17:54:54 deraadt Exp $ */
+/* $OpenBSD: hme.c,v 1.62 2011/07/05 05:25:09 bluhm Exp $ */
/* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */
/*-
@@ -362,6 +362,13 @@ hme_tick(arg)
bus_space_write_4(t, mac, HME_MACI_EXCNT, 0);
bus_space_write_4(t, mac, HME_MACI_LTCNT, 0);
+ /*
+ * If buffer allocation fails, the receive ring may become
+ * empty. There is no receive interrupt to recover from that.
+ */
+ if (sc->sc_rx_cnt == 0)
+ hme_fill_rx_ring(sc);
+
mii_tick(&sc->sc_mii);
splx(s);