netfilter: flowtable: Remove redundant hw refresh bit
authorRoi Dayan <roid@nvidia.com>
Mon, 10 May 2021 11:50:24 +0000 (14:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 07:00:37 +0000 (09:00 +0200)
commit c07531c01d8284aedaf95708ea90e76d11af0e21 upstream.

Offloading conns could fail for multiple reasons and a hw refresh bit is
set to try to reoffload it in next sw packet.
But it could be in some cases and future points that the hw refresh bit
is not set but a refresh could succeed.
Remove the hw refresh bit and do offload refresh if requested.
There won't be a new work entry if a work is already pending
anyway as there is the hw pending bit.

Fixes: 8b3646d6e0c4 ("net/sched: act_ct: Support refreshing the flow table entries")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/netfilter/nf_flow_table.h
net/netfilter/nf_flow_table_core.c
net/netfilter/nf_flow_table_offload.c

index 16e8b2f8d006aaefc2a7f3d54d507e9499c0abed..b338638f22792d433371eb866e3d94a8b11863be 100644 (file)
@@ -126,7 +126,6 @@ enum nf_flow_flags {
        NF_FLOW_HW,
        NF_FLOW_HW_DYING,
        NF_FLOW_HW_DEAD,
-       NF_FLOW_HW_REFRESH,
        NF_FLOW_HW_PENDING,
 };
 
index b03feb6e1226ac01fcbe985ebe8d3c82fc01c26b..f4029fc2c88469136271b45181a0fb42427c42f9 100644 (file)
@@ -259,8 +259,7 @@ void flow_offload_refresh(struct nf_flowtable *flow_table,
 {
        flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT;
 
-       if (likely(!nf_flowtable_hw_offload(flow_table) ||
-                  !test_and_clear_bit(NF_FLOW_HW_REFRESH, &flow->flags)))
+       if (likely(!nf_flowtable_hw_offload(flow_table)))
                return;
 
        nf_flow_offload_add(flow_table, flow);
index 1c5460e7bce875d2c9cff8bdb6a2c8c5b9ee4f44..92047cea3c17091c53e4ff16df01a84c90f91b24 100644 (file)
@@ -753,10 +753,11 @@ static void flow_offload_work_add(struct flow_offload_work *offload)
 
        err = flow_offload_rule_add(offload, flow_rule);
        if (err < 0)
-               set_bit(NF_FLOW_HW_REFRESH, &offload->flow->flags);
-       else
-               set_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);
+               goto out;
+
+       set_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);
 
+out:
        nf_flow_offload_destroy(flow_rule);
 }