summaryrefslogtreecommitdiff
path: root/ofproto/ofproto.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-06-15 16:29:22 -0700
committerBen Pfaff <blp@ovn.org>2018-07-31 13:11:13 -0700
commitae6f7530bff39c62d3b7d1baab93623d8f5f3db1 (patch)
tree0db01af5bfa256b1b7b4cfec1efe73a6b08649dd /ofproto/ofproto.c
parent86c6aa826e9274e5cb0e49159ba5e825c43065b2 (diff)
downloadopenvswitch-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 'ofproto/ofproto.c')
-rw-r--r--ofproto/ofproto.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index e71431129..4d72dd841 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3507,10 +3507,14 @@ ofproto_packet_out_init(struct ofproto *ofproto,
* check instructions (e.g., goto-table), which can't appear on the action
* list of a packet-out. */
match_wc_init(&match, opo->flow);
- error = ofpacts_check_consistency(po->ofpacts, po->ofpacts_len, &match,
- u16_to_ofp(ofproto->max_ports), 0,
- ofproto->n_tables,
- ofconn_get_protocol(ofconn));
+ struct ofpact_check_params cp = {
+ .match = &match,
+ .max_ports = u16_to_ofp(ofproto->max_ports),
+ .table_id = 0,
+ .n_tables = ofproto->n_tables
+ };
+ error = ofpacts_check_consistency(po->ofpacts, po->ofpacts_len,
+ ofconn_get_protocol(ofconn), &cp);
if (error) {
dp_packet_delete(opo->packet);
free(opo->flow);