summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorJoe Stringer <joe@ovn.org>2016-09-28 14:42:39 -0700
committerJoe Stringer <joe@ovn.org>2016-09-28 16:59:13 -0700
commit1d0e37ff272d5c305ceee390cd6d123c1278bab0 (patch)
tree976469a9f8aa0fc6d1e30818fdc09a626209e6fd /ofproto
parent74f205f6cc66a15f6b8e194bfcb4d4f144088583 (diff)
downloadopenvswitch-1d0e37ff272d5c305ceee390cd6d123c1278bab0.tar.gz
revalidator: Prepare xcache before xlate_lookup.
Functionally this has little change, but it allows the following patch to refactor the translation code with less changes. Strictly speaking the odp_flow_key_to_flow() and xlate_lookup() error cases should free the ukey->xcache, since it's empty and was never initialised via the later call to xlate_actions(). However, if one of these error conditions is hit during a flow dump, then there's no way that it will ever succeed on a subsequent revalidate/delete. Rather, the later revalidate/delete would do no stats translation - the same result as keeping the empty xcache here. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif-upcall.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index f76182e92..d251af1be 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -1905,6 +1905,13 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key *ukey,
goto exit;
}
+ if (need_revalidate) {
+ xlate_cache_clear(ukey->xcache);
+ }
+ if (!ukey->xcache) {
+ ukey->xcache = xlate_cache_new();
+ }
+
if (odp_flow_key_to_flow(ukey->key, ukey->key_len, &flow)
== ODP_FIT_ERROR) {
goto exit;
@@ -1916,13 +1923,6 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key *ukey,
goto exit;
}
- if (need_revalidate) {
- xlate_cache_clear(ukey->xcache);
- }
- if (!ukey->xcache) {
- ukey->xcache = xlate_cache_new();
- }
-
xlate_in_init(&xin, ofproto, ofproto_dpif_get_tables_version(ofproto),
&flow, ofp_in_port, NULL, push.tcp_flags,
NULL, need_revalidate ? &wc : NULL, odp_actions);