All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] netfilter: flowtable: fix excessive hw offload attempts after failure
@ 2022-05-06 13:18 Felix Fietkau
  2022-05-06 13:18 ` [PATCH 2/4] netfilter: nft_flow_offload: skip dst neigh lookup for ppp devices Felix Fietkau
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Felix Fietkau @ 2022-05-06 13:18 UTC (permalink / raw)
  To: netdev; +Cc: pablo

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.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/netfilter/nf_flow_table_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-09 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 13:18 [PATCH 1/4] netfilter: flowtable: fix excessive hw offload attempts after failure Felix Fietkau
2022-05-06 13:18 ` [PATCH 2/4] netfilter: nft_flow_offload: skip dst neigh lookup for ppp devices Felix Fietkau
2022-05-09  6:26   ` Pablo Neira Ayuso
2022-05-09 12:28     ` Felix Fietkau
2022-05-06 13:18 ` [PATCH 3/4] net: fix dev_fill_forward_path with pppoe + bridge Felix Fietkau
2022-05-06 13:18 ` [PATCH 4/4] netfilter: nft_flow_offload: fix offload with pppoe + vlan Felix Fietkau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.