From patchwork Thu Sep 11 17:47:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balazs Nemeth X-Patchwork-Id: 357 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 31328B347; Thu, 11 Sep 2014 19:41:32 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 4FAD7AF87 for ; Thu, 11 Sep 2014 19:41:31 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 11 Sep 2014 10:40:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,506,1406617200"; d="scan'208";a="601588434" 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:15 -0700 From: Balazs Nemeth To: dev@dpdk.org Date: Thu, 11 Sep 2014 19:47:18 +0200 Message-Id: <1410457641-3540-2-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 1/4] lib/librte_table: Fix empty bucket removal during entry deletion in rte_table_hash_ext 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" When an entry is deleted from an extensible rte_table_hash, the bucket that stored the entry can become empty. If this is the case, the bucket needs to be removed from the chain of buckets. During removal of the bucket, the chain should be updated first. If the bucket that will be removed is cleared first, the chain is broken and the information to update the chain is lost. Signed-off-by: Balazs Nemeth --- lib/librte_table/rte_table_hash_ext.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c index 6e26d98..17c16cd 100644 --- a/lib/librte_table/rte_table_hash_ext.c +++ b/lib/librte_table/rte_table_hash_ext.c @@ -408,12 +408,12 @@ void *entry) if ((bkt_prev != NULL) && (bkt->sig[0] == 0) && (bkt->sig[1] == 0) && (bkt->sig[2] == 0) && (bkt->sig[3] == 0)) { - /* Clear bucket */ - memset(bkt, 0, sizeof(struct bucket)); - /* Unchain bucket */ BUCKET_NEXT_COPY(bkt_prev, bkt); + /* Clear bucket */ + memset(bkt, 0, sizeof(struct bucket)); + /* Free bucket back to buckets ext */ bkt_index = bkt - t->buckets_ext; t->bkt_ext_stack[t->bkt_ext_stack_tos++]