If flow is in hardware and not in teardown state, check if flow needs to be removed due to closing, otherwise request for stats updates. Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nf_flow_table_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c index d5652e45ee04..fd5539bba88e 100644 --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c @@ -605,12 +605,12 @@ static void nf_flow_offload_gc_step(struct nf_flowtable *flow_table, } else { flow_offload_del(flow_table, flow); } - } else if (test_bit(NF_FLOW_CLOSING, &flow->flags) && - test_bit(NF_FLOW_HW, &flow->flags) && + } else if (test_bit(NF_FLOW_HW, &flow->flags) && !test_bit(NF_FLOW_HW_DYING, &flow->flags)) { - nf_flow_offload_del(flow_table, flow); - } else if (test_bit(NF_FLOW_HW, &flow->flags)) { - nf_flow_offload_stats(flow_table, flow); + if (test_bit(NF_FLOW_CLOSING, &flow->flags)) + nf_flow_offload_del(flow_table, flow); + else + nf_flow_offload_stats(flow_table, flow); } } -- 2.47.3 NF_FLOW_HW_DYING is redundant since the _PENDING bit already prevents the GC from queuing a duplicate request to remove this flow from hardware. Check for NF_FLOW_HW_DEAD is unset instead and remove NF_FLOW_HW_DYING. Signed-off-by: Pablo Neira Ayuso --- include/net/netfilter/nf_flow_table.h | 1 - net/netfilter/nf_flow_table_core.c | 6 +++--- net/netfilter/nf_flow_table_offload.c | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h index 9bb46457c192..eaaf8e06c158 100644 --- a/include/net/netfilter/nf_flow_table.h +++ b/include/net/netfilter/nf_flow_table.h @@ -186,7 +186,6 @@ enum nf_flow_flags { NF_FLOW_TEARDOWN, NF_FLOW_PENDING, NF_FLOW_HW, - NF_FLOW_HW_DYING, NF_FLOW_HW_DEAD, NF_FLOW_HW_BIDIRECTIONAL, NF_FLOW_HW_ESTABLISHED, diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c index fd5539bba88e..8d8b00a00ed8 100644 --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c @@ -598,15 +598,15 @@ static void nf_flow_offload_gc_step(struct nf_flowtable *flow_table, if (teardown) { if (test_bit(NF_FLOW_HW, &flow->flags)) { - if (!test_bit(NF_FLOW_HW_DYING, &flow->flags)) + if (!test_bit(NF_FLOW_HW_DEAD, &flow->flags)) nf_flow_offload_del(flow_table, flow); - else if (test_bit(NF_FLOW_HW_DEAD, &flow->flags)) + else flow_offload_del(flow_table, flow); } else { flow_offload_del(flow_table, flow); } } else if (test_bit(NF_FLOW_HW, &flow->flags) && - !test_bit(NF_FLOW_HW_DYING, &flow->flags)) { + !test_bit(NF_FLOW_HW_DEAD, &flow->flags)) { if (test_bit(NF_FLOW_CLOSING, &flow->flags)) nf_flow_offload_del(flow_table, flow); else diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c index 11434cfb105b..4279511c897b 100644 --- a/net/netfilter/nf_flow_table_offload.c +++ b/net/netfilter/nf_flow_table_offload.c @@ -1160,7 +1160,6 @@ void nf_flow_offload_del(struct nf_flowtable *flowtable, if (!offload) return; - set_bit(NF_FLOW_HW_DYING, &flow->flags); flow_offload_queue_work(offload); } -- 2.47.3