[ovs-dev] [PATCH] dpif-netdev: Fix zero length keys insertion to EMC.

Wang, Yipeng1 yipeng1.wang at intel.com
Wed Jul 25 16:30:29 UTC 2018


Thanks Ilya for pointing it out. It should be inserted after key length calculation.

Acked-by: Yipeng Wang <yipeng1.wang at intel.com>

>-----Original Message-----
>From: Ilya Maximets [mailto:i.maximets at samsung.com]
>Sent: Wednesday, July 25, 2018 9:10 AM
>To: ovs-dev at openvswitch.org; Wang, Yipeng1 <yipeng1.wang at intel.com>
>Cc: Ben Pfaff <blp at ovn.org>; Stokes, Ian <ian.stokes at intel.com>; Jan Scheurich <jan.scheurich at ericsson.com>; O Mahony, Billy
><billy.o.mahony at intel.com>; Ilya Maximets <i.maximets at samsung.com>
>Subject: [PATCH] dpif-netdev: Fix zero length keys insertion to EMC.
>
>'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 at intel.com>
>Fixes: 60d8ccae135f ("dpif-netdev: Add SMC cache after EMC cache")
>Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
>---
> lib/dpif-netdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
>index 13a20f0..0a833dc 100644
>--- a/lib/dpif-netdev.c
>+++ b/lib/dpif-netdev.c
>@@ -5810,9 +5810,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++;
>--
>2.7.4



More information about the dev mailing list