I think there is an even simpler fix for the problem:

+        /* Found a match in DFC. Insert into EMC for subsequent lookups.
+         * We use probabilistic insertion here so that mainly elephant
+         * flows enter EMC.
+         * Initialize the key's length from the matched flow. */
+        key->len = flow->cr.flow.len;
+        emc_probabilistic_insert(&cache->emc_cache, key, flow);
+        *exact_match = false;
+        return flow;
+    } else {

Please use that in the next version of 1/4.

BR, Jan

> -----Original Message-----
> From: Bodireddy, Bhanuprakash [mailto:[email protected]]
> Sent: Tuesday, 20 February, 2018 22:14
> To: Wang, Yipeng1 <[email protected]>; [email protected]; Jan 
> Scheurich <[email protected]>
> Cc: Tai, Charlie <[email protected]>
> Subject: RE: [ovs-dev] [RFC 2/4] dpif-netdev: Fix EMC key length
> 
> This fix is needed and can  be included in 1/4 in next revision.
> 
> - Bhanuprakash.
> 
> >-----Original Message-----
> >From: [email protected] [mailto:ovs-dev-
> >[email protected]] On Behalf Of Yipeng Wang
> >Sent: Thursday, January 18, 2018 6:20 PM
> >To: [email protected]; [email protected]
> >Cc: Tai, Charlie <[email protected]>
> >Subject: [ovs-dev] [RFC 2/4] dpif-netdev: Fix EMC key length
> >
> >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 <[email protected]>
> >---
> > 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
> >[email protected]
> >https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to