[dpdk-dev] [PATCH v3 4/8] hash: make duplicated code into functions

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Mon Jul 9 16:25:23 CEST 2018



> -----Original Message-----
> From: Wang, Yipeng1
> Sent: Friday, July 6, 2018 8:47 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
> Cc: dev at dpdk.org; Wang, Yipeng1 <yipeng1.wang at intel.com>; Richardson,
> Bruce <bruce.richardson at intel.com>; honnappa.nagarahalli at arm.com;
> vguvva at caviumnetworks.com; brijesh.s.singh at gmail.com
> Subject: [PATCH v3 4/8] hash: make duplicated code into functions
> 
> This commit refactors the hash table lookup/add/del code to remove some code
> duplication. Processing on primary bucket can also apply to secondary bucket
> with same code.
> 
> Signed-off-by: Yipeng Wang <yipeng1.wang at intel.com>
> ---
>  lib/librte_hash/rte_cuckoo_hash.c | 186 +++++++++++++++++++-------------------

...

> @@ -838,41 +830,45 @@ __rte_hash_del_key_with_hash(const struct rte_hash
> *h, const void *key,
>  			if (rte_hash_cmp_eq(key, k->key, h) == 0) {
>  				remove_entry(h, bkt, i);
> 
> +				ret = bkt->key_idx[i] - 1;
> +				bkt->key_idx[i] = EMPTY_SLOT;
>  				/*
>  				 * Return index where key is stored,
>  				 * subtracting the first dummy index
>  				 */
> -				ret = bkt->key_idx[i] - 1;
> -				bkt->key_idx[i] = EMPTY_SLOT;

Actually, this change doesn't look needed, right?
It looks like you are just moving the two lines before the comment.

Apart from this,

Acked-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>



More information about the dev mailing list