]> git.proxmox.com Git - mirror_ovs.git/commitdiff
revalidator: Prepare xcache before xlate_lookup.
authorJoe Stringer <joe@ovn.org>
Wed, 28 Sep 2016 21:42:39 +0000 (14:42 -0700)
committerJoe Stringer <joe@ovn.org>
Wed, 28 Sep 2016 23:59:13 +0000 (16:59 -0700)
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>
ofproto/ofproto-dpif-upcall.c

index f76182e9285da2c884c56cad37e81c6925aa48f9..d251af1bedc08eec34b28af6894f489133d0288d 100644 (file)
@@ -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);