+static void enic_fast_free_wq_bufs(struct vnic_wq *wq, u16 completed_index)
+{
+ unsigned int desc_count, n, nb_to_free, tail_idx;
+ struct rte_mempool *pool;
+ struct rte_mbuf **m;
+
+ desc_count = wq->ring.desc_count;
+ nb_to_free = enic_ring_sub(desc_count, wq->tail_idx, completed_index)
+ + 1;
+ tail_idx = wq->tail_idx;
+ wq->tail_idx += nb_to_free;
+ wq->ring.desc_avail += nb_to_free;
+ if (wq->tail_idx >= desc_count)
+ wq->tail_idx -= desc_count;
+ /* First, free at most until the end of ring */
+ m = &wq->bufs[tail_idx];
+ pool = (*m)->pool;
+ n = RTE_MIN(nb_to_free, desc_count - tail_idx);
+ rte_mempool_put_bulk(pool, (void **)m, n);
+ n = nb_to_free - n;
+ /* Then wrap and free the rest */
+ if (unlikely(n))
+ rte_mempool_put_bulk(pool, (void **)wq->bufs, n);
+}
+