From patchwork Tue Aug 7 02:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "De Lara Guarch, Pablo" X-Patchwork-Id: 43614 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 448B12BF4; Tue, 7 Aug 2018 12:06:50 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 21C8E23D; Tue, 7 Aug 2018 12:06:46 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2018 03:06:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,454,1526367600"; d="scan'208";a="81331697" Received: from silpixa00399466.ir.intel.com (HELO silpixa00399466.ger.corp.intel.com) ([10.237.223.220]) by orsmga002.jf.intel.com with ESMTP; 07 Aug 2018 03:06:29 -0700 From: Pablo de Lara To: bruce.richardson@intel.com Cc: dev@dpdk.org, Pablo de Lara , stable@dpdk.org Date: Tue, 7 Aug 2018 03:00:04 +0100 Message-Id: <20180807020004.9218-1-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] hash: fix Doxygen X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_hash_lookup_data() and rte_hash_lookup_with_hash_data() functions return the index of the table where the key is stored when this is found, and not 0 as the Doxygen currently states. Also, these functions, and rte_hash_get_key_with_position() return negative values when keys are not found (-EINVAL and -ENOENT), where the minus sign was missing. Fixes: 473d1bebce43 ("hash: allow to store data in hash table") Fixes: 6dc34e0afe7a ("hash: retrieve a key given its position") Cc: stable@dpdk.org Reported-by: Petr Houska Signed-off-by: Pablo de Lara --- lib/librte_hash/rte_hash.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/librte_hash/rte_hash.h b/lib/librte_hash/rte_hash.h index 1f1a276df..f2e50ab1a 100644 --- a/lib/librte_hash/rte_hash.h +++ b/lib/librte_hash/rte_hash.h @@ -268,8 +268,8 @@ rte_hash_del_key_with_hash(const struct rte_hash *h, const void *key, hash_sig_t * Output containing a pointer to the key * @return * - 0 if retrieved successfully - * - EINVAL if the parameters are invalid. - * - ENOENT if no valid key is found in the given position. + * - -EINVAL if the parameters are invalid. + * - -ENOENT if no valid key is found in the given position. */ int rte_hash_get_key_with_position(const struct rte_hash *h, const int32_t position, @@ -286,9 +286,11 @@ rte_hash_get_key_with_position(const struct rte_hash *h, const int32_t position, * @param data * Output with pointer to data returned from the hash table. * @return - * 0 if successful lookup - * - EINVAL if the parameters are invalid. - * - ENOENT if the key is not found. + * - A positive value that can be used by the caller as an offset into an + * array of user data. This value is unique for this key, and is the same + * value that was returned when the key was added. + * - -EINVAL if the parameters are invalid. + * - -ENOENT if the key is not found. */ int rte_hash_lookup_data(const struct rte_hash *h, const void *key, void **data); @@ -307,9 +309,11 @@ rte_hash_lookup_data(const struct rte_hash *h, const void *key, void **data); * @param data * Output with pointer to data returned from the hash table. * @return - * 0 if successful lookup - * - EINVAL if the parameters are invalid. - * - ENOENT if the key is not found. + * - A positive value that can be used by the caller as an offset into an + * array of user data. This value is unique for this key, and is the same + * value that was returned when the key was added. + * - -EINVAL if the parameters are invalid. + * - -ENOENT if the key is not found. */ int rte_hash_lookup_with_hash_data(const struct rte_hash *h, const void *key,