[SRU][F:linux-bluefield][PATCH 2/9] netfilter: flowtable: Set offload timeout when adding flow

Roi Dayan roid at nvidia.com
Tue Apr 6 17:52:02 UTC 2021


From: Roi Dayan <roid at mellanox.com>

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922672

On heavily loaded systems the GC can take time to go over all existing
conns and reset their timeout. At that time other calls like from
nf_conntrack_in() can call of nf_ct_is_expired() and see the conn as
expired. To fix this when we set the offload bit we should also reset
the timeout instead of counting on GC to finish first iteration over
all conns before the initial timeout.

Fixes: 90964016e5d3 ("netfilter: nf_conntrack: add IPS_OFFLOAD status bit")
Signed-off-by: Roi Dayan <roid at mellanox.com>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
(cherry picked from commit 4203b19c27967d9eff6928f6a733f81892ffc592)
Signed-off-by: Roi Dayan <roid at nvidia.com>
---
 net/netfilter/nf_flow_table_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index dcdc37d3a748..5144e317caab 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -244,6 +244,8 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow)
 		return err;
 	}
 
+	nf_ct_offload_timeout(flow->ct);
+
 	if (nf_flowtable_hw_offload(flow_table)) {
 		__set_bit(NF_FLOW_HW, &flow->flags);
 		nf_flow_offload_add(flow_table, flow);
-- 
2.26.2




More information about the kernel-team mailing list