[ovs-dev] [PATCH 16/17] ofproto-dpif: teach goto-table instruction packet-in

Isaku Yamahata yamahata at valinux.co.jp
Wed Jul 18 11:41:30 UTC 2012


When goto-table instruction results in table miss, generate packet-in event

Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
---
 ofproto/ofproto-dpif.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 12c61af..d272cc0 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -4971,7 +4971,7 @@ compose_output_action(struct action_xlate_ctx *ctx, uint16_t ofp_port)
 
 static void
 xlate_table_action(struct action_xlate_ctx *ctx,
-                   uint16_t in_port, uint8_t table_id)
+                   uint16_t in_port, uint8_t table_id, bool may_packet_in)
 {
     if (ctx->recurse < MAX_RESUBMIT_RECURSION) {
         struct ofproto_dpif *ofproto = ctx->ofproto;
@@ -5007,6 +5007,17 @@ xlate_table_action(struct action_xlate_ctx *ctx,
             ctx->resubmit_hook(ctx, rule);
         }
 
+        if (rule == NULL && may_packet_in) {
+            /* TODO:XXX
+             * check if table configuration flags
+             * OFPTC_TABLE_MISS_CONTROLLER, default.
+             * OFPTC_TABLE_MISS_CONTINUE,
+             * OFPTC_TABLE_MISS_DROP
+             * When OF1.0, OFPTC_TABLE_MISS_CONTINUE is used. What to do?
+             */
+            rule = rule_dpif_miss_rule(ofproto, &ctx->flow);
+        }
+
         if (rule) {
             struct rule_dpif *old_rule = ctx->rule;
 
@@ -5048,7 +5059,8 @@ xlate_ofpact_resubmit(struct action_xlate_ctx *ctx,
         table_id = ctx->table_id;
     }
 
-    xlate_table_action(ctx, in_port, table_id);
+    xlate_table_action(ctx, in_port, table_id,
+                       resubmit->ofpact.compat == OFPUTIL_OFPIT11_GOTO_TABLE);
 }
 
 static void
@@ -5173,7 +5185,7 @@ xlate_output_action(struct action_xlate_ctx *ctx,
         break;
     case OFPP_TABLE:
         xlate_table_action(ctx, ctx->flow.in_port,
-                           first_table? 0: ctx->table_id);
+                           first_table? 0: ctx->table_id, first_table);
         break;
     case OFPP_NORMAL:
         xlate_normal(ctx);
-- 
1.7.1.1




More information about the dev mailing list