summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-10-09 20:55:42 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-10-09 20:55:42 +0000
commit4e8dd37a2bf9595115c590fbdf28674de442d6a1 (patch)
treea0a4085403a06a5bba03008c484284f46ddfacb5 /sys/dev/pci
parent0494213f312c7a1e16660c05590518bcda40b702 (diff)
- move bus_dmamap_load_mbuf() to where it should be in bge_newbuf_std()
- add comments mentioning where we're re-using mbufs
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_bge.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index f08bef2eea6..28e9dbc8339 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.84 2005/10/06 06:01:05 brad Exp $ */
+/* $OpenBSD: if_bge.c,v 1.85 2005/10/09 20:55:41 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -666,20 +666,23 @@ bge_newbuf_std(sc, i, m, dmamap)
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;
+ * be sure to re-init pointers and lengths to
+ * default values.
+ */
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 (bus_dmamap_load_mbuf(sc->bge_dmatag, dmamap, m_new,
- BUS_DMA_READ|BUS_DMA_NOWAIT)) {
- if (m == NULL)
- m_freem(m_new);
- return(ENOBUFS);
+ if (!sc->bge_rx_alignment_bug)
+ m_adj(m_new, ETHER_ALIGN);
}
sc->bge_cdata.bge_rx_std_chain[i] = m_new;
@@ -730,6 +733,11 @@ bge_newbuf_jumbo(sc, i, m)
m_new->m_len = m_new->m_pkthdr.len = ETHER_MAX_LEN_JUMBO;
MEXTADD(m_new, buf, ETHER_MAX_LEN_JUMBO, 0, bge_jfree, sc);
} else {
+ /*
+ * We're re-using a previously allocated mbuf;
+ * be sure to re-init pointers and lengths to
+ * default values.
+ */
m_new = m;
m_new->m_data = m_new->m_ext.ext_buf;
m_new->m_ext.ext_size = ETHER_MAX_LEN_JUMBO;