[ovs-dev] [PATCH] ofproto: Add support for NXAST_RESUBMIT recursion.

Ben Pfaff blp at nicira.com
Thu Aug 12 21:26:22 UTC 2010


CC: Teemu Koponen <koponen at nicira.com>
---
 include/openflow/nicira-ext.h |   14 ++++++++------
 ofproto/ofproto.c             |    6 +++++-
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
index e6f34ba..a80439c 100644
--- a/include/openflow/nicira-ext.h
+++ b/include/openflow/nicira-ext.h
@@ -118,14 +118,16 @@ enum nx_action_subtype {
      * Following the lookup, the original in_port is restored.
      *
      * If the modified flow matched in the flow table, then the corresponding
-     * actions are executed, except that NXAST_RESUBMIT actions found in the
-     * secondary set of actions are ignored.  Afterward, actions following
-     * NXAST_RESUBMIT in the original set of actions, if any, are executed; any
-     * changes made to the packet (e.g. changes to VLAN) by secondary actions
-     * persist when those actions are executed, although the original in_port
-     * is restored.
+     * actions are executed.  Afterward, actions following NXAST_RESUBMIT in
+     * the original set of actions, if any, are executed; any changes made to
+     * the packet (e.g. changes to VLAN) by secondary actions persist when
+     * those actions are executed, although the original in_port is restored.
      *
      * NXAST_RESUBMIT may be used any number of times within a set of actions.
+     *
+     * NXAST_RESUBMIT may nest to an implementation-defined depth.  Beyond this
+     * implementation-defined depth, further NXAST_RESUBMIT actions are simply
+     * ignored.  (Open vSwitch 1.0.1 and earlier did not support recursion.)
      */
     NXAST_RESUBMIT,
 
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index a466c9c..c989cd4 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2427,6 +2427,10 @@ struct action_xlate_ctx {
     uint16_t nf_output_iface;   /* Output interface index for NetFlow. */
 };
 
+/* Maximum depth of flow table recursion (due to NXAST_RESUBMIT actions) in a
+ * flow translation. */
+#define MAX_RESUBMIT_RECURSION 8
+
 static void do_xlate_actions(const union ofp_action *in, size_t n_in,
                              struct action_xlate_ctx *ctx);
 
@@ -2474,7 +2478,7 @@ lookup_valid_rule(struct ofproto *ofproto, const flow_t *flow)
 static void
 xlate_table_action(struct action_xlate_ctx *ctx, uint16_t in_port)
 {
-    if (!ctx->recurse) {
+    if (ctx->recurse < MAX_RESUBMIT_RECURSION) {
         uint16_t old_in_port;
         struct rule *rule;
 
-- 
1.7.1





More information about the dev mailing list