From fd3e790228315e810962888163929a14ee6566f6 Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Thu, 25 Jun 2009 21:50:15 +0000 Subject: [PATCH] mvec routines should have no knowledge of the SG engine. Reviewed by: kmacy Approved by: gnn (mentor) --- sys/dev/cxgb/cxgb_sge.c | 12 +++++++----- sys/dev/cxgb/sys/mvec.h | 9 ++++----- sys/dev/cxgb/sys/uipc_mvec.c | 13 ++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index fe9ae706ed83..ab85c293b09c 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -1152,17 +1152,18 @@ busdma_map_mbufs(struct mbuf **m, struct sge_txq *txq, { struct mbuf *m0; int err, pktlen, pass = 0; + bus_dma_tag_t tag = txq->entry_tag; retry: err = 0; m0 = *m; pktlen = m0->m_pkthdr.len; #if defined(__i386__) || defined(__amd64__) - if (busdma_map_sg_collapse(txq, txsd->map, m, segs, nsegs) == 0) { + if (busdma_map_sg_collapse(tag, txsd->map, m, segs, nsegs) == 0) { goto done; } else #endif - err = bus_dmamap_load_mbuf_sg(txq->entry_tag, txsd->map, m0, segs, nsegs, 0); + err = bus_dmamap_load_mbuf_sg(tag, txsd->map, m0, segs, nsegs, 0); if (err == 0) { goto done; @@ -1189,7 +1190,7 @@ busdma_map_mbufs(struct mbuf **m, struct sge_txq *txq, } done: #if !defined(__i386__) && !defined(__amd64__) - bus_dmamap_sync(txq->entry_tag, txsd->map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(tag, txsd->map, BUS_DMASYNC_PREWRITE); #endif txsd->flags |= TX_SW_DESC_MAPPED; @@ -1412,11 +1413,12 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz); #endif if (m0->m_nextpkt != NULL) { - busdma_map_sg_vec(txq, txsd->map, m0, segs, &nsegs); + busdma_map_sg_vec(txq->entry_tag, txsd->map, m0, segs, &nsegs); ndesc = 1; mlen = 0; } else { - if ((err = busdma_map_sg_collapse(txq, txsd->map, &m0, segs, &nsegs))) { + if ((err = busdma_map_sg_collapse(txq->entry_tag, txsd->map, + &m0, segs, &nsegs))) { if (cxgb_debug) printf("failed ... err=%d\n", err); return (err); diff --git a/sys/dev/cxgb/sys/mvec.h b/sys/dev/cxgb/sys/mvec.h index da0273cce3e8..ed38dca34445 100644 --- a/sys/dev/cxgb/sys/mvec.h +++ b/sys/dev/cxgb/sys/mvec.h @@ -43,7 +43,7 @@ #define m_ulp_mode m_pkthdr.tso_segsz /* upper level protocol */ static __inline void -busdma_map_mbuf_fast(struct sge_txq *txq, bus_dmamap_t map, +busdma_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *seg) { #if defined(__i386__) || defined(__amd64__) @@ -52,14 +52,13 @@ busdma_map_mbuf_fast(struct sge_txq *txq, bus_dmamap_t map, #else int nsegstmp; - bus_dmamap_load_mbuf_sg(txq->entry_tag, map, m, seg, - &nsegstmp, 0); + bus_dmamap_load_mbuf_sg(tag, map, m, seg, &nsegstmp, 0); #endif } -int busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map, +int busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf **m, bus_dma_segment_t *segs, int *nsegs); -void busdma_map_sg_vec(struct sge_txq *txq, bus_dmamap_t map, +void busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *segs, int *nsegs); static __inline int busdma_map_sgl(bus_dma_segment_t *vsegs, bus_dma_segment_t *segs, int count) diff --git a/sys/dev/cxgb/sys/uipc_mvec.c b/sys/dev/cxgb/sys/uipc_mvec.c index 9695d141cc2a..4e494ebfc152 100644 --- a/sys/dev/cxgb/sys/uipc_mvec.c +++ b/sys/dev/cxgb/sys/uipc_mvec.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #endif int -busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map, +busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf **m, bus_dma_segment_t *segs, int *nsegs) { struct mbuf *n = *m; @@ -73,7 +73,7 @@ busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map, psegs = segs; seg_count = 0; if (n->m_next == NULL) { - busdma_map_mbuf_fast(txq, map, n, segs); + busdma_map_mbuf_fast(tag, map, n, segs); *nsegs = 1; return (0); } @@ -84,14 +84,13 @@ busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map, */ if (__predict_true(n->m_len != 0)) { seg_count++; - busdma_map_mbuf_fast(txq, map, n, psegs); + busdma_map_mbuf_fast(tag, map, n, psegs); psegs++; } n = n->m_next; } #else - err = bus_dmamap_load_mbuf_sg(txq->entry_tag, map, *m, segs, - &seg_count, 0); + err = bus_dmamap_load_mbuf_sg(tag, map, *m, segs, &seg_count, 0); #endif if (seg_count == 0) { if (cxgb_debug) @@ -122,11 +121,11 @@ busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map, } void -busdma_map_sg_vec(struct sge_txq *txq, bus_dmamap_t map, +busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *segs, int *nsegs) { for (*nsegs = 0; m != NULL ; segs++, *nsegs += 1, m = m->m_nextpkt) - busdma_map_mbuf_fast(txq, map, m, segs); + busdma_map_mbuf_fast(tag, map, m, segs); }