From 18cdcd59d8f94a07665f8ef058caa30ecced3815 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_flow.c | 1 - dp-core/vr_htable.c | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dp-core/vr_flow.c b/dp-core/vr_flow.c index b9de76629..da4b4518f 100644 --- a/dp-core/vr_flow.c +++ b/dp-core/vr_flow.c @@ -224,7 +224,6 @@ __vr_flow_reset_entry(struct vrouter *router, struct vr_flow_entry *fe) (VR_FLOW_FLAG_ACTIVE | VR_FLOW_FLAG_EVICTED | VR_FLOW_FLAG_NEW_FLOW); - vr_htable_release_hentry(router->vr_flow_table, &fe->fe_hentry); return; } diff --git a/dp-core/vr_htable.c b/dp-core/vr_htable.c index afe444321..c25fbb5dc 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) {