From: Balazs Nemeth Date: Fri, 26 Sep 2014 09:37:37 +0000 (+0000) Subject: table: fix empty bucket removal during entry deletion X-Git-Tag: spdx-start~10142 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fb20a4bd0f68da9405420312561e98d6874b26b1;p=dpdk.git table: fix empty bucket removal during entry deletion 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 Acked-by: Cristian Dumitrescu Acked-by: Neil Horman --- diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c index 6e26d9844b..17c16cd9d4 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++]