/* Reclaims Tx descriptors from an SGE Tx queue and frees the associated Tx buffers. Called with the Tx queue lock held.  */
static void free_tx_desc(struct adapter *adapter, struct sge_txq *q, unsigned int n)
/* Reclaims Tx descriptors from an SGE Tx queue and frees the associated Tx buffers. Called with the Tx queue lock held.  */
static void free_tx_desc(struct adapter *adapter, struct sge_txq *q, unsigned int n)
{
	struct tx_sw_desc *d;
	struct pci_dev *pdev = adapter->pdev;
	unsigned int cidx = q->cidx;
	const int need_unmap = need_skb_unmap() &&
			       q->cntxt_id >= FW_TUNNEL_SGEEC_START;
	d = &q->sdesc[cidx];
	while (n--) {
		if (d->skb) {
			if (need_unmap)
				unmap_skb(d->skb, q, cidx, pdev);
			if (d->eop)
				kfree_skb(d->skb);
		}
		++d;
		if (++cidx == q->size) {
			cidx = 0;
			d = q->sdesc;
		}
	}
	q->cidx = cidx;
}