diff options
author | Jarno Rajahalme <jarno@ovn.org> | 2016-09-14 16:51:27 -0700 |
---|---|---|
committer | Jarno Rajahalme <jarno@ovn.org> | 2016-09-14 16:51:27 -0700 |
commit | 2c7ee5248496896b3794df1d8635b70370097847 (patch) | |
tree | fadc512acfe3ac4984c1e4bdc6d15780052072b3 /ofproto/ofproto-provider.h | |
parent | a027899ee3e5a65c9253a24be8f8abdd9c47a023 (diff) | |
download | openvswitch-2c7ee5248496896b3794df1d8635b70370097847.tar.gz |
ofproto: Use ofproto_flow_mod for learn execution from xlate cache.
Use ofproto_flow_mod with a reference to an existing or new rule
instead of ofputil_flow_mod for learn action execution from xlate
cache
Typically we would find that when a learn xlate cache entry is
created, a preceding upcall has already created the learned flow. In
this case the xlate cache entry takes a reference to that flow and
keeps refreshing it without needing to perform any flow table lookups.
Otherwise the creation of the xlate cache entry creates the new rule,
which is then subsequently added to the classifier. In both cases
this is both faster and shrinks the memory cost of each learn cache
entry from ~3.5kb to about 0.3kb.
If the learned rule does not yet exist, it is created and attached to
the ofproto_flow_mod, from which it is then added. If the referred
rule happens to expire, or is modified in any way and is thus removed
from the classifier tables, we create a new rule using the old rule as
a template, so that we can avoid storing the ofputil_flow_mod in all
cases.
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto/ofproto-provider.h')
-rw-r--r-- | ofproto/ofproto-provider.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index ef8ed6710..74bf89a55 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -1899,6 +1899,12 @@ struct ofproto_group_mod { enum ofperr ofproto_flow_mod(struct ofproto *, const struct ofputil_flow_mod *) OVS_EXCLUDED(ofproto_mutex); +enum ofperr ofproto_flow_mod_init_for_learn(struct ofproto *, + const struct ofputil_flow_mod *, + struct ofproto_flow_mod *) + OVS_EXCLUDED(ofproto_mutex); +enum ofperr ofproto_flow_mod_learn(struct ofproto_flow_mod *, bool keep_ref) + OVS_EXCLUDED(ofproto_mutex); void ofproto_add_flow(struct ofproto *, const struct match *, int priority, const struct ofpact *ofpacts, size_t ofpacts_len) OVS_EXCLUDED(ofproto_mutex); |