diff options
author | harti <harti@FreeBSD.org> | 2003-10-27 16:21:59 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2003-10-27 16:21:59 +0000 |
commit | 9a473fa2fc80e66c80bc58683fb874c7991addbb (patch) | |
tree | 6fa9229a3ac9567ecab95369b1ead88f5b222526 /sys/dev/hatm | |
parent | 6ff074e438909e1d3d6d49fb7f76772bf682e713 (diff) | |
download | FreeBSD-src-9a473fa2fc80e66c80bc58683fb874c7991addbb.zip FreeBSD-src-9a473fa2fc80e66c80bc58683fb874c7991addbb.tar.gz |
When we cannot allocate an external buffer (bacause we've hit
the maximum number of pages for buffers) return -1 instead of 0.
This fixes a panic under conditions when many mbufs are needed.
Update the head pointer of the receive buffer pool queue even when
we could not supply a buffer to the chip. Otherwise the chip will
not re-interrupt us for another try. A better strategy would probably
be to remember this condition and to supply buffers without an interrupt
as soon as buffers get available.
Diffstat (limited to 'sys/dev/hatm')
-rw-r--r-- | sys/dev/hatm/if_hatm_intr.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/dev/hatm/if_hatm_intr.c b/sys/dev/hatm/if_hatm_intr.c index 4c76816..80347d1 100644 --- a/sys/dev/hatm/if_hatm_intr.c +++ b/sys/dev/hatm/if_hatm_intr.c @@ -236,7 +236,7 @@ hatm_mbuf_alloc(struct hatm_softc *sc, u_int group, struct mbuf *m, hatm_mbuf_page_alloc(sc, group); if ((cf = SLIST_FIRST(&sc->mbuf0_list)) == NULL) { mtx_unlock(&sc->mbuf0_mtx); - return (0); + return (-1); } } SLIST_REMOVE_HEAD(&sc->mbuf0_list, link); @@ -260,7 +260,7 @@ hatm_mbuf_alloc(struct hatm_softc *sc, u_int group, struct mbuf *m, hatm_mbuf_page_alloc(sc, group); if ((cf = SLIST_FIRST(&sc->mbuf1_list)) == NULL) { mtx_unlock(&sc->mbuf1_mtx); - return (0); + return (-1); } } SLIST_REMOVE_HEAD(&sc->mbuf1_list, link); @@ -309,7 +309,7 @@ static void he_intr_rbp(struct hatm_softc *sc, struct herbp *rbp, u_int large, u_int group) { - u_int ntail, upd; + u_int ntail; struct mbuf *m; int error; @@ -319,7 +319,6 @@ he_intr_rbp(struct hatm_softc *sc, struct herbp *rbp, u_int large, rbp->head = (READ4(sc, HE_REGO_RBP_S(large, group)) >> HE_REGS_RBP_HEAD) & (rbp->size - 1); - upd = 0; for (;;) { if ((ntail = rbp->tail + 1) == rbp->size) ntail = 0; @@ -374,12 +373,9 @@ he_intr_rbp(struct hatm_softc *sc, struct herbp *rbp, u_int large, rbp->rbp[rbp->tail].handle <<= HE_REGS_RBRQ_ADDR; rbp->tail = ntail; - upd++; - } - if (upd) { - WRITE4(sc, HE_REGO_RBP_T(large, group), - (rbp->tail << HE_REGS_RBP_TAIL)); } + WRITE4(sc, HE_REGO_RBP_T(large, group), + (rbp->tail << HE_REGS_RBP_TAIL)); } /* |