RE: [PATCH dpdk v3 0/2] hash: safe data replacement on overwrite

Konstantin Ananyev
2026-03-09T08:32:42Z

Hi Robin,

> >> * Removed the rte_hash_replace_key_data() API
> >
> > That's a pity - I think it is a useful one.
> >
> >> which required to bubble
> >> a potential old_data pointer from search_and_update() to all
> >> intermediate callers down to __rte_hash_add_key_with_hash(). It made
> >> an already complex code even more obscure.
>
> I can send it back but it will make the code complex since I cannot free
> the pointer in the callers. I need to pass it down the call chain to
> make the free-or-return-old-data decision.

> Let me know what you prefer.

My thoughts are:
I think what we have now inside rte_hash - Is a bug that needs to be fixed.
So your v3 patch looks good to me: it fixes the memory leak.
That's why I ack-ed it - I think patch is good to go as it is.

From other hand - rte_hash_replace_key_data() - is a 'nice to have' feature,
At it is kind of a new API, I think if we decide to go ahead with it - it can be done as a new patch series.
If you have time to work on it - please go ahead, I'll be happy to review the patch.
Also CC-ing to hash lib maintainers - lads what is your opinion on that subject?

Konstantin