From patchwork Thu Aug 24 07:37:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jhascoet X-Patchwork-Id: 130701 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23313430EE; Thu, 24 Aug 2023 10:53:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8473743067; Thu, 24 Aug 2023 10:52:58 +0200 (CEST) Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by mails.dpdk.org (Postfix) with ESMTP id D664F42B8B for ; Thu, 24 Aug 2023 09:37:22 +0200 (CEST) Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-52a250aa012so2174197a12.3 for ; Thu, 24 Aug 2023 00:37:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692862642; x=1693467442; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v49c25UX8/DVYZO76RR0+8rxzqI4pCyo6aURY+U7HuE=; b=jKUsqt7hcv+Lg+k1OXBXdp2A1Z5W9MkZ6JaxDDw8YsJOw1l3OiZVwwPxitGD8oLiaa EJGzyBIwOY5ac33z3ScrTMlgze5sdCQ332LQBVo/Ox3NpCX8ftjwB9YnJV/rX67/iF+n iH/bzehEs+jBXvDUocaXw8zapmzUDHiFMHVakssTzV4dtdgEUfbNspGufUw9rrSXJwcc 9buN4cN1CgwScuH/aJWSC/aD3kxyyTPsCTJUVzURiXvJLJHSP5ZIXW6Ee7KPSUR/HXUA aCdUrp4sr3E+bTRizu8t64jASOVf6BizzuVGlTQ+WJ6gEwf/jk9OhX8G3balLwDmyBBs VJzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692862642; x=1693467442; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v49c25UX8/DVYZO76RR0+8rxzqI4pCyo6aURY+U7HuE=; b=klI/1B+LJoimvbNA19xWeFRoGIh26Rr4OLpPnMJ7o+PDuQ04WzLMnK1MGOflE34he6 B/Z+xLtyznytMm/O7P/ou2vFLmBsg302TrC0PSBMkUli4B1nxOxOU1Glvff791pOH1in ZXBzqQ47i+zbLRAt6pIxIo92URAGX41a5i56FKxey0EPIacsLeNP/tU8diOWaB2Uu+lq jRjaxncr9frJjsOi9SHN0Vu5vJdOkzVDLwRQL7WP1RwNGgNE4evuTuTDNLqNs9+wc/Fg oHV6g3zoYdMAR9gF7gjjuzDtfgTxJGcZR6xz7jKmAc0caQJEIlhPoe98k8vUQ/wUjakl cVJw== X-Gm-Message-State: AOJu0YzIJG25BwXPnVLtpz1O+639eWj0qGaDIzlBmFjtpxc8ACKH1Owy Cj2UIIspzyVvCkCGth685Sc= X-Google-Smtp-Source: AGHT+IFCfEF1OcJVXC91v9wTngSEZysjZQZy9YGFIIEy71p9RiCH8h/bm+ZKHozDwnlvl4EjDEm4PA== X-Received: by 2002:a17:906:1090:b0:99b:c8db:d92f with SMTP id u16-20020a170906109000b0099bc8dbd92fmr12220359eju.69.1692862641992; Thu, 24 Aug 2023 00:37:21 -0700 (PDT) Received: from coolup54.lin.mbt.kalray.eu ([217.181.231.53]) by smtp.gmail.com with ESMTPSA id n12-20020a170906688c00b00982be08a9besm10836815ejr.172.2023.08.24.00.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 00:37:21 -0700 (PDT) From: jhascoet X-Google-Original-From: jhascoet To: olivier.matz@6wind.com Cc: dev@dpdk.org, Julien Hascoet Subject: [PATCH] app: enhance error check if enqueue fail in test_mbuf test_refcnt_iter Date: Thu, 24 Aug 2023 09:37:18 +0200 Message-Id: <20230824073718.718872-1-jhascoet@kalray.eu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230810160941.3895855-1-jhascoet@kalray.eu> References: <20230810160941.3895855-1-jhascoet@kalray.eu> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 24 Aug 2023 10:52:56 +0200 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Julien Hascoet 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 --- 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