From 762cb5c93628166ca5d600c5ac208692566aceff Mon Sep 17 00:00:00 2001 From: brad Date: Fri, 19 Dec 2014 04:53:58 +0000 Subject: [PATCH] Make use of m_defrag() in re_encap(). --- sys/dev/ic/re.c | 19 ++++++++++++++----- 1 file 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); } -- 2.20.1