summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2012-11-21 11:24:17 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2012-11-21 11:24:17 +0000
commit9a61a124b716b5ab9d916b562366b10f25ed1f70 (patch)
treecfcf8ee6a890c2b159cb0262a0a488eed5983839 /sys/dev
parentdd624ad3624e02fa5aa1f525b068a8c6b6906f95 (diff)
Don't forget to delete an rx refill timeout when bringing
an interface down (noticed by dlg@ in the other diff). While here, do some minor cleanup in the interrupt handler.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_oce.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/sys/dev/pci/if_oce.c b/sys/dev/pci/if_oce.c
index 13eec76de80..634b05dd7b6 100644
--- a/sys/dev/pci/if_oce.c
+++ b/sys/dev/pci/if_oce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_oce.c,v 1.62 2012/11/20 18:43:19 mikeb Exp $ */
+/* $OpenBSD: if_oce.c,v 1.63 2012/11/21 11:24:16 mikeb Exp $ */
/*
* Copyright (c) 2012 Mike Belopuhov
@@ -1132,6 +1132,7 @@ oce_stop(struct oce_softc *sc)
int i;
timeout_del(&sc->sc_tick);
+ timeout_del(&sc->sc_rxrefill);
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
@@ -1398,7 +1399,7 @@ oce_intr(void *arg)
struct oce_eq *eq = sc->sc_eq[0];
struct oce_eqe *eqe;
struct oce_cq *cq = NULL;
- int i, claimed = 0, neqe = 0;
+ int i, neqe = 0;
oce_dma_sync(&eq->ring->dma, BUS_DMASYNC_POSTREAD);
@@ -1407,13 +1408,14 @@ oce_intr(void *arg)
neqe++;
}
- if (!neqe)
- goto eq_arm; /* Spurious */
+ /* Spurious? */
+ if (!neqe) {
+ oce_arm_eq(eq, 0, TRUE, FALSE);
+ return (0);
+ }
oce_dma_sync(&eq->ring->dma, BUS_DMASYNC_PREWRITE);
- claimed = 1;
-
/* Clear EQ entries, but dont arm */
oce_arm_eq(eq, neqe, FALSE, TRUE);
@@ -1421,17 +1423,11 @@ oce_intr(void *arg)
for (i = 0; i < eq->cq_valid; i++) {
cq = eq->cq[i];
(*cq->cq_intr)(cq->cb_arg);
- }
-
- /* Arm all CQs connected to this EQ */
- for (i = 0; i < eq->cq_valid; i++) {
- cq = eq->cq[i];
oce_arm_cq(cq, 0, TRUE);
}
-eq_arm:
oce_arm_eq(eq, 0, TRUE, FALSE);
- return (claimed);
+ return (1);
}
/* Handle the Completion Queue for transmit */
@@ -1843,9 +1839,8 @@ oce_refill_rx(void *arg)
s = splnet();
OCE_RQ_FOREACH(sc, rq, i) {
- oce_alloc_rx_bufs(rq);
- if (!rq->pending)
- timeout_add(&sc->sc_rxrefill, 1);
+ if (!oce_alloc_rx_bufs(rq))
+ timeout_add(&sc->sc_rxrefill, 5);
}
splx(s);
}