2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

dpif-netdev: Fix insertion probability

emc_conditional_insert uses pmd->last_cycles and the packet's RSS hash
to generate a random number used to determine whether or not an emc
entry should be inserted. This works for single-packet bursts as
last_cycles is updated for each burst. However, for bursts > 1 packet,
where the packets in the batch generate the same RSS hash,
pmd->last_cycles remains constant for the entire burst also, and thus
cannot be used as a random number for each packet in the burst.

This commit replaces the use of pmd->last_cycles with random_uint32()
for this purpose and subsequently fixes the behavior of the
emc_insert_inv_prob setting for high-throughput (large bursts)
single-flow cases.

Fixes: 4c30b24602 ("dpif-netdev: Conditional EMC insert")
Reported-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Darrell Ball <dlu998@gmail.com>
Tested-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Ciara Loftus
2017-06-23 16:31:03 +01:00
committed by Ben Pfaff
parent 8a0d9d85b3
commit 656238ee92

View File

@@ -2074,11 +2074,7 @@ emc_probabilistic_insert(struct dp_netdev_pmd_thread *pmd,
uint32_t min;
atomic_read_relaxed(&pmd->dp->emc_insert_min, &min);
#ifdef DPDK_NETDEV
if (min && (key->hash ^ (uint32_t) pmd->last_cycles) <= min) {
#else
if (min && (key->hash ^ random_uint32()) <= min) {
#endif
if (min && random_uint32() <= min) {
emc_insert(&pmd->flow_cache, key, flow);
}
}