]> git.proxmox.com Git - mirror_ovs.git/commitdiff
dpif-netdev: Fix zero length keys insertion to EMC.
authorIlya Maximets <i.maximets@samsung.com>
Wed, 25 Jul 2018 16:09:31 +0000 (19:09 +0300)
committerIan Stokes <ian.stokes@intel.com>
Wed, 8 Aug 2018 21:06:21 +0000 (22:06 +0100)
'key.len' should be calculated before inserting to EMC, otherwise
resulting entry will match with any packet with the same hash.

CC: Yipeng Wang <yipeng1.wang@intel.com>
Fixes: 60d8ccae135f ("dpif-netdev: Add SMC cache after EMC cache")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
lib/dpif-netdev.c

index 26d07b39c9af6e01c20d19e83f582ec5ac499958..5ee8d0a4c8fff812418fbc9b5bc1c32e093f0b3a 100644 (file)
@@ -5801,9 +5801,9 @@ smc_lookup_batch(struct dp_netdev_pmd_thread *pmd,
                 if (OVS_LIKELY(dpcls_rule_matches_key(&flow->cr, &keys[i]) &&
                 flow->flow.in_port.odp_port == packet->md.in_port.odp_port)) {
                     /* SMC hit and emc miss, we insert into EMC */
-                    emc_probabilistic_insert(pmd, &keys[i], flow);
                     keys[i].len =
                         netdev_flow_key_size(miniflow_n_values(&keys[i].mf));
+                    emc_probabilistic_insert(pmd, &keys[i], flow);
                     dp_netdev_queue_batches(packet, flow,
                     miniflow_get_tcp_flags(&keys[i].mf), batches, n_batches);
                     n_smc_hit++;