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 1/4] lib/librte_table: Fix empty bucket removal during entry deletion in rte_table_hash_ext
Date: Thu, 11 Sep 2014 19:47:18 +0200	[thread overview]
Message-ID: <1410457641-3540-2-git-send-email-balazs.nemeth@intel.com> (raw)
In-Reply-To: <1410457641-3540-1-git-send-email-balazs.nemeth@intel.com>

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 <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++]
-- 
1.9.1

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.

  reply	other threads:[~2014-09-11 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 17:47 [dpdk-dev] [PATCH 0/4] lib/librte_table: Fix bugs occuring in corner cases Balazs Nemeth
2014-09-11 17:47 ` Balazs Nemeth [this message]
2014-09-11 17:47 ` [dpdk-dev] [PATCH 2/4] lib/librte_table: Fix checking extended buckets in unoptimized case Balazs Nemeth
2014-09-11 17:47 ` [dpdk-dev] [PATCH 3/4] lib/librte_table: Fix incorrect t->data_size_shl initialization Balazs Nemeth
2014-09-11 17:47 ` [dpdk-dev] [PATCH 4/4] lib/librte_table: Fix pointer calculations at initialization Balazs Nemeth
2014-09-11 17:56 ` [dpdk-dev] [PATCH 0/4] lib/librte_table: Fix bugs occuring in corner cases Dumitrescu, Cristian
2014-09-24 17:48 ` Thomas Monjalon

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=1410457641-3540-2-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).