[ovs-dev] [PATCH upstream] net-ovs: Remove loop_counters.

Pravin B Shelar pshelar at nicira.com
Thu Nov 17 00:23:26 UTC 2011


Upstream OVS is not going to have patch vports. So there is no
need to have special loop-detection in OVS.

Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
 net/openvswitch/actions.c |   45 +--------------------------------------------
 1 files changed, 1 insertions(+), 44 deletions(-)

diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 8eaaea9..f10aaf8 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -406,54 +406,11 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
 	return 0;
 }
 
-/* We limit the number of times that we pass into execute_actions()
- * to avoid blowing out the stack in the event that we have a loop. */
-#define MAX_LOOPS 5
-
-struct loop_counter {
-	u8 count;		/* Count. */
-	bool looping;		/* Loop detected? */
-};
-
-static DEFINE_PER_CPU(struct loop_counter, loop_counters);
-
-static int loop_suppress(struct datapath *dp, struct sw_flow_actions *actions)
-{
-	if (net_ratelimit())
-		pr_warn("%s: flow looped %d times, dropping\n",
-				dp_name(dp), MAX_LOOPS);
-	actions->actions_len = 0;
-	return -ELOOP;
-}
-
 /* Execute a list of actions against 'skb'. */
 int execute_actions(struct datapath *dp, struct sk_buff *skb)
 {
 	struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts);
-	struct loop_counter *loop;
-	int error;
-
-	/* Check whether we've looped too much. */
-	loop = &__get_cpu_var(loop_counters);
-	if (unlikely(++loop->count > MAX_LOOPS))
-		loop->looping = true;
-	if (unlikely(loop->looping)) {
-		error = loop_suppress(dp, acts);
-		kfree_skb(skb);
-		goto out_loop;
-	}
 
-	error = do_execute_actions(dp, skb, acts->actions,
+	return do_execute_actions(dp, skb, acts->actions,
 					 acts->actions_len, false);
-
-	/* Check whether sub-actions looped too much. */
-	if (unlikely(loop->looping))
-		error = loop_suppress(dp, acts);
-
-out_loop:
-	/* Decrement loop counter. */
-	if (!--loop->count)
-		loop->looping = false;
-
-	return error;
 }
-- 
1.7.1




More information about the dev mailing list