From: Julien Hascoet <ju.hasc...@gmail.com> In case of ring full state, we retry the enqueue operation in order to avoid mbuf loss.
Fixes: af75078fece ("first public release") Signed-off-by: Julien Hascoet <ju.hasc...@gmail.com> --- app/test/test_mbuf.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index efac01806b..ad18bf6378 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -1033,12 +1033,21 @@ test_refcnt_iter(unsigned int lcore, unsigned int iter, tref += ref; if ((ref & 1) != 0) { rte_pktmbuf_refcnt_update(m, ref); - while (ref-- != 0) - rte_ring_enqueue(refcnt_mbuf_ring, m); + while (ref-- != 0) { + /* retry in case of failure */ + while (rte_ring_enqueue(refcnt_mbuf_ring, m) != 0) { + /* let others consume */ + rte_pause(); + } + } } else { while (ref-- != 0) { rte_pktmbuf_refcnt_update(m, 1); - rte_ring_enqueue(refcnt_mbuf_ring, m); + /* retry in case of failure */ + while (rte_ring_enqueue(refcnt_mbuf_ring, m) != 0) { + /* let others consume */ + rte_pause(); + } } } rte_pktmbuf_free(m); -- 2.34.1