From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <nhorman@tuxdriver.com>
Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58])
 by dpdk.org (Postfix) with ESMTP id 1A4BD7DF0
 for <dev@dpdk.org>; Thu, 25 Sep 2014 17:37:56 +0200 (CEST)
Received: from hmsreliant.think-freely.org
 ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost)
 by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63)
 (envelope-from <nhorman@tuxdriver.com>)
 id 1XXBDD-0006BH-1t; Thu, 25 Sep 2014 11:44:13 -0400
Date: Thu, 25 Sep 2014 11:44:06 -0400
From: Neil Horman <nhorman@tuxdriver.com>
To: Balazs Nemeth <balazs.nemeth@intel.com>
Message-ID: <20140925154406.GE32725@hmsreliant.think-freely.org>
References: <1411658678-658-1-git-send-email-balazs.nemeth@intel.com>
 <1411658678-658-2-git-send-email-balazs.nemeth@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1411658678-658-2-git-send-email-balazs.nemeth@intel.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Spam-Score: -2.9 (--)
X-Spam-Status: No
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 1/4] 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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Sep 2014 15:37:56 -0000

On Thu, Sep 25, 2014 at 03:24:35PM +0000, Balazs Nemeth wrote:
> 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.
> 
> 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 | 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++]
Acked-by: Neil Horman <nhorman@tuxdriver.com>

> --
> 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.
> 
>