Skip to content

Commit

Permalink
dpif-netdev: Fix zero length keys insertion to EMC.
Browse files Browse the repository at this point in the history
'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: 60d8cca ("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>
  • Loading branch information
igsilya authored and istokes committed Aug 8, 2018
1 parent c3cc694 commit 18e0895
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down

0 comments on commit 18e0895

Please sign in to comment.