[ovs-dev] [PATCH] dpif-netdev: Fix insertion probability

Kevin Traynor ktraynor at redhat.com
Wed May 17 10:37:51 UTC 2017


On 05/17/2017 09:28 AM, Ciara Loftus wrote:
> 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: 4c30b24602c3 ("dpif-netdev: Conditional EMC insert")
> Reported-by: Kevin Traynor <ktraynor at redhat.com>
> Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
> ---
>  lib/dpif-netdev.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index d215156..ab1e26e 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -2037,11 +2037,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
>          emc_insert(&pmd->flow_cache, key, flow);
>      }
>  }
> 

Thanks for the fix.

Tested-by: Kevin Traynor <ktraynor at redhat.com>
Acked-by: Kevin Traynor <ktraynor at redhat.com>


More information about the dev mailing list