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 69A1543B3B; Fri, 16 Feb 2024 13:42:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F0A98432C8; Fri, 16 Feb 2024 13:42:05 +0100 (CET) Received: from fhigh2-smtp.messagingengine.com (fhigh2-smtp.messagingengine.com [103.168.172.153]) by mails.dpdk.org (Postfix) with ESMTP id 82BFE43001 for ; Fri, 16 Feb 2024 13:42:04 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id D1ED5114009A; Fri, 16 Feb 2024 07:42:03 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 16 Feb 2024 07:42:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1708087323; x=1708173723; bh=65iFEPcych7TQvYw4VSN6KtOkOX3UvWYDLwDf6w8uHg=; b= pQXj4oGVF+Sra6GPH/qQC0ZdRGS/0F/K0ePVeteLG0es0rS0gWv2KRHZ2aWgpAks Csv7QzhYGp5W77fRZJCchrcXn/CgUAwMj+p1+AL5PEYO65zsZTkghNxqIrctE5KG /PtDclpwnOV6VRgamHkyK8m3IxP72bFYrmDa77MY2KyH+qAPJLvS0BLWI2C5A3DQ /ZEWY850r5SIyQz9GlsIPxRvpewWq+/58cDeO0zCXpa25xklF950etinaYxr5hi+ 9Kgb6xePOVmzJ/UlnPkX3EAkGbbFiLDFNNG5hO0R61FNTCArGRWh0IVE/wv+0qx6 oQ9Se/HLRRrFKECJb22piQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1708087323; x= 1708173723; bh=65iFEPcych7TQvYw4VSN6KtOkOX3UvWYDLwDf6w8uHg=; b=O XVVKi7Laa0XKpv6DPISXn6oWYk3yNse3ustBwkV85xZu2uAEmafQQpETD7cLDlLy w5Yd9imOXZuClGEsGMz+PNutQWP11MyVYkf9c9ZrxBmmsTNB4h9xJHU9a0yhDyV/ trw5X8HB9839A+1PK2y7eybGn3K8b/i6qwga7lNTO9mQifi51KDfhLpIvOc0xtV+ igKNT9QstXz6AQZ0lZ6vvPH02yBtunofA9RwD9Er/dDqd0Y1mf7tzDslM/j1xxmi LJdu3Na69ab+8jzLhjUfZvwnk9FCIgjSp/hFZepImaoDnXCUD1Q9iJ7TOZVbTWP9 vbvp4TVMbqU568H09bJcQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddvgdegvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkfgjfhgggfgtsehtqhertddttddunecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepfefhjeeluedvvedtuddtuedtvefhieejtefhffeujefhteduudev tdektdeikeffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 16 Feb 2024 07:42:02 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: Abdullah =?ISO-8859-1?Q?=D6mer_Yama=E7?= , Honnappa Nagarahalli , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin , Abdullah =?ISO-8859-1?Q?=D6mer_Yama=E7?= Subject: Re: [PATCH] lib/hash,lib/rcu: feature hidden key count in hash Date: Fri, 16 Feb 2024 13:41:59 +0100 Message-ID: <40388235.10thIPus4b@thomas> In-Reply-To: <20240207153340.34146-1-aomeryamac@gmail.com> References: <20240207153340.34146-1-aomeryamac@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" 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 Any review please? 07/02/2024 16:33, Abdullah =D6mer Yama=E7: > This patch introduce a new API to get the hidden key count in the hash > table if the rcu qsbr is enabled. When using rte_hash_count with rcu > qsbr enabled, it will return the number of elements that are not in the > free queue. Unless rte_rcu_qsbr_dq_reclaim is called, the number of > elements in the defer queue will not be counted and freed. Therefore I > added a new API to get the number of hidden (defer queue) elements > in the hash table. Then the user can calculate the total number of > elements that are available in the hash table. >=20 > Signed-off-by: Abdullah =D6mer Yama=E7 >=20 > --- > Cc: Honnappa Nagarahalli > Cc: Yipeng Wang > Cc: Sameh Gobriel > Cc: Bruce Richardson > Cc: Vladimir Medvedkin > --- > lib/hash/rte_cuckoo_hash.c | 9 +++++++++ > lib/hash/rte_hash.h | 13 +++++++++++++ > lib/hash/version.map | 1 + > lib/rcu/rte_rcu_qsbr.c | 8 ++++++++ > lib/rcu/rte_rcu_qsbr.h | 11 +++++++++++ > lib/rcu/version.map | 1 + > 6 files changed, 43 insertions(+) >=20 > diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c > index 70456754c4..3553f3efc7 100644 > --- a/lib/hash/rte_cuckoo_hash.c > +++ b/lib/hash/rte_cuckoo_hash.c > @@ -555,6 +555,15 @@ rte_hash_max_key_id(const struct rte_hash *h) > return h->entries; > } > =20 > +int32_t > +rte_hash_dq_count(const struct rte_hash *h) > +{ > + if (h->dq =3D=3D NULL) > + return -EINVAL; > + > + return rte_rcu_qsbr_dq_count(h->dq); > +} > + > int32_t > rte_hash_count(const struct rte_hash *h) > { > diff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h > index 7ecc021111..8ea97e297d 100644 > --- a/lib/hash/rte_hash.h > +++ b/lib/hash/rte_hash.h > @@ -193,6 +193,19 @@ rte_hash_free(struct rte_hash *h); > void > rte_hash_reset(struct rte_hash *h); > =20 > + > +/** > + * Return the number of records in the defer queue of the hash table=20 > + * if RCU is enabled. > + * @param h > + * Hash table to query from > + * @return > + * - -EINVAL if parameters are invalid > + * - A value indicating how many records were inserted in the table. > + */ > +int32_t > +rte_hash_dq_count(const struct rte_hash *h); > + > /** > * Return the number of keys in the hash table > * @param h > diff --git a/lib/hash/version.map b/lib/hash/version.map > index 6b2afebf6b..7f7b158cf1 100644 > --- a/lib/hash/version.map > +++ b/lib/hash/version.map > @@ -9,6 +9,7 @@ DPDK_24 { > rte_hash_add_key_with_hash; > rte_hash_add_key_with_hash_data; > rte_hash_count; > + rte_hash_dq_count; > rte_hash_crc32_alg; > rte_hash_crc_set_alg; > rte_hash_create; > diff --git a/lib/rcu/rte_rcu_qsbr.c b/lib/rcu/rte_rcu_qsbr.c > index bd0b83be0c..89f8da4c4c 100644 > --- a/lib/rcu/rte_rcu_qsbr.c > +++ b/lib/rcu/rte_rcu_qsbr.c > @@ -450,6 +450,14 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, = unsigned int n, > return 0; > } > =20 > +/** > + * Return the number of entries in a defer queue. > + */ > +unsigned int rte_rcu_qsbr_dq_count(struct rte_rcu_qsbr_dq *dq) > +{ > + return rte_ring_count(dq->r); > +} > + > /* Delete a defer queue. */ > int > rte_rcu_qsbr_dq_delete(struct rte_rcu_qsbr_dq *dq) > diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h > index 23c9f89805..ed5a590edd 100644 > --- a/lib/rcu/rte_rcu_qsbr.h > +++ b/lib/rcu/rte_rcu_qsbr.h > @@ -794,6 +794,17 @@ int > rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n, > unsigned int *freed, unsigned int *pending, unsigned int *available); > =20 > +/** > + * Return the number of entries in a defer queue. > + * > + * @param dq > + * Defer queue. > + * @return > + * The number of entries in the defer queue. > + */ > +unsigned int > +rte_rcu_qsbr_dq_count(struct rte_rcu_qsbr_dq *dq); > + > /** > * Delete a defer queue. > * > diff --git a/lib/rcu/version.map b/lib/rcu/version.map > index 982ffd59d9..f410ab41e7 100644 > --- a/lib/rcu/version.map > +++ b/lib/rcu/version.map > @@ -5,6 +5,7 @@ DPDK_24 { > rte_rcu_qsbr_dq_create; > rte_rcu_qsbr_dq_delete; > rte_rcu_qsbr_dq_enqueue; > + rte_rcu_qsbr_dq_count; > rte_rcu_qsbr_dq_reclaim; > rte_rcu_qsbr_dump; > rte_rcu_qsbr_get_memsize; >=20