hash: new function to retrieve a key given its position
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Yari Adan Petralanda
The function
rte_hash_get_key_with_positionis 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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Juan Antonio Montesinos Delgado
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
Quoted 23 lines
-----Original Message-----
From: Bruce Richardson [mailto:[email protected]]
Sent: jueves, 16 de junio de 2016 11:50
To: Yari Adan PETRALANDA <[email protected]>
Cc: [email protected]; Juan Antonio Montesinos Delgado <[email protected]>; [email protected]
Subject: Re: [PATCH] hash: new function to retrieve a key given its positionQuoted 9 lines · Yari Adan Petralanda
The function
rte_hash_get_key_with_positionis 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
Quoted 31 lines
-----Original Message-----
From: Yari Adan Petralanda [mailto:[email protected]]
Sent: Thursday, June 16, 2016 9:23 AM
To: Richardson, Bruce; De Lara Guarch, Pablo; Juan Antonio Montesinos Delgado
Cc: [email protected]
Subject: [PATCH] hash: new function to retrieve a key given its positionThe function
rte_hash_get_key_with_positionis 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.
Signed-off-by: Juan Antonio Montesinos
<[email protected]>Signed-off-by Yari Adan Petralanda <[email protected]>--- app/test/test_hash.c | 42 ++++++++++++++++++++++++++++++++++++ lib/librte_hash/rte_cuckoo_hash.c | 18 ++++++++++++++++ lib/librte_hash/rte_hash.h | 18 ++++++++++++++++ lib/librte_hash/rte_hash_version.map | 7 ++++++ 4 files changed, 85 insertions(+)
[...]
lib/librte_hash/rte_hash_version.map DPDK_2.2 { · line 42
Quoted 11 lines
lib/librte_hash/rte_hash_version.map +2
-0@@ -38,3 +38,10 @@ DPDK_2.2 { rte_hash_set_cmp_func; } DPDK_2.1; + +DPDK_16.04 {
This should be DPDK_16.07.
Quoted 8 lines
lib/librte_hash/rte_hash_version.map +5
-1+ global: + + rte_hash_get_key_with_position; + +}; DPDK_2.2 --2.1.4