@@ -568,12 +568,10 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
ring_size = 1 << mq->log2_ring_size;
mask = ring_size - 1;
- n_free = __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE) - mq->last_tail;
- mq->last_tail += n_free;
-
if (type == MEMIF_RING_S2M) {
slot = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE);
- n_free = ring_size - slot + mq->last_tail;
+ n_free = ring_size - slot +
+ __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE);
} else {
slot = __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE);
n_free = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE) - slot;