X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=switch%2Fchain.c;h=0388951da8ff9ff9dd0f7ec180470b1582562435;hb=57d52057650716ee354ebbe588d2a884ccabc81f;hp=8419070b3417f470f2df74c064834bf9188afafc;hpb=4f546834ac37ff964f732e12c3abbcb16f7570e2;p=openvswitch diff --git a/switch/chain.c b/switch/chain.c index 8419070b..0388951d 100644 --- a/switch/chain.c +++ b/switch/chain.c @@ -114,6 +114,27 @@ chain_insert(struct sw_chain *chain, struct sw_flow *flow) return -ENOBUFS; } +/* Modifies actions in 'chain' that match 'key'. Returns the number of + * flows that were modified. + * + * Expensive in the general case as currently implemented, since it requires + * iterating through the entire contents of each table for keys that contain + * wildcards. Relatively cheap for fully specified keys. */ +int +chain_modify(struct sw_chain *chain, const struct sw_flow_key *key, + const struct ofp_action *actions, int n_actions) +{ + int count = 0; + int i; + + for (i = 0; i < chain->n_tables; i++) { + struct sw_table *t = chain->tables[i]; + count += t->modify(t, key, actions, n_actions); + } + + return count; +} + /* Deletes from 'chain' any and all flows that match 'key'. Returns the number * of flows that were deleted. *