From patchwork Thu Aug 10 16:09:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jhascoet X-Patchwork-Id: 130267 X-Patchwork-Delegate: david.marchand@redhat.com 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 AA81B43063; Mon, 14 Aug 2023 16:07:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5D7E43293; Mon, 14 Aug 2023 16:07:38 +0200 (CEST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by mails.dpdk.org (Postfix) with ESMTP id 3963940691 for ; Thu, 10 Aug 2023 18:09:44 +0200 (CEST) Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2b9bee2d320so16816111fa.1 for ; Thu, 10 Aug 2023 09:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691683783; x=1692288583; 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=vNUJtctEe9Fb/DWhLDmJ4i4ahTOndz0EhBeq9LlgZk0=; b=qg/FskRbJt+hK2vTMmN1KWyBzNtjfapYKK0Og8E1/6DXoQsOe9lsOtzj90NCvVLan3 80mWa7S3OiRdtrWsRNNAdkxTjlbC/K2Vuya1xZhxaWWFw2UpgaHBS2QcWBCqhfjiENe1 4EMV/WGm3rpeHIJ/jlmk/1nJMNdABO/nCiTjAaexDYE2Ls28ULmhN6LWwtbh9XnRRmBJ pmHqdZsiT17UQggq4+RJpOnUGx0GdVkRFIpZbf3yuR1raxnDnrTIz1pCZ3xygpTzF4IZ HIPlIHaKmUDNlHKob3bI1gvTNQNXL9GnHKubT097czWovhtZEEjoQf7/Z8dgKN2S/ikZ 1CAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691683783; x=1692288583; 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=vNUJtctEe9Fb/DWhLDmJ4i4ahTOndz0EhBeq9LlgZk0=; b=T6tXRK2/01aNNuekyG+VXgepvhFc2Ockk9XQ/HOSc4lF4Vtw0L5oLDqr6x/x8bO7Tc zinWC4ooquvp3xvJwnLsmqlkw9eHD+0TXt0twpMUZHCReXOosqJUoyBeJRb+XeKTtAv1 94uj1vPsiph6KHy5ChVmWzJDeElw/hgGNkKd2204W76K4j2GP26dJ6E584HsProm/s/K XqCuw3cDYoN+vHc6Qwv49tbUbR8ltQ/aVscQkoUWfxxmIU358SdB5/P2bsIZoT3A2bdy EcTEIGjKPXXF54pA+lc473AoUSFxn35Z5UZhkJzWIjMrU5PeW19vkMeiM8WW9yh7KfTo 8ATQ== X-Gm-Message-State: AOJu0Yy2kAtklJ7bPRNvZ9dP2epOTHmDxG2E/DIrgmZv4ohF5/zYJL7g X3YIylQOfakWgcqm+KSQVeE= X-Google-Smtp-Source: AGHT+IFlEtpoPxxqvCqzrkXlaopfNtBp2/vv08Lsr0tbDWjKgG7TCINR0LiTNTD8ZlqfllMRLcYv8Q== X-Received: by 2002:a2e:320d:0:b0:2b9:4418:b46e with SMTP id y13-20020a2e320d000000b002b94418b46emr2582341ljy.21.1691683783298; Thu, 10 Aug 2023 09:09:43 -0700 (PDT) Received: from coolup54.lin.mbt.kalray.eu ([217.181.231.53]) by smtp.gmail.com with ESMTPSA id o20-20020a17090611d400b0099bd6026f45sm1112994eja.198.2023.08.10.09.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 09:09:42 -0700 (PDT) From: jhascoet X-Google-Original-From: jhascoet To: david.marchand@redhat.com Cc: dev@dpdk.org, Julien Hascoet Subject: [PATCH] app: fix silent enqueue fail in test_mbuf test_refcnt_iter Date: Thu, 10 Aug 2023 18:09:41 +0200 Message-Id: <20230810160941.3895855-1-jhascoet@kalray.eu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230810060030.3759835-1-jhascoet@kalray.eu> References: <20230810060030.3759835-1-jhascoet@kalray.eu> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 14 Aug 2023 16:07:37 +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 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 --- 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);