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 F27A7A04C2; Mon, 25 Nov 2019 17:01:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5ACCF2952; Mon, 25 Nov 2019 17:01:10 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 5155D28EE for ; Mon, 25 Nov 2019 17:01:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574697667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HOrma9JPSKmhj3vnfIY+viWN3u0RKT1pBuXfWRkuFvY=; b=XPpqY4To3xcVsEvy6bXoHbJVBx9xi4vFHDD9bChJ95h52LaiEihxvTBZsSzyJhucbnNJec KSmUHpegJlCCumlstAXJgBElMesFPnqp/Sbe9hEN7Zj+bmtj4wkZj4W47eYi2NPgGxVQyw KwFejanacOL0ZvySkc6eHf0629i+igo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-vC3JwjPJPAia9hymfjptTw-1; Mon, 25 Nov 2019 11:01:04 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0C4AA1856A91; Mon, 25 Nov 2019 16:01:03 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B920B5D9CD; Mon, 25 Nov 2019 16:01:01 +0000 (UTC) From: Aaron Conole To: "Amber\, Kumar" Cc: "dev\@dpdk.org" , "Wang\, Yipeng1" , "Yigit\, Ferruh" , "thomas\@monjalon.net" , "Van Haaren\, Harry" , "Thakur\, Sham Singh" References: <20191122182100.15631-1-kumar.amber@intel.com> <20191125110805.28187-1-kumar.amber@intel.com> Date: Mon, 25 Nov 2019 11:01:00 -0500 In-Reply-To: (Kumar Amber's message of "Mon, 25 Nov 2019 15:50:50 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: vC3JwjPJPAia9hymfjptTw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v3] 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" "Amber, Kumar" writes: > Hi all , > > I want to report random untouched unit test cases failed by Jenkins > . pls can you guys check why it is unstable ? > Every upload shows random test failed . I'll work on the service_autotest patch. > http://mails.dpdk.org/archives/test-report/2019-November/109120.html=20 > > Regards > Amber=20 > > -----Original Message----- > From: dev On Behalf Of Kumar Amber > Sent: Monday, November 25, 2019 4:38 PM > To: dev@dpdk.org > Cc: Wang, Yipeng1 > Subject: [dpdk-dev] [PATCH v3] hash: added a new API to hash to query key= id > > Adding new API function to query the maximum key ID that could possibly r= eturned by rte_hash_add_key and rte_hash_add_key_with_hash. When RTE_HASH_E= XTRA_FLAGS_MULTI_WRITER_ADD > is set, the maximum key id is larger than the entry count specified by th= e 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_cuck= oo_hash.c > index 87a4c01f2..3a94f10b8 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 *= key) > =09return h->hash_func(key, h->key_len, h->hash_func_init_val); } > =20 > +uint32_t > +rte_hash_max_key_id(const struct rte_hash *h) { > +=09RETURN_IF_TRUE((h =3D=3D NULL), -EINVAL); > +=09if (h->use_local_cache) > +=09=09/* > +=09=09 * Increase number of slots by total number of indices > +=09=09 * that can be stored in the lcore caches > +=09=09 */ > +=09=09return (h->entries + ((RTE_MAX_LCORE - 1) * > +=09=09=09=09=09(LCORE_CACHE_SIZE - 1))); > +=09else > +=09=09return 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..c87861e72 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_ha= sh_count(const struct rte_hash *h); > =20 > +/** > + * @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 Id key slots present in the table= . > + */ > +__rte_experimental > +uint32_t > +rte_hash_max_key_id(const struct rte_hash *h); > + > /** > * Add a key-value pair to an existing hash table. > * This operation is not multi-thread safe @@ -234,7 +251,9 @@ rte_hash_= add_key_with_hash_data(const struct rte_hash *h, const void *key, > * - -EINVAL if the parameters are invalid. > * - -ENOSPC if there is no space in the hash for this key. > * - 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. > + * array of user data. This value is unique for this key. This > + * unique key id may be larger than the user specified entry count > + * when RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is set. > */ > int32_t > rte_hash_add_key(const struct rte_hash *h, const void *key); @@ -256,7 += 275,9 @@ rte_hash_add_key(const struct rte_hash *h, const void *key); > * - -EINVAL if the parameters are invalid. > * - -ENOSPC if there is no space in the hash for this key. > * - 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. > + * array of user data. This value is unique for this key. This > + * unique key ID may be larger than the user specified entry count > + * when RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is set. > */ > int32_t > rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key, ha= sh_sig_t sig); diff --git a/lib/librte_hash/rte_hash_version.map b/lib/libr= te_hash/rte_hash_version.map > index 734ae28b0..562ceb8bc 100644 > --- a/lib/librte_hash/rte_hash_version.map > +++ b/lib/librte_hash/rte_hash_version.map > @@ -58,5 +58,6 @@ EXPERIMENTAL { > =09global: > =20 > =09rte_hash_free_key_with_position; > + rte_hash_max_key_id; > =20 > }; > -- > 2.17.1