summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_age.c
diff options
context:
space:
mode:
authorKevin Lo <kevlo@cvs.openbsd.org>2011-05-28 08:28:42 +0000
committerKevin Lo <kevlo@cvs.openbsd.org>2011-05-28 08:28:42 +0000
commit48597734de6681f88d2e023376a5785836be94d8 (patch)
tree7add71c9c0b981249f31eb4ee2332a5827f81ab2 /sys/dev/pci/if_age.c
parentcc6465847a09553a2314bf1395d958fd0961046b (diff)
age_newbuf is called from the interrupt context so it can't sleep.
From Brad. Tested by Thomas Pfaff
Diffstat (limited to 'sys/dev/pci/if_age.c')
-rw-r--r--sys/dev/pci/if_age.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/sys/dev/pci/if_age.c b/sys/dev/pci/if_age.c
index 0fe9b7dc867..cca30843fd2 100644
--- a/sys/dev/pci/if_age.c
+++ b/sys/dev/pci/if_age.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_age.c,v 1.13 2011/04/05 18:01:21 henning Exp $ */
+/* $OpenBSD: if_age.c,v 1.14 2011/05/28 08:28:41 kevlo Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
@@ -103,7 +103,7 @@ int age_init_rx_ring(struct age_softc *);
void age_init_rr_ring(struct age_softc *);
void age_init_cmb_block(struct age_softc *);
void age_init_smb_block(struct age_softc *);
-int age_newbuf(struct age_softc *, struct age_rxdesc *, int);
+int age_newbuf(struct age_softc *, struct age_rxdesc *);
void age_mac_config(struct age_softc *);
void age_txintr(struct age_softc *, int);
void age_rxeof(struct age_softc *sc, struct rx_rdesc *);
@@ -1343,7 +1343,7 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
mp = rxd->rx_m;
desc = rxd->rx_desc;
/* Add a new receive buffer to the ring. */
- if (age_newbuf(sc, rxd, 0) != 0) {
+ if (age_newbuf(sc, rxd) != 0) {
ifp->if_iqdrops++;
/* Reuse Rx buffers. */
if (sc->age_cdata.age_rxhead != NULL) {
@@ -2083,7 +2083,7 @@ age_init_rx_ring(struct age_softc *sc)
rxd = &sc->age_cdata.age_rxdesc[i];
rxd->rx_m = NULL;
rxd->rx_desc = &rd->age_rx_ring[i];
- if (age_newbuf(sc, rxd, 1) != 0)
+ if (age_newbuf(sc, rxd) != 0)
return (ENOBUFS);
}
@@ -2130,17 +2130,17 @@ age_init_smb_block(struct age_softc *sc)
}
int
-age_newbuf(struct age_softc *sc, struct age_rxdesc *rxd, int init)
+age_newbuf(struct age_softc *sc, struct age_rxdesc *rxd)
{
struct rx_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);
@@ -2153,17 +2153,8 @@ age_newbuf(struct age_softc *sc, struct age_rxdesc *rxd, int init)
sc->age_cdata.age_rx_sparemap, m, BUS_DMA_NOWAIT);
if (error != 0) {
- if (!error) {
- bus_dmamap_unload(sc->sc_dmat,
- sc->age_cdata.age_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);
}