[ovs-dev,RFC,2/4] dpif-netdev: Fix EMC key length

Message ID 1516299624-452546-3-git-send-email-yipeng1.wang@intel.com
State New
Delegated to: Ian Stokes
Headers show
Series
  • dpif-netdev: Combine CD and DFC patch for datapath refactor
Related show

Commit Message

Yipeng Wang Jan. 18, 2018, 6:20 p.m.
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.wang@intel.com>
---
 lib/dpif-netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

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;