[ovs-dev] [PATCH v2 3/7] lib/ofp-util: preparation for OF12 of ofp-util
Isaku Yamahata
yamahata at valinux.co.jp
Thu Jun 28 04:30:44 PDT 2012
Add necessary macros to ofp-util for OF12 support.
This is just a place holder.
Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
---
v2
no change
---
lib/ofp-actions.c | 3 +++
lib/ofp-parse.c | 4 ++++
lib/ofp-print.c | 1 +
lib/ofp-util.c | 3 +++
lib/ofp-util.def | 20 ++++++++++++++++++++
lib/ofp-util.h | 6 ++++++
6 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 1a45ab2..0b1945f 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 OFPAT12_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 OFPAT12_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def"
NOT_REACHED();
@@ -576,6 +578,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 OFPAT12_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 bd414eb..09fdc4a 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -364,6 +364,10 @@ parse_named_action(enum ofputil_action_code code, const struct flow *flow,
parse_enqueue(arg, ofpacts);
break;
+ case OFPUTIL_OFPAT12_SET_FIELD:
+ NOT_REACHED(); /* This will be implemented by later patch */
+ break;
+
case OFPUTIL_NXAST_RESUBMIT:
parse_resubmit(arg, ofpacts);
break;
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 7e8c789..f8128c6 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -456,6 +456,7 @@ ofputil_action_bitmap_to_name(uint32_t bit)
case OFPUTIL_A_SET_NW_TOS: return "SET_NW_TOS";
case OFPUTIL_A_SET_TP_SRC: return "SET_TP_SRC";
case OFPUTIL_A_SET_TP_DST: return "SET_TP_DST";
+ case OFPUTIL_A_SET_FIELD: return "SET_FIELD";
case OFPUTIL_A_ENQUEUE: return "ENQUEUE";
case OFPUTIL_A_COPY_TTL_OUT: return "COPY_TTL_OUT";
case OFPUTIL_A_COPY_TTL_IN: return "COPY_TTL_IN";
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index df63155..fe95137 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -4212,6 +4212,7 @@ ofputil_action_code_from_name(const char *name)
NULL,
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) NAME,
#define OFPAT11_ACTION(ENUM, STRUCT, NAME) NAME,
+#define OFPAT12_ACTION(ENUM, STRUCT, NAME) NAME,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME,
#include "ofp-util.def"
};
@@ -4241,6 +4242,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 OFPAT12_ACTION OFPAT10_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
#include "ofp-util.def"
@@ -4265,6 +4267,7 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
return s; \
}
#define OFPAT11_ACTION OFPAT10_ACTION
+#define OFPAT12_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..8f21e90 100644
--- a/lib/ofp-util.def
+++ b/lib/ofp-util.def
@@ -36,6 +36,25 @@ 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 OFPAT12_ACTION
+#define OFPAT12_ACTION(ENUM, STRUCT, NAME)
+#endif
+//OFPAT12_ACTION(OFPAT12_OUTPUT, , "output")
+//OFPAT12_ACTION(OFPAT12_COPY_TTL_OUT, ofp_action_header, "copy_ttl_out")
+//OFPAT12_ACTION(OFPAT12_COPY_TTL_IN, ofp_action_header, "copy_ttl_in")
+//OFPAT12_ACTION(OFPAT12_SET_MPLS_TTL, , "set_mpls_ttl")
+//OFPAT12_ACTION(OFPAT12_DEC_MPLS_TTL, ofp_action_header, "dec_mpls_ttl")
+//OFPAT12_ACTION(OFPAT12_PUSH_VLAN, , "push_vlan")
+//OFPAT12_ACTION(OFPAT12_POP_VLAN, ofp_action_header, "pop_vlan")
+//OFPAT12_ACTION(OFPAT12_PUSH_MPLS, , "push_mpls")
+//OFPAT12_ACTION(OFPAT12_POP_MPLS, , "pop_mpls")
+//OFPAT12_ACTION(OFPAT12_SET_QUEUE, , "set_queue")
+//OFPAT12_ACTION(OFPAT12_GROUP, , "group")
+//OFPAT12_ACTION(OFPAT12_SET_NW_TTL, , "set_nw_ttl")
+//OFPAT12_ACTION(OFPAT12_DEC_NW_TTL, ofp_action_header, "dec_ttl")
+OFPAT12_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, "set_field")
+//OFPAT12_ACTION(OFPAT12_EXPERIMENTER, , )
+
#ifndef NXAST_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)
#endif
@@ -61,4 +80,5 @@ NXAST_ACTION(NXAST_CONTROLLER, nx_action_controller, 0, "controller")
#undef OFPAT10_ACTION
#undef OFPAT11_ACTION
+#undef OFPAT12_ACTION
#undef NXAST_ACTION
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index 549b5f8..d2e128c 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -477,6 +477,7 @@ enum ofputil_action_bitmap {
OFPUTIL_A_GROUP = 1 << 24,
OFPUTIL_A_SET_NW_TTL = 1 << 25,
OFPUTIL_A_DEC_NW_TTL = 1 << 26,
+ OFPUTIL_A_SET_FIELD = 1 << 27,
};
/* Abstract ofp_switch_features. */
@@ -635,6 +636,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 OFPAT12_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
#include "ofp-util.def"
};
@@ -643,6 +645,7 @@ enum OVS_PACKED_ENUM ofputil_action_code {
enum {
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) + 1
#define OFPAT11_ACTION(ENUM, STRUCT, NAME) + 1
+#define OFPAT12_ACTION(ENUM, STRUCT, NAME) + 1
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1
OFPUTIL_N_ACTIONS = 1
#include "ofp-util.def"
@@ -672,6 +675,9 @@ 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 OFPAT12_ACTION(ENUM, STRUCT, NAME) \
+ void ofputil_init_##ENUM(struct STRUCT *); \
+ struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
#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