From e9536ecb5097ee60cf0fa6f06ca27f41aa67d165 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 25 Sep 2012 10:23:38 -0700 Subject: [PATCH] ofp-actions: Prepare to treat OF1.2 actions as OF1.1 actions. The numbering of OpenFlow 1.0 actions overlaps with the numbering of OpenFlow 1.1+ actions, so the two sets of actions have to be distinguished for input and output. But OpenFlow 1.1 and 1.2 actions are numbered to avoid this problem, so there is no need to distinguish them in the same way. Therefore, this commit prepares to treat them together. Signed-off-by: Ben Pfaff Reviewed-by: Simon Horman --- lib/ofp-actions.c | 7 ++++--- lib/ofp-util.c | 3 --- lib/ofp-util.def | 24 +----------------------- lib/ofp-util.h | 5 ----- 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 19ed7a02..bb45edc0 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -283,7 +283,6 @@ 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(); @@ -398,7 +397,6 @@ 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(); @@ -661,7 +659,6 @@ 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(); @@ -716,6 +713,10 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out) ofpact_put_SET_L4_DST_PORT(out)->port = ntohs(a->tp_port.tp_port); break; + case OFPUTIL_OFPAT12_SET_FIELD: + /* Not yet implemented. */ + break; + #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM: #include "ofp-util.def" return ofpact_from_nxast(a, code, out); diff --git a/lib/ofp-util.c b/lib/ofp-util.c index fc988946..e2a815be 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -3667,7 +3667,6 @@ 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" }; @@ -3697,7 +3696,6 @@ 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" @@ -3722,7 +3720,6 @@ 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 6f5113e7..2e50db16 100644 --- a/lib/ofp-util.def +++ b/lib/ofp-util.def @@ -35,28 +35,7 @@ OFPAT11_ACTION(OFPAT11_SET_TP_DST, ofp_action_tp_port, "mod_tp_dst") //OFPAT11_ACTION(OFPAT11_SET_QUEUE, ofp11_action_set_queue, "set_queue") //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") -//Use non-NULL name for OFPAT12_SET_FIELD once the code for -//the OFPUTIL_OFPAT12_SET_FIELD case in parse_named_action() is implemented -//OFPAT12_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, "set_field") -OFPAT12_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, NULL) -//OFPAT12_ACTION(OFPAT12_EXPERIMENTER, , ) +OFPAT11_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, NULL) #ifndef NXAST_ACTION #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) @@ -84,5 +63,4 @@ NXAST_ACTION(NXAST_DEC_TTL_CNT_IDS, nx_action_cnt_ids, 1, NULL) #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 4e9f946f..6b5f3672 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -560,7 +560,6 @@ 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" }; @@ -569,7 +568,6 @@ 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" @@ -599,9 +597,6 @@ 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 *); -- 2.30.2