EMC's key length is not initialized when insertion. Initialize the
key length before insertion.

The code might be put in another place, for now I just put it
in dfc_lookup.

Signed-off-by: Yipeng Wang <yipeng1.w...@intel.com>
---
 lib/dpif-netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index b9f4b6d..3e87992 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2295,7 +2295,7 @@ dfc_insert(struct dp_netdev_pmd_thread *pmd,
 }
 
 static inline struct dp_netdev_flow *
-dfc_lookup(struct dfc_cache *cache, const struct netdev_flow_key *key,
+dfc_lookup(struct dfc_cache *cache, struct netdev_flow_key *key,
            bool *exact_match)
 {
     struct dp_netdev_flow *flow;
@@ -2317,6 +2317,7 @@ dfc_lookup(struct dfc_cache *cache, const struct 
netdev_flow_key *key,
         /* Found a match in DFC. Insert into EMC for subsequent lookups.
          * We use probabilistic insertion here so that mainly elephant
          * flows enter EMC. */
+        key->len = netdev_flow_key_size(miniflow_n_values(&key->mf));
         emc_probabilistic_insert(&cache->emc_cache, key, flow);
         *exact_match = false;
         return flow;
-- 
2.7.4

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to