Skip to content

Commit 2a1d6ab

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: remove unneeded conditional
This helper is inlined, so keep it as small as possible. If the static key is true, there is only a very small chance that info->trace is false: 1. tracing was enabled at this very moment, the static key was updated to active right after nft_do_table was called. 2. tracing was disabled at this very moment. trace->info is already false, the static key is about to be patched to false soon. In both cases, no event will be sent because info->trace is false (checked in noinline slowpath). info->nf_trace is irrelevant. The nf_trace update is redunant in this case, but this will only happen for short duration, when static key flips. text data bss dec hex filename old: 2980 192 32 3204 c84 nf_tables_core.o new: 2964 192 32 3188 c74i nf_tables_core.o Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 00c320f commit 2a1d6ab

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/netfilter/nf_tables_core.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ static inline void nft_trace_packet(const struct nft_pktinfo *pkt,
6767
static inline void nft_trace_copy_nftrace(const struct nft_pktinfo *pkt,
6868
struct nft_traceinfo *info)
6969
{
70-
if (static_branch_unlikely(&nft_trace_enabled)) {
71-
if (info->trace)
72-
info->nf_trace = pkt->skb->nf_trace;
73-
}
70+
if (static_branch_unlikely(&nft_trace_enabled))
71+
info->nf_trace = pkt->skb->nf_trace;
7472
}
7573

7674
static void nft_bitwise_fast_eval(const struct nft_expr *expr,

0 commit comments

Comments
 (0)