[ovs-dev] [PATCH 04/17] ofp-util: introduce actions corresponding to instructions
Isaku Yamahata
yamahata at valinux.co.jp
Wed Jul 18 11:41:18 UTC 2012
Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
---
lib/ofp-actions.c | 3 +++
lib/ofp-parse.c | 9 +++++++++
lib/ofp-util.c | 2 ++
lib/ofp-util.def | 10 ++++++++++
lib/ofp-util.h | 3 +++
5 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 2f80a29..a826078 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -231,6 +231,7 @@ ofpact_from_nxast(const union ofp_action *a, enum ofputil_action_code code,
case OFPUTIL_ACTION_INVALID:
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
#define OFPAT11_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
+#define OFPIT11_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def"
NOT_REACHED();
@@ -340,6 +341,7 @@ ofpact_from_openflow10(const union ofp_action *a, struct ofpbuf *out)
switch (code) {
case OFPUTIL_ACTION_INVALID:
#define OFPAT11_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
+#define OFPIT11_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def"
NOT_REACHED();
@@ -609,6 +611,7 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out)
switch (code) {
case OFPUTIL_ACTION_INVALID:
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
+#define OFPIT11_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def"
NOT_REACHED();
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 32d3836..65b3f0f 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -434,6 +434,15 @@ parse_named_action(enum ofputil_action_code code, const struct flow *flow,
case OFPUTIL_NXAST_CONTROLLER:
parse_controller(ofpacts, arg);
break;
+
+ case OFPUTIL_OFPIT11_GOTO_TABLE:
+ case OFPUTIL_OFPIT11_WRITE_METADATA:
+ case OFPUTIL_OFPIT11_WRITE_ACTIONS:
+ case OFPUTIL_OFPIT11_APPLY_ACTIONS:
+ case OFPUTIL_OFPIT11_CLEAR_ACTIONS:
+ /* TODO:XXX */
+ NOT_REACHED();
+ break;
}
}
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index a62b554..d4154b3 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -3991,6 +3991,7 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
#define OFPAT11_ACTION OFPAT10_ACTION
+#define OFPIT11_ACTION OFPAT10_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
#include "ofp-util.def"
@@ -4015,6 +4016,7 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
return s; \
}
#define OFPAT11_ACTION OFPAT10_ACTION
+#define OFPIT11_ACTION OFPAT10_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
void \
ofputil_init_##ENUM(struct STRUCT *s) \
diff --git a/lib/ofp-util.def b/lib/ofp-util.def
index 974cd8f..bf12625 100644
--- a/lib/ofp-util.def
+++ b/lib/ofp-util.def
@@ -36,6 +36,15 @@ OFPAT11_ACTION(OFPAT11_SET_TP_DST, ofp_action_tp_port, "mod_tp_dst")
//OFPAT11_ACTION(OFPAT11_SET_NW_TTL, ofp11_action_nw_ttl, "set_nw_ttl")
//OFPAT11_ACTION(OFPAT11_DEC_NW_TTL, ofp_action_header, "dec_ttl")
+#ifndef OFPIT11_ACTION
+#define OFPIT11_ACTION(ENUM, STRUCT, NAME)
+#endif
+OFPIT11_ACTION(OFPIT11_GOTO_TABLE, ofp11_instruction_goto_table, "goto_table")
+OFPIT11_ACTION(OFPIT11_WRITE_METADATA, ofp11_instruction_write_metadata, "write_metadata")
+OFPIT11_ACTION(OFPIT11_WRITE_ACTIONS, ofp11_instruction_actions, "write_actions")
+OFPIT11_ACTION(OFPIT11_APPLY_ACTIONS, ofp11_instruction_actions, "apply_actions")
+OFPIT11_ACTION(OFPIT11_CLEAR_ACTIONS, ofp11_instruction_actions, "clear_actions")
+
#ifndef NXAST_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)
#endif
@@ -61,4 +70,5 @@ NXAST_ACTION(NXAST_CONTROLLER, nx_action_controller, 0, "controller")
#undef OFPAT10_ACTION
#undef OFPAT11_ACTION
+#undef OFPIT11_ACTION
#undef NXAST_ACTION
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index f7d3307..f645b38 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -651,6 +651,7 @@ enum OVS_PACKED_ENUM ofputil_action_code {
OFPUTIL_ACTION_INVALID,
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM,
#define OFPAT11_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM,
+#define OFPIT11_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
#include "ofp-util.def"
};
@@ -659,6 +660,7 @@ enum OVS_PACKED_ENUM ofputil_action_code {
enum {
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) + 1
#define OFPAT11_ACTION(ENUM, STRUCT, NAME) + 1
+#define OFPIT11_ACTION(ENUM, STRUCT, NAME) + 1
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1
OFPUTIL_N_ACTIONS = 1
#include "ofp-util.def"
@@ -688,6 +690,7 @@ void *ofputil_put_action(enum ofputil_action_code, struct ofpbuf *buf);
#define OFPAT11_ACTION(ENUM, STRUCT, NAME) \
void ofputil_init_##ENUM(struct STRUCT *); \
struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
+#define OFPIT11_ACTION OFPAT11_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
void ofputil_init_##ENUM(struct STRUCT *); \
struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
--
1.7.1.1
More information about the dev
mailing list