[dpdk-dev] [PATCH v3 2/4] hash: reorganize bucket structure

Bruce Richardson bruce.richardson at intel.com
Wed Sep 28 11:05:23 CEST 2016


On Tue, Sep 06, 2016 at 08:34:02PM +0100, Pablo de Lara wrote:
> From: Byron Marohn <byron.marohn at intel.com>
> 
> Move current signatures of all entries together in the bucket
> and same with all alternative signatures, instead of having
> current and alternative signatures together per entry in the bucket.
> This will be benefitial in the next commits, where a vectorized
> comparison will be performed, achieving better performance.
> 
> Signed-off-by: Byron Marohn <byron.marohn at intel.com>
> Signed-off-by: Saikrishna Edupuganti <saikrishna.edupuganti at intel.com>
> ---
>  lib/librte_hash/rte_cuckoo_hash.c     | 43 ++++++++++++++++++-----------------
>  lib/librte_hash/rte_cuckoo_hash.h     | 17 ++++----------
>  lib/librte_hash/rte_cuckoo_hash_x86.h | 20 ++++++++--------
>  3 files changed, 37 insertions(+), 43 deletions(-)
> 
<snip>
> --- a/lib/librte_hash/rte_cuckoo_hash.h
> +++ b/lib/librte_hash/rte_cuckoo_hash.h
> @@ -151,17 +151,6 @@ struct lcore_cache {
>  	void *objs[LCORE_CACHE_SIZE]; /**< Cache objects */
>  } __rte_cache_aligned;
>  
> -/* Structure storing both primary and secondary hashes */
> -struct rte_hash_signatures {
> -	union {
> -		struct {
> -			hash_sig_t current;
> -			hash_sig_t alt;
> -		};
> -		uint64_t sig;
> -	};
> -};
> -
>  /* Structure that stores key-value pair */
>  struct rte_hash_key {
>  	union {
> @@ -174,10 +163,14 @@ struct rte_hash_key {
>  
>  /** Bucket structure */
>  struct rte_hash_bucket {
> -	struct rte_hash_signatures signatures[RTE_HASH_BUCKET_ENTRIES];
> +	hash_sig_t sig_current[RTE_HASH_BUCKET_ENTRIES];
> +
>  	/* Includes dummy key index that always contains index 0 */
>  	uint32_t key_idx[RTE_HASH_BUCKET_ENTRIES + 1];
> +
>  	uint8_t flag[RTE_HASH_BUCKET_ENTRIES];
> +
> +	hash_sig_t sig_alt[RTE_HASH_BUCKET_ENTRIES];
>  } __rte_cache_aligned;
> 

Is there a reason why sig_current and sig_alt fields cannot be beside each
other in the structure. It looks strange having them separate by other fields?

/Bruce


More information about the dev mailing list