netfilter: nf_tables: avoid retpoline overhead for some ct expression calls
authorFlorian Westphal <fw@strlen.de>
Tue, 3 Jan 2023 12:47:17 +0000 (13:47 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 18 Jan 2023 12:05:25 +0000 (13:05 +0100)
commitd9e7891476057b24a1acbf10a491e5b9a1c4ae77
treee423897435657e7f0b9a485043b5cedb922fd776
parent2032e907d8d498fcabfe24b43550c50947817c6d
netfilter: nf_tables: avoid retpoline overhead for some ct expression calls

nft_ct expression cannot be made builtin to nf_tables without also
forcing the conntrack itself to be builtin.

However, this can be avoided by splitting retrieval of a few
selector keys that only need to access the nf_conn structure,
i.e. no function calls to nf_conntrack code.

Many rulesets start with something like
"ct status established,related accept"

With this change, this no longer requires an indirect call, which
gives about 1.8% more throughput with a simple conntrack-enabled
forwarding test (retpoline thunk used).

Signed-off-by: Florian Westphal <fw@strlen.de>
include/net/netfilter/nf_tables_core.h
net/netfilter/Makefile
net/netfilter/nf_tables_core.c
net/netfilter/nft_ct.c
net/netfilter/nft_ct_fast.c [new file with mode: 0644]