Commit 396ef641 authored by Felix Fietkau's avatar Felix Fietkau Committed by Pablo Neira Ayuso
Browse files

netfilter: flowtable: fix excessive hw offload attempts after failure



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: c07531c0 ("netfilter: flowtable: Remove redundant hw refresh bit")
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent f3f19f93
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;