From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2678B45A78; Tue, 15 Oct 2024 19:11:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1260A400D7; Tue, 15 Oct 2024 19:11:56 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id DC78C400D6 for ; Tue, 15 Oct 2024 19:11:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729012314; x=1760548314; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=M3DBR8tLfHUPehsymGTOMkzf/tkRjsjF18yVGU33O/I=; b=OqNIvOjw+Y7p58il7afhcsc+LkgKJ3J5malxo0n9seD1PaGRk35YE9Zl +/2FOTMLt81dMiKS4PFRjGxXD4AHQwzttcHUaZ2c7yH2acCXmdncWmqbB NqpOn2LeVleD5SvpMIFaG6nHxSEY7ax+iOHYGE2FxxD5jIV61+H1ekksz CGoEa52zBb8KkUqMARV8iu+hWgFFKAJNO0ev95Tfb+DrfnwpWph3ikfsr 4qx9Y1Usf9fQf1UVqwPqmvAvo7AgB3PE1zyEXj/MxrPAy2wn/r+TJW4I7 wlhiKWu25dBXZ0uKE000F5tR5JJ1mK4Oow/u9angcoleezxFU9V1a7r/m w==; X-CSE-ConnectionGUID: NAB5mgVTSkWI3Bn2YHWnGQ== X-CSE-MsgGUID: QtqpZyJCSKWdyu6vBo5QwQ== X-IronPort-AV: E=McAfee;i="6700,10204,11225"; a="27901963" X-IronPort-AV: E=Sophos;i="6.11,205,1725346800"; d="scan'208";a="27901963" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2024 10:11:53 -0700 X-CSE-ConnectionGUID: lqa2898rTEOhO+IUG5qJ8g== X-CSE-MsgGUID: y5Olvxb7SgCf+1SqNPgl2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,205,1725346800"; d="scan'208";a="83026583" Received: from unknown (HELO silpixa00401176.ir.intel.com) ([10.243.22.76]) by orviesa004.jf.intel.com with ESMTP; 15 Oct 2024 10:11:52 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: david.marchand@redhat.com Subject: [PATCH] fib: fix return value behavior Date: Tue, 15 Oct 2024 17:11:43 +0000 Message-ID: <20241015171143.497709-1-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Fixes the behavior of the rte_fib_rcu_qsbr_add() function regarding its return value to align with the existing rte_fib API. Fixes: 96c3d06a3547 ("fib: implement RCU rule reclamation") Signed-off-by: Vladimir Medvedkin --- lib/fib/dir24_8.c | 21 ++++++++------------- lib/fib/rte_fib.h | 8 ++++---- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/fib/dir24_8.c b/lib/fib/dir24_8.c index 2fb01a3f99..73a59f3397 100644 --- a/lib/fib/dir24_8.c +++ b/lib/fib/dir24_8.c @@ -617,15 +617,11 @@ dir24_8_rcu_qsbr_add(struct dir24_8_tbl *dp, struct rte_fib_rcu_config *cfg, struct rte_rcu_qsbr_dq_parameters params = {0}; char rcu_dq_name[RTE_RCU_QSBR_DQ_NAMESIZE]; - if (dp == NULL || cfg == NULL) { - rte_errno = EINVAL; - return 1; - } + if (dp == NULL || cfg == NULL) + return -EINVAL; - if (dp->v != NULL) { - rte_errno = EEXIST; - return 1; - } + if (dp->v != NULL) + return -EEXIST; if (cfg->mode == RTE_FIB_QSBR_MODE_SYNC) { /* No other things to do. */ @@ -648,12 +644,11 @@ dir24_8_rcu_qsbr_add(struct dir24_8_tbl *dp, struct rte_fib_rcu_config *cfg, dp->dq = rte_rcu_qsbr_dq_create(¶ms); if (dp->dq == NULL) { FIB_LOG(ERR, "LPM defer queue creation failed"); - return 1; + return -rte_errno; } - } else { - rte_errno = EINVAL; - return 1; - } + } else + return -EINVAL; + dp->rcu_mode = cfg->mode; dp->v = cfg->v; diff --git a/lib/fib/rte_fib.h b/lib/fib/rte_fib.h index 9732ace2e4..c49b02ab11 100644 --- a/lib/fib/rte_fib.h +++ b/lib/fib/rte_fib.h @@ -266,10 +266,10 @@ rte_fib_select_lookup(struct rte_fib *fib, enum rte_fib_lookup_type type); * @param cfg * RCU QSBR configuration * @return - * On success - 0 - * On error - 1 with error code set in rte_errno. - * Possible rte_errno codes are: - * - EINVAL - invalid pointer + * 0 on success + * Negative otherwise + * Possible error codes are: + * - EINVAL - invalid parameters * - EEXIST - already added QSBR * - ENOMEM - memory allocation failure * - ENOTSUP - not supported by configured dataplane algorithm -- 2.43.0