X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofp-actions.h;h=b97afd0b42d0dd485cfcac8824b2a93aad065e04;hb=bbb8dee92d639331e8bd81823638267dcc895396;hp=c4e1b4a60f39158ca056e4762819a31a779233e6;hpb=1bda9b9e1a74ce376a1b51127a7e80640336c715;p=sliver-openvswitch.git diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h index c4e1b4a60..b97afd0b4 100644 --- a/lib/ofp-actions.h +++ b/lib/ofp-actions.h @@ -70,7 +70,11 @@ DEFINE_OFPACT(SET_L4_DST_PORT, ofpact_l4_port, ofpact) \ DEFINE_OFPACT(REG_MOVE, ofpact_reg_move, ofpact) \ DEFINE_OFPACT(REG_LOAD, ofpact_reg_load, ofpact) \ + DEFINE_OFPACT(STACK_PUSH, ofpact_stack, ofpact) \ + DEFINE_OFPACT(STACK_POP, ofpact_stack, ofpact) \ DEFINE_OFPACT(DEC_TTL, ofpact_cnt_ids, cnt_ids) \ + DEFINE_OFPACT(SET_MPLS_TTL, ofpact_mpls_ttl, ofpact) \ + DEFINE_OFPACT(DEC_MPLS_TTL, ofpact_null, ofpact) \ DEFINE_OFPACT(PUSH_MPLS, ofpact_push_mpls, ofpact) \ DEFINE_OFPACT(POP_MPLS, ofpact_pop_mpls, ofpact) \ \ @@ -90,11 +94,13 @@ /* Other. */ \ DEFINE_OFPACT(NOTE, ofpact_note, data) \ DEFINE_OFPACT(EXIT, ofpact_null, ofpact) \ + DEFINE_OFPACT(SAMPLE, ofpact_sample, ofpact) \ \ /* Instructions */ \ + DEFINE_OFPACT(METER, ofpact_meter, ofpact) \ /* XXX Write-Actions */ \ - DEFINE_OFPACT(WRITE_METADATA, ofpact_metadata, ofpact) \ DEFINE_OFPACT(CLEAR_ACTIONS, ofpact_null, ofpact) \ + DEFINE_OFPACT(WRITE_METADATA, ofpact_metadata, ofpact) \ DEFINE_OFPACT(GOTO_TABLE, ofpact_goto_table, ofpact) /* enum ofpact_type, with a member OFPACT_ for each action. */ @@ -193,7 +199,7 @@ struct ofpact_null { * Used for OFPAT10_OUTPUT. */ struct ofpact_output { struct ofpact ofpact; - uint16_t port; /* Output port. */ + ofp_port_t port; /* Output port. */ uint16_t max_len; /* Max send len, for port OFPP_CONTROLLER. */ }; @@ -212,7 +218,7 @@ struct ofpact_controller { * Used for OFPAT10_ENQUEUE. */ struct ofpact_enqueue { struct ofpact ofpact; - uint16_t port; + ofp_port_t port; uint32_t queue; }; @@ -242,7 +248,7 @@ struct ofpact_bundle { /* Slaves for output. */ unsigned int n_slaves; - uint16_t slaves[]; + ofp_port_t slaves[]; }; /* OFPACT_SET_VLAN_VID. @@ -302,6 +308,14 @@ struct ofpact_reg_move { struct mf_subfield dst; }; +/* OFPACT_STACK_PUSH. + * + * Used for NXAST_STACK_PUSH and NXAST_STACK_POP. */ +struct ofpact_stack { + struct ofpact ofpact; + struct mf_subfield subfield; +}; + /* OFPACT_REG_LOAD. * * Used for NXAST_REG_LOAD, OFPAT12_SET_FIELD. */ @@ -361,25 +375,33 @@ struct ofpact_metadata { ovs_be64 mask; }; +/* OFPACT_METER. + * + * Used for OFPIT13_METER. */ +struct ofpact_meter { + struct ofpact ofpact; + uint32_t meter_id; +}; + /* OFPACT_RESUBMIT. * * Used for NXAST_RESUBMIT, NXAST_RESUBMIT_TABLE. */ struct ofpact_resubmit { struct ofpact ofpact; - uint16_t in_port; + ofp_port_t in_port; uint8_t table_id; }; /* Part of struct ofpact_learn, below. */ struct ofpact_learn_spec { - int n_bits; + int n_bits; /* Number of bits in source and dest. */ - int src_type; - struct mf_subfield src; - union mf_subvalue src_imm; + int src_type; /* One of NX_LEARN_SRC_*. */ + struct mf_subfield src; /* NX_LEARN_SRC_FIELD only. */ + union mf_subvalue src_imm; /* NX_LEARN_SRC_IMMEDIATE only. */ - int dst_type; - struct mf_subfield dst; + int dst_type; /* One of NX_LEARN_DST_*. */ + struct mf_subfield dst; /* NX_LEARN_DST_MATCH, NX_LEARN_DST_LOAD only. */ }; /* OFPACT_LEARN. @@ -429,6 +451,17 @@ struct ofpact_note { uint8_t data[]; }; +/* OFPACT_SAMPLE. + * + * Used for NXAST_SAMPLE. */ +struct ofpact_sample { + struct ofpact ofpact; + uint16_t probability; // Always >0. + uint32_t collector_set_id; + uint32_t obs_domain_id; + uint32_t obs_point_id; +}; + /* OFPACT_DEC_TTL. * * Used for OFPAT11_DEC_NW_TTL, NXAST_DEC_TTL and NXAST_DEC_TTL_CNT_IDS. */ @@ -440,6 +473,15 @@ struct ofpact_cnt_ids { uint16_t cnt_ids[]; }; +/* OFPACT_SET_MPLS_TTL. + * + * Used for NXAST_SET_MPLS_TTL */ +struct ofpact_mpls_ttl { + struct ofpact ofpact; + + uint8_t ttl; +}; + /* OFPACT_GOTO_TABLE * * Used for OFPIT11_GOTO_TABLE */ @@ -459,7 +501,8 @@ enum ofperr ofpacts_pull_openflow11_instructions(struct ofpbuf *openflow, unsigned int instructions_len, struct ofpbuf *ofpacts); enum ofperr ofpacts_check(const struct ofpact[], size_t ofpacts_len, - const struct flow *, int max_ports); + struct flow *, ofp_port_t max_ports, + uint8_t table_id); enum ofperr ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len); /* Converting ofpacts to OpenFlow. */ @@ -473,7 +516,7 @@ void ofpacts_put_openflow11_instructions(const struct ofpact[], /* Working with ofpacts. */ bool ofpacts_output_to_port(const struct ofpact[], size_t ofpacts_len, - uint16_t port); + ofp_port_t port); bool ofpacts_equal(const struct ofpact a[], size_t a_len, const struct ofpact b[], size_t b_len); @@ -567,6 +610,10 @@ void ofpact_pad(struct ofpbuf *); * It is enforced on parser from text string. */ #define OVS_INSTRUCTIONS \ + DEFINE_INST(OFPIT13_METER, \ + ofp13_instruction_meter, false, \ + "meter") \ + \ DEFINE_INST(OFPIT11_APPLY_ACTIONS, \ ofp11_instruction_actions, true, \ "apply_actions") \ @@ -599,18 +646,10 @@ enum { #undef DEFINE_INST }; - -static inline bool -ofpact_is_instruction(const struct ofpact *a) -{ - /* XXX Write-Actions */ - return a->type == OFPACT_CLEAR_ACTIONS - || a->type == OFPACT_WRITE_METADATA - || a->type == OFPACT_GOTO_TABLE; -} - -const char *ofpact_instruction_name_from_type(enum ovs_instruction_type type); -int ofpact_instruction_type_from_name(const char *name); +const char *ovs_instruction_name_from_type(enum ovs_instruction_type type); +int ovs_instruction_type_from_name(const char *name); +enum ovs_instruction_type ovs_instruction_type_from_ofpact_type( + enum ofpact_type); void ofpact_set_field_init(struct ofpact_reg_load *load, const struct mf_field *mf, const void *src);