[ovs-dev] [PATCH v2 3/3] dpif-netdev: Exact match cache

Jarno Rajahalme jrajahalme at nicira.com
Fri Aug 15 21:54:54 UTC 2014


Not a review, only one vey small comment below,

  Jarno

On Aug 15, 2014, at 12:43 PM, Daniele Di Proietto <ddiproietto at vmware.com> wrote:
> 
> + * A miniflow with a given hash can be in one of EM_FLOW_HASH_SEGS different
> + * entries. Given its hash (h), the miniflow can be in the entries whose index
> + * is:
> + *
> + * h                           & EM_FLOW_HASH_MASK
> + * h >>     EM_FLOW_HASH_SHIFT & EM_FLOW_HASH_MASK
> + * h >> 2 * EM_FLOW_HASH_SHIFT & EM_FLOW_HASH_MASK
> + * h >> 3 * EM_FLOW_HASH_SHIFT & EM_FLOW_HASH_MASK
> + * …

The last one has only two hash bits left, maybe it would be better to drop that? I noticed only later that EM_FLOW_HASH_SEGS was defined as 2 (and not 4 as I implied from the above...

> + *
> + * Thread-safety
> + * =============
> + *
> + * Each pmd_thread has its own private exact match cache.
> + * If dp_netdev_input is not called from a pmd thread, a mutex is used.
> + */
> +
> +#define EM_FLOW_HASH_SHIFT 10
> +#define EM_FLOW_HASH_ENTRIES (1u << EM_FLOW_HASH_SHIFT)
> +#define EM_FLOW_HASH_MASK (EM_FLOW_HASH_ENTRIES - 1)
> +#define EM_FLOW_HASH_SEGS 2
> +





More information about the dev mailing list