diff mbox series

[net,1/7] netfilter: flowtable: fix excessive hw offload attempts after failure

Message ID 20220518213841.359653-2-pablo@netfilter.org
State Accepted
Delegated to: Pablo Neira
Headers show
Series [net,1/7] netfilter: flowtable: fix excessive hw offload attempts after failure | expand

Commit Message

Pablo Neira Ayuso May 18, 2022, 9:38 p.m. UTC
From: Felix Fietkau <nbd@nbd.name>

If a flow cannot be offloaded, the code currently repeatedly tries again as
quickly as possible, which can significantly increase system load.
Fix this by limiting flow timeout update and hardware offload retry to once
per second.

Fixes: c07531c01d82 ("netfilter: flowtable: Remove redundant hw refresh bit")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_flow_table_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org May 19, 2022, 4:40 a.m. UTC | #1
Hello:

This series was applied to netdev/net.git (master)
by Pablo Neira Ayuso <pablo@netfilter.org>:

On Wed, 18 May 2022 23:38:35 +0200 you wrote:
> From: Felix Fietkau <nbd@nbd.name>
> 
> If a flow cannot be offloaded, the code currently repeatedly tries again as
> quickly as possible, which can significantly increase system load.
> Fix this by limiting flow timeout update and hardware offload retry to once
> per second.
> 
> [...]

Here is the summary with links:
  - [net,1/7] netfilter: flowtable: fix excessive hw offload attempts after failure
    https://git.kernel.org/netdev/net/c/396ef64113a8
  - [net,2/7] netfilter: nft_flow_offload: skip dst neigh lookup for ppp devices
    https://git.kernel.org/netdev/net/c/45ca3e61999e
  - [net,3/7] net: fix dev_fill_forward_path with pppoe + bridge
    https://git.kernel.org/netdev/net/c/cf2df74e202d
  - [net,4/7] netfilter: nft_flow_offload: fix offload with pppoe + vlan
    https://git.kernel.org/netdev/net/c/245607493500
  - [net,5/7] netfilter: flowtable: fix TCP flow teardown
    https://git.kernel.org/netdev/net/c/e5eaac2beb54
  - [net,6/7] netfilter: flowtable: move dst_check to packet path
    https://git.kernel.org/netdev/net/c/2738d9d963bd
  - [net,7/7] netfilter: nf_tables: disable expression reduction infra
    https://git.kernel.org/netdev/net/c/9e539c5b6d9c

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 3db256da919b..20b4a14e5d4e 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -335,8 +335,10 @@  void flow_offload_refresh(struct nf_flowtable *flow_table,
 	u32 timeout;
 
 	timeout = nf_flowtable_time_stamp + flow_offload_get_timeout(flow);
-	if (READ_ONCE(flow->timeout) != timeout)
+	if (timeout - READ_ONCE(flow->timeout) > HZ)
 		WRITE_ONCE(flow->timeout, timeout);
+	else
+		return;
 
 	if (likely(!nf_flowtable_hw_offload(flow_table)))
 		return;