[PATCH 3/6] Add hash support in cache mngr

Thomas Graf tgraf at suug.ch
Mon Nov 5 07:17:25 EST 2012


On 11/04/12 at 09:13pm, roopa at cumulusnetworks.com wrote:
> @@ -190,6 +191,22 @@ struct nl_cache *nl_cache_alloc(struct nl_cache_ops *ops)
>  	nl_init_list_head(&cache->c_items);
>  	cache->c_ops = ops;
>  
> +	/*
> +	 * If object type provides a hash keygen
> +	 * functions, allocate a hash table for the
> +	 * cache objects for faster lookups
> +	 */
> +	if (ops->co_obj_ops->oo_keygen) {
> +		int hashtable_size;
> +
> +		if (ops->co_hash_size)
> +			hashtable_size = ops->co_hash_size;
> +		else
> +			hashtable_size = NL_MAX_HASH_ENTRIES;

NL_MAX_HASH_ENTRIES is 16K which is _huge_. Is this intentional?
It doesn't make sense to default to such a giant hash table size.



More information about the libnl mailing list