- struct rte_mbuf **free = txq->free;
- uint16_t cons = txr->tx_cons;
- unsigned int blk = 0;
- uint32_t ring_mask = txr->tx_ring_struct->ring_mask;
+ uint16_t cons, raw_cons = txr->tx_raw_cons;
+ uint32_t ring_mask, ring_size, num;
+ struct rte_mempool *pool;
+
+ ring_mask = txr->tx_ring_struct->ring_mask;
+ ring_size = txr->tx_ring_struct->ring_size;
+
+ cons = raw_cons & ring_mask;
+ num = RTE_MIN(nr_pkts, ring_size - cons);
+ pool = txr->tx_buf_ring[cons]->pool;
+
+ rte_mempool_put_bulk(pool, (void **)&txr->tx_buf_ring[cons], num);
+ memset(&txr->tx_buf_ring[cons], 0, num * sizeof(struct rte_mbuf *));
+ raw_cons += num;
+ num = nr_pkts - num;
+ if (num) {
+ cons = raw_cons & ring_mask;
+ rte_mempool_put_bulk(pool, (void **)&txr->tx_buf_ring[cons],
+ num);
+ memset(&txr->tx_buf_ring[cons], 0,
+ num * sizeof(struct rte_mbuf *));
+ raw_cons += num;
+ }