/* xfrm_hash.c: Common hash table code.
 *
 * Copyright (C) 2006 David S. Miller (davem@davemloft.net)
 */

#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/bootmem.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/xfrm.h>

#include "xfrm_hash.h"

struct hlist_head *xfrm_hash_alloc(unsigned int sz)
{
	struct hlist_head *n;

	if (sz <= PAGE_SIZE)
		n = kzalloc(sz, GFP_KERNEL);
	else if (hashdist)
		n = vzalloc(sz);
	else
		n = (struct hlist_head *)
			__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,
					 get_order(sz));

	return n;
}

void xfrm_hash_free(struct hlist_head *n, unsigned int sz)
{
	if (sz <= PAGE_SIZE)
		kfree(n);
	else if (hashdist)
		vfree(n);
	else
		free_pages((unsigned long)n, get_order(sz));
}
cgit.cgi/linux/net-next.git/'>net-next.git</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'/><select name='h' onchange='this.form.submit();'>
<option value='emaclite-cleanup'>emaclite-cleanup</option>
<option value='master' selected='selected'>master</option>
<option value='nds-private-remove'>nds-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/net/caif/cfdgml.c'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/net/caif/cfdgml.c?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/net/caif/cfdgml.c?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/net/caif/cfdgml.c?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/net/caif/cfdgml.c'>
<input type='hidden' name='id' value='7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/net?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'>net</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/caif?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'>caif</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/caif/cfdgml.c?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5'>cfdgml.c</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/net/caif/cfdgml.c?id=7d4d5065ecb0cea9c5815d5e0df5fb586c5ee9b5&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>