xref: /freebsd/sys/dev/cxgb/sys/mvec.h (revision 95ee2897)
18e0ad55aSJoel Dahl /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
48e0ad55aSJoel Dahl  * Copyright (c) 2007, 2009 Kip Macy <kmacy@freebsd.org>
5a8d9a363SKip Macy  * All rights reserved.
6a8d9a363SKip Macy  *
7a8d9a363SKip Macy  * Redistribution and use in source and binary forms, with or without
88e0ad55aSJoel Dahl  * modification, are permitted provided that the following conditions
98e0ad55aSJoel Dahl  * are met:
108e0ad55aSJoel Dahl  * 1. Redistributions of source code must retain the above copyright
118e0ad55aSJoel Dahl  *    notice, this list of conditions and the following disclaimer.
128e0ad55aSJoel Dahl  * 2. Redistributions in binary form must reproduce the above copyright
138e0ad55aSJoel Dahl  *    notice, this list of conditions and the following disclaimer in the
148e0ad55aSJoel Dahl  *    documentation and/or other materials provided with the distribution.
15a8d9a363SKip Macy  *
168e0ad55aSJoel Dahl  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
178e0ad55aSJoel Dahl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18a8d9a363SKip Macy  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198e0ad55aSJoel Dahl  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
208e0ad55aSJoel Dahl  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218e0ad55aSJoel Dahl  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228e0ad55aSJoel Dahl  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238e0ad55aSJoel Dahl  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248e0ad55aSJoel Dahl  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258e0ad55aSJoel Dahl  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268e0ad55aSJoel Dahl  * SUCH DAMAGE.
27a8d9a363SKip Macy  *
288e0ad55aSJoel Dahl  */
29a8d9a363SKip Macy 
30db2faf11SKip Macy #ifndef _MVEC_H_
31db2faf11SKip Macy #define _MVEC_H_
328e10660fSKip Macy #include <machine/bus.h>
33db2faf11SKip Macy 
34fd3e7902SNavdeep Parhar int busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map,
353f345a5dSKip Macy     struct mbuf **m, bus_dma_segment_t *segs, int *nsegs);
36fd3e7902SNavdeep Parhar void busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map,
3775417d6dSKip Macy     struct mbuf *m, bus_dma_segment_t *segs, int *nsegs);
38501e1590SKip Macy 
39501e1590SKip Macy static __inline void
m_freem_list(struct mbuf * m)403f345a5dSKip Macy m_freem_list(struct mbuf *m)
418e10660fSKip Macy {
423f345a5dSKip Macy 	struct mbuf *n;
438e10660fSKip Macy 
443f345a5dSKip Macy 	while (m != NULL) {
453f345a5dSKip Macy 		n = m->m_nextpkt;
463f345a5dSKip Macy 		if (n != NULL)
473f345a5dSKip Macy 			prefetch(n);
483f345a5dSKip Macy 		m_freem(m);
493f345a5dSKip Macy 		m = n;
50501e1590SKip Macy 	}
51a8d9a363SKip Macy }
52db2faf11SKip Macy 
53501e1590SKip Macy #endif /* _MVEC_H_ */
54