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. Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nf_flow_table_offload.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c index 4365859220e6..44e4c6a64431 100644 --- a/net/netfilter/nf_flow_table_offload.c +++ b/net/netfilter/nf_flow_table_offload.c @@ -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) { -- 2.47.3