Date: Fri, 3 Nov 2006 00:20:27 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 109084 for review Message-ID: <200611030020.kA30KRkn000875@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=109084 Change 109084 by imp@imp_lighthouse on 2006/11/03 00:19:45 Avoid a copy and alloc/free pair when there's only one mbuf. Suggested by: scottl@, sam@ Affected files ... .. //depot/projects/arm/src/sys/arm/at91/if_ate.c#60 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#60 (text+ko) ==== @@ -778,7 +778,7 @@ struct ate_softc *sc = ifp->if_softc; struct mbuf *m, *mdefrag; bus_dma_segment_t segs[1]; - int nseg; + int nseg, e; ATE_ASSERT_LOCKED(sc); if (ifp->if_drv_flags & IFF_DRV_OACTIVE) @@ -800,14 +800,19 @@ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; return; } - mdefrag = m_defrag(m, M_DONTWAIT); - if (mdefrag == NULL) { - IFQ_DRV_PREPEND(&ifp->if_snd, m); - return; + e = bus_dmamap_load_mbuf_sg(sc->mtag, sc->tx_map[sc->txcur], m, + segs, &nseg, 0); + if (e == EFBIG) { + mdefrag = m_defrag(m, M_DONTWAIT); + if (mdefrag == NULL) { + IFQ_DRV_PREPEND(&ifp->if_snd, m); + return; + } + m = mdefrag; + e = bus_dmamap_load_mbuf_sg(sc->mtag, + sc->tx_map[sc->txcur], m, segs, &nseg, 0); } - m = mdefrag; - if (bus_dmamap_load_mbuf_sg(sc->mtag, sc->tx_map[sc->txcur], m, - segs, &nseg, 0) != 0) { + if (e == EFBIG) { m_freem(m); continue; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611030020.kA30KRkn000875>