<div dir="ltr">Hello, <br>Could you check the last commit?<br>Thanks</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 14, 2024 at 10:04 AM Abdullah Ömer Yamaç <<a href="mailto:aomeryamac@gmail.com">aomeryamac@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<br>Is there any other comment on this? </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 6, 2024 at 1:13 PM Abdullah Ömer Yamaç <<a href="mailto:aomeryamac@gmail.com" target="_blank">aomeryamac@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This patch adds a new feature to the hash library to allow the user to<br>
reclaim the defer queue. This is useful when the user wants to force<br>
reclaim resources that are not being used. This API is only available<br>
if the RCU is enabled.<br>
<br>
Signed-off-by: Abdullah Ömer Yamaç <<a href="mailto:aomeryamac@gmail.com" target="_blank">aomeryamac@gmail.com</a>><br>
---<br>
lib/hash/rte_cuckoo_hash.c | 23 +++++++++++++++++++++++<br>
lib/hash/rte_hash.h | 24 ++++++++++++++++++++++++<br>
lib/hash/version.map | 6 ++++++<br>
3 files changed, 53 insertions(+)<br>
<br>
diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c<br>
index 9cf94645f6..1c360fa38b 100644<br>
--- a/lib/hash/rte_cuckoo_hash.c<br>
+++ b/lib/hash/rte_cuckoo_hash.c<br>
@@ -1588,6 +1588,29 @@ rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg)<br>
return 0;<br>
}<br>
<br>
+int<br>
+rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *freed,<br>
+ unsigned int *pending, unsigned int *available)<br>
+{<br>
+ int ret;<br>
+<br>
+ if (h->hash_rcu_cfg == NULL) {<br>
+ rte_errno = EINVAL;<br>
+ return -1;<br>
+ }<br>
+<br>
+ ret = rte_rcu_qsbr_dq_reclaim(h->dq, h->hash_rcu_cfg->max_reclaim_size,<br>
+ freed, pending, available);<br>
+ if (ret != 0) {<br>
+ HASH_LOG(ERR,<br>
+ "%s: could not reclaim the defer queue in hash table",<br>
+ __func__);<br>
+ return -1;<br>
+ }<br>
+<br>
+ return 0;<br>
+}<br>
+<br>
static inline void<br>
remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt,<br>
unsigned int i)<br>
diff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h<br>
index 7ecc021111..edfa262aca 100644<br>
--- a/lib/hash/rte_hash.h<br>
+++ b/lib/hash/rte_hash.h<br>
@@ -674,6 +674,30 @@ rte_hash_iterate(const struct rte_hash *h, const void **key, void **data, uint32<br>
*/<br>
int rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg);<br>
<br>
+/**<br>
+ * Reclaim resources from the defer queue.<br>
+ * This API reclaim the resources from the defer queue if rcu is enabled.<br>
+ *<br>
+ * @param h<br>
+ * The hash object to reclaim resources.<br>
+ * @param freed<br>
+ * Number of resources that were freed.<br>
+ * @param pending<br>
+ * Number of resources pending on the defer queue.<br>
+ * This number might not be accurate if multi-thread safety is configured.<br>
+ * @param available<br>
+ * Number of resources that can be added to the defer queue.<br>
+ * This number might not be accurate if multi-thread safety is configured.<br>
+ * @return<br>
+ * On success - 0<br>
+ * On error - 1 with error code set in rte_errno.<br>
+ * Possible rte_errno codes are:<br>
+ * - EINVAL - invalid pointer<br>
+ */<br>
+__rte_experimental<br>
+int rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *freed,<br>
+ unsigned int *pending, unsigned int *available);<br>
+<br>
#ifdef __cplusplus<br>
}<br>
#endif<br>
diff --git a/lib/hash/version.map b/lib/hash/version.map<br>
index 6b2afebf6b..fac7f81e6f 100644<br>
--- a/lib/hash/version.map<br>
+++ b/lib/hash/version.map<br>
@@ -48,3 +48,9 @@ DPDK_24 {<br>
<br>
local: *;<br>
};<br>
+<br>
+EXPERIMENTAL {<br>
+ global:<br>
+<br>
+ rte_hash_rcu_qsbr_dq_reclaim;<br>
+};<br>
\ No newline at end of file<br>
-- <br>
2.34.1<br>
<br>
</blockquote></div>
</blockquote></div>