DPDK patches and discussions
 help / color / mirror / Atom feed
From: Balazs Nemeth <balazs.nemeth@intel.com>
To: dev@dpdk.org
Cc: Balazs Nemeth <balazs.nemeth@intel.com>
Subject: [dpdk-dev] [PATCH 3/4] table: fix incorrect t->data_size_shl initialization
Date: Thu, 25 Sep 2014 15:24:37 +0000	[thread overview]
Message-ID: <1411658678-658-4-git-send-email-balazs.nemeth@intel.com> (raw)
In-Reply-To: <1411658678-658-1-git-send-email-balazs.nemeth@intel.com>

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.

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Balazs Nemeth <balazs.nemeth@intel.com>
---
 lib/librte_table/rte_table_hash_ext.c | 2 +-
 lib/librte_table/rte_table_hash_lru.c | 2 +-
 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;
--
2.1.0
Intel Corporation NV/SA
Kings Square, Veldkant 31
2550 Kontich
RPM (Bruxelles) 0415.497.718. 
Citibank, Brussels, account 570/1031255/09

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

  parent reply	other threads:[~2014-09-25 15:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 15:24 [dpdk-dev] [PATCH 0/4] table: fix bugs occuring in corner cases Balazs Nemeth
2014-09-25 15:24 ` [dpdk-dev] [PATCH 1/4] table: fix empty bucket removal during entry deletion in rte_table_hash_ext Balazs Nemeth
2014-09-25 15:44   ` Neil Horman
2014-09-25 15:24 ` [dpdk-dev] [PATCH 2/4] table: fix checking extended buckets in unoptimized case Balazs Nemeth
2014-09-25 15:24 ` Balazs Nemeth [this message]
2014-09-25 15:24 ` [dpdk-dev] [PATCH 4/4] table: fix pointer calculations at initialization Balazs Nemeth
2014-09-26  9:37 [dpdk-dev] [PATCH 0/4] table: fix bugs occuring in corner cases Balazs Nemeth
2014-09-26  9:37 ` [dpdk-dev] [PATCH 3/4] table: fix incorrect t->data_size_shl initialization Balazs Nemeth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411658678-658-4-git-send-email-balazs.nemeth@intel.com \
    --to=balazs.nemeth@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).