FreeBSD/sys/dev/cxgb/cxgb_sge.c
/**
 *	free_rx_bufs - free the Rx buffers on an SGE free list
 *	@sc: the controle softc
 *	@q: the SGE free list to clean up
 *
 *	Release the buffers on an SGE free-buffer Rx queue.  HW fetching from
 *	this queue should be stopped before calling this function.
 */
free the Rx buffers on an SGE free list
@sc: the controle softc
@q: the SGE free list to clean up

Release the buffers on an SGE free-buffer Rx queue.  HW fetching from
this queue should be stopped before calling this function.
free the Rx buffers on an SGE free list @sc : the controle softc @q : the SGE free list to clean up Release the buffers on an SGE free - buffer Rx queue . HW fetching from this queue should be stopped before calling this function .
static void
free_rx_bufs(adapter_t *sc, struct sge_fl *q)
{
	u_int cidx = q->cidx;
	while (q->credits--) {
		struct rx_sw_desc *d = &q->sdesc[cidx];
		if (d->flags & RX_SW_DESC_INUSE) {
			bus_dmamap_unload(q->entry_tag, d->map);
			bus_dmamap_destroy(q->entry_tag, d->map);
			if (q->zone == zone_pack) {
				m_init(d->m, M_NOWAIT, MT_DATA, M_EXT);
				uma_zfree(zone_pack, d->m);
			} else {
				m_init(d->m, M_NOWAIT, MT_DATA, 0);
				uma_zfree(zone_mbuf, d->m);
				uma_zfree(q->zone, d->rxsd_cl);
			}			
		}
		d->rxsd_cl = NULL;
		d->m = NULL;
		if (++cidx == q->size)
			cidx = 0;
	}
}
static void free_rx_bufs ( adapter_t * sc , struct sge_fl * q ) { u_int cidx = q -> cidx ; while ( q -> credits -- ) { struct rx_sw_desc * d = & q -> sdesc [ cidx ] ; if ( d -> flags & RX_SW_DESC_INUSE ) { bus_dmamap_unload ( q -> entry_tag , d -> map ) ; bus_dmamap_destroy ( q -> entry_tag , d -> map ) ; if ( q -> zone == zone_pack ) { m_init ( d -> m , M_NOWAIT , MT_DATA , M_EXT ) ; uma_zfree ( zone_pack , d -> m ) ; } else { m_init ( d -> m , M_NOWAIT , MT_DATA , 0 ) ; uma_zfree ( zone_mbuf , d -> m ) ; uma_zfree ( q -> zone , d -> rxsd_cl ) ; } } d -> rxsd_cl = NULL ; d -> m = NULL ; if ( ++ cidx == q -> size ) cidx = 0 ; } }
free_rx_bufs - free the Rx buffers on an SGE free list
      @sc: the controle softc
      @q: the SGE free list to clean up
free_rx_bufs - free the Rx buffers on an SGE free list @sc : the controle softc @q : the SGE free list to clean up