DPDK patches and discussions
 help / color / mirror / Atom feed
From: jhascoet <ju.hascoet@gmail.com>
To: olivier.matz@6wind.com
Cc: dev@dpdk.org, Julien Hascoet <ju.hascoet@gmail.com>
Subject: [PATCH] app: enhance error check if enqueue fail in test_mbuf test_refcnt_iter
Date: Thu, 24 Aug 2023 09:37:18 +0200	[thread overview]
Message-ID: <20230824073718.718872-1-jhascoet@kalray.eu> (raw)
In-Reply-To: <20230810160941.3895855-1-jhascoet@kalray.eu>

From: Julien Hascoet <ju.hascoet@gmail.com>

As the ring is big enough by construction, the ring
enqueue ops cannot fail; therefore, we check and panic
on it as soon as it is detected.

Signed-off-by: Julien Hascoet <ju.hascoet@gmail.com>
---
 app/test/test_mbuf.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index d7393df7eb..c94dd3749e 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -1033,12 +1033,15 @@ 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) {
+				if (rte_ring_enqueue(refcnt_mbuf_ring, m) != 0)
+					goto fail_enqueue;
+			}
 		} else {
 			while (ref-- != 0) {
 				rte_pktmbuf_refcnt_update(m, 1);
-				rte_ring_enqueue(refcnt_mbuf_ring, m);
+				if (rte_ring_enqueue(refcnt_mbuf_ring, m) != 0)
+					goto fail_enqueue;
 			}
 		}
 		rte_pktmbuf_free(m);
@@ -1066,6 +1069,10 @@ test_refcnt_iter(unsigned int lcore, unsigned int iter,
 
 	rte_panic("(lcore=%u, iter=%u): after %us only "
 	          "%u of %u mbufs left free\n", lcore, iter, wn, i, n);
+
+fail_enqueue:
+	rte_panic("(lcore=%u, iter=%u): enqueue mbuf %u cannot "
+		"fail since ring is big enough\n", lcore, iter, i);
 }
 
 static int
-- 
2.34.1


      parent reply	other threads:[~2023-08-24  8:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09  5:38 [PATCH] app: fix silent " jhascoet
2023-08-09  9:18 ` David Marchand
2023-08-10  6:00 ` jhascoet
2023-08-10 15:33   ` Stephen Hemminger
2023-08-10 15:40     ` [PUB] " Julien Hascoet
2023-08-10 16:09   ` jhascoet
2023-08-18  5:16     ` Hascoet Julien
2023-08-18  6:25       ` David Marchand
2023-08-22  6:34     ` jhascoet
2023-08-22  8:34       ` Olivier Matz
2023-08-24  6:51         ` Hascoet Julien
2023-08-30 16:16       ` Thomas Monjalon
2023-08-24  7:37     ` jhascoet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230824073718.718872-1-jhascoet@kalray.eu \
    --to=ju.hascoet@gmail.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).