[dpdk-dev] [PATCH] hash: new function to retrieve a key given its position

Bruce Richardson bruce.richardson at intel.com
Thu Jun 16 12:55:25 CEST 2016


On Thu, Jun 16, 2016 at 10:23:42AM +0000, Juan Antonio Montesinos Delgado wrote:
> Hi,
> 
> As I understand it, the hash table entry can change position in the first hash table but the index in the second hash table remains the same. So, regardless the bucket the entry is in, the index (of the second hash table) stored in that entry will be the same. Am I right?
> 
> Best,
> 
> Juan Antonio
> 

Ah, yes, you are right. The key data should not move, only the hash value. I'd
forgotten that.

/Bruce

> -----Original Message-----
> From: Bruce Richardson [mailto:bruce.richardson at intel.com] 
> Sent: jueves, 16 de junio de 2016 11:50
> To: Yari Adan PETRALANDA <yari.adan.petralanda at ericsson.com>
> Cc: pablo.de.lara.guarch at intel.com; Juan Antonio Montesinos Delgado <juan.antonio.montesinos.delgado at ericsson.com>; dev at dpdk.org
> Subject: Re: [PATCH] hash: new function to retrieve a key given its position
> 
> On Thu, Jun 16, 2016 at 10:22:30AM +0200, Yari Adan Petralanda wrote:
> > The function rte_hash_get_key_with_position is added in this patch.
> > As the position returned when adding a key is frequently used as an 
> > offset into an array of user data, this function performs the 
> > operation of retrieving a key given this offset.
> > 
> > A possible use case would be to delete a key from the hash table when 
> > its entry in the array of data has certain value. For instance, the 
> > key could be a flow 5-tuple, and the value stored in the array a time stamp.
> > 
> 
> I have my doubts that this will work. With cuckoo hashing, a hash table entry can change position multiple times after it is added, as the table is reorganised to make room for new entries.
> 
> Regards,
> /Bruce
> 


More information about the dev mailing list