From owner-p4-projects@FreeBSD.ORG Wed Jul 26 20:25:47 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 319EF16A4E1; Wed, 26 Jul 2006 20:25:47 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1076D16A4DA for ; Wed, 26 Jul 2006 20:25:47 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8E9E243D55 for ; Wed, 26 Jul 2006 20:25:43 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6QKPhOK061258 for ; Wed, 26 Jul 2006 20:25:43 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6QKPhk8061255 for perforce@freebsd.org; Wed, 26 Jul 2006 20:25:43 GMT (envelope-from jb@freebsd.org) Date: Wed, 26 Jul 2006 20:25:43 GMT Message-Id: <200607262025.k6QKPhk8061255@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 102496 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2006 20:25:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=102496 Change 102496 by jb@jb_freebsd2 on 2006/07/26 20:25:03 Patch from yongari@ which resolves the bus_dmamap_unload problem. Affected files ... .. //depot/projects/dtrace/src/sys/dev/em/if_em.c#5 edit Differences ... ==== //depot/projects/dtrace/src/sys/dev/em/if_em.c#5 (text+ko) ==== @@ -1388,13 +1388,13 @@ struct ifnet *ifp = sc->ifp; bus_dma_segment_t segs[EM_MAX_SCATTER]; bus_dmamap_t map; - struct em_buffer *tx_buffer; + struct em_buffer *tx_buffer, *tx_buffer_last; struct em_tx_desc *current_tx_desc; struct mbuf *m_head; struct m_tag *mtag; uint32_t txd_upper, txd_lower, txd_used, txd_saved; int nsegs, i, j; - int error = 0; + int error; m_head = *m_headp; current_tx_desc = NULL; @@ -1416,9 +1416,10 @@ * Map the packet for DMA. */ tx_buffer = &sc->tx_buffer_area[sc->next_avail_tx_desc]; - error = bus_dmamap_load_mbuf_sg(sc->txtag, tx_buffer->map, m_head, + tx_buffer_last = tx_buffer; + map = tx_buffer->map; + error = bus_dmamap_load_mbuf_sg(sc->txtag, map, m_head, segs, &nsegs, BUS_DMA_NOWAIT); - map = tx_buffer->map; if (error != 0) { sc->no_tx_dma_setup++; return (error); @@ -1548,6 +1549,8 @@ } tx_buffer->m_head = m_head; + tx_buffer_last->map = tx_buffer->map; + tx_buffer->map = map; bus_dmamap_sync(sc->txtag, map, BUS_DMASYNC_PREWRITE); /* @@ -1572,7 +1575,7 @@ return (0); encap_fail: - bus_dmamap_unload(sc->txtag, tx_buffer->map); + bus_dmamap_unload(sc->txtag, map); return (error); } @@ -2808,7 +2811,7 @@ MCLBYTES, /* maxsize */ 1, /* nsegments */ MCLBYTES, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockarg */ &sc->rxtag);