diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-02-13 00:44:53 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-02-13 00:44:53 +0000 |
commit | 28d98a5e6db505ef87a85d6be6777698e3f6353e (patch) | |
tree | b00c9d20c56e54ff335dc3bd754eab068ad06218 /sys/dev | |
parent | 64cee7154a1da116be166c7b64f1787d5be7ca8e (diff) |
revert rev 1.85. The mbuf needs to be re-mapped in the case of an error.
ok damien@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_bge.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 09c4416a760..b58b73b7309 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.132 2006/02/11 09:01:30 brad Exp $ */ +/* $OpenBSD: if_bge.c,v 1.133 2006/02/13 00:44:52 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -825,12 +825,6 @@ bge_newbuf_std(struct bge_softc *sc, int i, struct mbuf *m, return (ENOBUFS); } m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - if (!sc->bge_rx_alignment_bug) - m_adj(m_new, ETHER_ALIGN); - - if (bus_dmamap_load_mbuf(sc->bge_dmatag, dmamap, m_new, - BUS_DMA_READ|BUS_DMA_NOWAIT)) - return (ENOBUFS); } else { /* * We're re-using a previously allocated mbuf; @@ -840,8 +834,20 @@ bge_newbuf_std(struct bge_softc *sc, int i, struct mbuf *m, m_new = m; m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; m_new->m_data = m_new->m_ext.ext_buf; - if (!sc->bge_rx_alignment_bug) - m_adj(m_new, ETHER_ALIGN); + } + + if (!sc->bge_rx_alignment_bug) + m_adj(m_new, ETHER_ALIGN); + + error = bus_dmamap_load_mbuf(sc->bge_dmatag, dmamap, m_new, + BUS_DMA_READ|BUS_DMA_NOWAIT); + if (error) { + if (m == NULL) { + m_freem(m_new); + sc->bge_cdata.bge_rx_std_chain[i] = NULL; + } + return(ENOMEM); + } sc->bge_cdata.bge_rx_std_chain[i] = m_new; |