From: liuyongqiang <liu.liuyongqi...@huawei.com> Signed-off-by: liuyongqiang <liu.liuyongqi...@huawei.com> --- lib/ofp-actions.c | 105 +++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 53 deletions(-)
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 7d9ee58..9904fed 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -331,7 +331,7 @@ static char *WARN_UNUSED_RESULT ofpacts_parse( bool allow_instructions); #include "ofp-actions.inc1" - + /* Output actions. */ /* Action structure for OFPAT10_OUTPUT, which sends packets out 'port'. @@ -443,7 +443,7 @@ format_OUTPUT(const struct ofpact_output *a, struct ds *s) } } } - + /* Group actions. */ static enum ofperr @@ -476,7 +476,7 @@ format_GROUP(const struct ofpact_group *a, struct ds *s) { ds_put_format(s, "group:%"PRIu32, a->group_id); } - + /* Action structure for NXAST_CONTROLLER. * * This generalizes using OFPAT_OUTPUT to send a packet to OFPP_CONTROLLER. In @@ -611,7 +611,7 @@ format_CONTROLLER(const struct ofpact_controller *a, struct ds *s) ds_put_char(s, ')'); } } - + /* Enqueue action. */ struct ofp10_action_enqueue { ovs_be16 type; /* OFPAT10_ENQUEUE. */ @@ -684,7 +684,7 @@ format_ENQUEUE(const struct ofpact_enqueue *a, struct ds *s) ofputil_format_port(a->port, s); ds_put_format(s, ":%"PRIu32, a->queue); } - + /* Action structure for NXAST_OUTPUT_REG. * * Outputs to the OpenFlow port number written to src[ofs:ofs+nbits]. @@ -826,7 +826,7 @@ format_OUTPUT_REG(const struct ofpact_output_reg *a, struct ds *s) ds_put_cstr(s, "output:"); mf_format_subfield(&a->src, s); } - + /* Action structure for NXAST_BUNDLE and NXAST_BUNDLE_LOAD. * * The bundle actions choose a slave from a supplied list of options. @@ -1035,7 +1035,7 @@ format_BUNDLE(const struct ofpact_bundle *a, struct ds *s) { bundle_format(a, s); } - + /* Set VLAN actions. */ static enum ofperr @@ -1122,7 +1122,7 @@ format_SET_VLAN_VID(const struct ofpact_vlan_vid *a, struct ds *s) a->push_vlan_if_needed ? "mod_vlan_vid" : "set_vlan_vid", a->vlan_vid); } - + /* Set PCP actions. */ static enum ofperr @@ -1208,7 +1208,7 @@ format_SET_VLAN_PCP(const struct ofpact_vlan_pcp *a, struct ds *s) a->push_vlan_if_needed ? "mod_vlan_pcp" : "set_vlan_pcp", a->vlan_pcp); } - + /* Strip VLAN actions. */ static enum ofperr @@ -1258,7 +1258,7 @@ format_STRIP_VLAN(const struct ofpact_null *a, struct ds *s) ? "pop_vlan" : "strip_vlan")); } - + /* Push VLAN action. */ static enum ofperr @@ -1313,7 +1313,7 @@ format_PUSH_VLAN(const struct ofpact_null *a OVS_UNUSED, struct ds *s) /* XXX 802.1AD case*/ ds_put_format(s, "push_vlan:%#"PRIx16, ETH_TYPE_VLAN_8021Q); } - + /* Action structure for OFPAT10_SET_DL_SRC/DST and OFPAT11_SET_DL_SRC/DST. */ struct ofp_action_dl_addr { ovs_be16 type; /* Type. */ @@ -1401,7 +1401,7 @@ format_SET_ETH_DST(const struct ofpact_mac *a, struct ds *s) { ds_put_format(s, "mod_dl_dst:"ETH_ADDR_FMT, ETH_ADDR_ARGS(a->mac)); } - + /* Set IPv4 address actions. */ static enum ofperr @@ -1473,7 +1473,7 @@ format_SET_IPV4_DST(const struct ofpact_ipv4 *a, struct ds *s) { ds_put_format(s, "mod_nw_dst:"IP_FMT, IP_ARGS(a->ipv4)); } - + /* Set IPv4/v6 TOS actions. */ static enum ofperr @@ -1523,7 +1523,7 @@ format_SET_IP_DSCP(const struct ofpact_dscp *a, struct ds *s) { ds_put_format(s, "mod_nw_tos:%d", a->dscp); } - + /* Set IPv4/v6 ECN actions. */ static enum ofperr @@ -1575,7 +1575,7 @@ format_SET_IP_ECN(const struct ofpact_ecn *a, struct ds *s) { ds_put_format(s, "mod_nw_ecn:%d", a->ecn); } - + /* Set IPv4/v6 TTL actions. */ static enum ofperr @@ -1617,7 +1617,7 @@ format_SET_IP_TTL(const struct ofpact_ip_ttl *a, struct ds *s) { ds_put_format(s, "mod_nw_ttl:%d", a->ttl); } - + /* Set TCP/UDP/SCTP port actions. */ static enum ofperr @@ -1702,7 +1702,7 @@ format_SET_L4_DST_PORT(const struct ofpact_l4_port *a, struct ds *s) { ds_put_format(s, "mod_tp_dst:%d", a->port); } - + /* Action structure for OFPAT_COPY_FIELD. */ struct ofp15_action_copy_field { ovs_be16 type; /* OFPAT_COPY_FIELD. */ @@ -1954,7 +1954,7 @@ format_REG_MOVE(const struct ofpact_reg_move *a, struct ds *s) { nxm_format_reg_move(a, s); } - + /* Action structure for OFPAT12_SET_FIELD. */ struct ofp12_action_set_field { ovs_be16 type; /* OFPAT12_SET_FIELD. */ @@ -2518,7 +2518,7 @@ ofpact_put_reg_load(struct ofpbuf *ofpacts) sf->ofpact.raw = NXAST_RAW_REG_LOAD; return sf; } - + /* Action structure for NXAST_STACK_PUSH and NXAST_STACK_POP. * * Pushes (or pops) field[offset: offset + n_bits] to (or from) @@ -2635,7 +2635,7 @@ format_STACK_POP(const struct ofpact_stack *a, struct ds *s) { nxm_format_stack_pop(a, s); } - + /* Action structure for NXAST_DEC_TTL_CNT_IDS. * * If the packet is not IPv4 or IPv6, does nothing. For IPv4 or IPv6, if the @@ -2798,7 +2798,7 @@ format_DEC_TTL(const struct ofpact_cnt_ids *a, struct ds *s) ds_put_cstr(s, ")"); } } - + /* Set MPLS label actions. */ static enum ofperr @@ -2839,7 +2839,7 @@ format_SET_MPLS_LABEL(const struct ofpact_mpls_label *a, struct ds *s) { ds_put_format(s, "set_mpls_label(%"PRIu32")", ntohl(a->label)); } - + /* Set MPLS TC actions. */ static enum ofperr @@ -2879,7 +2879,7 @@ format_SET_MPLS_TC(const struct ofpact_mpls_tc *a, struct ds *s) { ds_put_format(s, "set_mpls_ttl(%"PRIu8")", a->tc); } - + /* Set MPLS TTL actions. */ static enum ofperr @@ -2920,7 +2920,7 @@ format_SET_MPLS_TTL(const struct ofpact_mpls_ttl *a, struct ds *s) { ds_put_format(s, "set_mpls_ttl(%"PRIu8")", a->ttl); } - + /* Decrement MPLS TTL actions. */ static enum ofperr @@ -2950,7 +2950,7 @@ format_DEC_MPLS_TTL(const struct ofpact_null *a OVS_UNUSED, struct ds *s) { ds_put_cstr(s, "dec_mpls_ttl"); } - + /* Push MPLS label action. */ static enum ofperr @@ -2993,7 +2993,7 @@ format_PUSH_MPLS(const struct ofpact_push_mpls *a, struct ds *s) { ds_put_format(s, "push_mpls:0x%04"PRIx16, ntohs(a->ethertype)); } - + /* Pop MPLS label action. */ static enum ofperr @@ -3029,7 +3029,7 @@ format_POP_MPLS(const struct ofpact_pop_mpls *a, struct ds *s) { ds_put_format(s, "pop_mpls:0x%04"PRIx16, ntohs(a->ethertype)); } - + /* Set tunnel ID actions. */ static enum ofperr @@ -3094,7 +3094,7 @@ format_SET_TUNNEL(const struct ofpact_tunnel *a, struct ds *s) || a->ofpact.raw == NXAST_RAW_SET_TUNNEL64 ? "64" : ""), a->tun_id); } - + /* Set queue action. */ static enum ofperr @@ -3123,7 +3123,7 @@ format_SET_QUEUE(const struct ofpact_queue *a, struct ds *s) { ds_put_format(s, "set_queue:%"PRIu32, a->queue_id); } - + /* Pop queue action. */ static enum ofperr @@ -3153,7 +3153,7 @@ format_POP_QUEUE(const struct ofpact_null *a OVS_UNUSED, struct ds *s) { ds_put_cstr(s, "pop_queue"); } - + /* Action structure for NXAST_FIN_TIMEOUT. * * This action changes the idle timeout or hard timeout, or both, of this @@ -3249,7 +3249,7 @@ format_FIN_TIMEOUT(const struct ofpact_fin_timeout *a, struct ds *s) ds_chomp(s, ','); ds_put_char(s, ')'); } - + /* Action structures for NXAST_RESUBMIT and NXAST_RESUBMIT_TABLE. * * These actions search one of the switch's flow tables: @@ -3409,7 +3409,7 @@ format_RESUBMIT(const struct ofpact_resubmit *a, struct ds *s) ds_put_char(s, ')'); } } - + /* Action structure for NXAST_LEARN. * * This action adds or modifies a flow in an OpenFlow table, similar to @@ -3844,7 +3844,7 @@ format_LEARN(const struct ofpact_learn *a, struct ds *s) { learn_format(a, s); } - + /* Action structure for NXAST_MULTIPATH. * * This action performs the following steps in sequence: @@ -3964,7 +3964,7 @@ format_MULTIPATH(const struct ofpact_multipath *a, struct ds *s) { multipath_format(a, s); } - + /* Action structure for NXAST_NOTE. * * This action has no effect. It is variable length. The switch does not @@ -4067,7 +4067,7 @@ format_NOTE(const struct ofpact_note *a, struct ds *s) ds_put_format(s, "%02"PRIx8, a->data[i]); } } - + /* Exit action. */ static enum ofperr @@ -4097,7 +4097,7 @@ format_EXIT(const struct ofpact_null *a OVS_UNUSED, struct ds *s) { ds_put_cstr(s, "exit"); } - + /* Action structure for NXAST_SAMPLE. * * Samples matching packets with the given probability and sends them @@ -4202,7 +4202,7 @@ format_SAMPLE(const struct ofpact_sample *a, struct ds *s) a->probability, a->collector_set_id, a->obs_domain_id, a->obs_point_id); } - + /* Meter instruction. */ static void @@ -4227,7 +4227,7 @@ format_METER(const struct ofpact_meter *a, struct ds *s) { ds_put_format(s, "meter:%"PRIu32, a->meter_id); } - + /* Clear-Actions instruction. */ static void @@ -4253,7 +4253,7 @@ format_CLEAR_ACTIONS(const struct ofpact_null *a OVS_UNUSED, struct ds *s) { ds_put_cstr(s, "clear_actions"); } - + /* Write-Actions instruction. */ static void @@ -4314,7 +4314,7 @@ format_WRITE_ACTIONS(const struct ofpact_nest *a, struct ds *s) ofpacts_format(a->actions, ofpact_nest_get_action_len(a), s); ds_put_char(s, ')'); } - + /* Action structure for NXAST_WRITE_METADATA. * * Modifies the 'mask' bits of the metadata value. */ @@ -4398,7 +4398,7 @@ format_WRITE_METADATA(const struct ofpact_metadata *a, struct ds *s) ds_put_format(s, "/%#"PRIx64, ntohll(a->mask)); } } - + /* Goto-Table instruction. */ static void @@ -4437,7 +4437,7 @@ format_GOTO_TABLE(const struct ofpact_goto_table *a, struct ds *s) { ds_put_format(s, "goto_table:%"PRIu8, a->table_id); } - + static void log_bad_action(const struct ofp_action_header *actions, size_t actions_len, const struct ofp_action_header *bad_action, enum ofperr error) @@ -4549,7 +4549,7 @@ ofpacts_pull_openflow_actions(struct ofpbuf *openflow, 1u << OVSINST_OFPIT11_APPLY_ACTIONS, ofpacts); } - + /* OpenFlow 1.1 actions. */ @@ -4790,7 +4790,7 @@ ofpacts_decode_for_action_set(const struct ofp_action_header *in, return 0; } - + /* OpenFlow 1.1 instructions. */ struct instruction_type_info { @@ -5195,7 +5195,7 @@ ofpacts_update_instruction_actions(struct ofpbuf *openflow, size_t ofs) ofpbuf_set_size(openflow, ofs); } } - + /* Checks that 'port' is a valid output port for OFPACT_OUTPUT, given that the * switch will never have more than 'max_ports' ports. Returns 0 if 'port' is * valid, otherwise an OpenFlow error code. */ @@ -5573,7 +5573,7 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len, return 0; } - + /* Converting ofpacts to OpenFlow. */ static void @@ -5648,7 +5648,7 @@ ofpacts_put_openflow_instructions(const struct ofpact ofpacts[], } } } - + /* Sets of supported actions. */ /* Two-way translation between OVS's internal "OFPACT_*" representation of @@ -5797,7 +5797,7 @@ ofpact_bitmap_format(uint64_t ofpacts_bitmap, struct ds *s) ds_chomp(s, ' '); } } - + /* Returns true if 'action' outputs to 'port', false otherwise. */ static bool ofpact_outputs_to_port(const struct ofpact *ofpact, ofp_port_t port) @@ -5922,7 +5922,7 @@ ofpacts_get_meter(const struct ofpact ofpacts[], size_t ofpacts_len) return 0; } - + /* Formatting ofpacts. */ static void @@ -5961,7 +5961,7 @@ ofpacts_format(const struct ofpact *ofpacts, size_t ofpacts_len, } } } - + /* Internal use by helpers. */ void * @@ -5983,7 +5983,7 @@ ofpact_init(struct ofpact *ofpact, enum ofpact_type type, size_t len) ofpact->raw = -1; ofpact->len = len; } - + /* Updates 'ofpact->len' to the number of bytes in the tail of 'ofpacts' * starting at 'ofpact'. * @@ -6015,7 +6015,6 @@ ofpact_pad(struct ofpbuf *ofpacts) ofpbuf_put_zeros(ofpacts, pad); } } - @@ -6200,7 +6199,7 @@ ofpact_name(enum ofpact_type type) } return "<unknown>"; } - + /* Low-level action decoding and encoding functions. */ /* Everything needed to identify a particular OpenFlow action. */ -- 1.9.4.msysgit.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev