diff mbox

[v4,1/2] nft_hash: define max_shift rhashtable parameter

Message ID 1424801227-17320-2-git-send-email-johunt@akamai.com
State Changes Requested
Delegated to: Pablo Neira
Headers show

Commit Message

Josh Hunt Feb. 24, 2015, 6:07 p.m. UTC
You must define a max_shift parameter to rhashtable or else the table cannot
grow. This sets max_shift for nft_hash to 24, which will allow the table to
grow to 2^24 or 16 million buckets.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Josh Hunt <johunt@akamai.com>
---
 net/netfilter/nft_hash.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Daniel Borkmann Feb. 24, 2015, 6:16 p.m. UTC | #1
On 02/24/2015 07:07 PM, Josh Hunt wrote:
> You must define a max_shift parameter to rhashtable or else the table cannot
> grow. This sets max_shift for nft_hash to 24, which will allow the table to
> grow to 2^24 or 16 million buckets.
>
> Acked-by: Thomas Graf <tgraf@suug.ch>
> Signed-off-by: Josh Hunt <johunt@akamai.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

Thanks Josh!
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index 61e6c40..a32df35 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -23,6 +23,9 @@ 
 /* We target a hash table size of 4, element hint is 75% of final size */
 #define NFT_HASH_ELEMENT_HINT 3
 
+/* Set default of 2^24 buckets or 16 million entries */
+#define NFT_HASH_MAX_BUCKETS 24
+
 struct nft_hash_elem {
 	struct rhash_head		node;
 	struct nft_data			key;
@@ -192,6 +195,7 @@  static int nft_hash_init(const struct nft_set *set,
 		.key_offset = offsetof(struct nft_hash_elem, key),
 		.key_len = set->klen,
 		.hashfn = jhash,
+		.max_shift = NFT_HASH_MAX_BUCKETS,
 		.grow_decision = rht_grow_above_75,
 		.shrink_decision = rht_shrink_below_30,
 	};