From d2c75e1595b7149ab24443430d102b3baf439366 Mon Sep 17 00:00:00 2001 From: Manish Date: Sun, 28 Feb 2016 09:28:17 +0530 Subject: [PATCH] Adding/deleting SI in chain results in traffic loss. Problem: While re-evaluating flow/rflow the old reverse flow of flow/rflow were not pointing to same(pointing to NULL) and hence were marked as short flow, but same was not updated to stats_collector. This resulted in flow dangling till aging and in turn holding respective VRF in deleted state. Afet aging VRF was removed and new VRF added, in turn restoring traffic. Solution: Notify stats collector on marking as short flow. (cherry picked from commit 74e0dff2e00ffdf55cdbfbcbe74544e169453daf) Closes-bug: 1549454 Change-Id: Ibfac8308002e1f91bd423426b771d699fc9bb3f4 --- src/vnsw/agent/pkt/flow_table.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/vnsw/agent/pkt/flow_table.cc b/src/vnsw/agent/pkt/flow_table.cc index 5adeeda72df..e1b1dc71933 100644 --- a/src/vnsw/agent/pkt/flow_table.cc +++ b/src/vnsw/agent/pkt/flow_table.cc @@ -411,6 +411,8 @@ bool FlowTable::ValidFlowMove(const FlowEntry *new_flow, void FlowTable::UpdateReverseFlow(FlowEntry *flow, FlowEntry *rflow) { FlowEntry *flow_rev = flow->reverse_flow_entry(); FlowEntry *rflow_rev = NULL; + bool flow_rev_notify = false; + bool rflow_rev_notify = false; if (rflow) { rflow_rev = rflow->reverse_flow_entry(); @@ -435,6 +437,7 @@ void FlowTable::UpdateReverseFlow(FlowEntry *flow, FlowEntry *rflow) { if (ValidFlowMove(rflow, flow_rev)== false) { flow->MakeShortFlow(FlowEntry::SHORT_REVERSE_FLOW_CHANGE); } + flow_rev_notify = true; } if (rflow && rflow->is_flags_set(FlowEntry::BgpRouterService)) { @@ -455,6 +458,7 @@ void FlowTable::UpdateReverseFlow(FlowEntry *flow, FlowEntry *rflow) { if (ValidFlowMove(flow, rflow_rev) == false) { flow->MakeShortFlow(FlowEntry::SHORT_REVERSE_FLOW_CHANGE); } + rflow_rev_notify = true; } if (flow->reverse_flow_entry() == NULL) { @@ -474,6 +478,15 @@ void FlowTable::UpdateReverseFlow(FlowEntry *flow, FlowEntry *rflow) { rflow->set_flags(FlowEntry::Multicast); } } + //Has been marked for short flow, notify stats collector + if (flow_rev_notify) { + FlowEntryPtr flow_rev_ptr(flow_rev); + agent()->flow_stats_manager()->AddEvent(flow_rev_ptr); + } + if (rflow_rev_notify) { + FlowEntryPtr rflow_rev_ptr(rflow_rev); + agent()->flow_stats_manager()->AddEvent(rflow_rev_ptr); + } } //////////////////////////////////////////////////////////////////////////// @@ -764,6 +777,8 @@ void FlowTable::EvictFlow(FlowEntry *flow, FlowEntry *reverse_flow) { // Reverse flow unlinked with forward flow. Make it short-flow if (reverse_flow && reverse_flow->deleted() == false) { reverse_flow->MakeShortFlow(FlowEntry::SHORT_NO_REVERSE_FLOW); + FlowEntryPtr reverse_flow_ptr(reverse_flow); + agent()->flow_stats_manager()->AddEvent(reverse_flow_ptr); UpdateKSync(reverse_flow, true); } }