From 97a3556e76f1b1fa16b2b37c3ba273e853aeb44c Mon Sep 17 00:00:00 2001 From: "Anand H. Krishnan" Date: Fri, 13 May 2016 16:29:24 +0530 Subject: [PATCH] Do not allow agent to modify a "NEW" flow The "NEW" flag is set whenever a flow becomes active and is in the transient state. If agent tries to modify the entry in that state, a possibility because of reuse of an entry due to eviction, a condition could happen where the flags used by datapath could come from the flags set by agent, more specifically the Modified flag, and thus be in a state where nothing can be done in the entry. Hence, prevent agent from acting upon NEW flows. Change-Id: I017fd7d32f0488cef90a17c491c6021bbdd181c7 Closes-BUG: #1580855 --- dp-core/vr_flow.c | 3 ++- include/vr_flow.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dp-core/vr_flow.c b/dp-core/vr_flow.c index c3685b114..c86fc8b9d 100644 --- a/dp-core/vr_flow.c +++ b/dp-core/vr_flow.c @@ -343,7 +343,8 @@ vr_flow_start_modify(struct vrouter *router, struct vr_flow_entry *fe) unsigned short flags; flags = fe->fe_flags; - if (!(flags & (VR_FLOW_FLAG_MODIFIED | VR_FLOW_FLAG_EVICTED))) { + if (!(flags & (VR_FLOW_FLAG_MODIFIED | VR_FLOW_FLAG_EVICTED | + VR_FLOW_FLAG_NEW_FLOW))) { if (__sync_bool_compare_and_swap(&fe->fe_flags, flags, flags | VR_FLOW_FLAG_MODIFIED)) { return true; diff --git a/include/vr_flow.h b/include/vr_flow.h index 391113567..68f8fb59e 100644 --- a/include/vr_flow.h +++ b/include/vr_flow.h @@ -34,7 +34,8 @@ typedef enum { #define VR_FLOW_FLAG_DP_FLAGS (VR_FLOW_FLAG_EVICT_CANDIDATE |\ VR_FLOW_FLAG_EVICTED |\ - VR_FLOW_FLAG_NEW_FLOW) + VR_FLOW_FLAG_NEW_FLOW |\ + VR_FLOW_FLAG_MODIFIED) #define VR_FLOW_FLAG_DP_BITS(fe) (((fe)->fe_flags) &\ (VR_FLOW_FLAG_DP_FLAGS))