summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2011-02-18 17:20:15 +0000
committermikeb <mikeb@openbsd.org>2011-02-18 17:20:15 +0000
commit0bdccd551fcb107c9001da78d2b62c1c86529cd1 (patch)
treeade0a7e3a7ce23df5d7939b45cf7be911886b7b5
parentwhen changing the vlandev of a running vlan(4) interface, we also need to (diff)
downloadwireguard-openbsd-0bdccd551fcb107c9001da78d2b62c1c86529cd1.tar.xz
wireguard-openbsd-0bdccd551fcb107c9001da78d2b62c1c86529cd1.zip
alc_newbuf is always called from the interrupt context so it can't sleep;
tested by Gabriel Linder, ok kevlo, miod
-rw-r--r--sys/dev/pci/if_alc.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c
index 5bf57d67596..628a1de0b5b 100644
--- a/sys/dev/pci/if_alc.c
+++ b/sys/dev/pci/if_alc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_alc.c,v 1.9 2011/01/29 08:13:46 kevlo Exp $ */
+/* $OpenBSD: if_alc.c,v 1.10 2011/02/18 17:20:15 mikeb Exp $ */
/*-
* Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -104,7 +104,7 @@ void alc_mac_config(struct alc_softc *);
int alc_miibus_readreg(struct device *, int, int);
void alc_miibus_statchg(struct device *);
void alc_miibus_writereg(struct device *, int, int, int);
-int alc_newbuf(struct alc_softc *, struct alc_rxdesc *, int);
+int alc_newbuf(struct alc_softc *, struct alc_rxdesc *);
void alc_phy_down(struct alc_softc *);
void alc_phy_reset(struct alc_softc *);
void alc_reset(struct alc_softc *);
@@ -1552,16 +1552,16 @@ alc_txeof(struct alc_softc *sc)
}
int
-alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd, int init)
+alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd)
{
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);
@@ -1573,18 +1573,8 @@ alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd, int init)
sc->alc_cdata.alc_rx_sparemap, m, BUS_DMA_NOWAIT);
if (error != 0) {
- if (!error) {
- bus_dmamap_unload(sc->sc_dmat,
- sc->alc_cdata.alc_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);
}
@@ -1707,7 +1697,7 @@ alc_rxeof(struct alc_softc *sc, struct rx_rdesc *rrd)
rxd = &sc->alc_cdata.alc_rxdesc[rx_cons];
mp = rxd->rx_m;
/* Add a new receive buffer to the ring. */
- if (alc_newbuf(sc, rxd, 0) != 0) {
+ if (alc_newbuf(sc, rxd) != 0) {
ifp->if_iqdrops++;
/* Reuse Rx buffers. */
if (sc->alc_cdata.alc_rxhead != NULL)
@@ -2293,7 +2283,7 @@ alc_init_rx_ring(struct alc_softc *sc)
rxd = &sc->alc_cdata.alc_rxdesc[i];
rxd->rx_m = NULL;
rxd->rx_desc = &rd->alc_rx_ring[i];
- if (alc_newbuf(sc, rxd, 1) != 0)
+ if (alc_newbuf(sc, rxd) != 0)
return (ENOBUFS);
}