diff options
author | Patrick McHardy <kaber@trash.net> | 2014-03-28 10:19:47 +0000 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@gnumonks.org> | 2014-04-02 21:32:57 +0200 |
commit | c50b960ccc5981627628302701e93e6aceccdb1c (patch) | |
tree | 3621dae1299222f46a2096694cb8c936abc02f5e /fs/ntfs | |
parent | fe92ca45a170cb8d09c163db23d46634110b3c2f (diff) | |
download | linux-c50b960ccc5981627628302701e93e6aceccdb1c.tar.bz2 |
netfilter: nf_tables: implement proper set selection
The current set selection simply choses the first set type that provides
the requested features, which always results in the rbtree being chosen
by virtue of being the first set in the list.
What we actually want to do is choose the implementation that can provide
the requested features and is optimal from either a performance or memory
perspective depending on the characteristics of the elements and the
preferences specified by the user.
The elements are not known when creating a set. Even if we would provide
them for anonymous (literal) sets, we'd still have standalone sets where
the elements are not known in advance. We therefore need an abstract
description of the data charcteristics.
The kernel already knows the size of the key, this patch starts by
introducing a nested set description which so far contains only the maximum
amount of elements. Based on this the set implementations are changed to
provide an estimate of the required amount of memory and the lookup
complexity class.
The set ops have a new callback ->estimate() that is invoked during set
selection. It receives a structure containing the attributes known to the
kernel and is supposed to populate a struct nft_set_estimate with the
complexity class and, in case the size is known, the complete amount of
memory required, or the amount of memory required per element otherwise.
Based on the policy specified by the user (performance/memory, defaulting
to performance) the kernel will then select the best suited implementation.
Even if the set implementation would allow to add more than the specified
maximum amount of elements, they are enforced since new implementations
might not be able to add more than maximum based on which they were
selected.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'fs/ntfs')
0 files changed, 0 insertions, 0 deletions