X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofp-actions.h;h=d6aabf9773d024bc7b615def0ab098e45ae53c3d;hb=cfbad126a725ff76852166f4409f4974b1369a20;hp=0876ed702fcb3b55776aacef8606e6c01dd2b84f;hpb=d6fb622dcb9cb048b564621a73cf4165edc857ea;p=sliver-openvswitch.git diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h index 0876ed702..d6aabf977 100644 --- a/lib/ofp-actions.h +++ b/lib/ofp-actions.h @@ -17,6 +17,7 @@ #ifndef OFP_ACTIONS_H #define OFP_ACTIONS_H 1 +#include #include #include "meta-flow.h" #include "ofp-errors.h" @@ -99,8 +100,8 @@ \ /* Instructions */ \ DEFINE_OFPACT(METER, ofpact_meter, ofpact) \ - /* XXX Write-Actions */ \ DEFINE_OFPACT(CLEAR_ACTIONS, ofpact_null, ofpact) \ + DEFINE_OFPACT(WRITE_ACTIONS, ofpact_nest, ofpact) \ DEFINE_OFPACT(WRITE_METADATA, ofpact_metadata, ofpact) \ DEFINE_OFPACT(GOTO_TABLE, ofpact_goto_table, ofpact) @@ -326,12 +327,26 @@ struct ofpact_reg_load { union mf_subvalue subvalue; /* Least-significant bits are used. */ }; +/* The position in the packet at which to insert an MPLS header. + * + * Used NXAST_PUSH_MPLS, OFPAT11_PUSH_MPLS. */ +enum ofpact_mpls_position { + /* Add the MPLS LSE after the Ethernet header but before any VLAN tags. + * OpenFlow 1.3+ requires this behavior. */ + OFPACT_MPLS_BEFORE_VLAN, + + /* Add the MPLS LSE after the Ethernet header and any VLAN tags. + * OpenFlow 1.1 and 1.2 require this behavior. */ + OFPACT_MPLS_AFTER_VLAN +}; + /* OFPACT_PUSH_VLAN/MPLS/PBB * * Used for NXAST_PUSH_MPLS, OFPAT11_PUSH_MPLS. */ struct ofpact_push_mpls { struct ofpact ofpact; ovs_be16 ethertype; + enum ofpact_mpls_position position; }; /* OFPACT_POP_MPLS @@ -384,6 +399,25 @@ struct ofpact_meter { uint32_t meter_id; }; +/* OFPACT_WRITE_ACTIONS. + * + * Used for OFPIT11_WRITE_ACTIONS. */ +struct ofpact_nest { + struct ofpact ofpact; + uint8_t pad[OFPACT_ALIGN(sizeof(struct ofpact)) - sizeof(struct ofpact)]; + struct ofpact actions[]; +}; +BUILD_ASSERT_DECL(offsetof(struct ofpact_nest, actions) == OFPACT_ALIGNTO); + +static inline size_t +ofpact_nest_get_action_len(const struct ofpact_nest *on) +{ + return on->ofpact.len - offsetof(struct ofpact_nest, actions); +} + +void ofpacts_execute_action_set(struct ofpbuf *action_list, + const struct ofpbuf *action_set); + /* OFPACT_RESUBMIT. * * Used for NXAST_RESUBMIT, NXAST_RESUBMIT_TABLE. */ @@ -504,9 +538,11 @@ enum ofperr ofpacts_pull_openflow10(struct ofpbuf *openflow, unsigned int actions_len, struct ofpbuf *ofpacts); enum ofperr ofpacts_pull_openflow11_actions(struct ofpbuf *openflow, + enum ofp_version version, unsigned int actions_len, struct ofpbuf *ofpacts); enum ofperr ofpacts_pull_openflow11_instructions(struct ofpbuf *openflow, + enum ofp_version version, unsigned int instructions_len, struct ofpbuf *ofpacts); enum ofperr ofpacts_check(const struct ofpact[], size_t ofpacts_len, @@ -665,5 +701,4 @@ enum ovs_instruction_type ovs_instruction_type_from_ofpact_type( void ofpact_set_field_init(struct ofpact_reg_load *load, const struct mf_field *mf, const void *src); - #endif /* ofp-actions.h */