From 968be3dfc61dc3a5cc17d1f6a33635efe5072e46 Mon Sep 17 00:00:00 2001 From: Divakar Date: Fri, 29 Jan 2016 16:24:00 +0530 Subject: [PATCH] Get hentry even if Invalid, to manipulate bucket entry While deleting over flow table entry, the main bucket entry is fetched using an API which return only valid hash entries. Due to this, if the bucket entry is invalid, the over flow entry is not manipulated in the list of bucket, but over flow entry is manipulated independently. Beause of this, next index of main hash entry still points to cleared over flow entry. Later if same over flow entry is added to same bucket, the next index goes bad. As a fix, the API which returns hash entry unconditinally is used to manipulate the bucket entry. Also next_index is not made invalid whilte invalidating hash table entry. This gets invalidated only when the overflow entry is deleted An extra vr_release_hentry() is removed from flow. Change-Id: I90f50847a0f928f4325290bb0b8cb0ec5f47e108 closs-bug: #1539397 --- dp-core/vr_htable.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dp-core/vr_htable.c b/dp-core/vr_htable.c index 22b7ef2ca..40af6f703 100644 --- a/dp-core/vr_htable.c +++ b/dp-core/vr_htable.c @@ -165,11 +165,12 @@ vr_htable_hentry_invalidate(struct vr_htable *table, vr_hentry_t *ent) if (!table || !ent) return; - ent->hentry_next_index = VR_INVALID_HENTRY_INDEX; ent->hentry_bucket_index = VR_INVALID_HENTRY_INDEX; - if (ent->hentry_index >= table->ht_hentries) + if (ent->hentry_index >= table->ht_hentries) { + ent->hentry_next_index = VR_INVALID_HENTRY_INDEX; vr_htable_put_free_oentry(table, ent); + } ent->hentry_flags &= VR_HENTRY_FLAG_IN_FREE_LIST; } @@ -186,7 +187,7 @@ __vr_htable_hentry_invalidate(struct vr_htable *table, vr_hentry_t *ent) return; if (ent->hentry_index >= table->ht_hentries) { - head_ent = vr_htable_get_hentry_by_index((vr_htable_t)table, + head_ent = __vr_htable_get_hentry_by_index((vr_htable_t)table, ent->hentry_bucket_index); for (prev = head_ent; prev; prev = prev->hentry_next) { if (prev->hentry_next == ent) {