summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2014-12-19 04:53:59 +0000
committerBrad Smith <brad@cvs.openbsd.org>2014-12-19 04:53:59 +0000
commit40ac43966a02a9df27bd6166381399205a4db7a0 (patch)
treeb41ce11cf6aa407063717533ac79ee3eca8b7f0e /sys
parent10b0744127bc28e3270ce693382ce4cd5f504fc5 (diff)
Make use of m_defrag() in re_encap().
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/re.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index 32219a78801..439d8ec17d4 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.163 2014/11/24 10:33:37 brad Exp $ */
+/* $OpenBSD: re.c,v 1.164 2014/12/19 04:53:58 brad Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -1635,12 +1635,21 @@ re_encap(struct rl_softc *sc, struct mbuf *m, int *idx)
txq = &sc->rl_ldata.rl_txq[*idx];
map = txq->txq_dmamap;
+
error = bus_dmamap_load_mbuf(sc->sc_dmat, map, m,
BUS_DMA_WRITE|BUS_DMA_NOWAIT);
- if (error) {
- /* XXX try to defrag if EFBIG? */
- printf("%s: can't map mbuf (error %d)\n",
- sc->sc_dev.dv_xname, error);
+ switch (error) {
+ case 0:
+ break;
+
+ case EFBIG:
+ if ((error = m_defrag(m, M_DONTWAIT)) == 0 &&
+ (error = bus_dmamap_load_mbuf(sc->sc_dmat, map, m,
+ BUS_DMA_WRITE|BUS_DMA_NOWAIT)) == 0)
+ break;
+
+ /* FALLTHROUGH */
+ default:
return (error);
}