/* Recycles the specified buffer on the given free list by adding it at the next available slot on the list.  */
static void recycle_rx_buf(struct adapter *adap, struct sge_fl *q, unsigned int idx)
/* Recycles the specified buffer on the given free list by adding it at the next available slot on the list.  */
static void recycle_rx_buf(struct adapter *adap, struct sge_fl *q, unsigned int idx)
{
	struct rx_desc *from = &q->desc[idx];
	struct rx_desc *to = &q->desc[q->pidx];
	q->sdesc[q->pidx] = q->sdesc[idx];
	to->addr_lo = from->addr_lo;
	to->addr_hi = from->addr_hi;
	wmb();
	to->len_gen = cpu_to_be32(V_FLD_GEN1(q->gen));
	to->gen2 = cpu_to_be32(V_FLD_GEN2(q->gen));
	if (++q->pidx == q->size) {
		q->pidx = 0;
		q->gen ^= 1;
	}
	q->credits++;
	q->pend_cred++;
	ring_fl_db(adap, q);
}