summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Nemeth <balazs.nemeth@intel.com>2014-09-26 09:37:39 +0000
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-11-24 13:17:49 +0100
commit8595428e50e70d982e4a47784557d345913c4a56 (patch)
tree312d7c4c893e06c44d3887ab3d130e0ccb23af67
parent14f2544cda74bb7f80b0269fba40574c9fad6b44 (diff)
downloaddpdk-8595428e50.zip
dpdk-8595428e50.tar.gz
dpdk-8595428e50.tar.xz
table: fix incorrect initialization
During initialization of rte_hash_table_ext and rte_hash_table_lru, t->data_size_shl is calculated. This member contains the number of bits to shift left during calculation of the location of entries in the hash table. To determine the number of bits to shift left, the size of the entry (as provided to the rte_table_hash_ext_create and rte_table_hash_lru_create) has to be used instead of the size of the key. Signed-off-by: Balazs Nemeth <balazs.nemeth@intel.com> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
-rw-r--r--lib/librte_table/rte_table_hash_ext.c2
-rw-r--r--lib/librte_table/rte_table_hash_lru.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c
index 17c16cd..fb3e6d2 100644
--- a/lib/librte_table/rte_table_hash_ext.c
+++ b/lib/librte_table/rte_table_hash_ext.c
@@ -221,7 +221,7 @@ rte_table_hash_ext_create(void *params, int socket_id, uint32_t entry_size)
/* Internal */
t->bucket_mask = t->n_buckets - 1;
t->key_size_shl = __builtin_ctzl(p->key_size);
- t->data_size_shl = __builtin_ctzl(p->key_size);
+ t->data_size_shl = __builtin_ctzl(entry_size);
/* Tables */
table_meta_offset = 0;
diff --git a/lib/librte_table/rte_table_hash_lru.c b/lib/librte_table/rte_table_hash_lru.c
index d1a4984..bf92e81 100644
--- a/lib/librte_table/rte_table_hash_lru.c
+++ b/lib/librte_table/rte_table_hash_lru.c
@@ -192,7 +192,7 @@ rte_table_hash_lru_create(void *params, int socket_id, uint32_t entry_size)
/* Internal */
t->bucket_mask = t->n_buckets - 1;
t->key_size_shl = __builtin_ctzl(p->key_size);
- t->data_size_shl = __builtin_ctzl(p->key_size);
+ t->data_size_shl = __builtin_ctzl(entry_size);
/* Tables */
table_meta_offset = 0;