2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00

ofp-actions: Complete ofp13_action_type.

Signed-off-by: Alexander Wu <alexander.wu@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Alexander Wu
2014-01-17 13:19:35 -08:00
committed by Ben Pfaff
parent c0621c394f
commit 9c4dbc1caa
6 changed files with 71 additions and 2 deletions

View File

@@ -104,8 +104,24 @@ struct ofp13_instruction_meter {
OFP_ASSERT(sizeof(struct ofp13_instruction_meter) == 8); OFP_ASSERT(sizeof(struct ofp13_instruction_meter) == 8);
enum ofp13_action_type { enum ofp13_action_type {
OFPAT13_PUSH_PBB = 26, /* Push a new PBB service tag (I-TAG) */ OFPAT13_OUTPUT = 0, /* Output to switch port. */
OFPAT13_POP_PBB = 27 /* Pop the outer PBB service tag (I-TAG) */ OFPAT13_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from next-to-outermost
to outermost */
OFPAT13_COPY_TTL_IN = 12, /* Copy TTL "inwards" -- from outermost to
next-to-outermost */
OFPAT13_SET_MPLS_TTL = 15, /* MPLS TTL */
OFPAT13_DEC_MPLS_TTL = 16, /* Decrement MPLS TTL */
OFPAT13_PUSH_VLAN = 17, /* Push a new VLAN tag */
OFPAT13_POP_VLAN = 18, /* Pop the outer VLAN tag */
OFPAT13_PUSH_MPLS = 19, /* Push a new MPLS Label Stack Entry */
OFPAT13_POP_MPLS = 20, /* Pop the outer MPLS Label Stack Entry */
OFPAT13_SET_QUEUE = 21, /* Set queue id when outputting to a port */
OFPAT13_GROUP = 22, /* Apply group. */
OFPAT13_SET_NW_TTL = 23, /* IP TTL. */
OFPAT13_DEC_NW_TTL = 24, /* Decrement IP TTL. */
OFPAT13_SET_FIELD = 25, /* Set a header field using OXM TLV format. */
OFPAT13_PUSH_PBB = 26, /* Push a new PBB service tag (I-TAG) */
OFPAT13_POP_PBB = 27 /* Pop the outer PBB service tag (I-TAG) */
}; };
/* enum ofp_config_flags value OFPC_INVALID_TTL_TO_CONTROLLER /* enum ofp_config_flags value OFPC_INVALID_TTL_TO_CONTROLLER

View File

@@ -377,6 +377,7 @@ ofpact_from_nxast(const union ofp_action *a, enum ofputil_action_code code,
case OFPUTIL_ACTION_INVALID: case OFPUTIL_ACTION_INVALID:
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM: #define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM: #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def" #include "ofp-util.def"
OVS_NOT_REACHED(); OVS_NOT_REACHED();
@@ -523,6 +524,7 @@ ofpact_from_openflow10(const union ofp_action *a,
switch (code) { switch (code) {
case OFPUTIL_ACTION_INVALID: case OFPUTIL_ACTION_INVALID:
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM: #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def" #include "ofp-util.def"
OVS_NOT_REACHED(); OVS_NOT_REACHED();
@@ -1141,6 +1143,7 @@ ofpact_from_openflow11(const union ofp_action *a, enum ofp_version version,
switch (code) { switch (code) {
case OFPUTIL_ACTION_INVALID: case OFPUTIL_ACTION_INVALID:
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM: #define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def" #include "ofp-util.def"
OVS_NOT_REACHED(); OVS_NOT_REACHED();

View File

@@ -650,6 +650,7 @@ parse_named_action(enum ofputil_action_code code,
case OFPUTIL_OFPAT10_OUTPUT: case OFPUTIL_OFPAT10_OUTPUT:
case OFPUTIL_OFPAT11_OUTPUT: case OFPUTIL_OFPAT11_OUTPUT:
case OFPUTIL_OFPAT13_OUTPUT:
error = parse_output(arg, ofpacts); error = parse_output(arg, ofpacts);
break; break;
@@ -686,14 +687,17 @@ parse_named_action(enum ofputil_action_code code,
break; break;
case OFPUTIL_OFPAT12_SET_FIELD: case OFPUTIL_OFPAT12_SET_FIELD:
case OFPUTIL_OFPAT13_SET_FIELD:
return set_field_parse(arg, ofpacts, usable_protocols); return set_field_parse(arg, ofpacts, usable_protocols);
case OFPUTIL_OFPAT10_STRIP_VLAN: case OFPUTIL_OFPAT10_STRIP_VLAN:
case OFPUTIL_OFPAT11_POP_VLAN: case OFPUTIL_OFPAT11_POP_VLAN:
case OFPUTIL_OFPAT13_POP_VLAN:
ofpact_put_STRIP_VLAN(ofpacts)->ofpact.compat = code; ofpact_put_STRIP_VLAN(ofpacts)->ofpact.compat = code;
break; break;
case OFPUTIL_OFPAT11_PUSH_VLAN: case OFPUTIL_OFPAT11_PUSH_VLAN:
case OFPUTIL_OFPAT13_PUSH_VLAN:
*usable_protocols &= OFPUTIL_P_OF11_UP; *usable_protocols &= OFPUTIL_P_OF11_UP;
error = str_to_u16(arg, "ethertype", &ethertype); error = str_to_u16(arg, "ethertype", &ethertype);
if (error) { if (error) {
@@ -709,6 +713,7 @@ parse_named_action(enum ofputil_action_code code,
break; break;
case OFPUTIL_OFPAT11_SET_QUEUE: case OFPUTIL_OFPAT11_SET_QUEUE:
case OFPUTIL_OFPAT13_SET_QUEUE:
error = str_to_u32(arg, &ofpact_put_SET_QUEUE(ofpacts)->queue_id); error = str_to_u32(arg, &ofpact_put_SET_QUEUE(ofpacts)->queue_id);
break; break;
@@ -758,6 +763,7 @@ parse_named_action(enum ofputil_action_code code,
break; break;
case OFPUTIL_OFPAT11_SET_NW_TTL: case OFPUTIL_OFPAT11_SET_NW_TTL:
case OFPUTIL_OFPAT13_SET_NW_TTL:
error = str_to_u8(arg, "TTL", &ttl); error = str_to_u8(arg, "TTL", &ttl);
if (error) { if (error) {
return error; return error;
@@ -767,6 +773,7 @@ parse_named_action(enum ofputil_action_code code,
break; break;
case OFPUTIL_OFPAT11_DEC_NW_TTL: case OFPUTIL_OFPAT11_DEC_NW_TTL:
case OFPUTIL_OFPAT13_DEC_NW_TTL:
OVS_NOT_REACHED(); OVS_NOT_REACHED();
case OFPUTIL_OFPAT10_SET_TP_SRC: case OFPUTIL_OFPAT10_SET_TP_SRC:
@@ -861,10 +868,12 @@ parse_named_action(enum ofputil_action_code code,
case OFPUTIL_NXAST_SET_MPLS_TTL: case OFPUTIL_NXAST_SET_MPLS_TTL:
case OFPUTIL_OFPAT11_SET_MPLS_TTL: case OFPUTIL_OFPAT11_SET_MPLS_TTL:
case OFPUTIL_OFPAT13_SET_MPLS_TTL:
error = parse_set_mpls_ttl(ofpacts, arg); error = parse_set_mpls_ttl(ofpacts, arg);
break; break;
case OFPUTIL_OFPAT11_DEC_MPLS_TTL: case OFPUTIL_OFPAT11_DEC_MPLS_TTL:
case OFPUTIL_OFPAT13_DEC_MPLS_TTL:
case OFPUTIL_NXAST_DEC_MPLS_TTL: case OFPUTIL_NXAST_DEC_MPLS_TTL:
ofpact_put_DEC_MPLS_TTL(ofpacts); ofpact_put_DEC_MPLS_TTL(ofpacts);
break; break;
@@ -878,6 +887,7 @@ parse_named_action(enum ofputil_action_code code,
break; break;
case OFPUTIL_OFPAT11_PUSH_MPLS: case OFPUTIL_OFPAT11_PUSH_MPLS:
case OFPUTIL_OFPAT13_PUSH_MPLS:
case OFPUTIL_NXAST_PUSH_MPLS: case OFPUTIL_NXAST_PUSH_MPLS:
error = str_to_u16(arg, "push_mpls", &ethertype); error = str_to_u16(arg, "push_mpls", &ethertype);
if (!error) { if (!error) {
@@ -886,6 +896,7 @@ parse_named_action(enum ofputil_action_code code,
break; break;
case OFPUTIL_OFPAT11_POP_MPLS: case OFPUTIL_OFPAT11_POP_MPLS:
case OFPUTIL_OFPAT13_POP_MPLS:
case OFPUTIL_NXAST_POP_MPLS: case OFPUTIL_NXAST_POP_MPLS:
error = str_to_u16(arg, "pop_mpls", &ethertype); error = str_to_u16(arg, "pop_mpls", &ethertype);
if (!error) { if (!error) {
@@ -894,9 +905,17 @@ parse_named_action(enum ofputil_action_code code,
break; break;
case OFPUTIL_OFPAT11_GROUP: case OFPUTIL_OFPAT11_GROUP:
case OFPUTIL_OFPAT13_GROUP:
error = str_to_u32(arg, &ofpact_put_GROUP(ofpacts)->group_id); error = str_to_u32(arg, &ofpact_put_GROUP(ofpacts)->group_id);
break; break;
/* FIXME when implement OFPAT13_* */
case OFPUTIL_OFPAT13_COPY_TTL_OUT:
case OFPUTIL_OFPAT13_COPY_TTL_IN:
case OFPUTIL_OFPAT13_PUSH_PBB:
case OFPUTIL_OFPAT13_POP_PBB:
OVS_NOT_REACHED();
case OFPUTIL_NXAST_STACK_PUSH: case OFPUTIL_NXAST_STACK_PUSH:
error = nxm_parse_stack_action(ofpact_put_STACK_PUSH(ofpacts), arg); error = nxm_parse_stack_action(ofpact_put_STACK_PUSH(ofpacts), arg);
break; break;

View File

@@ -5236,6 +5236,7 @@ static const char *const names[OFPUTIL_N_ACTIONS] = {
NULL, NULL,
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) NAME, #define OFPAT10_ACTION(ENUM, STRUCT, NAME) NAME,
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME, #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME,
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME, #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME,
#include "ofp-util.def" #include "ofp-util.def"
}; };
@@ -5275,6 +5276,8 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
{ {
switch (code) { switch (code) {
case OFPUTIL_ACTION_INVALID: case OFPUTIL_ACTION_INVALID:
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def"
OVS_NOT_REACHED(); OVS_NOT_REACHED();
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \ #define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
@@ -5306,6 +5309,8 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
} }
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \ #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
OFPAT10_ACTION(ENUM, STRUCT, NAME) OFPAT10_ACTION(ENUM, STRUCT, NAME)
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
OFPAT10_ACTION(ENUM, STRUCT, NAME)
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \ #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
void \ void \
ofputil_init_##ENUM(struct STRUCT *s) \ ofputil_init_##ENUM(struct STRUCT *s) \

View File

@@ -44,6 +44,26 @@ OFPAT11_ACTION(OFPAT11_DEC_NW_TTL, ofp_action_header, 0, NULL)
OFPAT11_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, 1, "set_field") OFPAT11_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, 1, "set_field")
OFPAT11_ACTION(OFPAT11_GROUP, ofp11_action_group, 0, "group") OFPAT11_ACTION(OFPAT11_GROUP, ofp11_action_group, 0, "group")
#ifndef OFPAT13_ACTION
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)
#endif
OFPAT13_ACTION(OFPAT13_OUTPUT, ofp11_action_output, 0, "output")
OFPAT13_ACTION(OFPAT13_COPY_TTL_OUT, ofp_action_header, 0, "copy_ttl_out")
OFPAT13_ACTION(OFPAT13_COPY_TTL_IN, ofp_action_header, 0, "copy_ttl_in")
OFPAT13_ACTION(OFPAT13_SET_MPLS_TTL, ofp11_action_mpls_ttl, 0, "set_mpls_ttl")
OFPAT13_ACTION(OFPAT13_DEC_MPLS_TTL, ofp_action_header, 0, "dec_mpls_ttl")
OFPAT13_ACTION(OFPAT13_PUSH_VLAN, ofp11_action_push, 0, "push_vlan")
OFPAT13_ACTION(OFPAT13_POP_VLAN, ofp_action_header, 0, "pop_vlan")
OFPAT13_ACTION(OFPAT13_PUSH_MPLS, ofp11_action_push, 0, "push_mpls")
OFPAT13_ACTION(OFPAT13_POP_MPLS, ofp11_action_pop_mpls, 0, "pop_mpls")
OFPAT13_ACTION(OFPAT13_SET_QUEUE, ofp11_action_set_queue, 0, "set_queue")
OFPAT13_ACTION(OFPAT13_GROUP, ofp11_action_group, 0, "group")
OFPAT13_ACTION(OFPAT13_SET_NW_TTL, ofp11_action_nw_ttl, 0, "set_nw_ttl")
OFPAT13_ACTION(OFPAT13_DEC_NW_TTL, ofp_action_header, 0, "dec_nw_ttl")
OFPAT13_ACTION(OFPAT13_SET_FIELD, ofp12_action_set_field, 1, "set_field")
OFPAT13_ACTION(OFPAT13_PUSH_PBB, ofp11_action_push, 0, "push_pbb")
OFPAT13_ACTION(OFPAT13_POP_PBB, ofp_action_header, 0, "pop_pbb")
#ifndef NXAST_ACTION #ifndef NXAST_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)
#endif #endif
@@ -80,4 +100,5 @@ NXAST_ACTION(NXAST_SAMPLE, nx_action_sample, 0, "sample")
#undef OFPAT10_ACTION #undef OFPAT10_ACTION
#undef OFPAT11_ACTION #undef OFPAT11_ACTION
#undef OFPAT13_ACTION
#undef NXAST_ACTION #undef NXAST_ACTION

View File

@@ -851,6 +851,7 @@ enum OVS_PACKED_ENUM ofputil_action_code {
OFPUTIL_ACTION_INVALID, OFPUTIL_ACTION_INVALID,
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM, #define OFPAT10_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM,
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM, #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM, #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
#include "ofp-util.def" #include "ofp-util.def"
}; };
@@ -859,6 +860,7 @@ enum OVS_PACKED_ENUM ofputil_action_code {
enum { enum {
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) + 1 #define OFPAT10_ACTION(ENUM, STRUCT, NAME) + 1
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1 #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1
OFPUTIL_N_ACTIONS = 1 OFPUTIL_N_ACTIONS = 1
#include "ofp-util.def" #include "ofp-util.def"
@@ -889,6 +891,9 @@ void *ofputil_put_action(enum ofputil_action_code, struct ofpbuf *buf);
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \ #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
void ofputil_init_##ENUM(struct STRUCT *); \ void ofputil_init_##ENUM(struct STRUCT *); \
struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *); struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
#define OFPAT13_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
void ofputil_init_##ENUM(struct STRUCT *); \
struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \ #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
void ofputil_init_##ENUM(struct STRUCT *); \ void ofputil_init_##ENUM(struct STRUCT *); \
struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *); struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);