sched: act_ct: additional checks for outdated flows
Subsystems (3)
Pablo Neira Ayuso
maintainerPATCH 1/1 sched: act_ct: additional checks for outdated flows
From: Vlad Buslov <[email protected]>
Current nf_flow_is_outdated() implementation considers any flow table flow which state diverged from its underlying CT connection status for teardown which can be problematic in the following cases:
- Flow has never been offloaded to hardware in the first place either because flow table has hardware offload disabled (flag NF_FLOWTABLE_HW_OFFLOAD is not set) or because it is still pending on 'add' workqueue to be offloaded for the first time. The former is incorrect, the later generates excessive deletions and additions of flows.
- Flow is already pending to be updated on the workqueue. Tearing down such flows will also generate excessive removals from the flow table, especially on highly loaded system where the latency to re-offload a flow via 'add' workqueue can be quite high.
When considering a flow for teardown as outdated verify that it is both offloaded to hardware and doesn't have any pending updates.
---
I am taking Vlad's patch and rebasing as per his request:
This patch requires:
https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/
net/sched/act_ct.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/act_ct.c +2 -0
@@ -281,6 +281,8 @@ static int tcf_ct_flow_table_fill_actions(struct net *net,static bool tcf_ct_flow_is_outdated (const struct flow_offload *flow) {return test_bit (IPS_SEEN_REPLY_BIT , &flow->ct->status) && +test_bit (IPS_HW_OFFLOAD_BIT , &flow->ct->status) && + !test_bit (NF_FLOW_HW_PENDING , &flow->flags) && !test_bit (NF_FLOW_HW_ESTABLISHED , &flow->flags); }
Signature · 1 line
2.30.2
Quoted 24 lines · Pablo Neira Ayuso
From: Vlad Buslov <[email protected]>
Current
nf_flow_is_outdated()implementation considers any flow table flow which state diverged from its underlying CT connection status for teardown which can be problematic in the following cases:- Flow has never been offloaded to hardware in the first place either because flow table has hardware offload disabled (flag
NF_FLOWTABLE_HW_OFFLOADis not set) or because it is still pending on 'add' workqueue to be offloaded for the first time. The former is incorrect, the later generates excessive deletions and additions of flows.- Flow is already pending to be updated on the workqueue. Tearing down such flows will also generate excessive removals from the flow table, especially on highly loaded system where the latency to re-offload a flow via 'add' workqueue can be quite high.
When considering a flow for teardown as outdated verify that it is both offloaded to hardware and doesn't have any pending updates.
Fixes 41f2c7c342d3 ("net/sched: act_ct: Fix promotion of offloaded unreplied tuple")Reviewed-by Paul Blakey <[email protected]>Signed-off-by Vlad Buslov <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>
Quoted 6 lines
---
I am taking Vlad's patch and rebasing as per his request:This patch requires:
https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/
Quoted 38 lines · Pablo Neira Ayuso
From: Vlad Buslov <[email protected]>
Current
nf_flow_is_outdated()implementation considers any flow table flow which state diverged from its underlying CT connection status for teardown which can be problematic in the following cases:- Flow has never been offloaded to hardware in the first place either because flow table has hardware offload disabled (flag
NF_FLOWTABLE_HW_OFFLOADis not set) or because it is still pending on 'add' workqueue to be offloaded for the first time. The former is incorrect, the later generates excessive deletions and additions of flows.- Flow is already pending to be updated on the workqueue. Tearing down such flows will also generate excessive removals from the flow table, especially on highly loaded system where the latency to re-offload a flow via 'add' workqueue can be quite high.
When considering a flow for teardown as outdated verify that it is both offloaded to hardware and doesn't have any pending updates.
Fixes 41f2c7c342d3 ("net/sched: act_ct: Fix promotion of offloaded unreplied tuple")Reviewed-by Paul Blakey <[email protected]>Signed-off-by Vlad Buslov <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>---
I am taking Vlad's patch and rebasing as per his request:This patch requires:
https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/net/sched/act_ct.c | 2 ++ 1 file changed, 2 insertions(+)net/sched/act_ct.c +0
-0
net/sched/act_ct.c static int tcf_ct_flow_table_fill_actions(struct net *net, · line 288
Quoted 8 lines
net/sched/act_ct.c +2
-0@@ -281,6 +281,8 @@ static int tcf_ct_flow_table_fill_actions(struct net *net,static bool tcf_ct_flow_is_outdated (const struct flow_offload *flow) {return test_bit (IPS_SEEN_REPLY_BIT , &flow->ct->status) && +test_bit (IPS_HW_OFFLOAD_BIT , &flow->ct->status) && + !test_bit (NF_FLOW_HW_PENDING , &flow->flags) && !test_bit (NF_FLOW_HW_ESTABLISHED , &flow->flags); }