The meta action is used for delimiting the instructions.

Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp>
---
v2
- newly introduced
---
 lib/ofp-actions.c      |   17 +++++++++++++++++
 lib/ofp-actions.h      |   23 ++++++++++++++++++++++-
 ofproto/ofproto-dpif.c |    4 ++++
 3 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 122066c..2b0476e 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -938,6 +938,9 @@ ofpact_check__(const struct ofpact *a, const struct flow 
*flow, int max_ports)
     case OFPACT_EXIT:
         return 0;
 
+    case OFPACT_INSTRUCTION:
+        return 0;
+
     default:
         NOT_REACHED();
     }
@@ -1130,6 +1133,7 @@ ofpact_to_nxast(const struct ofpact *a, struct ofpbuf 
*out)
     case OFPACT_SET_IPV4_DSCP:
     case OFPACT_SET_L4_SRC_PORT:
     case OFPACT_SET_L4_DST_PORT:
+    case OFPACT_INSTRUCTION:
         NOT_REACHED();
     }
 }
@@ -1219,6 +1223,10 @@ ofpact_to_openflow10(const struct ofpact *a, struct 
ofpbuf *out)
             = htons(ofpact_get_SET_L4_DST_PORT(a)->port);
         break;
 
+    case OFPACT_INSTRUCTION:
+        NOT_REACHED(); /* TODO:XXX return error */
+        break;
+
     case OFPACT_CONTROLLER:
     case OFPACT_OUTPUT_REG:
     case OFPACT_BUNDLE:
@@ -1327,6 +1335,10 @@ ofpact_to_openflow11(const struct ofpact *a, struct 
ofpbuf *out)
             = htons(ofpact_get_SET_L4_DST_PORT(a)->port);
         break;
 
+    case OFPACT_INSTRUCTION:
+        NOT_REACHED();  /* TODO:XXX */
+        break;
+
     case OFPACT_CONTROLLER:
     case OFPACT_OUTPUT_REG:
     case OFPACT_BUNDLE:
@@ -1421,6 +1433,7 @@ ofpact_outputs_to_port(const struct ofpact *ofpact, 
uint16_t port)
     case OFPACT_AUTOPATH:
     case OFPACT_NOTE:
     case OFPACT_EXIT:
+    case OFPACT_INSTRUCTION:
     default:
         return false;
     }
@@ -1665,6 +1678,10 @@ ofpact_format(const struct ofpact *a, struct ds *s)
     case OFPACT_EXIT:
         ds_put_cstr(s, "exit");
         break;
+
+    case OFPACT_INSTRUCTION:
+        NOT_REACHED(); /* TODO:XXX */
+        break;
     }
 }
 
diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h
index 10ab301..d742590 100644
--- a/lib/ofp-actions.h
+++ b/lib/ofp-actions.h
@@ -87,7 +87,11 @@
                                                                     \
     /* Other. */                                                    \
     DEFINE_OFPACT(NOTE,            ofpact_note,          data)      \
-    DEFINE_OFPACT(EXIT,            ofpact_null,          ofpact)
+    DEFINE_OFPACT(EXIT,            ofpact_null,          ofpact)    \
+                                                                    \
+    /* Instruction */                                               \
+    DEFINE_OFPACT(INSTRUCTION,     ofpact_instruction,   ofpact)
+
 
 /* enum ofpact_type, with a member OFPACT_<ENUM> for each action. */
 enum OVS_PACKED_ENUM ofpact_type {
@@ -380,6 +384,14 @@ struct ofpact_note {
     uint8_t data[];
 };
 
+/* OFPACT_INSTRUCTION
+ *
+ * Used for instructions */
+struct ofpact_instruction {
+    struct ofpact ofpact;
+    uint16_t type;
+};
+
 /* Converting OpenFlow to ofpacts. */
 enum ofperr ofpacts_pull_openflow10(struct ofpbuf *openflow,
                                     unsigned int actions_len,
@@ -528,4 +540,13 @@ enum {
 #undef DEFINE_INST
 };
 
+static inline struct ofpact_instruction *
+ofpact_put_instruction(struct ofpbuf *ofpacts, enum ovs_instruction_type type)
+{
+    struct ofpact_instruction *inst;
+    inst = ofpact_put_INSTRUCTION(ofpacts);
+    inst->type = type;
+    return inst;
+}
+
 #endif /* ofp-actions.h */
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index dc15c15..b22a749 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5539,6 +5539,10 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t 
ofpacts_len,
             ctx->has_fin_timeout = true;
             xlate_fin_timeout(ctx, ofpact_get_FIN_TIMEOUT(a));
             break;
+
+        case OFPACT_INSTRUCTION:
+            NOT_REACHED();      /* TODO:XXX */
+            break;
         }
     }
 
-- 
1.7.1.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to