[ovs-dev] [PATCH v4] dpif-netdev: Conditional EMC insert
Jan Scheurich
jan.scheurich at ericsson.com
Thu Feb 9 13:43:04 UTC 2017
I'd suggest not to duplicate the code around the calls to emc_probabilistic_insert() but move it into the function itself, passing pmd instead of pmd->flow_cache as first argument.
Jan
> @@ -4194,7 +4231,15 @@ handle_packet_upcall(struct dp_netdev_pmd_thread *pmd, struct dp_packet *packet,
> }
> ovs_mutex_unlock(&pmd->flow_mutex);
>
> - emc_insert(&pmd->flow_cache, key, netdev_flow);
> + uint32_t min;
> + atomic_read_relaxed(&pmd->dp->emc_insert_min, &min);
> +#ifdef DPDK_NETDEV
> + emc_probabilistic_insert(&pmd->flow_cache, key, netdev_flow,
> + pmd->last_cycles, min);
> +#else
> + emc_probabilistic_insert(&pmd->flow_cache, key, netdev_flow,
> + random_uint32(), min);
> +#endif
> }
> }
>
> @@ -4288,7 +4333,15 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
>
> flow = dp_netdev_flow_cast(rules[i]);
>
> - emc_insert(flow_cache, &keys[i], flow);
> + uint32_t min;
> + atomic_read_relaxed(&pmd->dp->emc_insert_min, &min);
> +#ifdef DPDK_NETDEV
> + emc_probabilistic_insert(flow_cache, &keys[i], flow,
> + pmd->last_cycles, min);
> +#else
> + emc_probabilistic_insert(flow_cache, &keys[i], flow,
> + random_uint32(), min);
> +#endif
> dp_netdev_queue_batches(packet, flow, &keys[i].mf, batches, n_batches);
> }
>
More information about the dev
mailing list