diff options
author | Ben Pfaff <blp@ovn.org> | 2018-06-15 16:29:22 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-07-31 13:11:13 -0700 |
commit | ae6f7530bff39c62d3b7d1baab93623d8f5f3db1 (patch) | |
tree | 0db01af5bfa256b1b7b4cfec1efe73a6b08649dd /include | |
parent | 86c6aa826e9274e5cb0e49159ba5e825c43065b2 (diff) | |
download | openvswitch-ae6f7530bff39c62d3b7d1baab93623d8f5f3db1.tar.gz |
ofp-actions: Split ofpacts_check__() into many functions.
ofpacts_check__() was a huge switch statement with special cases for many
different kinds of actions. This made it unwieldy and put the special
cases far away from the rest of the code related to a given action. This
commit refactors the code to avoid the problem.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/openvswitch/ofp-actions.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h index 3b0350496..e0588afad 100644 --- a/include/openvswitch/ofp-actions.h +++ b/include/openvswitch/ofp-actions.h @@ -1037,14 +1037,22 @@ ofpacts_pull_openflow_instructions(struct ofpbuf *openflow, const struct vl_mff_map *vl_mff_map, uint64_t *ofpacts_tlv_bitmap, struct ofpbuf *ofpacts); + +struct ofpact_check_params { + /* Input. */ + struct match *match; + ofp_port_t max_ports; + uint8_t table_id; + uint8_t n_tables; + + /* Output. */ + enum ofputil_protocol usable_protocols; +}; enum ofperr ofpacts_check(struct ofpact[], size_t ofpacts_len, - struct match *, ofp_port_t max_ports, - uint8_t table_id, uint8_t n_tables, - enum ofputil_protocol *usable_protocols); + struct ofpact_check_params *); enum ofperr ofpacts_check_consistency(struct ofpact[], size_t ofpacts_len, - struct match *, ofp_port_t max_ports, - uint8_t table_id, uint8_t n_tables, - enum ofputil_protocol usable_protocols); + enum ofputil_protocol needed_protocols, + struct ofpact_check_params *); enum ofperr ofpact_check_output_port(ofp_port_t port, ofp_port_t max_ports); /* Converting ofpacts to OpenFlow. */ |