From patchwork Thu Sep 11 17:47:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balazs Nemeth X-Patchwork-Id: 359 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 5A1BCB3A3; Thu, 11 Sep 2014 19:41:36 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B0CA8B39A for ; Thu, 11 Sep 2014 19:41:33 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 11 Sep 2014 10:40:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,506,1406617200"; d="scan'208";a="601588457" Received: from bnemeth-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([172.22.195.53]) by orsmga002.jf.intel.com with ESMTP; 11 Sep 2014 10:46:18 -0700 From: Balazs Nemeth To: dev@dpdk.org Date: Thu, 11 Sep 2014 19:47:20 +0200 Message-Id: <1410457641-3540-4-git-send-email-balazs.nemeth@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1410457641-3540-1-git-send-email-balazs.nemeth@intel.com> References: <1410457641-3540-1-git-send-email-balazs.nemeth@intel.com> Cc: Balazs Nemeth Subject: [dpdk-dev] [PATCH 3/4] lib/librte_table: Fix incorrect t->data_size_shl initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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;