summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_jme.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2012-02-08 13:17:00 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2012-02-08 13:17:00 +0000
commitd38899b329e85dbab990bf469bbb26a7209554ba (patch)
treea9f62bc5bfa295debabd6e63ed5a4e301af5499e /sys/dev/pci/if_jme.c
parent30b39b93119d42772250d26c7e44296a4985df13 (diff)
Remove the init path of jme_newbuf that used M_WAITOK
as this can be called from an interrupt context. From brad.
Diffstat (limited to 'sys/dev/pci/if_jme.c')
-rw-r--r--sys/dev/pci/if_jme.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c
index 323f8e09005..ab97b09fe17 100644
--- a/sys/dev/pci/if_jme.c
+++ b/sys/dev/pci/if_jme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_jme.c,v 1.25 2011/04/05 18:01:21 henning Exp $ */
+/* $OpenBSD: if_jme.c,v 1.26 2012/02/08 13:16:59 jsg Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -104,7 +104,7 @@ void jme_dma_free(struct jme_softc *);
int jme_init_rx_ring(struct jme_softc *);
void jme_init_tx_ring(struct jme_softc *);
void jme_init_ssb(struct jme_softc *);
-int jme_newbuf(struct jme_softc *, struct jme_rxdesc *, int);
+int jme_newbuf(struct jme_softc *, struct jme_rxdesc *);
int jme_encap(struct jme_softc *, struct mbuf **);
void jme_rxpkt(struct jme_softc *);
@@ -1602,7 +1602,7 @@ jme_rxpkt(struct jme_softc *sc)
mp = rxd->rx_m;
/* Add a new receive buffer to the ring. */
- if (jme_newbuf(sc, rxd, 0) != 0) {
+ if (jme_newbuf(sc, rxd) != 0) {
ifp->if_iqdrops++;
/* Reuse buffer. */
jme_discard_rxbufs(sc, cons, nsegs - count);
@@ -2169,7 +2169,7 @@ jme_init_rx_ring(struct jme_softc *sc)
rxd = &sc->jme_cdata.jme_rxdesc[i];
rxd->rx_m = NULL;
rxd->rx_desc = &rd->jme_rx_ring[i];
- error = jme_newbuf(sc, rxd, 1);
+ error = jme_newbuf(sc, rxd);
if (error)
return (error);
}
@@ -2181,17 +2181,17 @@ jme_init_rx_ring(struct jme_softc *sc)
}
int
-jme_newbuf(struct jme_softc *sc, struct jme_rxdesc *rxd, int init)
+jme_newbuf(struct jme_softc *sc, struct jme_rxdesc *rxd)
{
struct jme_desc *desc;
struct mbuf *m;
bus_dmamap_t map;
int error;
- MGETHDR(m, init ? M_WAITOK : M_DONTWAIT, MT_DATA);
+ MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (ENOBUFS);
- MCLGET(m, init ? M_WAITOK : M_DONTWAIT);
+ MCLGET(m, M_DONTWAIT);
if (!(m->m_flags & M_EXT)) {
m_freem(m);
return (ENOBUFS);
@@ -2206,20 +2206,11 @@ jme_newbuf(struct jme_softc *sc, struct jme_rxdesc *rxd, int init)
m->m_len = m->m_pkthdr.len = MCLBYTES;
error = bus_dmamap_load_mbuf(sc->sc_dmat,
- sc->jme_cdata.jme_rx_sparemap,
- m, BUS_DMA_NOWAIT);
+ sc->jme_cdata.jme_rx_sparemap, m, BUS_DMA_NOWAIT);
+
if (error != 0) {
- if (!error) {
- bus_dmamap_unload(sc->sc_dmat,
- sc->jme_cdata.jme_rx_sparemap);
- error = EFBIG;
- printf("%s: too many segments?!\n",
- sc->sc_dev.dv_xname);
- }
m_freem(m);
-
- if (init)
- printf("%s: can't load RX mbuf\n", sc->sc_dev.dv_xname);
+ printf("%s: can't load RX mbuf\n", sc->sc_dev.dv_xname);
return (error);
}