FreeBSD/sys/dev/cxgb/cxgb_sge.c
/**
 *	t3_free_tx_desc - reclaims Tx descriptors and their buffers
 *	@adapter: the adapter
 *	@q: the Tx queue to reclaim descriptors from
 *	@reclaimable: the number of descriptors to reclaim
 *      @m_vec_size: maximum number of buffers to reclaim
 *      @desc_reclaimed: returns the number of descriptors reclaimed
 *
 *	Reclaims Tx descriptors from an SGE Tx queue and frees the associated
 *	Tx buffers.  Called with the Tx queue lock held.
 *
 *      Returns number of buffers of reclaimed   
 */


Reclaims Tx descriptors from an SGE Tx queue and frees the associated
Tx buffers.  Called with the Tx queue lock held.

Returns number of buffers of reclaimed
Reclaims Tx descriptors from an SGE Tx queue and frees the associated Tx buffers . Called with the Tx queue lock held . Returns number of buffers of reclaimed
void
t3_free_tx_desc(struct sge_qset *qs, int reclaimable, int queue)
{
	struct tx_sw_desc *txsd;
	unsigned int cidx, mask;
	struct sge_txq *q = &qs->txq[queue];
#ifdef T3_TRACE
	T3_TRACE2(sc->tb[q->cntxt_id & 7],
		  "reclaiming %u Tx descriptors at cidx %u", reclaimable, cidx);
#endif
	cidx = q->cidx;
	mask = q->size - 1;
	txsd = &q->sdesc[cidx];
	mtx_assert(&qs->lock, MA_OWNED);
	while (reclaimable--) {
		prefetch(q->sdesc[(cidx + 1) & mask].m);
		prefetch(q->sdesc[(cidx + 2) & mask].m);
		if (txsd->m != NULL) {
			if (txsd->flags & TX_SW_DESC_MAPPED) {
				bus_dmamap_unload(q->entry_tag, txsd->map);
				txsd->flags &= ~TX_SW_DESC_MAPPED;
			}
			m_freem_list(txsd->m);
			txsd->m = NULL;
		} else
			q->txq_skipped++;
		++txsd;
		if (++cidx == q->size) {
			cidx = 0;
			txsd = q->sdesc;
		}
	}
	q->cidx = cidx;
}
void t3_free_tx_desc ( struct sge_qset * qs , int reclaimable , int queue ) { struct tx_sw_desc * txsd ; unsigned int cidx , mask ; struct sge_txq * q = & qs -> txq [ queue ] ; #ifdef T3_TRACE T3_TRACE2 ( sc -> tb [ q -> cntxt_id & 7 ] , " " , reclaimable , cidx ) ; #endif cidx = q -> cidx ; mask = q -> size - 1 ; txsd = & q -> sdesc [ cidx ] ; mtx_assert ( & qs -> lock , MA_OWNED ) ; while ( reclaimable -- ) { prefetch ( q -> sdesc [ ( cidx + 1 ) & mask ] . m ) ; prefetch ( q -> sdesc [ ( cidx + 2 ) & mask ] . m ) ; if ( txsd -> m != NULL ) { if ( txsd -> flags & TX_SW_DESC_MAPPED ) { bus_dmamap_unload ( q -> entry_tag , txsd -> map ) ; txsd -> flags &= ~ TX_SW_DESC_MAPPED ; } m_freem_list ( txsd -> m ) ; txsd -> m = NULL ; } else q -> txq_skipped ++ ; ++ txsd ; if ( ++ cidx == q -> size ) { cidx = 0 ; txsd = q -> sdesc ; } } q -> cidx = cidx ; }
t3_free_tx_desc - reclaims Tx descriptors and their buffers
      @adapter: the adapter
      @q: the Tx queue to reclaim descriptors from
      @reclaimable: the number of descriptors to reclaim
      @m_vec_size: maximum number of buffers to reclaim
      @desc_reclaimed: returns the number of descriptors reclaimed
t3_free_tx_desc - reclaims Tx descriptors and their buffers @adapter : the adapter @q : the Tx queue to reclaim descriptors from @reclaimable : the number of descriptors to reclaim @m_vec_size : maximum number of buffers to reclaim @desc_reclaimed : returns the number of descriptors reclaimed