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 79846432EA;
	Thu,  9 Nov 2023 20:46:14 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 7801B40DC9;
	Thu,  9 Nov 2023 20:46:10 +0100 (CET)
Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com
 [209.85.167.173])
 by mails.dpdk.org (Postfix) with ESMTP id 37DDD4026B
 for <dev@dpdk.org>; Thu,  9 Nov 2023 20:46:09 +0100 (CET)
Received: by mail-oi1-f173.google.com with SMTP id
 5614622812f47-3b565722c0eso705147b6e.2
 for <dev@dpdk.org>; Thu, 09 Nov 2023 11:46:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1699559168;
 x=1700163968; 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=dzO7hXbQ2jqdDptnVyq6Ah0zFTtMVblIxZyUbi0KLfM=;
 b=ZyDVDP5RkuFPz0tIjINQfeTyLSYT7uP9zXPjfyQFTDHw0Dv8uiykoZkSBOtZ9uZGaS
 5OTwVbO4Hd3bvECugDyQ4RxSULjJrqnZgGdMs+nQx+5fHnDJfZgTc6UYT8JbDpKwVyHK
 G0ixfJYAZ83aLhX76nVsF1XXwcuH7J2as82wszkSIazlyYJ/SpOpiwuLa1BgTLnjl+wa
 U/hxhAqzRVV6nzOLc4fpHIB06OogdSz7er4WfPHH19kLRu61i6416TfhPjTD4q/1Lp1U
 AnzInstpMr+9r0kd3HsP2XMKetOf1ZR6E8aNhUwiAnLpeUg/6gZMngHM0b1nB/U5nowa
 mHwg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1699559168; x=1700163968;
 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=dzO7hXbQ2jqdDptnVyq6Ah0zFTtMVblIxZyUbi0KLfM=;
 b=EHkhYHEEe3NazA7EmedylhC7rne173fkVruYVdjWzn2G5/9ApYZ/dqlFIhgPI1XwTr
 TZV9WrbprIUzTspdKRIDwtGLr0cI4oghFHI5xP+uc/2ZJ+hooNASR/ASaJsTccL4sftd
 slvVasvCroCtKE0Zqp4PD6xqwFlVlzqXh3H79+/DQNPOzk086FxhQVS81HFevFsGJsjL
 px2LDrRvpkxv2Ms4gYVTdPBSAuUKqpYqK4z+wo/7OED5RTzvbHx2Vu0hBt5XoBMTQqUU
 9rdoIJF4+mLkSgtcpfTX+Qto5dQ93uxhzqhuI3nJVBN4SnJovgM/RSOl1TAVWK4BJ5pq
 OPGw==
X-Gm-Message-State: AOJu0YxIpoR2tKF95qMcY7MR6v0SLofpUsUCEyJtUnPY1KfjIdsSCItz
 siERu89MF28R3GHgMQt0FKLjq8Biw7HBw/HA198=
X-Google-Smtp-Source: AGHT+IGwVgyrh0+U/yKDCn5G87whYQLIFg1Jnk5u/7JSzgiZ+71wgx0omZjwtWWQ2JDXLTY2AfLvIg==
X-Received: by 2002:a05:6808:2096:b0:3b5:ae0d:b208 with SMTP id
 s22-20020a056808209600b003b5ae0db208mr2985986oiw.6.1699559168095; 
 Thu, 09 Nov 2023 11:46:08 -0800 (PST)
Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141])
 by smtp.gmail.com with ESMTPSA id
 j191-20020a6380c8000000b0059b782e8541sm5176101pgd.28.2023.11.09.11.46.06
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 09 Nov 2023 11:46:07 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 =?UTF-8?q?Morten=20Br=C3=B8rup?= <mb@smartsharesystems.com>,
 Reshma Pattan <reshma.pattan@intel.com>,
 Jianfeng Tan <jianfeng.tan@intel.com>
Subject: [PATCH v5 1/5] pdump: fix setting rte_errno on mp error
Date: Thu,  9 Nov 2023 11:45:53 -0800
Message-Id: <20231109194557.111350-2-stephen@networkplumber.org>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20231109194557.111350-1-stephen@networkplumber.org>
References: <20230921042349.104150-1-stephen@networkplumber.org>
 <20231109194557.111350-1-stephen@networkplumber.org>
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

The response from MP server sets err_value to negative
on error. The convention for rte_errno is to use a positive
value on error. This makes errors like duplicate registration
show up with the correct error value.

Fixes: 660098d61f57 ("pdump: use generic multi-process channel")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/pdump/rte_pdump.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 80b90c6f7d03..e94f49e21250 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -564,9 +564,10 @@ pdump_prepare_client_request(const char *device, uint16_t queue,
 	if (rte_mp_request_sync(&mp_req, &mp_reply, &ts) == 0) {
 		mp_rep = &mp_reply.msgs[0];
 		resp = (struct pdump_response *)mp_rep->param;
-		rte_errno = resp->err_value;
-		if (!resp->err_value)
+		if (resp->err_value == 0)
 			ret = 0;
+		else
+			rte_errno = -resp->err_value;
 		free(mp_reply.msgs);
 	}
 
-- 
2.39.2