From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 85F68460C5;
	Mon, 20 Jan 2025 13:22:20 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 7212E40E3A;
	Mon, 20 Jan 2025 13:22:20 +0100 (CET)
Received: from mail-ej1-f97.google.com (mail-ej1-f97.google.com
 [209.85.218.97]) by mails.dpdk.org (Postfix) with ESMTP id A3AFE40E1D
 for <dev@dpdk.org>; Mon, 20 Jan 2025 13:22:19 +0100 (CET)
Received: by mail-ej1-f97.google.com with SMTP id
 a640c23a62f3a-ab2bb0822a4so883764966b.3
 for <dev@dpdk.org>; Mon, 20 Jan 2025 04:22:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind.com; s=google; t=1737375739; x=1737980539; darn=dpdk.org;
 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=hPWOCx4ZFq41JWE7EfN9qsppLlXyG4ZxwzqtH0jGTY4=;
 b=D12wPhq2Nh/+x8yGnRGfD9JjnYvXR8/5r606gp2Nr/jAvx2skU6zUGeB95neJiBP+J
 qAnTYef7zo9VFVBfxmZPgzLkomSjiNtoirmcsEbeCkJY6EjH9XVepkdrgCPPCx94WdGg
 LNztw6IFMHrmmHPVKCAUHmKvGriO2/SIPj4TvKUOFbvjGYwqPLJodohJhEVNZYVTkBiq
 X7zhT5jb/5d9LfNyWB3oZIH3TvkEqC98siwxAHZNz/a0Xlwwy7fFE3jhXTTwa09vMUyb
 fu4Kh/LO7IbStzGX2j8zn4qkD0z4yaKGK+ifgKlrrQbD5R+sy+FHH2zotzZ0almrPLm6
 9hSw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737375739; x=1737980539;
 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=hPWOCx4ZFq41JWE7EfN9qsppLlXyG4ZxwzqtH0jGTY4=;
 b=gP8NNVE4Xfpb9luOJ8uBCt/ZLlBTI9LBI5vAJOuHjNfarTOwT7tgZFHsZWPdJvpk0Z
 YCRrXPugX0Fg1iXZiyAp0VPD22f904ejZA8oqHzxd/w/3dE9GrLwnvvEj1QZERtl08Z0
 GM4NVcPKcyRtCS90w+kA62lh1rt/M8UpIlOszFw54u+7PTRdw9uW0L+aKaToOieQA3Ri
 L81noLcekGUgxYxRFuDBMHIvGjzC2S4aQ9uJUNhaS6MXTjpWfh00YN/mYeJsg5W/PRn+
 vymD1yONg02q9yf9Wy1+/KTYQiye7dSTZvHfpz2u7vQs53046z7e3xaK0EL3oJ5bd12t
 qROw==
X-Gm-Message-State: AOJu0Yz0t2Vme8f+oJc7MJu58qZkeoS+gnSxIeDnqFmO+Nj6Tayz+/ZZ
 HUzQl9p/VGnpHj3ruRJ8MDFBsF5l/8XVLgXCE7yOLEbxsFt9Vly1Nq5UHeXTLDS/k1+cgXwcc9T
 yd4uEBu+mHfqFQ7mZrbAEslTeaISCx8hZw/esiVw4
X-Gm-Gg: ASbGncvqd/UuTACxi/BhH3rnDT7IwcjZc7KortoF/Ta/gNpSVQy5mig0crjsG9bq7qu
 /gk1CBPXHADwaDj+m8OWsoo3XiSuw6IQEGaue8PgnzRdNqpj9he6lyklXMdGrmVkpKgdU4tKrtD
 cvnAkD+a2sOnBziufJFjGFaSZAaPwB+T4sd1v69EB9nzoZFS49DVMuho128Wlx7lKF1uPP7K//u
 lUYBc1OMAKXMbppU8GVZoEJVQsLniujOxJYZfmOt/Rtk3znl2uX0c4bwCFsEL/lr/ieoqo9o0ax
 I5x57BSmETKqnsYmPvAIAAY3IeNAeGVpcDfa0qc=
X-Google-Smtp-Source: AGHT+IGXX9YiysCXyKOVwJ9ejie2NsDcX8y4KsrUMOTvXB9Cw9CpjOftYFq/ENSPoaa12MeG8Ksgj1dhTrzu
X-Received: by 2002:a17:907:1ca2:b0:aac:4325:a604 with SMTP id
 a640c23a62f3a-ab38b3d63a6mr1250600566b.49.1737375739043; 
 Mon, 20 Jan 2025 04:22:19 -0800 (PST)
Received: from smtpservice.6wind.com ([185.13.181.2])
 by smtp-relay.gmail.com with ESMTP id
 a640c23a62f3a-ab385207359sm37165366b.129.2025.01.20.04.22.18; 
 Mon, 20 Jan 2025 04:22:19 -0800 (PST)
X-Relaying-Domain: 6wind.com
Received: from localhost (rainbow.dev.6wind.com [10.17.1.165])
 by smtpservice.6wind.com (Postfix) with ESMTP id DC083138E7;
 Mon, 20 Jan 2025 13:22:18 +0100 (CET)
From: Ariel Otilibili <ariel.otilibili@6wind.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,
 David Marchand <david.marchand@redhat.com>,
 Ariel Otilibili <ariel.otilibili@6wind.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
 =?UTF-8?q?Morten=20Br=C3=B8rup?= <mb@smartsharesystems.com>,
 Konstantin Ananyev <konstantin.ananyev@huawei.com>
Subject: [PATCH v2 1/2] mempool: fix rte_errno in rte_mempool_create_empty
Date: Mon, 20 Jan 2025 13:21:55 +0100
Message-Id: <20250120122156.2480524-2-ariel.otilibili@6wind.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20250120122156.2480524-1-ariel.otilibili@6wind.com>
References: <20250119174643.2162110-1-ariel.otilibili@6wind.com>
 <20250120122156.2480524-1-ariel.otilibili@6wind.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

When returning from rte_mempool_set_ops_byname(), rte_errno is not set
for error exits.

The API requires rte_errno to be set in that case.

Bugzilla ID: 1559
Fixes: c2c6b2f41305 ("mempool: fix default ops for an empty mempool")
Link: https://doc.dpdk.org/api/rte__mempool_8h.html#a82e301ee33ed7a263ceb4582655dc3ea
Signed-off-by: Ariel Otilibili <ariel.otilibili@6wind.com>
---
 lib/mempool/rte_mempool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index d8e39e5c2072..1e4f24783c0b 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -928,8 +928,10 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
 	else
 		ret = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL);
 
-	if (ret)
+	if (ret) {
+		rte_errno = -ret;
 		goto exit_unlock;
+	}
 
 	/*
 	 * local_cache pointer is set even if cache_size is zero.
-- 
2.30.2