Skip to contentSkip to conversation

netfilter: flowtable: consolidate unsupported hardware offload check

PATCH New Pablo Neira Ayuso 1 participant 1 message Oct 19

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: flowtable: consolidate unsupported hardware offload check

Move this check to the function that allocates and enqueues the hardware offload work. If hardware does not support it, then turn this into noop.

---
 net/netfilter/nf_flow_table_offload.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
net/netfilter/nf_flow_table_offload.c +12 -9
index 4365859220e6..44e4c6a64431 100644
@@ -1079,12 +1079,24 @@ static void flow_offload_queue_work(struct flow_offload_work *offload)
 	}
 }
 
+static bool nf_flow_offload_unsupported(struct flow_offload *flow)
+{
+	if (flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.tun_num ||
+	    flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.tun_num)
+		return true;
+
+	return false;
+}
+
 static struct flow_offload_work *
 nf_flow_offload_work_alloc(struct nf_flowtable *flowtable,
 			   struct flow_offload *flow, unsigned int cmd)
 {
 	struct flow_offload_work *offload;
 
+	if (nf_flow_offload_unsupported(flow))
+		return NULL;
+
 	if (test_and_set_bit(NF_FLOW_PENDING, &flow->flags))
 		return NULL;
 
@@ -1102,15 +1114,6 @@ nf_flow_offload_work_alloc(struct nf_flowtable *flowtable,
 	return offload;
 }
 
-static bool nf_flow_offload_unsupported(struct flow_offload *flow)
-{
-	if (flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.tun_num ||
-	    flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.tun_num)
-		return true;
-
-	return false;
-}
-
 void nf_flow_offload_refresh(struct nf_flowtable *flowtable,
 			     struct flow_offload *flow)
 {
Signature · 1 line
2.47.3