[dpdk-dev] hash: fix ring size
Commit Message
Ring stores the free slots available to be used in the key table.
The ring size was being increased by 1, because of the dummy slot,
used for key misses, but this is not actually stored in the ring,
so there is no need to increase it.
Fixes: 5915699153d7 ("hash: fix scaling by reducing contention")
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_hash/rte_cuckoo_hash.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Monday, September 26, 2016 4:52 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce; De Lara Guarch, Pablo
> Subject: [PATCH] hash: fix ring size
>
> Ring stores the free slots available to be used in the key table.
> The ring size was being increased by 1, because of the dummy slot,
> used for key misses, but this is not actually stored in the ring,
> so there is no need to increase it.
>
> Fixes: 5915699153d7 ("hash: fix scaling by reducing contention")
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Nack. This was already sent in another patchset
@@ -160,7 +160,8 @@ rte_hash_create(const struct rte_hash_parameters *params)
num_key_slots = params->entries + 1;
snprintf(ring_name, sizeof(ring_name), "HT_%s", params->name);
- r = rte_ring_create(ring_name, rte_align32pow2(num_key_slots),
+ /* Create ring (Dummy slot index is not enqueued) */
+ r = rte_ring_create(ring_name, rte_align32pow2(num_key_slots - 1),
params->socket_id, 0);
if (r == NULL) {
RTE_LOG(ERR, HASH, "memory allocation failed\n");