From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 747D2A04DE; Wed, 27 Nov 2019 02:59:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AC9311B9A9; Wed, 27 Nov 2019 02:59:54 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8E09D1B994 for ; Wed, 27 Nov 2019 02:59:53 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2019 17:59:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,247,1571727600"; d="scan'208";a="408853401" Received: from orsmsx109.amr.corp.intel.com ([10.22.240.7]) by fmsmga005.fm.intel.com with ESMTP; 26 Nov 2019 17:59:52 -0800 Received: from orsmsx156.amr.corp.intel.com (10.22.240.22) by ORSMSX109.amr.corp.intel.com (10.22.240.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 26 Nov 2019 17:59:51 -0800 Received: from orsmsx104.amr.corp.intel.com ([169.254.4.122]) by ORSMSX156.amr.corp.intel.com ([169.254.8.101]) with mapi id 14.03.0439.000; Tue, 26 Nov 2019 17:59:51 -0800 From: "Wang, Yipeng1" To: "Amber, Kumar" , "dev@dpdk.org" Thread-Topic: [PATCH v4] hash: added a new API to hash to query key id Thread-Index: AQHVpAK3uMBBTbubTU20kjSBqUx4WKeeQrew Date: Wed, 27 Nov 2019 01:59:50 +0000 Message-ID: References: <20191122182100.15631-1-kumar.amber@intel.com> <20191126023913.16425-1-kumar.amber@intel.com> In-Reply-To: <20191126023913.16425-1-kumar.amber@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzQ4ODMyNzEtM2M5Mi00MWM5LTkzMWYtZTA0YTUwZGEzOGEzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS1NFQlwvNXlXMG9JbUdIZzY0N1lsSEVRQVZFOTF3bVRPZUFCR3VXcWxRZk0rUVlPV01Sa0U1MFwveFJrNTBvODM1In0= x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4] hash: added a new API to hash to query key id 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" >-----Original Message----- >From: Amber, Kumar >Sent: Monday, November 25, 2019 6:39 PM >To: dev@dpdk.org >Cc: Wang, Yipeng1 >Subject: [PATCH v4] hash: added a new API to hash to query key id > >Adding new API function to query the maximum key ID >that could possibly be returned by rte_hash_add_key and >rte_hash_add_key_with_hash. When RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD >is set, the maximum key id is larger than the entry count specified >by the user. > >Signed-off-by: Kumar Amber >--- > lib/librte_hash/rte_cuckoo_hash.c | 15 +++++++++++++++ > lib/librte_hash/rte_hash.h | 25 +++++++++++++++++++++++-- > lib/librte_hash/rte_hash_version.map | 1 + > 3 files changed, 39 insertions(+), 2 deletions(-) > >diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cucko= o_hash.c >index 87a4c01f2..41a081f10 100644 >--- a/lib/librte_hash/rte_cuckoo_hash.c >+++ b/lib/librte_hash/rte_cuckoo_hash.c >@@ -506,6 +506,21 @@ rte_hash_hash(const struct rte_hash *h, const void *k= ey) > return h->hash_func(key, h->key_len, h->hash_func_init_val); > } > >+int32_t >+rte_hash_max_key_id(const struct rte_hash *h) >+{ >+ RETURN_IF_TRUE((h =3D=3D NULL), -EINVAL); >+ if (h->use_local_cache) >+ /* >+ * Increase number of slots by total number of indices >+ * that can be stored in the lcore caches >+ */ >+ return (h->entries + ((RTE_MAX_LCORE - 1) * >+ (LCORE_CACHE_SIZE - 1))); >+ else >+ return h->entries; >+} >+ > int32_t > rte_hash_count(const struct rte_hash *h) > { >diff --git a/lib/librte_hash/rte_hash.h b/lib/librte_hash/rte_hash.h >index 0d73370dc..f93203122 100644 >--- a/lib/librte_hash/rte_hash.h >+++ b/lib/librte_hash/rte_hash.h >@@ -164,6 +164,23 @@ rte_hash_reset(struct rte_hash *h); > int32_t > rte_hash_count(const struct rte_hash *h); > >+/** >+ * @warning >+ * @b EXPERIMENTAL: this API may change without prior notice >+ * >+ * Return the maximum key value ID that could possibly be returned by >+ * rte_hash_add_key function. >+ * >+ * @param h >+ * Hash table to query from >+ * @return >+ * - -EINVAL if parameters are invalid >+ * - A value indicating the max key of Id key slots present in the tabl= e. >+ */ [Wang, Yipeng] typo: key of id -> key Id of Other than this: Acked-by: Yipeng Wang